/* =========================================================
   MultiAirlines Support — glass UI
   Brand: blue #105E8E (primary) + orange #FF7E02 (action/highlight).
   Sky-blue + sunrise-orange backdrop under frosted panels. Light & dark.
   ========================================================= */

:root {
    color-scheme: light;
    --bg: #e8f0f6;
    --orb-a: #5ea8d6;   /* sky blue */
    --orb-b: #ffb56b;   /* sunrise orange */
    --orb-c: #a9d8f2;   /* pale sky */

    --brand-blue: #105e8e;
    --brand-orange: #ff7e02;
    --wm-blue: #105e8e;
    --wm-orange: #ff7e02;

    --ink: #0d2a40;
    --ink-soft: #2f4b61;
    --muted: #587086;
    --accent: #105e8e;
    --accent-2: #ff7e02;
    --accent-rgb: 16, 94, 142;
    --cta-rgb: 255, 126, 2;
    --accent-grad: linear-gradient(135deg, #0c5180 0%, #105e8e 50%, #1a78b2 100%);
    --cta-grad: linear-gradient(135deg, #ff9126 0%, #ff7e02 55%, #f26c00 100%);
    --danger: #d93f4f;
    --ok: #0f9b6f;
    --warn: #c46a00;

    --glass: rgba(255, 255, 255, 0.44);
    --glass-strong: rgba(255, 255, 255, 0.68);
    --glass-soft: rgba(255, 255, 255, 0.28);
    --glass-border: rgba(255, 255, 255, 0.72);
    --glass-edge: rgba(255, 255, 255, 0.95);
    --hairline: rgba(13, 42, 64, 0.09);
    --shadow: 0 12px 40px rgba(16, 70, 110, 0.14), 0 2px 6px rgba(16, 70, 110, 0.06);
    --shadow-lift: 0 18px 50px rgba(16, 70, 110, 0.2);
    --blur: blur(22px) saturate(170%);

    --user-bubble: linear-gradient(135deg, rgba(16, 94, 142, 0.96), rgba(26, 120, 178, 0.92));
    --user-ink: #fff;

    --r-xl: 26px;
    --r-lg: 18px;
    --r-md: 12px;
    --r-sm: 8px;

    --font-display: "Nunito", "Noto Sans Khmer", "Segoe UI", system-ui, sans-serif;
    --font-body: "Figtree", "Noto Sans Khmer", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #04121e;
        --orb-a: #0f5c8c;
        --orb-b: #b45700;
        --orb-c: #0a3a5a;
        --wm-blue: #5fb0e3;
        --wm-orange: #ff8a1c;
        --ink: #e7f0f7;
        --ink-soft: #c2d4e2;
        --muted: #8ea5b8;
        --accent: #5fb0e3;
        --accent-2: #ff9a3d;
        --danger: #ff7080;
        --ok: #3fd3a0;
        --warn: #ffab4a;
        --glass: rgba(12, 32, 50, 0.5);
        --glass-strong: rgba(18, 44, 68, 0.72);
        --glass-soft: rgba(255, 255, 255, 0.05);
        --glass-border: rgba(255, 255, 255, 0.1);
        --glass-edge: rgba(255, 255, 255, 0.15);
        --hairline: rgba(255, 255, 255, 0.08);
        --shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
        --shadow-lift: 0 18px 50px rgba(0, 0, 0, 0.55);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #04121e;
    --orb-a: #0f5c8c;
    --orb-b: #b45700;
    --orb-c: #0a3a5a;
    --wm-blue: #5fb0e3;
    --wm-orange: #ff8a1c;
    --ink: #e7f0f7;
    --ink-soft: #c2d4e2;
    --muted: #8ea5b8;
    --accent: #5fb0e3;
    --accent-2: #ff9a3d;
    --danger: #ff7080;
    --ok: #3fd3a0;
    --warn: #ffab4a;
    --glass: rgba(12, 32, 50, 0.5);
    --glass-strong: rgba(18, 44, 68, 0.72);
    --glass-soft: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-edge: rgba(255, 255, 255, 0.15);
    --hairline: rgba(255, 255, 255, 0.08);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 18px 50px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
h2 { font-size: 1.08rem; font-weight: 600; }
h3 { font-size: 0.78rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--glass-soft); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1:focus { outline: none; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center-note { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- Backdrop: drifting light blobs ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop::after {
    /* fine grain so the blur doesn't band */
    content: ""; position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.75; will-change: transform; }
.orb-a { width: 52vmax; height: 52vmax; background: var(--orb-a); top: -18vmax; left: -12vmax; animation: drift-a 26s ease-in-out infinite alternate; }
.orb-b { width: 44vmax; height: 44vmax; background: var(--orb-b); bottom: -20vmax; right: -10vmax; animation: drift-b 32s ease-in-out infinite alternate; }
.orb-c { width: 30vmax; height: 30vmax; background: var(--orb-c); top: 38%; left: 46%; opacity: 0.55; animation: drift-c 38s ease-in-out infinite alternate; }

@keyframes drift-a { to { transform: translate(14vmax, 10vmax) scale(1.08); } }
@keyframes drift-b { to { transform: translate(-12vmax, -8vmax) scale(1.12); } }
@keyframes drift-c { to { transform: translate(-18vmax, -14vmax) scale(0.9); } }

@media (prefers-reduced-motion: reduce) {
    .orb { animation: none; }
    * { scroll-behavior: auto !important; }
}

/* ---------- Glass surfaces ---------- */
.glass {
    background: var(--glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
}

/* ---------- Brand ---------- */
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-sub { color: var(--muted); font-weight: 500; }
.brand-mark {
    width: 28px; height: 28px; border-radius: 9px; background: var(--accent-grad);
    box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
}
.brand-mark::after {
    content: ""; position: absolute; inset: 7px 6px 9px; border-radius: 5px 5px 5px 1px;
    background: rgba(255, 255, 255, 0.92);
}

/* MultiAirlines wordmark: "multi" blue + "airlines" orange */
.wordmark {
    font-family: "Nunito", "Segoe UI", system-ui, sans-serif; font-weight: 800;
    font-size: 1.32rem; letter-spacing: -0.035em; line-height: 1; white-space: nowrap;
}
.wordmark .wm-1 { color: var(--wm-blue); }
.wordmark .wm-2 { color: var(--wm-orange); }
.brand .brand-tag {
    font-family: var(--font-body); font-size: .74rem; font-weight: 600; color: var(--muted);
    padding: 3px 8px; border-radius: 999px; background: var(--glass-soft); border: 1px solid var(--glass-border);
}
.auth-card .wordmark { font-size: 1.7rem; }

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: var(--r-md); padding: 11px 18px;
    background: var(--accent-grad); color: #fff; font-weight: 600;
    box-shadow: 0 8px 22px rgba(var(--accent-rgb), 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-primary:hover { text-decoration: none; filter: brightness(1.06); box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.4); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary.wide { width: 100%; padding: 13px 18px; }

.btn-ghost {
    border: 1px solid var(--glass-border); background: var(--glass-soft); color: var(--ink-soft);
    border-radius: var(--r-md); padding: 9px 14px; font-weight: 500;
    transition: background .15s ease;
}
.btn-ghost:hover { background: var(--glass-strong); }
.btn-ghost.small { padding: 6px 12px; font-size: 0.85rem; }

.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    border-radius: 10px; border: 0; background: transparent; color: var(--ink-soft);
    transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--glass-strong); color: var(--ink); text-decoration: none; }
.icon-btn.subtle { width: 30px; height: 30px; color: var(--muted); }
.icon-btn.subtle:hover { color: var(--ink); }

.mini {
    border: 1px solid var(--glass-border); background: var(--glass-strong); border-radius: 8px;
    padding: 3px 10px; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft);
}
.mini.danger { background: var(--danger); border-color: transparent; color: #fff; }

.only-mobile { display: none; }

/* =========================================================
   CHAT
   ========================================================= */
.chat-shell {
    display: grid; grid-template-columns: 290px 1fr; gap: 14px;
    height: 100vh; height: 100dvh; padding: 14px;
}

/* ---- Sidebar ---- */
.sidebar {
    display: flex; flex-direction: column; min-height: 0;
    border-radius: var(--r-xl); padding: 16px 12px 12px;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 14px; }

.new-chat {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 11px 14px; border-radius: var(--r-md);
    border: 1px solid var(--glass-border); background: var(--glass-strong);
    font-weight: 600; color: var(--ink);
    box-shadow: inset 0 1px 0 var(--glass-edge);
    transition: transform .15s ease, box-shadow .15s ease;
}
.new-chat:hover { box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); }
.new-chat svg { color: var(--accent-2); }

.history { flex: 1; overflow-y: auto; margin-top: 16px; padding-right: 2px; scrollbar-width: thin; }
.history-empty { color: var(--muted); font-size: 0.88rem; padding: 6px 10px; }
.history-group + .history-group { margin-top: 16px; }
.history-group h3 { color: var(--muted); padding: 0 10px 6px; font-family: var(--font-body); font-size: 0.78rem; font-weight: 600; letter-spacing: 0; }

.history-item {
    display: flex; align-items: center; gap: 4px; border-radius: 10px; padding: 0 4px 0 0;
    transition: background .15s ease;
}
.history-item a {
    flex: 1; min-width: 0; padding: 8px 10px; color: var(--ink-soft); font-size: 0.92rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-item a:hover { text-decoration: none; }
.history-item .icon-btn { opacity: 0; }
.history-item:hover, .history-item:focus-within { background: var(--glass-soft); }
.history-item:hover .icon-btn, .history-item:focus-within .icon-btn { opacity: 1; }
.history-item.active { background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--glass-edge); }
.history-item.active a { color: var(--ink); font-weight: 600; }
.history-confirm { flex: 1; padding: 8px 10px; font-size: 0.85rem; color: var(--ink-soft); }

/* ---- Main ---- */
.chat-main {
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
    border-radius: var(--r-xl); overflow: hidden;
}
.chat-header {
    display: flex; align-items: center; gap: 10px; padding: 14px 22px;
    border-bottom: 1px solid var(--hairline);
}
.chat-title {
    flex: 1; min-width: 0; font-size: 1rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }

/* Welcome */
.welcome {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 32px 24px; gap: 12px; overflow-y: auto;
}
/* ---- Animated glass ball (GlassOrb.razor) ---- */
.glass-orb-wrap {
    --orb: 104px;
    position: relative; isolation: isolate; width: var(--orb); height: var(--orb); margin-bottom: 18px;
}
.glass-orb-wrap.small { --orb: 72px; margin-bottom: 10px; }
/* soft glow behind the ball */
.glass-orb-wrap::before {
    content: ""; position: absolute; inset: -22%; z-index: -1; border-radius: 50%;
    background: radial-gradient(circle at 60% 40%, rgba(255, 126, 2, .38), rgba(26, 120, 178, .30) 45%, transparent 70%);
    filter: blur(16px); animation: orb-glow 5s ease-in-out infinite;
}
/* shadow on the "floor" that shrinks as the ball rises */
.glass-orb-wrap::after {
    content: ""; position: absolute; left: 18%; right: 18%; bottom: -16px; height: 10px; z-index: -1; border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(4, 30, 50, .28), transparent 70%);
    animation: orb-floor 6s ease-in-out infinite;
}
.glass-orb {
    position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
    background:
        radial-gradient(circle at 50% 115%, rgba(255, 126, 2, .55), transparent 55%),
        radial-gradient(circle at 32% 28%, #1f86c4 0%, #0f5c8c 50%, #073452 100%);
    box-shadow:
        0 18px 40px rgba(var(--accent-rgb), .35),
        0 6px 14px rgba(255, 126, 2, .18);
    animation: orb-float 6s ease-in-out infinite;
}
/* liquid colour swirling inside the glass */
.orb-swirl {
    position: absolute; inset: -35%; border-radius: 50%; mix-blend-mode: screen; filter: blur(6px) saturate(1.3);
    background: conic-gradient(from 0deg,
        transparent 0 10%, rgba(255, 126, 2, .95) 20%, transparent 34%,
        rgba(64, 178, 240, .9) 52%, transparent 66%,
        rgba(255, 170, 70, .85) 82%, transparent 95%);
    animation: orb-spin 9s linear infinite;
}
.orb-swirl-2 {
    inset: -15%; opacity: .6; filter: blur(8px); mix-blend-mode: normal;
    background: conic-gradient(from 120deg,
        transparent 0 22%, rgba(255, 140, 30, .85) 32%, transparent 46%,
        rgba(12, 81, 128, .95) 64%, transparent 82%);
    animation: orb-spin 14s linear infinite reverse;
}
/* depth: darker edge, lighter centre */
.orb-core {
    position: absolute; inset: 0; border-radius: 50%;
    background: radial-gradient(circle at 42% 40%, transparent 50%, rgba(6, 40, 66, .38) 100%);
}
/* glass: highlight, bottom reflection and rim */
.orb-shine {
    position: absolute; inset: 0; border-radius: 50%;
    background:
        radial-gradient(ellipse 34% 22% at 34% 22%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .35) 50%, transparent 75%),
        radial-gradient(ellipse 9% 9% at 72% 30%, rgba(255, 255, 255, .6), transparent 100%),
        radial-gradient(ellipse 55% 18% at 50% 93%, rgba(255, 255, 255, .30), transparent 72%);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .45), inset 0 -8px 18px rgba(255, 255, 255, .12), inset 0 10px 22px rgba(255, 255, 255, .18);
    animation: orb-shimmer 6s ease-in-out infinite;
}
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-float { 50% { transform: translateY(-7px); } }
@keyframes orb-floor { 50% { transform: scaleX(.78); opacity: .6; } }
@keyframes orb-glow { 50% { transform: scale(1.12); opacity: .75; } }
@keyframes orb-shimmer { 50% { filter: brightness(1.08); } }
@media (prefers-reduced-motion: reduce) {
    .glass-orb, .orb-swirl, .orb-shine, .glass-orb-wrap::before, .glass-orb-wrap::after { animation: none; }
}

.welcome h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 600; letter-spacing: -0.025em; }
.welcome p { color: var(--muted); max-width: 46ch; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; max-width: 680px; }
.chip {
    border: 1px solid var(--glass-border); background: var(--glass-strong);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border-radius: 999px; padding: 9px 16px; font-size: 0.9rem; color: var(--ink-soft);
    box-shadow: inset 0 1px 0 var(--glass-edge);
    transition: transform .15s ease, box-shadow .15s ease, color .15s ease;
}
.chip:hover:not(:disabled) { color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge); }

/* Messages */
.messages { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.messages-inner { max-width: 780px; margin: 0 auto; padding: 28px 22px 12px; display: flex; flex-direction: column; gap: 18px; }

.msg { display: flex; gap: 12px; align-items: flex-start; animation: msg-in .22s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .msg { animation: none; } }

.msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: min(640px, 85%); }
.msg-user .msg-body { align-items: flex-end; }
.msg .bubble { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }

/* per-message actions (delete) — shown on hover/focus, always faintly visible on touch screens */
.msg-actions { display: flex; align-items: center; gap: 6px; min-height: 28px; opacity: 0; transition: opacity .15s ease; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg-actions.confirming { opacity: 1; }
.msg-confirm { font-size: .82rem; color: var(--ink-soft); }
@media (hover: none) { .msg-actions { opacity: .75; } }
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
    background: var(--user-bubble); color: var(--user-ink);
    padding: 11px 16px; border-radius: 20px 20px 6px 20px;
    box-shadow: 0 8px 22px rgba(var(--accent-rgb), 0.25), inset 0 1px 0 rgba(255,255,255,.3);
}
.msg-bot .bubble {
    background: var(--glass-strong); border: 1px solid var(--glass-border);
    padding: 11px 16px; border-radius: 6px 20px 20px 20px; color: var(--ink);
    box-shadow: inset 0 1px 0 var(--glass-edge);
}
/* Bot replies are Markdown */
.msg-bot .bubble.md { white-space: normal; }
.bubble.md > :first-child { margin-top: 0; }
.bubble.md > :last-child { margin-bottom: 0; }
.bubble.md p { margin: 0 0 .7em; }
.bubble.md ul, .bubble.md ol { margin: .2em 0 .8em; padding-left: 1.35em; }
.bubble.md li { margin: .25em 0; }
.bubble.md li::marker { color: var(--accent-2); font-weight: 700; }
.bubble.md strong { font-weight: 600; color: var(--ink); }
.bubble.md h1, .bubble.md h2, .bubble.md h3, .bubble.md h4 { font-size: 1rem; margin: .9em 0 .4em; }
.bubble.md code { font-size: .88em; background: var(--glass-soft); border: 1px solid var(--hairline); }
.bubble.md pre { background: var(--glass-soft); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 10px 12px; overflow-x: auto; }
.bubble.md pre code { border: 0; background: none; padding: 0; }
.bubble.md table { border-collapse: collapse; margin: .4em 0 .8em; font-size: .92em; display: block; overflow-x: auto; }
.bubble.md th, .bubble.md td { border: 1px solid var(--hairline); padding: 6px 10px; text-align: left; }
.bubble.md th { background: var(--glass-soft); font-weight: 600; }
.bubble.md blockquote { margin: .4em 0; padding-left: 12px; border-left: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--ink-soft); }
.bubble.md a { text-decoration: underline; text-underline-offset: 2px; }
.bubble.md hr { border: 0; border-top: 1px solid var(--hairline); margin: .8em 0; }
.bubble.streaming > :last-child::after {
    content: ""; display: inline-block; width: .5em; height: 1em; margin-left: 2px; vertical-align: -0.15em;
    border-radius: 2px; background: var(--accent-2); animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.bot-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
    background:
        radial-gradient(circle at 32% 28%, rgba(255,255,255,.9) 0 12%, transparent 40%),
        conic-gradient(from 200deg, #105e8e, #2a8cc8, #ff7e02, #ffc17a, #105e8e);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}
.bot-avatar.thinking { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.msg > .bubble { max-width: min(640px, 85%); }
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 15px 18px !important; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1.2s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* Composer */
.composer-wrap { padding: 8px 22px 16px; }
.composer {
    max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px;
    padding: 8px 8px 8px 18px; border-radius: 22px;
    background: var(--glass-strong); border: 1px solid var(--glass-border);
    box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
    transition: box-shadow .2s ease, border-color .2s ease;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow-lift), 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.composer textarea {
    flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink);
    font: inherit; font-size: 1rem; line-height: 1.5; padding: 8px 0; max-height: 220px; min-height: 24px;
}
.composer textarea::placeholder { color: var(--muted); }
.send {
    width: 40px; height: 40px; border-radius: 14px; border: 0; display: grid; place-items: center;
    background: var(--cta-grad); color: #fff;
    box-shadow: 0 6px 16px rgba(var(--cta-rgb), 0.38);
    transition: transform .15s ease, opacity .15s ease, filter .15s ease;
}
.send:hover:not(:disabled) { filter: brightness(1.08); }
.send:active:not(:disabled) { transform: scale(.94); }
.send:disabled { opacity: .35; box-shadow: none; }
.send.stop { background: var(--ink); color: var(--bg); box-shadow: none; }
.disclaimer { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 8px; }

.scrim { display: none; }

/* ---- Chat: mobile ---- */
@media (max-width: 860px) {
    .chat-shell { grid-template-columns: 1fr; padding: 8px; }
    .only-mobile { display: inline-grid; }
    .sidebar {
        position: fixed; z-index: 30; top: 8px; bottom: 8px; left: 8px; width: min(300px, 84vw);
        transform: translateX(calc(-100% - 16px)); transition: transform .25s ease;
        background: var(--glass-strong);
    }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(4, 18, 30, .3); }
    .history-item .icon-btn { opacity: 1; }
    .chat-header { padding: 10px 12px; }
    .messages-inner { padding: 18px 14px 8px; }
    .composer-wrap { padding: 6px 10px 10px; }
    .msg-body { max-width: 88%; }
}

/* =========================================================
   ADMIN
   ========================================================= */
body:has(.admin-shell), body:has(.auth-wrap) { overflow: auto; }

.admin-shell { min-height: 100vh; padding: 14px; }
.admin-nav {
    position: sticky; top: 14px; z-index: 10;
    display: flex; align-items: center; gap: 24px; padding: 10px 14px 10px 18px;
    border-radius: var(--r-lg); max-width: 1200px; margin: 0 auto;
}
.admin-links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.admin-links a {
    padding: 7px 12px; border-radius: 10px; color: var(--ink-soft); font-weight: 500; font-size: 0.92rem;
}
.admin-links a:hover { background: var(--glass-soft); text-decoration: none; color: var(--ink); }
.admin-links a.active { background: var(--glass-strong); color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -2px 0 var(--accent-2); }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user-name { font-weight: 600; font-size: 0.9rem; }
.admin-user form { margin: 0; }

.avatar-initial {
    width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--accent-grad); color: #fff; font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}

.admin-main { max-width: 1200px; margin: 0 auto; padding: 30px 4px 60px; display: flex; flex-direction: column; gap: 18px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; max-width: 70ch; }

.stats, .meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 0.86rem; }

.panel { border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel.narrow { max-width: 480px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Dropzone */
.dropzone {
    position: relative; border-radius: var(--r-lg); padding: 34px 20px; text-align: center;
    border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent);
    background: var(--glass-soft);
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.dropzone:hover, .dropzone.dragging { background: var(--glass-strong); border-color: var(--accent); }
.dropzone.dragging { transform: scale(1.01); }
.dropzone.busy { opacity: .75; }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone input[type=file]:disabled { cursor: progress; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.dropzone-icon {
    width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center;
    background: var(--cta-grad); color: #fff; box-shadow: 0 10px 24px rgba(var(--cta-rgb), 0.3);
}
.dropzone-title { font-weight: 600; font-size: 1.02rem; }
.dropzone-hint { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }

.upload-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-row {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px;
    padding: 10px 12px; border-radius: var(--r-md); background: var(--glass-soft); border: 1px solid var(--hairline);
}
.upload-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.upload-size { color: var(--muted); font-size: 0.85rem; }
.upload-msg { grid-column: 2 / -1; color: var(--muted); font-size: 0.85rem; }

/* Badges & pills */
.file-badge {
    display: inline-grid; place-items: center; min-width: 42px; height: 24px; padding: 0 6px;
    border-radius: 7px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; color: #fff;
}
.file-badge.large { min-width: 54px; height: 54px; border-radius: 16px; font-size: 0.8rem; }
.badge-pdf { background: linear-gradient(135deg, #ff6b6b, #e0475b); }
.badge-word { background: linear-gradient(135deg, #2a8cc8, #105e8e); }

.pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.pill-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.pill-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.pill-info { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.pill-muted { color: var(--muted); background: var(--glass-soft); }

/* Search */
.search {
    min-width: 240px; padding: 9px 14px; border-radius: var(--r-md); font: inherit; color: var(--ink);
    border: 1px solid var(--glass-border); background: var(--glass-strong); outline: 0;
    box-shadow: inset 0 1px 0 var(--glass-edge);
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }

/* Table */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; }
.data-table th {
    text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem;
    padding: 8px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: var(--glass-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.inactive td:not(:nth-last-child(-n+2)) { opacity: .5; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.actions-col { text-align: right; white-space: nowrap; width: 1%; }
.file-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-cell a { color: var(--ink); font-weight: 500; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell { display: flex; align-items: center; gap: 10px; }

/* Switch */
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; inset: 0; z-index: 1; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
    width: 40px; height: 23px; border-radius: 999px; background: var(--glass-strong);
    border: 1px solid var(--glass-border); position: relative; transition: background .2s ease;
}
.switch .thumb {
    position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s ease;
}
.switch input:checked + .track { background: var(--accent-grad); border-color: transparent; }
.switch input:checked + .track .thumb { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* Detail */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; font-size: 0.9rem; width: fit-content; }
.back-link:hover { color: var(--ink); text-decoration: none; }
.file-title { display: flex; gap: 14px; align-items: center; min-width: 0; }
.file-title h1 { font-size: 1.35rem; overflow-wrap: anywhere; }
.text-preview {
    margin: 0; max-height: 560px; overflow: auto; padding: 18px; border-radius: var(--r-md);
    background: var(--glass-soft); border: 1px solid var(--hairline);
    font-family: var(--font-body); font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-soft);
}

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }

/* Forms */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 0.88rem; color: var(--ink-soft); }
.field input {
    padding: 11px 14px; border-radius: var(--r-md); font: inherit; color: var(--ink);
    border: 1px solid var(--glass-border); background: var(--glass-strong); outline: 0;
    box-shadow: inset 0 1px 0 var(--glass-edge);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.field input.invalid { border-color: var(--danger); }
.field-error, .validation-message { color: var(--danger); font-size: 0.82rem; }

.alert { padding: 11px 14px; border-radius: var(--r-md); font-size: 0.9rem; font-weight: 500; }
.alert-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.alert-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.alert-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(420px, 100%); border-radius: var(--r-xl); padding: 34px 30px 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand { margin-bottom: 14px; }
.auth-card h1 { font-size: 1.7rem; }
.auth-card .muted { margin-top: -6px; margin-bottom: 6px; }
.auth-back { text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

/* Not found */
.notfound { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.notfound .panel { max-width: 420px; text-align: center; align-items: center; }

/* ---- Admin: smaller screens ---- */
@media (max-width: 960px) {
    .stats, .meta-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .admin-shell { padding: 8px; }
    .admin-nav { flex-wrap: wrap; gap: 10px; top: 8px; }
    .admin-links { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
    .admin-user { margin-left: auto; }
    .admin-user-name { display: none; }
    .admin-main { padding: 20px 0 40px; }
    .panel { padding: 16px; border-radius: var(--r-lg); }
    .search { min-width: 0; width: 100%; }
    .upload-row { grid-template-columns: auto minmax(0, 1fr) auto; }
    .upload-size { display: none; }
}

/* ---------- Blazor error bar ---------- */
#blazor-error-ui {
    display: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
    padding: 12px 44px 12px 18px; border-radius: var(--r-md);
    background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border); box-shadow: var(--shadow-lift); color: var(--ink);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 14px; top: 12px; }

.blazor-error-boundary { padding: 1rem; border-radius: var(--r-md); background: var(--danger); color: #fff; }
.blazor-error-boundary::after { content: "Something went wrong."; }

.brand-link { display: inline-flex; text-decoration: none; }
.brand-link:hover { text-decoration: none; }

/* ---------- Language picker (sidebar bottom) ---------- */
.lang-menu { position: relative; margin-top: 10px; }
.lang-trigger {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
    border-radius: var(--r-md); border: 1px solid var(--glass-border); background: var(--glass-soft);
    color: var(--ink); font: inherit; font-size: .92rem; text-align: start;
    box-shadow: inset 0 1px 0 var(--glass-edge); transition: background .15s ease, border-color .15s ease;
}
.lang-trigger:hover, .lang-menu.open .lang-trigger { background: var(--glass-strong); }
.lang-trigger:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.lang-trigger svg { color: var(--accent-2); flex-shrink: 0; }
.lang-current { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-trigger .lang-chevron { color: var(--muted); transition: transform .2s ease; transform: rotate(180deg); }
.lang-menu.open .lang-chevron { transform: none; }

.lang-pop {
    position: absolute; z-index: 41; left: 0; right: 0; bottom: calc(100% + 8px);
    max-height: min(500px, calc(100dvh - 120px)); overflow-y: auto; scrollbar-width: thin;
    padding: 8px; border-radius: var(--r-lg);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lift), inset 0 1px 0 var(--glass-edge);
    transform-origin: bottom center; animation: lang-pop-in .16s ease-out;
}
@keyframes lang-pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .lang-pop { animation: none; } }
.lang-pop-title { padding: 4px 10px 6px; font-size: .76rem; font-weight: 600; color: var(--muted); }

.lang-option {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 10px;
    border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft);
    font: inherit; text-align: start; cursor: pointer; transition: background .12s ease;
}
.lang-option:hover, .lang-option:focus-visible { background: var(--glass-strong); color: var(--ink); outline: 0; }
.lang-option:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.lang-option.current { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.lang-code {
    flex-shrink: 0; display: inline-grid; place-items: center; width: 34px; height: 26px; border-radius: 8px;
    font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: var(--accent);
    background: var(--glass-strong); border: 1px solid var(--glass-border);
}
.lang-option.current .lang-code { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(var(--accent-rgb), .3); }
.lang-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.lang-native { font-weight: 600; font-size: .93rem; unicode-bidi: isolate; }
.lang-english { font-size: .76rem; color: var(--muted); }
.lang-check { color: var(--accent-2); flex-shrink: 0; }

/* ---------- Rate-limit notice above the message box ---------- */
.composer-notice {
    max-width: 780px; margin: 0 auto 8px; padding: 9px 14px; border-radius: var(--r-md); font-size: .88rem; font-weight: 500;
    color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}

/* ---------- Right-to-left (Arabic) ---------- */
[dir="rtl"] .msg-user .bubble { border-radius: 20px 20px 20px 6px; }
[dir="rtl"] .msg-bot .bubble { border-radius: 20px 6px 20px 20px; }
[dir="rtl"] .composer { padding: 8px 18px 8px 8px; }
[dir="rtl"] .send svg { transform: none; }
.bubble.md ul, .bubble.md ol { padding-left: 0; padding-inline-start: 1.35em; }
.bubble.md blockquote { border-left: 0; padding-left: 0; border-inline-start: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); padding-inline-start: 12px; }
@media (max-width: 860px) {
    [dir="rtl"] .sidebar { left: auto; right: 8px; transform: translateX(calc(100% + 16px)); }
    [dir="rtl"] .sidebar-open .sidebar { transform: none; }
}

/* ---------- Typing status ("Searching flights…") ---------- */
.typing .typing-status { font-style: normal; font-size: .86rem; color: var(--ink-soft); margin-inline-end: 6px; }

/* ---------- Flight result cards ---------- */
.flight-cards { display: flex; flex-direction: column; gap: 10px; width: min(560px, 100%); margin-top: 2px; }
.flight-card {
    border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
    background: var(--glass-strong); border: 1px solid var(--glass-border);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
}
.flight-card.best { border-color: color-mix(in srgb, var(--accent-2) 55%, transparent); }
.fc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fc-airlines { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.fc-airline { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .9rem; }
.fc-code {
    display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 5px; border-radius: 6px;
    background: var(--accent-grad); color: #fff; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
}
.fc-price { display: flex; flex-direction: column; align-items: flex-end; text-align: end; line-height: 1.2; flex-shrink: 0; }
.fc-price strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.fc-price span { font-size: .75rem; color: var(--muted); }
.fc-price .fc-total { color: var(--ink-soft); font-weight: 600; }
.flight-card.best .fc-price strong { color: var(--accent-2); }

.fc-journey { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.fc-dir { font-size: .76rem; font-weight: 600; color: var(--muted); }
.fc-times { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.fc-point { display: flex; flex-direction: column; line-height: 1.15; }
.fc-point b { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.fc-point b sup { font-size: .62rem; color: var(--accent-2); margin-inline-start: 2px; }
.fc-point span { font-size: .78rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.fc-point.end { align-items: flex-end; text-align: end; }
.fc-line { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.fc-track { position: relative; width: 100%; height: 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 2px; }
.fc-track::before, .fc-track::after { content: ""; position: absolute; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.fc-track::before { left: 0; } .fc-track::after { right: 0; }
.fc-dur, .fc-stops { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fc-stops { color: var(--warn); font-weight: 600; }
.fc-stops.direct { color: var(--ok); }
.fc-flights { font-size: .76rem; color: var(--ink-soft); }
.fc-alt { display: block; color: var(--accent); margin-top: 2px; }

.fc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.fc-tag { font-size: .74rem; padding: 3px 9px; border-radius: 999px; background: var(--glass-soft); border: 1px solid var(--hairline); color: var(--ink-soft); }
.fc-tag b { font-weight: 600; color: var(--ink); margin-inline-end: 3px; }
.fc-book {
    margin-inline-start: auto; padding: 6px 14px; border-radius: 10px; font-size: .82rem; font-weight: 700; color: #fff;
    background: var(--cta-grad); box-shadow: 0 6px 14px rgba(var(--cta-rgb), .3);
}
.fc-book:hover { text-decoration: none; filter: brightness(1.06); }
.fc-note { font-size: .74rem; color: var(--muted); margin: 0 4px; }
@media (max-width: 860px) { .flight-card { padding: 12px; } .fc-times { gap: 8px; } }

/* =========================================================
   ADMIN · CONVERSATIONS (history-style viewer)
   ========================================================= */
.convo-shell {
    display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px;
    height: calc(100dvh - 120px); min-height: 520px;
}
.convo-list { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-radius: var(--r-xl); padding: 14px 10px 10px; }
.convo-tools { display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.convo-tools .search { min-width: 0; width: 100%; }
.convo-check { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-soft); cursor: pointer; }
.convo-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.convo-filter {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px; border-radius: 10px; font-size: .84rem;
    background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink-soft);
}
.convo-list .history { margin-top: 12px; }

.convo-item {
    display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px;
    color: var(--ink-soft); transition: background .15s ease;
}
.convo-item:hover { background: var(--glass-soft); text-decoration: none; }
.convo-item.active { background: color-mix(in srgb, var(--accent) 16%, var(--glass-soft)); box-shadow: inset 0 1px 0 var(--glass-edge), inset 3px 0 0 var(--accent-2); }
.convo-item.active .convo-title { color: var(--ink); font-weight: 600; }
.convo-item.deleted .convo-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.convo-title { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.convo-more { margin: 12px auto 4px; display: block; }

.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 600; line-height: 1.5; }
.tag-del { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.tag-flight { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, transparent); }

.convo-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: var(--r-xl); overflow: hidden; }
.convo-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); text-align: center; padding: 24px; }
.convo-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--hairline); }
.convo-head-main { flex: 1; min-width: 0; }
.convo-head h2 { font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-sub { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.convo-sub code, .convo-filter code { font-size: .78rem; padding: 1px 5px; border-radius: 5px; background: var(--glass-soft); border: 1px solid var(--hairline); }
.link-btn { border: 0; background: none; padding: 0 0 0 6px; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.convo-messages .msg { animation: none; }
.msg-time { font-size: .74rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 4px; }
.msg-deleted .bubble { opacity: .55; outline: 1.5px dashed color-mix(in srgb, var(--danger) 55%, transparent); outline-offset: 2px; }
.msg-deleted .flight-cards { opacity: .55; }

@media (max-width: 860px) {
    .convo-shell { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
    .convo-list { max-height: 70vh; }
    .convo-view { min-height: 60vh; }
    .convo-shell.has-selection .convo-list { display: none; }
    .convo-shell:not(.has-selection) .convo-view { display: none; }
    .convo-head { padding: 10px 12px; }
}
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
/* Admin top bar on phones: links get their own scrollable row */
@media (max-width: 760px) {
    .admin-nav { flex-wrap: wrap; gap: 8px 12px; }
    .admin-user { margin-left: auto; }
    .admin-user-name { display: none; }
    .admin-links { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .admin-links a { white-space: nowrap; }
}

/* Khmer: stacked vowels and subscripts need more line height */
html[lang="km"] body { line-height: 1.75; }
/* letter-spacing splits Khmer clusters apart, so turn it off everywhere except the logo */
html[lang="km"] :is(h1, h2, h3, h4, .chat-title, .welcome h2, .stat-value) { letter-spacing: 0; line-height: 1.5; }
html[lang="km"] .msg .bubble, html[lang="km"] .composer textarea { line-height: 1.75; }

/* Country flags (admin conversations) */
.fi.flag { width: 1.25em; line-height: 1em; border-radius: 3px; box-shadow: 0 0 0 1px var(--hairline); flex-shrink: 0; }
.flag-code { font-size: .66rem; font-weight: 700; padding: 0 4px; border-radius: 4px; background: var(--glass-soft); border: 1px solid var(--hairline); }
.flag-name { margin-left: 5px; }
.convo-origin { display: inline-flex; align-items: center; color: var(--ink-soft); font-weight: 600; margin-right: 4px; }
.country-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .86rem; margin-top: -4px; }
.country-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font: inherit; font-size: .84rem;
    color: var(--ink-soft); background: var(--glass-soft); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-edge); cursor: pointer;
}
.country-chip:hover { background: var(--glass-strong); color: var(--ink); }
.country-chip .flag-name { margin-left: 0; }
.country-chip b { color: var(--accent-2); }
