/* ═══════════════════════════════════════════════════════════
   TransportAssist — Apple-style UI
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg: #f5f5f7;
    --bg-white: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-input: #f2f2f7;
    --bg-hover: #e8e8ed;
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.12);
    --text: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #aeaeb2;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-light: rgba(0, 113, 227, 0.08);
    --user-bubble: #0071e3;
    --user-text: #ffffff;
    --assistant-bubble: #f2f2f7;
    --success: #34c759;
    --danger: #ff3b30;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --radius: 18px;
    --radius-sm: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: "";
    position: fixed;
    inset: -5%;
    width: 110%;
    height: 110%;
    background:
        linear-gradient(rgba(245, 245, 247, 0.8), rgba(245, 245, 247, 0.8)),
        url('bg-logistics.jpg') center / cover no-repeat;
    z-index: -1;
    animation: pan 60s ease-in-out infinite;
}

@keyframes pan {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05) translate(-1%, -1%); }
}

::selection {
    background: rgba(0, 113, 227, 0.2);
}

/* ── App Container ─────────────────────────────────────── */

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 820px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 0 0 1px var(--border);
}

@media (min-width: 860px) {
    .app {
        margin-top: 12px;
        margin-bottom: 12px;
        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);
        border-radius: 16px;
        overflow: hidden;
        box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    }
}

/* ── Header ────────────────────────────────────────────── */

.header {
    flex-shrink: 0;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(145deg, #0071e3, #5856d6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.status-dot.offline {
    background: var(--danger);
}

.status-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-lang {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-input);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.header-lang:hover {
    background: var(--bg-hover);
}

.header-lang.visible {
    display: flex;
}

/* ── Welcome Screen ────────────────────────────────────── */

.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    overflow-y: auto;
}

.welcome.hidden {
    display: none;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 22px;
    background: linear-gradient(145deg, #0071e3, #5856d6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    box-shadow: 0 8px 30px rgba(0, 113, 227, 0.25);
    margin-bottom: 24px;
}

.welcome h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.6px;
    text-align: center;
    margin-bottom: 8px;
}

.welcome .subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 400px;
    margin-bottom: 32px;
    line-height: 1.5;
}

.lang-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 14px;
}

/* ── Language Grid ─────────────────────────────────────── */

.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 480px;
    margin-bottom: 28px;
}

.lang-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-strong);
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.lang-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.lang-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.flag-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.lang-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lang-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
}

.lang-native {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.25;
}

.lang-card.active .lang-name {
    color: var(--accent);
}

/* ── Start Button ──────────────────────────────────────── */

.start-btn {
    padding: 12px 36px;
    border-radius: 980px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.1px;
}

.start-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.start-btn:active {
    transform: scale(0.98);
}

.start-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* ── Suggestions ───────────────────────────────────────── */

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 500px;
    margin-top: 18px;
}

.suggestion {
    padding: 8px 16px;
    border-radius: 980px;
    border: 1px solid var(--border-strong);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* ── Chat Screen ───────────────────────────────────────── */

.chat-screen {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.chat-screen.active {
    display: flex;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.messages::-webkit-scrollbar {
    width: 0;
}

/* ── Messages ──────────────────────────────────────────── */

.msg {
    display: flex;
    max-width: 80%;
    animation: msgIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg.user {
    align-self: flex-end;
}

.msg-bubble {
    padding: 10px 16px;
    font-size: 14.5px;
    line-height: 1.55;
    word-break: break-word;
}

.msg.assistant .msg-bubble {
    background: var(--assistant-bubble);
    border-radius: 4px var(--radius) var(--radius) var(--radius);
    color: var(--text);
}

.msg.user .msg-bubble {
    background: var(--user-bubble);
    border-radius: var(--radius) 4px var(--radius) var(--radius);
    color: var(--user-text);
}

.msg-bubble p {
    margin-bottom: 8px;
}

.msg-bubble p:last-child {
    margin-bottom: 0;
}

.msg-bubble strong {
    font-weight: 600;
}

.msg.assistant .msg-bubble strong {
    color: var(--accent);
}

.msg-bubble ul,
.msg-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}

.msg-bubble li {
    margin-bottom: 3px;
}

.msg-bubble code {
    font-family: 'SF Mono', 'Menlo', monospace;
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 13px;
}

.msg.user .msg-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Typing Indicator ──────────────────────────────────── */

.typing {
    display: flex;
    gap: 4px;
    padding: 14px 4px;
}

.typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: blink 1.4s ease-in-out infinite;
}

.typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes blink {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* ── Input Area ────────────────────────────────────────── */

.input-area {
    flex-shrink: 0;
    padding: 12px 16px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border-radius: 22px;
    padding: 4px 4px 4px 16px;
    transition: all 0.2s;
}

.input-row:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
    background: var(--bg-white);
}

#userInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    padding: 8px 0;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.45;
    outline: none;
}

#userInput::placeholder {
    color: var(--text-tertiary);
}

.input-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.btn-send {
    background: var(--accent);
    color: #fff;
}

.btn-send:hover {
    background: var(--accent-hover);
}

.btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-mic {
    background: transparent;
    color: var(--text-secondary);
}

.btn-mic:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.btn-mic.recording {
    color: var(--danger);
    background: rgba(255, 59, 48, 0.08);
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.25);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    }
}

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

/* ── Modal ─────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-white);
    border-radius: 18px;
    padding: 32px;
    max-width: 360px;
    width: calc(100% - 40px);
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px;
}

.modal h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
}

.modal p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-btn {
    width: 100%;
    padding: 12px;
    border-radius: 980px;
    height: 44px;
    border: none;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-btn.primary {
    background: var(--accent);
    color: #fff;
}

.modal-btn.primary:hover {
    background: var(--accent-hover);
}

.modal-btn.secondary {
    background: var(--bg-input);
    color: var(--text);
}

.modal-btn.secondary:hover {
    background: var(--bg-hover);
}

/* ── Auth Button & Modal ──────────────────────────────── */

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.auth-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border-strong);
    background: var(--bg-white);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.auth-btn.logged-in {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.auth-modal {
    max-width: 400px;
    text-align: left;
    padding: 24px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 3px;
}

.auth-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--bg-white);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border-strong);
    background: var(--bg-input);
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    background: var(--bg-white);
}

.auth-error {
    font-size: 13px;
    color: var(--danger);
    min-height: 18px;
}

.auth-submit {
    padding: 12px;
    border-radius: 980px;
    height: 44px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.auth-submit:hover {
    background: var(--accent-hover);
}

.logout-btn {
    background: var(--bg-input);
    color: var(--text);
}

.logout-btn:hover {
    background: var(--bg-hover);
}

.auth-user-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
}

.auth-user-info.hidden {
    display: none;
}

.user-email {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.user-plan {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-plan.free {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.user-plan.starter {
    background: rgba(0, 113, 227, 0.1);
    color: var(--accent);
}

.user-plan.pro {
    background: rgba(88, 86, 214, 0.1);
    color: #5856d6;
}

/* ── User Actions & Documents ─────────────────────────── */

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}

.accent-btn {
    background: var(--accent);
    color: #fff;
}

.accent-btn:hover {
    background: var(--accent-hover);
}

.user-verified {
    font-size: 12px;
    margin-top: -4px;
}

.user-verified.verified {
    color: var(--success);
}

.user-verified.unverified {
    color: var(--danger);
}

.docs-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.docs-section.hidden {
    display: none;
}

.docs-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.docs-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.docs-back {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 6px;
}

.docs-back:hover {
    background: var(--accent-light);
}

.docs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.docs-empty {
    color: var(--text-tertiary);
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
}

.doc-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 10px;
    gap: 8px;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

.doc-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.doc-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}

.doc-action-btn.download {
    background: var(--accent-light);
    color: var(--accent);
}

.doc-action-btn.download:hover {
    background: var(--accent);
    color: #fff;
}

.doc-action-btn.delete {
    background: rgba(255, 59, 48, 0.08);
    color: var(--danger);
}

.doc-action-btn.delete:hover {
    background: var(--danger);
    color: #fff;
}

/* ── RTL Support ───────────────────────────────────────── */

html[dir="rtl"] .msg.user {
    align-self: flex-start;
}

html[dir="rtl"] .msg.assistant .msg-bubble {
    border-radius: var(--radius) 4px var(--radius) var(--radius);
}

html[dir="rtl"] .msg.user .msg-bubble {
    border-radius: 4px var(--radius) var(--radius) var(--radius);
}

html[dir="rtl"] .input-row {
    padding: 4px 16px 4px 4px;
}

/* ── Email Verification Banner ────────────────────────── */

.email-verify-banner {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 149, 0, 0.1);
    border-bottom: 1px solid rgba(255, 149, 0, 0.2);
    font-size: 13px;
    color: #cc7700;
    text-align: center;
    flex-wrap: wrap;
}

.email-verify-banner a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.email-verify-banner a:hover {
    text-decoration: underline;
}

/* ── Generate Document Button ─────────────────────────── */

.generate-doc-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    border: 1.5px dashed var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.generate-doc-btn:hover {
    background: rgba(0, 113, 227, 0.14);
    border-style: solid;
}

/* ── Document Type Modal ─────────────────────────────── */

.doc-type-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-type-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-strong);
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: var(--font);
}

.doc-type-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateX(4px);
}

.doc-type-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.doc-type-info strong {
    font-size: 14px;
    color: var(--text);
    display: block;
    line-height: 1.3;
}

.doc-type-info small {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── System Message in Chat ──────────────────────────── */

.msg.system {
    align-self: center;
    max-width: 90%;
}

.msg.system .msg-bubble {
    background: rgba(52, 199, 89, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    border: 1px solid rgba(52, 199, 89, 0.2);
    font-size: 13px;
    text-align: center;
}

.msg.system .msg-bubble a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.msg.system .msg-bubble a:hover {
    text-decoration: underline;
}

/* ── Mobile ────────────────────────────────────────────── */

@media (max-width: 600px) {
    .header {
        padding: 12px 16px;
    }
    .messages {
        padding: 16px;
    }
    .msg {
        max-width: 88%;
    }
    .welcome {
        padding: 24px 20px;
    }
    .welcome h1 {
        font-size: 22px;
    }
    .lang-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Language Switcher ──────────────────────────────────── */

.lang-switcher {
    position: relative;
}
.lang-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.lang-switcher-btn:hover {
    border-color: var(--accent);
}
.lang-switcher-arrow {
    font-size: 10px;
    color: var(--text-tertiary);
}
.lang-switcher-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    overflow: hidden;
    z-index: 60;
    min-width: 160px;
}
[dir="rtl"] .lang-switcher-dropdown {
    right: auto;
    left: 0;
}
.lang-switcher-dropdown.open {
    display: flex;
    flex-direction: column;
}
.lang-switcher-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
[dir="rtl"] .lang-switcher-item {
    text-align: right;
}
.lang-switcher-item:hover {
    background: var(--bg-input);
}
.lang-switcher-item.active {
    color: var(--accent);
    font-weight: 600;
}

/* ── Shared Page Header (pricing, account, etc.) ─────── */

.page-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header .header-left a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

/* ── Nav Link ─────────────────────────────────────────── */

.nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: opacity 0.2s, color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

/* ── Forgot Password Link ─────────────────────────────── */

.forgot-password-link {
    display: block;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 12px;
    text-align: right;
}

.forgot-password-link:hover {
    text-decoration: underline;
}
