﻿* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    /* â”€â”€ Colour palette â”€â”€ */
    --page:          #080f14;
    --surface:       #0d1822;
    --surface-2:     #111f2b;
    --surface-soft:  #1a2c3a;
    --surface-hover: rgba(255,255,255,0.03);
    --line:          rgba(255,255,255,0.07);
    --line-strong:   rgba(255,255,255,0.12);

    /* â”€â”€ Text â”€â”€ */
    --text:          #e8edf0;
    --text-2:        #b0bec5;
    --muted:         #607d8b;

    /* â”€â”€ Accent â”€â”€ */
    --accent:        #00d4f5;
    --accent-hover:  #26dff8;
    --accent-dim:    rgba(0,212,245,0.1);
    --accent-glow:   rgba(0,212,245,0.2);

    /* â”€â”€ Status â”€â”€ */
    --danger:        #f06060;
    --danger-dim:    rgba(240,96,96,0.1);
    --success:       #4caf82;
    --success-dim:   rgba(76,175,130,0.1);
    --warning:       #f4b942;
    --warning-dim:   rgba(244,185,66,0.1);

    /* â”€â”€ Chat bubbles â”€â”€ */
    --bubble-ai:     #152030;
    --bubble-user:   #004d40;
    --chat-bg:       #080f14;

    /* â”€â”€ Radius & shadow â”€â”€ */
    --radius-sm:     8px;
    --radius:        12px;
    --radius-lg:     16px;
    --radius-xl:     20px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.3);
    --shadow:        0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.5);

    --chat-bg: #0b141a;
    --danger: #ff8f8f;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--page);
    color: var(--text);
    line-height: 1.5;
}

body {
    min-width: 320px;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.is-auth-page {
    background: var(--surface);
}

/* ========== App layout with sidebar ========== */

.app-layout {
    display: flex;
    min-height: 100dvh;
    background: var(--page);
}

/* â”€â”€ Sidebar â”€â”€ */
.sidebar {
    width: 248px;
    flex-shrink: 0;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 0;
    overflow-y: auto;
}


/* brand â€” now rendered as <a> tag */

.sidebar-brand__icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #001a22;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.sidebar-brand__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.sidebar-brand__name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1;
}

.sidebar-brand__name em {
    font-style: normal;
    color: var(--accent);
}

.sidebar-brand__sub {
    font-size: 0.68rem;
    color: var(--muted);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* nav */
.sidebar-nav {
    flex: 1;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav__label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 4px 8px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.sidebar-link i {
    width: 17px;
    text-align: center;
    font-size: 0.88rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text-2);
}

.sidebar-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-link.active i {
    color: var(--accent);
    opacity: 1;
}

/* footer / logout */
.sidebar-footer {
    padding: 12px 10px 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: auto;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
}

.sidebar-logout i {
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.sidebar-logout:hover {
    background: rgba(255,143,143,0.08);
    color: var(--danger);
}

/* â”€â”€ Main content area â”€â”€ */
.app-main {
    margin-left: 248px;
    flex: 1;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--page);
}

/* â”€â”€ Mobile top bar â”€â”€ */
.mobile-topbar {
    display: none;
}

/* â”€â”€ stub pages â”€â”€ */
.stub-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 24px;
    text-align: center;
    color: var(--muted);
}

.stub-page__icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.15);
    color: var(--accent);
    font-size: 1.6rem;
}

.stub-page h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
}

.stub-page p {
    margin: 0;
    font-size: 0.95rem;
}
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 58px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    backdrop-filter: blur(12px);
}

.app-topbar__left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.app-topbar__hamburger {
    display: none;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.app-topbar__hamburger:hover {
    background: rgba(255,255,255,0.06);
}

.app-topbar__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.app-topbar__right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.app-topbar__greeting {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}

.app-topbar__greeting strong {
    color: var(--text-2);
    font-weight: 600;
}

.app-topbar__role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--warning-dim);
    border: 1px solid rgba(244,185,66,0.2);
    color: var(--warning);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-topbar__logout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.app-topbar__logout:hover {
    background: var(--danger-dim);
    border-color: rgba(240,96,96,0.25);
    color: var(--danger);
}

/* â”€â”€ Overlay â”€â”€ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 190;
    backdrop-filter: blur(2px);
}

.sidebar-overlay--visible {
    display: block;
}

/* â”€â”€ Page containers â”€â”€ */
.page-chat {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 60px); /* subtract topbar height */
    background: var(--chat-bg);
}


/* ══════════════════════════════════════════════
   SCAN PAGE — Premium AI product design
══════════════════════════════════════════════ */

.scan-page {
    min-height: calc(100dvh - 58px);
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 80% 40% at 50% -10%, rgba(0,212,245,0.09) 0%, transparent 70%),
        radial-gradient(ellipse 60% 30% at 80% 100%, rgba(0,90,200,0.07) 0%, transparent 60%),
        #07111a;
    padding: 0;
    position: relative;
    overflow: hidden;
}

/* Subtle noise texture overlay */
.scan-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}

.scan-shell {
    position: relative;
    z-index: 1;
    width: min(680px, calc(100% - 48px));
    margin: 0 auto;
    padding: 52px 0 64px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Hero heading inside the card ── */
.scan-hero {
    text-align: center;
    padding: 0 8px 28px;
    position: relative;
}

.scan-hero__orb {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 220px;
    background: radial-gradient(ellipse, rgba(0,212,245,0.13) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(2px);
}

.scan-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(0,212,245,0.18) 0%, rgba(0,100,220,0.14) 100%);
    border: 1px solid rgba(0,212,245,0.25);
    box-shadow: 0 0 0 8px rgba(0,212,245,0.05),
                0 8px 32px rgba(0,212,245,0.12);
    font-size: 1.3rem;
    color: var(--accent);
    margin: 0 auto 22px;
}

.scan-hero__title {
    margin: 0 0 10px;
    font-size: clamp(1.45rem, 2.5vw, 1.9rem);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.scan-hero__sub {
    margin: 0 auto;
    max-width: 440px;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.65;
}

/* ── Glassmorphism card ── */
.scan-ui {
    width: 100%;
    border-radius: 24px;
    padding: 24px;
    background: rgba(255,255,255,0.038);
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.08) inset,
        0 32px 64px -12px rgba(0,0,0,0.45),
        0 0 0 1px rgba(0,0,0,0.2);
    backdrop-filter: blur(24px) saturate(160%);
}

.scan-panel {
    padding: 32px;
}

/* ── Mode switcher ── */
.scan-mode-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 28px;
    background: rgba(0,0,0,0.28);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.07);
    padding: 4px;
}

.side-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 11px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: -0.01em;
}

.side-switch-btn i {
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.side-switch-btn:hover:not(.is-active) {
    color: var(--text-2);
}

.side-switch-btn.is-active {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3),
                0 0 0 1px rgba(255,255,255,0.07);
}

.side-switch-btn.is-active i {
    opacity: 1;
    color: var(--accent);
}

/* ── Image previews ── */
.scan-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.scan-preview-container:empty,
.scan-preview-container:not(:has(.selected-card-preview:not(.hidden))) {
    display: none;
}

.selected-card-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 10px;
    border-radius: 14px;
    background: rgba(0,212,245,0.06);
    border: 1px solid rgba(0,212,245,0.18);
    max-width: 240px;
    flex: 1 1 180px;
}

.selected-card-preview img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    background: var(--surface);
}

.selected-image-meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.selected-image-meta span { display: none !important; }

.selected-image-meta strong {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    color: var(--muted);
    font-size: 0.65rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.preview-remove:hover {
    background: var(--danger-dim);
    color: var(--danger);
}

/* ── Upload row ── */
.upload-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: stretch;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1.5px dashed rgba(255,255,255,0.11);
    background: rgba(255,255,255,0.02);
    color: var(--text-2);
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease;
    min-width: 0;
}

.file-label:hover {
    border-color: rgba(0,212,245,0.4);
    background: rgba(0,212,245,0.04);
}

.file-label input[type="file"] { display: none; }

.file-label__icon-wrap {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(0,212,245,0.1);
    border: 1px solid rgba(0,212,245,0.18);
    color: var(--accent);
    font-size: 0.95rem;
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.file-label:hover .file-label__icon-wrap {
    background: rgba(0,212,245,0.16);
    box-shadow: 0 0 16px rgba(0,212,245,0.15);
}

.file-label__content {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.file-label__content strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-label__content small {
    font-size: 0.76rem;
    color: var(--muted);
    font-weight: 400;
}

/* ── Scan button ── */
.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 26px;
    min-height: 58px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(145deg, #00d4f5 0%, #0091f0 100%);
    color: #001820;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: pointer;
    white-space: nowrap;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.25) inset,
        0 8px 24px -4px rgba(0,145,240,0.45),
        0 0 0 1px rgba(0,145,240,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    pointer-events: none;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.25) inset,
        0 14px 32px -4px rgba(0,145,240,0.55),
        0 0 0 1px rgba(0,145,240,0.4);
    filter: brightness(1.06);
}

.send-btn:active {
    transform: translateY(1px);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.15) inset,
        0 4px 12px -4px rgba(0,145,240,0.35);
}

.send-btn i {
    font-size: 0.8rem;
    opacity: 0.85;
}

/* ── Status text ── */
.status-text {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
    text-align: center;
    letter-spacing: 0.01em;
}

/* ── Result panel ── */
.result-panel {
    width: 100%;
    border-radius: 24px;
    background: rgba(255,255,255,0.038);
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.08) inset,
        0 32px 64px -12px rgba(0,0,0,0.45);
    backdrop-filter: blur(24px) saturate(160%);
    padding: 32px;
    animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Processing */
.processing-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    min-height: 220px;
    padding: 16px;
}

.processing-ring {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.processing-ring svg {
    width: 64px;
    height: 64px;
    animation: spinRing 1.1s linear infinite;
}

.processing-ring__icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--accent);
    font-size: 1.1rem;
}

@keyframes spinRing {
    to { transform: rotate(360deg); }
}

.processing-label {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.processing-sub {
    margin: -6px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
    text-align: center;
    max-width: 300px;
}

/* Result card */
.result-card {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.result-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(76,175,130,0.07);
    border: 1px solid rgba(76,175,130,0.2);
}

.result-header__badge {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(76,175,130,0.15);
    border: 1px solid rgba(76,175,130,0.3);
    color: var(--success);
    font-size: 1rem;
    margin-top: 1px;
}

.result-header h3 {
    margin: 0 0 4px;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.result-header p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Result error card */
.result-error-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 24px;
    text-align: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(240,96,96,0.07), rgba(240,96,96,0.03));
    border: 1px solid rgba(240,96,96,0.2);
}

.result-error-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(240,96,96,0.12);
    border: 1px solid rgba(240,96,96,0.25);
    color: var(--danger);
    font-size: 1.15rem;
}

.result-error-card__title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.result-error-card__msg {
    margin: 0;
    font-size: 0.83rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 340px;
}

/* ── No-plan / limit-reached modal ── */
.npm-overlay {
    position: fixed;
    top: 58px; /* below the topbar */
    left: 248px; /* leaves the sidebar fully accessible */
    right: 0;
    bottom: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 12, 20, 0.82);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    animation: npmFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.npm-overlay.hidden {
    display: none;
}

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

/* On mobile the sidebar is off-canvas — go full width, but stay under the sidebar */
@media (max-width: 768px) {
    .npm-overlay {
        left: 0;
        top: 58px;
        z-index: 150; /* below sidebar (200) so it slides over the modal */
    }
}

.npm-card {
    position: relative;
    width: min(480px, 100%);
    padding: 44px 40px 40px;
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(18, 30, 44, 0.98) 0%, rgba(10, 18, 28, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08) inset,
        0 40px 80px -12px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 18px;
    animation: npmSlideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.05s;
}

@keyframes npmSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.npm-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(240, 96, 96, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.npm-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(240, 96, 96, 0.1);
    border: 1.5px solid rgba(240, 96, 96, 0.28);
    color: var(--danger);
    font-size: 1.7rem;
    box-shadow: 0 0 0 10px rgba(240, 96, 96, 0.05);
    flex-shrink: 0;
}

.npm-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.npm-body {
    margin: 0;
    font-size: 0.92rem;
    color: var(--muted);
    line-height: 1.7;
    max-width: 340px;
}

.npm-body strong {
    color: var(--text-2);
    font-weight: 600;
}

.npm-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 4px 0;
}

.npm-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.npm-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 500;
    text-align: left;
}

.npm-feature i {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(0, 212, 245, 0.08);
    border: 1px solid rgba(0, 212, 245, 0.14);
    color: var(--accent);
    font-size: 0.85rem;
}

.npm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 36px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(145deg, var(--accent) 0%, var(--accent-hover) 50%, #0091f0 100%);
    color: #001820;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 10px 28px -4px rgba(0, 145, 240, 0.4);
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    margin-top: 4px;
}

.npm-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.25) inset,
        0 16px 36px -4px rgba(0, 145, 240, 0.5);
}

@media (max-width: 520px) {
    .npm-card { padding: 36px 24px 32px; border-radius: 22px; gap: 14px; }
    .npm-title { font-size: 1.4rem; }
}


/* OCR output */
.ocr-result {
    max-height: min(55vh, 520px);
    overflow-y: auto;
    word-break: break-word;
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.55;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.structured-result {
    display: grid;
    gap: 16px;
}

.ocr-result-plain {
    white-space: pre-wrap;
    padding: 18px;
    background: rgba(0,0,0,0.18);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.07);
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    font-size: 0.82rem;
}

.result-summary {
    display: grid;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid rgba(0,212,245,0.22);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0,212,245,0.09) 0%, rgba(0,145,240,0.05) 100%);
}

.result-company {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 800;
    overflow-wrap: anywhere;
    letter-spacing: -0.02em;
}

.result-meta {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.result-section {
    display: grid;
    gap: 8px;
}

.result-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(0,212,245,0.7);
    padding: 0 2px;
}

.result-compact-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.result-action-link,
.person-row,
.result-note {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 11px;
    background: rgba(255,255,255,0.03);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.result-action-link {
    color: var(--text);
    text-decoration: none;
}

a.result-action-link:hover {
    border-color: rgba(0,212,245,0.3);
    background: rgba(0,212,245,0.06);
}

.result-action-link i {
    width: 18px;
    flex: 0 0 18px;
    color: var(--accent);
    text-align: center;
    font-size: 0.85rem;
}

.result-action-content {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.result-action-content strong,
.person-row strong {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
}

.result-action-content small,
.person-row small {
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.person-row {
    display: grid;
    gap: 2px;
}

.result-note {
    color: var(--text-2);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.result-field {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 11px;
    background: rgba(255,255,255,0.03);
}

.result-label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(0,212,245,0.65);
}

.result-value {
    color: var(--text);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.result-grid-nested { margin-top: 2px; }

.result-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.result-chip {
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(0,212,245,0.1);
    border: 1px solid rgba(0,212,245,0.2);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.result-mini-card {
    flex: 1 1 200px;
    min-width: min(200px, 100%);
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 11px;
    background: rgba(255,255,255,0.03);
}

.result-mini-card .result-field {
    padding: 0;
    border: 0;
    background: transparent;
}

/* Result action buttons */
.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.16);
    color: var(--text);
}

.primary-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(145deg, #00d4f5 0%, #0091f0 100%);
    color: #001820;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 16px -2px rgba(0,145,240,0.4),
                0 1px 0 rgba(255,255,255,0.2) inset;
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-action-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -2px rgba(0,145,240,0.5),
                0 1px 0 rgba(255,255,255,0.2) inset;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    }
    .sidebar--open { transform: translateX(0); }
    .app-topbar__hamburger { display: none; } /* bottom nav handles mobile navigation for users */
    .is-admin-page .app-topbar__hamburger { display: grid !important; } /* admins still use hamburger */
    .app-main { margin-left: 0; padding-bottom: 68px; } /* space for bottom nav */
    .is-admin-page .app-main { padding-bottom: 0; } /* admins have no bottom nav */
    .page-saved-data, .admin-page { padding: 20px 16px; }
    .app-topbar { padding: 0 16px; }
    .app-topbar__greeting { display: none; }
    .app-topbar__logout span { display: none; }
    .app-topbar__logout { padding: 8px 10px; }
}

@media (min-width: 769px) {
    .sidebar-overlay { display: none !important; }
    .mobile-bottom-nav { display: none !important; } /* desktop uses sidebar */
}


/* ══════════════════════════════════════════════
   MOBILE BOTTOM NAV — Premium floating pill
══════════════════════════════════════════════ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    width: calc(100% - 40px);
    max-width: 400px;
    height: 62px;
    padding: 0 6px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(13, 22, 34, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.07) inset,
        0 20px 60px -8px rgba(0, 0, 0, 0.6),
        0 4px 24px rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: space-around;
    gap: 0;
}

.mbn-item {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    border-radius: 16px;
    color: rgba(96, 125, 139, 0.9);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.2s ease;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.mbn-item i {
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
}

.mbn-item span {
    line-height: 1;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    transition: opacity 0.2s ease;
}

/* inactive — show icon and label, just muted */
.mbn-item:not(.active) span {
    opacity: 0.5;
}

.mbn-item:not(.active) {
    gap: 5px;
}

/* active state */
.mbn-item.active {
    color: var(--accent);
}

.mbn-item.active i {
    transform: translateY(-1px);
}

/* logout — danger tint */
.mbn-item--logout i {
    font-size: 1rem;
}

.mbn-item--logout.active,
.mbn-item--logout:hover {
    color: var(--danger);
}

/* tap animation */
.mbn-item:active i {
    transform: scale(0.88);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }
}


@media (max-width: 600px) {
    .scan-shell {
        width: calc(100% - 32px);
        padding: 32px 0 48px;
    }
    .scan-panel { padding: 24px 20px; }
    .result-panel { padding: 24px 20px; }
    .scan-hero { padding-bottom: 22px; }
    .scan-hero__title { font-size: 1.35rem; }
    .upload-wrapper { grid-template-columns: 1fr; }
    .send-btn { min-height: 52px; }
    .result-actions { grid-template-columns: 1fr; }
    .result-compact-list { grid-template-columns: 1fr; }
    .result-grid { grid-template-columns: 1fr; }
}

.chat-messages {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    background: radial-gradient(180deg, rgba(15, 23, 34, 0.95) 0%, rgba(11, 20, 26, 0.9) 100%);
    /* border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05); */
    /* box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3); */
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row-ai {
    justify-content: flex-start;
}

.message-row-user {
    justify-content: flex-end;
}

.message-bubble {
    position: relative;
    max-width: min(760px, 88%);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.message-bubble-ai {
    background: linear-gradient(180deg, rgba(38, 53, 68, 0.98), rgba(20, 31, 43, 0.96));
    border-top-left-radius: 18px;
}

.message-bubble-user {
    background: linear-gradient(180deg, rgba(0, 92, 75, 0.95), rgba(0, 75, 61, 0.95));
    border-top-right-radius: 18px;
}

.welcome-message {
    margin: 0;
    padding: 16px 18px 22px;
    text-align: left;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(0,229,255, 0.08) 0%, rgba(51,238,255, 0.04) 100%);
    border: 1px solid rgba(0,229,255, 0.2);
}

.welcome-message .ai-header {
    margin-bottom: 10px;
}

.welcome-message h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    line-height: 1.2;
    color: var(--text);
}

.welcome-message p {
    margin: 0;
    font-size: 1rem;
    color: var(--muted);
}

.upload-preview {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.ocr-result-panel {
    padding: 0;
    width: 100%;
}

.ocr-result-panel h3 {
    margin: 0;
    font-size: 0.9rem;
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.result-head h3 {
    margin-right: auto;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.ocr-result {
    max-height: min(50vh, 560px);
    margin: 0;
    padding: 0;
    overflow: auto;
    word-break: break-word;
    border-radius: 0;
    background: transparent;
    color: #eaf0f8;
    font-size: 0.9rem;
    line-height: 1.55;
}

.structured-result {
    display: grid;
    gap: 14px;
}

.ocr-result-plain {
    white-space: pre-wrap;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.result-summary {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid rgba(0, 212, 245, 0.3);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 212, 245, 0.12), rgba(0, 212, 245, 0.06));
    box-shadow: 0 4px 16px rgba(0, 212, 245, 0.08);
}

.result-company {
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 800;
    overflow-wrap: anywhere;
    letter-spacing: -0.01em;
}

.result-meta {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.result-section {
    display: grid;
    gap: 10px;
}

.result-section-title {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0 2px;
}

.result-compact-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.result-action-link,
.person-row,
.result-note {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    transition: all 0.25s ease;
}

.result-action-link {
    color: var(--text);
    text-decoration: none;
}

a.result-action-link:hover {
    border-color: rgba(0, 212, 245, 0.4);
    background: linear-gradient(135deg, rgba(0, 212, 245, 0.12), rgba(0, 212, 245, 0.06));
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 212, 245, 0.1);
}

.result-action-link i {
    width: 20px;
    flex: 0 0 20px;
    color: var(--accent);
    text-align: center;
    font-size: 0.95rem;
}

.result-action-content,
.person-row {
    min-width: 0;
}

.result-action-content {
    display: grid;
    gap: 3px;
}

.result-action-content strong,
.person-row strong {
    color: var(--text);
    font-size: 0.84rem;
    line-height: 1.3;
    font-weight: 600;
}

.result-action-content small,
.person-row small {
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.person-row {
    display: grid;
    gap: 3px;
    padding: 12px 14px;
}

.result-note {
    color: var(--text-2);
    font-size: 0.84rem;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.result-field {
    min-width: 0;
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    transition: border-color 0.2s ease;
}

.result-field:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.result-label {
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.result-value {
    color: var(--text);
    font-size: 0.84rem;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.result-grid-nested {
    margin-top: 4px;
}

.result-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-chip {
    max-width: 100%;
    padding: 6px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0, 212, 245, 0.15), rgba(0, 212, 245, 0.1));
    border: 1px solid rgba(0, 212, 245, 0.25);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.result-mini-card {
    flex: 1 1 220px;
    min-width: min(220px, 100%);
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.result-mini-card .result-field {
    padding: 0;
    border: 0;
    background: transparent;
}

.result-mini-card:hover {
    border-color: rgba(0, 212, 245, 0.3);
}

.chat-input-area {
    flex: 0 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(18, 31, 43, 0.98), rgba(18, 28, 36, 0.98));
    padding: 18px 0 calc(18px + env(safe-area-inset-bottom));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.input-shell {
    width: min(1440px, calc(100% - 48px));
    margin: 0 auto;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 16px 40px rgba(0,0,0,0.18);
}

.chat-form,
.upload-preview,
.status-text {
    width: 100%;
    margin: 0 auto;
}
.chat-form {
    padding-top: 2px;
}

/* ========== AI Processing & Effects ========== */

/* AI Glow Effects */
.ai-glow {
    animation: aiGlow 3s ease-in-out infinite;
}

.ai-icon {
    background: linear-gradient(135deg, rgba(0,229,255, 0.2), rgba(51,238,255, 0.15)) !important;
    border: 2px solid rgba(0,229,255, 0.3) !important;
}

.ai-icon:hover {
    background: linear-gradient(135deg, rgba(0,229,255, 0.3), rgba(51,238,255, 0.25)) !important;
}

@keyframes aiGlow {
    0% {
        box-shadow: 0 0 20px rgba(0,229,255, 0.3), 0 0 40px rgba(0,229,255, 0.15);
    }
    50% {
        box-shadow: 0 0 30px rgba(0,229,255, 0.5), 0 0 60px rgba(0,229,255, 0.25);
    }
    100% {
        box-shadow: 0 0 20px rgba(0,229,255, 0.3), 0 0 40px rgba(0,229,255, 0.15);
    }
}

/* AI Header with Icon */
.ai-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.ai-header i {
    font-size: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Processing Animation */
.ai-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: var(--muted);
    font-size: 0.95rem;
}

.processing-dots {
    display: flex;
    gap: 4px;
}

.processing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: processingBounce 1.4s infinite;
}

.processing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.processing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes processingBounce {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Processing Panel */
.processing-panel {
    padding: 10px;
    text-align: center;
}

/* Result Actions */
.result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.auto-save-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0,229,255, 0.15);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

@media (max-width: 640px) {
    .page-title {
        font-size: 1.65rem;
    }

    .chat-header-content,
    .chat-messages {
        padding-left: 16px;
        padding-right: 16px;
    }

    .welcome-message h2 {
        font-size: 0.98rem;
    }

    .welcome-message p {
        font-size: 0.94rem;
    }

    .chat-form,
    .upload-preview,
    .status-text {
        width: calc(100% - 32px);
    }

    .upload-wrapper {
        grid-template-columns: 1fr;
    }

    .message-bubble {
        max-width: 94%;
    }

    .upload-preview {
        display: none;
    }

    .ocr-result-panel {
        padding: 14px;
    }

    .ocr-result {
        max-height: min(50vh, 560px);
    }

    .result-grid,
    .result-compact-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .brand-title {
        font-size: 0.78rem;
        overflow-wrap: anywhere;
    }

    .brand-subtitle,
    .page-copy,
    .form-field label,
    .login-hint,
    .status-text,
    .welcome-message p,
    .preview-meta {
        font-size: 0.86rem;
    }

    .chat-header {
        min-height: 58px;
    }

    .chat-header-content {
        min-height: 58px;
    }

    .chat-title {
        font-size: 0.98rem;
    }

    .logout-btn {
        width: 38px;
        height: 38px;
    }

    .chat-messages {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .welcome-message h2 {
        font-size: 0.95rem;
    }

    .file-label {
        justify-content: center;
    }
}

@media (min-width: 900px) {
    .chat-messages {
        padding-top: 26px;
        padding-bottom: 26px;
    }
}

.admin-page {
    padding: 24px 20px 40px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-header h2 {
    margin: 0 0 6px;
    font-size: 1.9rem;
}

.admin-header p {
    margin: 0;
    color: var(--muted);
}

.admin-panel {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}

.admin-panel-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.admin-panel-card .panel-title {
    margin-bottom: 20px;
}

.admin-panel-card h3 {
    margin: 0;
    font-size: 1.2rem;
}

.admin-panel-card p {
    margin: 6px 0 0;
    color: var(--muted);
}

.admin-form {
    display: grid;
    gap: 16px;
}

.admin-form .form-group {
    display: grid;
    gap: 8px;
}

.admin-form label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
}

.admin-form input,
.admin-form select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table th {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-table td {
    color: var(--text);
    font-size: 0.92rem;
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(0,229,255, 0.15);
    border-color: var(--accent);
}

.action-btn.delete {
    border-color: rgba(255, 75, 85, 0.25);
}

.action-btn.delete:hover {
    background: rgba(255, 75, 85, 0.13);
}

.status-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-badge.active {
    background: rgba(0,229,255, 0.12);
    color: #9ef0d8;
}

.status-badge.blocked {
    background: rgba(255, 75, 85, 0.13);
    color: #ffb7c2;
}

@media (max-width: 980px) {
    .admin-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .admin-header {
        align-items: flex-start;
    }
    .admin-table {
        min-width: 100%;
    }
}

/* ========== Welcome Page & Auth Pages ========== */

/* â”€â”€ Split layout â”€â”€ */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100dvh;
    max-width: 1440px;
    margin: 0 auto;
}

.auth-split__form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    position: relative;
}

.auth-split__form::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

.auth-split__form-inner {
    width: 100%;
    max-width: 400px;
}

/* brand */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 44px;
}

.auth-brand__icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #001a22;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: 0 6px 20px var(--accent-glow);
}

.auth-brand__name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.auth-brand__name span {
    color: var(--accent);
}

/* heading */
.auth-heading {
    margin-bottom: 32px;
}

.auth-heading h1 {
    margin: 0 0 6px;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.auth-heading p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

/* alert */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(240,96,96,0.25);
    background: var(--danger-dim);
    color: var(--danger);
    font-size: 0.85rem;
    line-height: 1.4;
}

.auth-alert i {
    flex-shrink: 0;
    font-size: 0.9rem;
}

.auth-alert--success {
    border-color: rgba(76,175,130,0.25);
    background: var(--success-dim);
    color: var(--success);
}

/* form */
.auth-form {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.01em;
}

.auth-field__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.auth-field__label-row label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    margin: 0;
    letter-spacing: 0.01em;
}

.auth-forgot {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.auth-forgot:hover {
    color: var(--accent);
}

.auth-field label small {
    font-weight: 400;
    color: var(--muted);
    margin-left: 4px;
}

.auth-field__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    transition: box-shadow 0.2s ease;
}

.auth-field__input-wrap:focus-within {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-field__input-wrap i {
    position: absolute;
    left: 13px;
    color: var(--muted);
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 1;
}

.auth-field__input-wrap input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px 10px 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-field__input-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0,212,245,0.03);
}

.auth-field__input-wrap input::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

#password {
    padding-right: 44px;
}

.auth-eye {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    outline: none;
    color: var(--muted);
    font-size: 0.9rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
    border-radius: 6px;
    padding: 0;
    flex-shrink: 0;
}

.auth-eye:hover {
    color: var(--accent);
}

.auth-submit {
    width: 100%;
    min-height: 46px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #001a22;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.auth-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.auth-submit:active {
    transform: scale(0.98);
}

.auth-switch {
    margin: 0 0 10px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.auth-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,0.02);
    color: var(--text-2);
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-switch-btn:hover {
    background: rgba(0,229,255,0.08);
    border-color: var(--accent);
    color: var(--accent-hover);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}

/* â”€â”€ right info panel â”€â”€ */
.auth-split__info {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 6vw, 72px) clamp(36px, 5vw, 64px);
    background: linear-gradient(160deg, #0a1822 0%, #060e14 100%);
    position: relative;
    overflow: hidden;
}

.auth-split__info::before {
    content: '';
    position: absolute;
    top: -120px; right: -120px;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,245,0.12) 0%, transparent 65%);
    pointer-events: none;
}

.auth-split__info::after {
    content: '';
    position: absolute;
    bottom: -80px; left: -80px;
    width: 340px; height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,245,0.07) 0%, transparent 65%);
    pointer-events: none;
}

.auth-split__info-inner {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-info-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0,212,245,0.3);
    background: rgba(0,212,245,0.07);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.auth-split__info h2 {
    margin: 0 0 16px;
    font-size: clamp(1.85rem, 3vw, 2.6rem);
    font-weight: 800;
    color: var(--text);
    line-height: 1.18;
    letter-spacing: -0.03em;
}

.auth-split__info h2 span {
    color: var(--accent);
}

.auth-split__info-inner > p {
    margin: 0 0 32px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.7;
    max-width: 400px;
}

.auth-feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 36px;
    display: grid;
    gap: 14px;
}

.auth-feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.afl__icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: rgba(0,212,245,0.1);
    border: 1px solid rgba(0,212,245,0.18);
    color: var(--accent);
    font-size: 0.85rem;
}

.auth-feature-list li > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
}

.auth-feature-list li strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.auth-feature-list li span {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
}

/* stats footer */
.auth-info-footer {
    display: flex;
    align-items: center;
    gap: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.auth-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-stat span {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.auth-stat small {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.auth-stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* â”€â”€ responsive â”€â”€ */

/* tablet portrait and up â€” show both panels */
@media (min-width: 768px) {
    .auth-split {
        grid-template-columns: 1fr 1fr;
    }
}

/* below 768px â€” single column, hide right panel, form fills screen */
@media (max-width: 767px) {
    .auth-split {
        grid-template-columns: 1fr;
        min-height: 100dvh;
    }

    .auth-split__info {
        display: none;
    }

    .auth-split__form {
        min-height: 100dvh;
        border-right: none;
        padding: 40px 24px;
        justify-content: center;
    }
}

/* small phones */
@media (max-width: 400px) {
    .auth-split__form {
        padding: 32px 18px;
    }

    .auth-heading h1 {
        font-size: 1.55rem;
    }

    .auth-submit {
        min-height: 50px;
    }
}

/* right panel fine-tuning at narrow desktop */
@media (min-width: 768px) and (max-width: 1024px) {
    .auth-split__info {
        padding: 40px 32px;
    }

    .auth-split__info h2 {
        font-size: 1.8rem;
    }

    .auth-split__info-inner > p {
        font-size: 0.88rem;
    }

    .auth-feature-list li strong {
        font-size: 0.85rem;
    }

    .auth-feature-list li span {
        font-size: 0.78rem;
    }
}

/* ========== Settings / spage shared styles ========== */
.spage {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.spage-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    flex-wrap: wrap;
}

.spage-hero__avatar {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #33eeff);
    color: #001a1f;
    font-size: 1.5rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 16px rgba(0,229,255,0.3);
}

.spage-hero__info { flex: 1; min-width: 0; }
.spage-hero__info h1 {
    margin: 0 0 3px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}
.spage-hero__info span { font-size: 0.85rem; color: var(--muted); }

.spage-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.2);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.spage-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.scard {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    overflow: hidden;
}

.scard__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.015);
}

.scard__head-left { display: flex; align-items: center; gap: 14px; }

.scard__icon {
    width: 38px; height: 38px;
    flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 10px;
    font-size: 0.9rem;
}

.scard__icon--email {
    background: rgba(0,229,255,0.1);
    border: 1px solid rgba(0,229,255,0.2);
    color: var(--accent);
}

.scard__icon--pwd {
    background: rgba(247,201,72,0.1);
    border: 1px solid rgba(247,201,72,0.2);
    color: #f7c948;
}

.scard__icon--name {
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.18);
    color: var(--accent);
}

.scard__head h2 { margin: 0 0 3px; font-size: 0.98rem; font-weight: 700; color: var(--text); }
.scard__head p  { margin: 0; font-size: 0.78rem; color: var(--muted); }

.sform {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sform__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sform__field { display: flex; flex-direction: column; gap: 7px; }
.sform__field--half { max-width: 50%; }
.sform__field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.sform__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 10px;
    transition: box-shadow 0.2s ease;
}

.sform__input-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}

.sform__input-wrap > i {
    position: absolute;
    left: 13px;
    color: var(--muted);
    font-size: 0.82rem;
    pointer-events: none;
}

.sform__input-wrap input {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 38px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.sform__input-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0,229,255,0.02);
}

.sform__input-wrap--readonly input { opacity: 0.5; cursor: not-allowed; }
.sform__input-wrap input::placeholder { color: rgba(134,150,160,0.45); }

.sform__eye {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    outline: none;
    color: var(--muted);
    font-size: 0.88rem;
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    transition: color 0.2s ease;
}
.sform__eye:hover { color: var(--accent); }
.sform__eye:focus { outline: none; }

.sform__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 4px;
    flex-wrap: wrap;
}

.sfeedback {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 9px;
    flex: 1;
    min-width: 200px;
}
.sfeedback.hidden { display: none; }
.sfeedback--success {
    background: rgba(0,229,255,0.07);
    border: 1px solid rgba(0,229,255,0.2);
    color: var(--accent);
}
.sfeedback--error {
    background: rgba(255,143,143,0.07);
    border: 1px solid rgba(255,143,143,0.25);
    color: var(--danger);
}

.sform__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    min-height: 44px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--accent), #33eeff);
    color: #001a1f;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(0,229,255,0.2);
    letter-spacing: 0.01em;
}
.sform__submit:hover    { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,229,255,0.28); }
.sform__submit:active   { transform: scale(0.98); }
.sform__submit:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

@media (max-width: 768px) {
    .spage            { padding: 16px; gap: 16px; }
    .spage-hero       { padding: 18px 20px; gap: 14px; }
    .scard__head      { padding: 18px 20px 16px; }
    .sform            { padding: 18px 20px; }
    .sform__row       { grid-template-columns: 1fr; }
    .sform__field--half { max-width: 100%; }
    .sform__footer    { flex-direction: column; align-items: stretch; }
    .sform__submit    { width: 100%; justify-content: center; }
    .spage-hero__badge { font-size: 0.72rem; }
}


/* ========== OTP Verification ========== */

.otp-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.otp-box {
    width: 50px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    caret-color: var(--accent);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.otp-box:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0,229,255,0.06);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.12);
}

.otp-resend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.otp-resend #resendTimer {
    font-size: 0.83rem;
    color: var(--muted);
}

.otp-resend #resendTimer strong {
    color: var(--accent);
}

.otp-resend #resendForm {
    width: 100%;
}

.auth-alert--success {
    border-color: rgba(0,229,255,0.3);
    background: rgba(0,229,255,0.08);
    color: #9ef0d8;
}

/* â”€â”€ Admin WhatsApp Settings badge â”€â”€ */
.wa-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.wa-status-badge.configured {
    background: rgba(0,229,255,0.12);
    color: #9ef0d8;
    border: 1px solid rgba(0,229,255,0.25);
}

.wa-status-badge.not-configured {
    background: rgba(255,143,143,0.1);
    color: var(--danger);
    border: 1px solid rgba(255,143,143,0.25);
}

@media (max-width: 480px) {
    .otp-box {
        width: 42px;
        height: 48px;
        font-size: 1.2rem;
    }
}

/* â”€â”€ Settings select input â”€â”€ */
.sform__select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-size: 0.91rem;
    transition: border-color 0.2s ease, background 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.sform__select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0,229,255,0.04);
}

.sform__select option {
    background: var(--surface);
    color: var(--text);
}

/* â”€â”€ Warning alert variant â”€â”€ */
.auth-alert--warning {
    border-color: rgba(247,201,72,0.35);
    background: rgba(247,201,72,0.08);
    color: #f7e048;
    align-items: flex-start;
}

.auth-alert--warning i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ========================================
   Plans page â€” user-facing
======================================== */

.plan-page {
    padding: 28px 28px 48px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* â”€â”€ Current plan hero â”€â”€ */
.plan-current {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 28px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.plan-current__icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.18);
    font-size: 1.4rem;
}

.plan-current__body {
    flex: 1;
    min-width: 0;
}

.plan-current__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.plan-current__name {
    margin: 0 0 4px;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    line-height: 1.15;
}

.plan-current__name--empty {
    color: var(--muted);
}

.plan-current__desc {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

.plan-featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.28);
    color: #ffd700;
}

/* â”€â”€ Usage bar â”€â”€ */
.plan-usage {
    margin-bottom: 20px;
}

.plan-usage__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.plan-usage__top strong {
    color: var(--text);
    font-weight: 700;
}

.plan-usage__bar {
    height: 8px;
    background: rgba(255,255,255,0.07);
    border-radius: 999px;
    overflow: hidden;
}

.plan-usage__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.plan-usage__fill--warn {
    background: linear-gradient(90deg, #f7c948, #ff8c42);
}

.plan-usage__fill--danger {
    background: linear-gradient(90deg, var(--danger), #ff4b4b);
}

.plan-usage__sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 6px;
}

.plan-unlim {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0,229,255,0.1);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 6px;
    border: 1px solid rgba(0,229,255,0.2);
}

/* â”€â”€ Meta chips â”€â”€ */
.plan-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.plan-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    color: var(--muted);
    white-space: nowrap;
}

.plan-meta__item i {
    color: var(--accent);
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* â”€â”€ Section divider title â”€â”€ */
.plan-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* â”€â”€ Plan cards grid â”€â”€ */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 20px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.07);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.plan-card:hover {
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.plan-card--featured {
    border-color: rgba(0,229,255,0.28);
    background: linear-gradient(160deg,
        rgba(0,229,255,0.05) 0%,
        var(--surface) 60%);
    box-shadow: 0 4px 24px rgba(0,229,255,0.08);
}

.plan-card--current {
    border-color: rgba(0,229,255,0.45);
    box-shadow: 0 0 0 1px rgba(0,229,255,0.15), 0 8px 32px rgba(0,0,0,0.2);
}

.plan-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255,215,0,0.1);
    border: 1px solid rgba(255,215,0,0.28);
    color: #ffd700;
    align-self: flex-start;
}

.plan-card__badge--current {
    background: rgba(0,229,255,0.12);
    border-color: rgba(0,229,255,0.3);
    color: var(--accent);
}

.plan-card__name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.plan-card__price {
    display: flex;
    align-items: baseline;
    gap: 3px;
    line-height: 1;
}

.plan-card__price-currency {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 600;
}

.plan-card__price-amount {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.plan-card__price-cycle {
    font-size: 0.82rem;
    color: var(--muted);
    margin-left: 2px;
}

.plan-card__scans {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.plan-card__scans i {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.plan-card__desc {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.55;
    flex: 1;
}

.plan-card__cta {
    margin-top: auto;
    padding-top: 4px;
}

.plan-card__btn {
    width: 100%;
    min-height: 42px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: none;
}

.plan-card__btn--current {
    background: rgba(0,229,255,0.1);
    border-color: rgba(0,229,255,0.3);
    color: var(--accent);
}

/* â”€â”€ Admin plans modal row â”€â”€ */
.amodal__row {
    display: flex;
    gap: 12px;
}

.amodal__row .amodal__field {
    flex: 1;
    min-width: 0;
}

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 768px) {
    .plan-page {
        padding: 16px 16px 40px;
    }

    .plan-current {
        flex-direction: column;
        padding: 20px;
    }

    .plan-current__name {
        font-size: 1.35rem;
    }

    .plan-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .plan-grid {
        grid-template-columns: 1fr;
    }

    .amodal__row {
        flex-direction: column;
    }
}

/* ========================================
   Admin pages â€” shared layout & components
======================================== */

/* â”€â”€ Admin page container â”€â”€ */
.apage {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* â”€â”€ Toolbar (search + action button) â”€â”€ */
.apage-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.apage-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
}

.apage-search i {
    position: absolute;
    left: 13px;
    color: var(--muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.apage-search__input {
    width: 100%;
    min-height: 40px;
    padding: 9px 14px 9px 38px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.apage-search__input:focus {
    outline: none;
    border-color: rgba(0,229,255,0.35);
}

.apage-search__input::placeholder {
    color: var(--muted);
}

.apage-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 40px;
    border-radius: 9px;
    border: none;
    background: var(--accent);
    color: #001a1f;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.apage-btn-primary:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

/* â”€â”€ Admin table â”€â”€ */
.atable-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
}

.atable {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
    font-size: 0.875rem;
}

.atable thead tr {
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--line);
}

.atable th {
    padding: 11px 16px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.atable tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.12s ease;
}

.atable tbody tr:last-child {
    border-bottom: none;
}

.atable tbody tr:hover {
    background: rgba(0,212,245,0.03);
}

.atable td {
    padding: 12px 16px;
    color: var(--text);
    vertical-align: middle;
}

.atable-loading {
    text-align: center;
    color: var(--muted);
    padding: 48px !important;
    font-size: 0.875rem;
}

/* â”€â”€ User info cell (used in users table) â”€â”€ */
.ucell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ucell__av {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #001a1f;
    font-size: 0.8rem;
    font-weight: 800;
    display: grid;
    place-items: center;
}

.ucell__name {
    font-weight: 600;
    font-size: 0.88rem;
}

.ucell__email {
    font-size: 0.78rem;
    color: var(--muted);
}

/* â”€â”€ Badges â”€â”€ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge--admin {
    background: var(--warning-dim);
    border: 1px solid rgba(244,185,66,0.22);
    color: var(--warning);
}

.badge--user {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    color: var(--muted);
}

.badge--active {
    background: rgba(0,212,245,0.08);
    border: 1px solid rgba(0,212,245,0.18);
    color: var(--accent);
}

.badge--blocked {
    background: var(--danger-dim);
    border: 1px solid rgba(240,96,96,0.2);
    color: var(--danger);
}

/* â”€â”€ Row action buttons â”€â”€ */
.row-actions {
    display: flex;
    gap: 5px;
}

.ract {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ract:hover {
    background: rgba(0,212,245,0.08);
    border-color: rgba(0,212,245,0.25);
    color: var(--accent);
}

.ract.ract--danger:hover {
    background: var(--danger-dim);
    border-color: rgba(240,96,96,0.22);
    color: var(--danger);
}

/* â”€â”€ Stats strip â”€â”€ */
.apage-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 11px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--muted);
}

.apage-stats span strong {
    color: var(--text);
    font-weight: 700;
}

/* â”€â”€ Modal overlay & dialog â”€â”€ */
.amodal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.amodal-overlay.hidden {
    display: none;
}

.amodal {
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    width: min(500px, 94vw);
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

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

.amodal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--line);
}

.amodal__head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.amodal__head h2 i {
    color: var(--accent);
}

.amodal__close {
    width: 28px; height: 28px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.amodal__close:hover {
    background: var(--danger-dim);
    border-color: rgba(240,96,96,0.2);
    color: var(--danger);
}

.amodal__form {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 70vh;
    overflow-y: auto;
}

.amodal__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.amodal__field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.02em;
}

.req {
    color: var(--danger);
}

.amodal__field input,
.amodal__field select,
.amodal__field textarea {
    min-height: 40px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.amodal__field textarea {
    resize: vertical;
    font-family: inherit;
    min-height: 64px;
}

.amodal__field input:focus,
.amodal__field select:focus,
.amodal__field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.amodal__feedback {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.4;
}

.amodal__feedback.hidden { display: none; }

.amodal__feedback.ok {
    background: var(--success-dim);
    border: 1px solid rgba(76,175,130,0.2);
    color: var(--success);
}

.amodal__feedback.err {
    background: var(--danger-dim);
    border: 1px solid rgba(240,96,96,0.2);
    color: var(--danger);
}

.amodal__actions {
    display: flex;
    gap: 10px;
    padding-top: 4px;
}

.amodal__btn {
    flex: 1;
    min-height: 40px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.amodal__btn--cancel {
    background: rgba(255,255,255,0.03);
    border-color: var(--line-strong);
    color: var(--muted);
}

.amodal__btn--cancel:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-2);
}

.amodal__btn--submit {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #001a22;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.amodal__btn--submit:hover {
    opacity: 0.9;
    box-shadow: 0 6px 16px var(--accent-glow);
}

.amodal__btn--submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Phone input wrapper ── */
.amodal__phone-wrap {
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.amodal__phone-wrap:focus-within {
    border-color: var(--accent);
}

.amodal__phone-prefix {
    padding: 0 10px 0 12px;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.92rem;
    border-right: 1px solid rgba(255,255,255,0.08);
    line-height: 40px;
    user-select: none;
    flex-shrink: 0;
}

.amodal__phone-wrap input {
    flex: 1;
    min-height: 40px;
    padding: 9px 12px;
    border: none !important;
    background: transparent !important;
    color: var(--text);
    font-size: 0.9rem;
    outline: none !important;
    box-shadow: none !important;
}

/* ── Verified note ── */
.amodal__verified-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(76,175,130,0.07);
    border: 1px solid rgba(76,175,130,0.2);
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.amodal__verified-note strong {
    color: var(--success);
}

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 768px) {
    .apage {
        padding: 16px;
    }

    .amodal__row {
        flex-direction: column;
    }
}

/* ========================================
   Plan status bar (chat page)
======================================== */

.plan-status-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    font-size: 0.82rem;
    font-weight: 500;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.plan-status-bar i {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.plan-status-bar span {
    flex: 1;
    min-width: 0;
}

.plan-status-bar__link {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid currentColor;
    opacity: 0.85;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    color: inherit;
}

.plan-status-bar__link:hover {
    opacity: 1;
}

.plan-status-bar__track {
    width: 80px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    flex-shrink: 0;
    overflow: hidden;
}

.plan-status-bar__fill {
    height: 100%;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.7;
    transition: width 0.4s ease;
}

/* â”€â”€ Colour variants â”€â”€ */
.plan-status-bar--ok {
    background: rgba(0,229,255,0.07);
    border-bottom: 1px solid rgba(0,229,255,0.15);
    color: var(--accent);
}

.plan-status-bar--warn {
    background: rgba(247,201,72,0.08);
    border-bottom: 1px solid rgba(247,201,72,0.2);
    color: #f7c948;
}

.plan-status-bar--danger {
    background: rgba(255,143,143,0.07);
    border-bottom: 1px solid rgba(255,143,143,0.2);
    color: var(--danger);
}

/* ========================================
   Plan page â€” alerts, buy button, history, overlay
======================================== */

/* â”€â”€ Alert banner â”€â”€ */
.plan-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.plan-alert--success {
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.25);
    color: var(--accent);
}

.plan-alert--success i {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.plan-alert strong {
    display: block;
    margin-bottom: 2px;
}

/* â”€â”€ Buy / activate button â”€â”€ */
.plan-card__btn--buy {
    width: 100%;
    min-height: 42px;
    border-radius: 9px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #001a1f;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(0,229,255,0.25);
}

.plan-card__btn--buy:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0,229,255,0.35);
}

.plan-card__btn--buy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* â”€â”€ Payment history table â”€â”€ */
.plan-history-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
}

.plan-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
    min-width: 560px;
}

.plan-history-table thead tr {
    background: rgba(255,255,255,0.04);
    border-bottom: 2px solid rgba(255,255,255,0.08);
}

.plan-history-table th {
    padding: 11px 16px;
    text-align: left;
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.plan-history-table td {
    padding: 12px 16px;
    color: var(--text);
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.plan-history-table tbody tr:last-child td {
    border-bottom: none;
}

.plan-history-table tbody tr:hover {
    background: rgba(0,229,255,0.03);
}

.plan-history-empty {
    text-align: center;
    color: var(--muted);
    padding: 32px !important;
    font-size: 0.88rem;
}

/* â”€â”€ History status badges â”€â”€ */
.plan-history-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.plan-history-badge--paid {
    background: rgba(0,229,255,0.1);
    border: 1px solid rgba(0,229,255,0.25);
    color: var(--accent);
}

.plan-history-badge--pending {
    background: rgba(247,201,72,0.1);
    border: 1px solid rgba(247,201,72,0.25);
    color: #f7c948;
}

.plan-history-badge--failed {
    background: rgba(255,143,143,0.08);
    border: 1px solid rgba(255,143,143,0.25);
    color: var(--danger);
}

/* â”€â”€ Payment processing overlay â”€â”€ */
.plan-pay-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plan-pay-overlay.hidden {
    display: none;
}

.plan-pay-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.plan-pay-spinner p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted);
}

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 480px) {
    .plan-history-table {
        min-width: 100%;
        font-size: 0.8rem;
    }

    .plan-history-table th,
    .plan-history-table td {
        padding: 10px 12px;
    }
}

/* ========================================
   Admin Dashboard â€” stat cards & panels
======================================== */

.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

@media (max-width: 900px) {
    .dash-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .dash-stats { grid-template-columns: 1fr; }
}

.dash-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dash-stat-card:hover {
    border-color: rgba(0,212,245,0.2);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.dash-stat-card__icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 1.1rem;
}

.dash-stat-card__value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 3px;
}

.dash-stat-card__label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 860px) {
    .dash-grid { grid-template-columns: 1fr; }
}

.dash-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.dash-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
}

.dash-panel__head i {
    color: var(--accent);
    margin-right: 8px;
}

.dash-panel__link {
    font-size: 0.78rem;
    color: var(--muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s ease;
}

.dash-panel__link:hover { color: var(--accent); }

.plan-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.86rem;
}

.plan-stat-row:last-child { border-bottom: none; }

.plan-stat-row__name {
    color: var(--text);
    font-weight: 600;
}

.plan-stat-row__meta {
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 1px;
}

.plan-stat-row__count {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
    min-width: 32px;
    text-align: right;
}

/* ========================================
   Global utility button â€” .btn-primary
   Used in empty-state CTAs (saved-data, etc.)
======================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #001a22;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

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

/* ========================================
   auto-save-badge â€” supports <a> and <span>
======================================== */

.auto-save-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0,212,245,0.12);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

a.auto-save-badge:hover {
    background: rgba(0,212,245,0.2);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ========================================
   Focus-visible global ring
======================================== */

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

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   Sidebar brand link reset
======================================== */

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 18px 18px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.sidebar-brand:hover {
    opacity: 0.85;
}

/* ========================================
   Saved-data / contacts empty state
======================================== */

.no-cards-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 72px 24px;
    text-align: center;
    color: var(--muted);
}

.no-cards-icon {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(0,212,245,0.06);
    border: 1px solid rgba(0,212,245,0.12);
    color: var(--accent);
    font-size: 1.5rem;
}

.no-cards-state h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.no-cards-state p {
    margin: 0;
    font-size: 0.9rem;
    max-width: 320px;
    line-height: 1.6;
}

/* ========================================
   Chat page â€” "Scan a Card" label polish
======================================== */

.file-label i {
    font-size: 1rem;
}

/* ========================================
   Plan page â€” contacts CTA link
======================================== */

.plan-contacts-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0,212,245,0.08);
    border: 1px solid rgba(0,212,245,0.18);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.plan-contacts-link:hover {
    background: rgba(0,212,245,0.15);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ========================================
   Scrollbar â€” thinner on narrow viewports
======================================== */

@media (max-width: 768px) {
    ::-webkit-scrollbar { width: 4px; height: 4px; }
}
