/* ============================================================================
   Client Portal — Trooply marketing system (emerald + Geist + Fraunces + sage).
   Rebranded from the old slate+blue+purple scheme to match the redesigned
   landing / pricing / docs / api-reference pages. Token NAMES are stable;
   every rule downstream keeps referencing --primary / --accent / etc.
   ============================================================================ */
:root {
    /* ---- Brand ---- */
    --primary: #1E8F3E;                /* emerald — marketing accent */
    --primary-hover: #17722F;          /* darker emerald for hover states */
    --primary-soft: rgba(30, 143, 62, 0.09);
    --primary-ring: rgba(30, 143, 62, 0.22);
    --accent: #1E8F3E;                 /* collapse legacy amber to emerald */
    --accent-soft: rgba(30, 143, 62, 0.09);

    /* ---- Semantic ---- */
    --success: #1E8F3E;
    --success-soft: rgba(30, 143, 62, 0.10);
    --danger:  #C0392B;
    --danger-soft: rgba(192, 57, 43, 0.10);
    --warning: #B45309;
    --warning-soft: rgba(180, 83, 9, 0.10);
    --info:    #1E8F3E;
    --info-soft: rgba(30, 143, 62, 0.10);

    /* ---- Neutrals (sage-white layered surface from landing.css) ---- */
    --bg:        #F4F6F3;              /* sage-tinted off-white page bg */
    --bg-dark:   #F4F6F3;              /* alias for legacy refs */
    --bg-darker: #EDF0EC;               /* deeper sage — sidebar, muted zones */
    --bg-card:   #FFFFFF;              /* card surface */
    --bg-card-hover: #F9FBF8;
    --bg-input:  #FFFFFF;
    --bg-subtle: #EDF0EC;
    --bg-overlay: rgba(14, 17, 15, 0.45);

    --text-primary:   #141613;
    --text-secondary: rgba(20, 22, 19, 0.72);
    --text-muted:     rgba(20, 22, 19, 0.50);
    --text-on-primary: #FFFFFF;

    --border-color: rgba(23, 25, 22, 0.09);
    --border-light: rgba(23, 25, 22, 0.05);
    --border-strong: rgba(23, 25, 22, 0.16);

    /* ---- Type stack (mirrors landing.css) ---- */
    --font-sans:  "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-serif: "Fraunces", "Times New Roman", serif;
    --font-mono:  "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* ---- Layout ---- */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* ---- Elevation ---- */
    --shadow-xs: 0 1px 2px rgba(20, 22, 19, 0.04);
    --shadow-sm: 0 1px 3px rgba(20, 22, 19, 0.06), 0 1px 2px rgba(20, 22, 19, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(20, 22, 19, 0.08), 0 2px 4px -2px rgba(20, 22, 19, 0.04);
    --shadow-lg: 0 12px 28px -6px rgba(20, 22, 19, 0.12), 0 4px 10px -4px rgba(20, 22, 19, 0.06);
    --shadow-xl: 0 24px 48px -12px rgba(20, 22, 19, 0.18);
    --shadow-ring: 0 0 0 4px var(--primary-ring);

    /* ---- Radii ---- */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* ---- Motion ---- */
    --motion-fast: 120ms;
    --motion-base: 200ms;
    --motion-slow: 320ms;
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Honor system / user reduced-motion preference globally */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { background: var(--bg); }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===== Utility Classes ===== */
.hidden {
    display: none !important;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f8fa;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(30, 143, 62, 0.07) 0%, transparent 70%);
    border-radius: 50%;
    top: -250px;
    right: -250px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(243, 175, 17, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    bottom: -200px;
    left: -200px;
}

.login-container {
    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 4px 24px rgba(30, 143, 62, 0.07), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #e2e6ed;
    position: relative;
    z-index: 1;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo {
    margin: 0 auto 18px;
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--text-on-primary);
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 36px;
    font-weight: 400;
    line-height: 1;
}

.login-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.login-header h1 em {
    font-style: italic;
    color: var(--primary);
}

.login-header p {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 6px;
}

.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-error::before {
    content: '';
    font-size: 16px;
    flex-shrink: 0;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid #e2e6ed;
}

.login-footer p {
    color: #9ca3af;
    font-size: 14px;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.login-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== Main Dashboard Layout ===== */
#main-dashboard {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.sidebar-header {
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}

.logo-small {
    flex-shrink: 0;
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--primary);
    color: var(--text-on-primary);
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
}

.logo-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition:
        background-color var(--motion-fast) var(--ease-out-quint),
        color var(--motion-fast) var(--ease-out-quint),
        transform var(--motion-fast) var(--ease-out-quint);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary-hover);
    font-weight: 600;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 3px;
    background: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1E8F3E 0%, #17722F 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-plan {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

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

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* ---- Floating notification bell (pinned inside the sidebar header) ---- */
/* Sidebar header needs to be positioned so the absolute bell attaches to it */
.sidebar-header { position: relative; }

.notif-float-btn {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--bg-card, #fff);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-color);
    transition: transform 0.15s, box-shadow 0.15s, color 0.15s;
    z-index: 2;
}
.notif-float-btn:hover {
    transform: translateY(-50%) scale(1.06);
    color: var(--primary);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25), 0 0 0 1px var(--primary);
}
.notif-float-btn:active { transform: translateY(-50%) scale(0.96); }

.notif-badge {
    display: none;              /* toggled via .is-visible by JS when unread > 0 */
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-card, #fff);
}
.notif-badge.is-visible { display: inline-flex; }

/* ---- Notification panel (dropdown anchored to the bell, stays within sidebar) ---- */
.notif-panel {
    position: fixed;
    top: 64px;                  /* just under sidebar header */
    left: 8px;
    width: calc(var(--sidebar-width) - 16px);
    max-height: calc(100vh - 120px);   /* leave room for sidebar footer */
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(99, 102, 241, 0.12);
    z-index: 210;
    overflow: hidden;
    animation: notif-pop-in 0.14s ease-out;
}
@keyframes notif-pop-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.notif-panel-header h4 { margin: 0; font-size: 0.9rem; }
.notif-panel-actions { display: flex; gap: 6px; }
.notif-panel-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    padding: 4px 6px;
    border-radius: 6px;
}
.notif-panel-actions button:hover { background: var(--surface-hover, rgba(99, 102, 241, 0.08)); }
.notif-panel-actions button.muted { color: var(--text-muted); font-weight: 400; }

.notif-list { max-height: calc(100vh - 180px); overflow-y: auto; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 768px) {
    .notif-float-btn { right: 16px; }
    .notif-panel {
        /* On narrow viewports (sidebar hidden) anchor the panel to the viewport top-right */
        left: auto;
        right: 12px;
        top: 64px;
        width: calc(100vw - 24px);
        max-width: 380px;
        max-height: calc(100vh - 100px);
    }
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    border: 1px solid transparent;
    transition:
        background-color var(--motion-fast) var(--ease-out-quint),
        color var(--motion-fast) var(--ease-out-quint),
        border-color var(--motion-fast) var(--ease-out-quint),
        box-shadow var(--motion-fast) var(--ease-out-quint),
        transform var(--motion-fast) var(--ease-out-quint);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}
.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-ring);
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 1px 0 rgba(20, 22, 19, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

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

.btn-large { padding: 12px 22px; font-size: 0.95rem; }

.btn-danger:disabled {
    background: #7f1d1d;
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
}

.btn-copy {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 143, 62, 0.09);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ===== Login Page Form Overrides ===== */
.login-container .form-group {
    margin-bottom: 20px;
}

.login-container .form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #252424;
    margin-bottom: 10px;
}

.login-container .form-group input {
    padding: 14px 18px;
    background: #f7f8fa;
    border: 1.5px solid #e2e6ed;
    border-radius: 10px;
    color: #252424;
    font-size: 15px;
    transition: all 0.3s ease;
}

.login-container .form-group input:hover {
    background: #f0f1f3;
    border-color: rgba(48, 119, 166, 0.3);
}

.login-container .form-group input:focus {
    outline: none;
    background: #ffffff;
    border-color: #1E8F3E;
    box-shadow: 0 0 0 3px rgba(30, 143, 62, 0.09);
}

.login-container .form-group input::placeholder {
    color: #b0b7c3;
}

.login-container .btn-large {
    margin-top: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(30, 143, 62, 0.18);
    transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}

.login-container .btn-large:hover {
    background: var(--primary);
    filter: brightness(1.05);
    box-shadow: 0 6px 18px rgba(30, 143, 62, 0.28);
    transform: translateY(-1px);
}

.login-container .btn-large:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(30, 143, 62, 0.18);
}

.login-container .btn-large:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.search-input {
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

select {
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform var(--motion-base) var(--ease-out-quint),
                box-shadow var(--motion-base) var(--ease-out-quint),
                border-color var(--motion-base) var(--ease-out-quint);
    will-change: transform;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--motion-base) var(--ease-spring);
}
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }

.stat-icon.blue   { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green  { background: var(--success-soft); color: var(--success); }
.stat-icon.purple { background: var(--accent-soft); color: var(--accent); }
.stat-icon.orange { background: var(--warning-soft); color: var(--warning); }

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat-limit {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-change {
    font-size: 13px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* ===== Mini Stats ===== */
.mini-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.mini-stat {
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.mini-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #f7f8fa;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    background: var(--bg-card-hover);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.plan-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, #1E8F3E 0%, #17722F 100%);
    color: white;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: var(--success-light);
    color: #065f46;
}

.status-badge.inactive {
    background: var(--danger-light);
    color: #991b1b;
}

/* ===== Progress Bar ===== */
.quota-item {
    margin-bottom: 20px;
}

.quota-item:last-child {
    margin-bottom: 0;
}

.quota-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.quota-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.quota-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.green {
    background: var(--success);
}

.progress-fill.orange {
    background: var(--warning);
}

.progress-fill.red {
    background: var(--danger);
}

/* ===== Product Thumbnails ===== */
.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: block;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
}

.product-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ===== Quick Actions ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.action-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon.blue {
    background: rgba(30, 143, 62, 0.09);
    color: var(--primary);
}

.action-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.action-icon.purple {
    background: rgba(243, 175, 17, 0.12);
    color: #d97706;
}

.action-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.action-card span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== Data Table ===== */
.products-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--bg-dark);
}

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

.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination button {
    padding: 8px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.pagination button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Search Demo ===== */
.search-demo-container {
    max-width: 900px;
}

.search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.search-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.search-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-content {
    margin-bottom: 32px;
}

.search-panel {
    display: none;
}

.search-panel.active {
    display: block;
}

.upload-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 24px;
    position: relative;   /* anchor for clear-image-btn (B10) */
}

/* Clear/reset button shown over an uploaded preview image (B10) */
.clear-image-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(14, 17, 15, 0.78);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s, background-color 0.15s;
    z-index: 2;
}
.clear-image-btn:hover { background: #dc2626; transform: scale(1.08); }
.clear-image-btn:active { transform: scale(0.95); }

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(30, 143, 62, 0.05);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(48, 119, 166, 0.1);
}

.upload-placeholder svg {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-placeholder p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-placeholder span {
    font-size: 13px;
    color: var(--text-muted);
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
}

.text-search-input {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.text-search-input input {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
}

.text-search-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.text-search-input .btn {
    padding: 16px 24px;
}

.search-suggestions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-suggestions span {
    font-size: 13px;
    color: var(--text-muted);
}

.search-suggestions button {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-suggestions button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-results {
    margin-top: 32px;
}

.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.results-header h3 {
    font-size: 18px;
    font-weight: 600;
}

#results-info {
    color: var(--text-muted);
    font-size: 14px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition:
        transform var(--motion-base) var(--ease-out-quint),
        box-shadow var(--motion-base) var(--ease-out-quint),
        border-color var(--motion-base) var(--ease-out-quint);
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.result-card:active { transform: translateY(-1px) scale(0.995); }

.result-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #f0f1f3 0%, #e2e6ed 100%);
    display: block;
}

.result-card-body {
    padding: 16px;
}

.result-card-body h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-card-body p {
    font-size: 13px;
    color: var(--text-muted);
}

.result-score {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

/* ===== Analytics ===== */
.analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.analytics-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.analytics-card.large {
    grid-row: span 1;
}

.chart-container {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    color: var(--text-muted);
    text-align: center;
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breakdown-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.breakdown-value {
    font-size: 16px;
    font-weight: 600;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.blue { background: var(--primary); }
.dot.green { background: var(--success); }
.dot.purple { background: var(--accent); }
.dot.orange { background: var(--warning); }

.top-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Settings ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.credential-row {
    margin-bottom: 16px;
}

.credential-row:last-child {
    margin-bottom: 0;
}

.credential-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.credential-value {
    display: flex;
    gap: 8px;
    align-items: center;
}

.credential-value code {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.danger-zone {
    border-color: var(--danger);
}

.danger-zone .card-header {
    border-color: rgba(239, 68, 68, 0.3);
}

.danger-zone .card-header h3 {
    color: var(--danger);
}

.danger-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.danger-action p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Modals ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: modal-fade-in var(--motion-base) var(--ease-out-quint);
}
@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: modal-pop-in var(--motion-slow) var(--ease-spring);
}
@keyframes modal-pop-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-content.modal-large {
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-large .modal-body {
    overflow-y: auto;
    flex: 1;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== Product Detail Modal ===== */
.product-detail-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 28px;
}

.product-detail-image-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-detail-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
}

.product-detail-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}

.product-detail-image-placeholder p {
    font-size: 13px;
}

.product-detail-info-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.detail-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    gap: 16px;
}

.detail-info-row + .detail-info-row {
    border-top: 1px solid #f0f1f3;
}

.detail-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: capitalize;
    flex-shrink: 0;
    min-width: 100px;
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

.detail-value code {
    padding: 2px 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
}

.detail-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
}

.detail-url {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-url a {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 13px;
}

.detail-url a:hover {
    text-decoration: underline;
}

.detail-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.detail-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.detail-color-hex {
    font-size: 12px;
    font-family: 'Monaco', 'Consolas', monospace;
    color: var(--text-secondary);
}

.actions-cell {
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
    }

    .product-detail-image {
        max-height: 250px;
        aspect-ratio: auto;
    }

    .modal-content.modal-large {
        max-width: 100%;
    }
}

/* ===== Match Analysis Modal ===== */
.result-card {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.ma-layout {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.ma-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
}

.ma-img-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ma-img-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.ma-img-wrapper {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ma-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ma-no-query-img {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.ma-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ma-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.ma-score-ring svg {
    width: 100%;
    height: 100%;
}

.ma-score-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ma-score-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.ma-score-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.ma-rank {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid var(--border-color);
}

/* Score Factors */
.ma-factors {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.ma-factors h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.ma-factor {
    margin-bottom: 18px;
}

.ma-factor:last-child {
    margin-bottom: 0;
}

.ma-factor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ma-factor-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ma-weight-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(30, 143, 62, 0.09);
    color: #1E8F3E;
    letter-spacing: 0.02em;
}

.ma-factor-value {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.ma-factor-value.excellent { color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.ma-factor-value.good { color: #1E8F3E; background: rgba(48, 119, 166, 0.1); }
.ma-factor-value.moderate { color: #B45309; background: rgba(180, 83, 9, 0.10); }
.ma-factor-value.low { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.ma-factor-bar {
    height: 6px;
    background: #e2e6ed;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.ma-factor-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.ma-factor-fill.excellent { background: linear-gradient(90deg, #22c55e, #4ade80); }
.ma-factor-fill.good { background: linear-gradient(90deg, #1E8F3E, #4a9fd4); }
.ma-factor-fill.moderate { background: linear-gradient(90deg, #B45309, #B45309); }
.ma-factor-fill.low { background: linear-gradient(90deg, #ef4444, #f87171); }

.ma-factor-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Product Info */
.ma-product-info {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.ma-product-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.ma-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ma-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ma-info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.ma-info-value {
    font-size: 14px;
    color: var(--text-primary);
}

.ma-colors {
    margin-top: 16px;
}

.ma-color-swatches {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.ma-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: default;
}

.ma-badge-explicit {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    margin-left: 6px;
}

.ma-tag {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(48, 119, 166, 0.1);
    color: #1E8F3E;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

@media (max-width: 768px) {
    .ma-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ma-img-wrapper {
        max-width: 160px;
    }

    .ma-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Alerts ===== */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

/* ===== Demo Options ===== */
.demo-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demo-option {
    display: flex;
    cursor: pointer;
}

.demo-option input {
    display: none;
}

.demo-option-content {
    flex: 1;
    padding: 16px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.demo-option input:checked + .demo-option-content {
    border-color: var(--primary);
    background: rgba(48, 119, 166, 0.1);
}

.demo-option-content strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.demo-option-content span {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 380px;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 14px 18px 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    font-size: 0.9rem;
    line-height: 1.5;
    z-index: 1100;
    animation: toast-in var(--motion-slow) var(--ease-spring);
}
@keyframes toast-in {
    from { transform: translateX(24px) scale(0.96); opacity: 0; }
    to   { transform: translateX(0) scale(1);       opacity: 1; }
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger);  }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--info);    }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 246, 248, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    gap: 16px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .analytics-card.large {
        grid-column: span 2;
    }
}

/* Mobile hamburger menu button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar-header .logo-text,
    .user-details {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
        overflow: hidden;
    }

    .nav-item svg { flex-shrink: 0; }

    /* Hide ALL text inside nav items */
    .sidebar-nav .nav-item {
        font-size: 0;
        gap: 0;
    }
    .sidebar-nav .nav-item svg {
        font-size: initial;
    }

    .sidebar-header {
        justify-content: center;
    }

    .sidebar-footer {
        flex-direction: column;
        gap: 8px;
    }

    .main-content {
        margin-left: 80px;
    }

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

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

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: 260px;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.open ~ .mobile-overlay {
        display: block;
    }

    /* Restore text in mobile drawer */
    .sidebar.open .sidebar-nav .nav-item {
        font-size: 0.9rem;
        gap: 12px;
        justify-content: flex-start;
        padding: 10px 20px;
    }
    .sidebar.open .sidebar-header .logo-text,
    .sidebar.open .user-details {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 56px; /* space for hamburger */
    }

    .page-header {
        flex-direction: column;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .mini-stats {
        flex-wrap: wrap;
    }

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

    .analytics-card.large {
        grid-column: span 1;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .search-input {
        width: 100%;
    }

    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .card-actions {
        width: 100%;
    }
}

/* ===== Search History Styles ===== */
.search-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.search-type-badge.image {
    background: #eff6ff;
    color: #1E8F3E;
}

.search-type-badge.text {
    background: #f0fdf4;
    color: #16a34a;
}

.search-type-badge.hybrid {
    background: #f5f3ff;
    color: #1E8F3E;
}

.search-type-badge.multi_image {
    background: rgba(180, 83, 9, 0.10);
    color: #d97706;
}

.search-query {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-searches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.saved-search-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.saved-search-card:hover {
    border-color: #1E8F3E;
    box-shadow: 0 4px 12px rgba(48, 119, 166, 0.1);
}

.saved-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.saved-search-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-search-query {
    margin: 8px 0;
    font-size: 14px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-search-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.saved-search-actions .btn {
    flex: 1;
    justify-content: center;
}

.history-table-container {
    overflow-x: auto;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-icon {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.btn-icon:hover {
    background: #f9fafb;
    border-color: #1E8F3E;
    color: #1E8F3E;
}

.btn-icon.danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

@media (max-width: 768px) {
    .saved-searches-grid {
        grid-template-columns: 1fr;
    }

    .search-query {
        max-width: 150px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-icon {
        width: 100%;
        height: auto;
        padding: 8px;
    }
}

/* ===== Hybrid & Multi-Image Search Styles ===== */
.hybrid-search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.hybrid-search-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.weight-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
}

.multi-image-upload {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upload-instructions {
    text-align: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.upload-instructions h4 {
    margin: 0 0 8px 0;
    color: #111827;
}

.upload-instructions p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

#multi-images-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.multi-image-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.multi-image-input input {
    flex: 1;
}

.multi-image-url {
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.multi-image-url:focus {
    outline: none;
    border-color: #1E8F3E;
    box-shadow: 0 0 0 3px rgba(48, 119, 166, 0.1);
}

/* ===== Color Display Styles ===== */
.result-colors {
    display: flex;
    gap: 6px;
    margin: 8px 0;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-dot:hover {
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .hybrid-search-form .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== Billing Page ===== */
.billing-plan-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.billing-plan-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.billing-plan-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.billing-plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 0.25rem;
}

.billing-plan-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.billing-plan-actions {
    display: flex;
    gap: 0.75rem;
}

.billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.billing-usage-meter {
    padding: 0.5rem 0;
}

.billing-usage-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.billing-usage-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.billing-features {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.billing-feature-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.billing-feature-row:last-child {
    border-bottom: none;
}

.billing-feature-row span {
    color: var(--text-secondary);
}

.billing-feature-row strong {
    color: var(--text-primary);
}

/* Plan Comparison Modal */
.plan-comparison {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

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

.plan-option {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.plan-option:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.plan-option.featured {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(48, 119, 166, 0.15);
}

.plan-badge-ribbon {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.75rem;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-option h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.plan-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.plan-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-option ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.plan-option ul li {
    padding: 0.3rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.plan-option ul li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.plan-option .btn {
    width: 100%;
}

/* ===== Team Page ===== */
.team-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.team-tab {
    padding: 10px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.team-tab:hover {
    color: var(--primary);
}

.team-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.group-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--info-light);
    color: var(--primary);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 1px 2px;
}

.default-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--warning-light);
    color: var(--warning);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.group-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.group-card-header h4 {
    margin: 0;
    font-size: 1rem;
}

.group-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.group-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.group-actions {
    display: flex;
    gap: 8px;
}

.checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.perm-group {
    margin-bottom: 8px;
}

.perm-group strong {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    margin-bottom: 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border-color);
}

/* ===== PLAN.md §0.6 — /portal/select-store picker ===== */
.select-store-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f8fa;
    padding: 24px;
}

.select-store-container {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 4px 24px rgba(30, 143, 62, 0.07), 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #e2e6ed;
}

.select-store-header {
    text-align: center;
    margin-bottom: 28px;
}

.select-store-header .logo {
    margin: 0 auto 16px;
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--text-on-primary);
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
}

.select-store-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(24px, 2.6vw, 30px);
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.select-store-greeting {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.select-store-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.store-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #e2e6ed;
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    font-family: inherit;
}

.store-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(30, 143, 62, 0.08);
    transform: translateY(-1px);
}

.store-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e8f3e, #2db05a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.store-card-body {
    flex: 1;
    min-width: 0;
}

.store-card-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14.5px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 2px;
}

.store-card-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    font-weight: 600;
}

.store-card-plan {
    font-size: 11px;
    text-transform: capitalize;
    color: var(--text-muted);
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 999px;
}

.store-card-recency {
    font-size: 11.5px;
    color: var(--text-muted);
}

.store-card-arrow {
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
    transition: transform 0.15s, color 0.15s;
}

.store-card:hover .store-card-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

.select-store-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
    background: #f7f8fa;
    border-radius: var(--radius-md);
}

.select-store-footer {
    text-align: center;
    margin-top: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: underline;
    padding: 6px 10px;
    font-family: inherit;
}

.btn-link:hover {
    color: var(--text-primary);
}

/* ===== PLAN.md §0.6 — In-sidebar tenant switcher ===== */
.tenant-switcher {
    position: relative;
    margin: 6px 12px 8px;
}

.tenant-switcher-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e6ed;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: border-color 0.15s, background 0.15s;
}

.tenant-switcher-current:hover {
    border-color: var(--primary);
    background: #f7f8fa;
}

.tenant-switcher-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
    padding-right: 6px;
}

.tenant-switcher-chevron {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

.tenant-switcher-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e6ed;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    z-index: 50;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}

.tenant-switcher-menu.open {
    display: block;
}

.tenant-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

.tenant-switcher-item:last-of-type {
    border-bottom: none;
}

.tenant-switcher-item:hover {
    background: #f7f8fa;
}

.tenant-switcher-item-name {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.tenant-switcher-item-role {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tenant-switcher-empty {
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.tenant-switcher-picker,
.tenant-switcher-admin {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    border-top: 1px solid #f3f4f6;
    background: #fbfcfd;
    text-align: left;
}

.tenant-switcher-picker:hover,
.tenant-switcher-admin:hover {
    background: #f3f5f7;
}

/* ===== Category picker (products filter bar) ===== */
.cat-picker { position: relative; min-width: 220px; }

.cat-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.cat-picker-trigger:hover { border-color: var(--primary-color, #1E8F3E); }
.cat-picker-trigger:focus { outline: 2px solid var(--primary-soft, rgba(30,143,62,0.25)); outline-offset: -1px; }
.cat-picker-trigger > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}
.cat-picker-trigger > svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    opacity: 0.55;
}

.cat-picker-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    width: max(100%, 360px);
    max-height: 440px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    overflow: hidden;
}
.cat-picker-popover.hidden { display: none; }

.cat-picker-search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    background: #fbfcfd;
}
.cat-picker-search-wrap input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    color: inherit;
    outline: none;
    box-sizing: border-box;
}
.cat-picker-search-wrap input:focus {
    border-color: var(--primary-color, #1E8F3E);
    box-shadow: 0 0 0 2px var(--primary-soft, rgba(30,143,62,0.18));
}

.cat-picker-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 8px;
    font-size: 0.85rem;
}

.cat-picker-empty {
    padding: 18px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.cat-picker-empty.hidden { display: none; }

.cat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.08s;
}
.cat-row:hover { background: rgba(30, 143, 62, 0.08); }
.cat-row-all { font-weight: 500; padding-top: 8px; padding-bottom: 8px; }
.cat-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}
.cat-row-count {
    font-size: 0.74rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.cat-indent-0 { padding-left: 16px; }
.cat-indent-1 { padding-left: 28px; }
.cat-indent-2 { padding-left: 40px; }
.cat-indent-3 { padding-left: 52px; }

.cat-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.cat-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px 3px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    user-select: none;
    pointer-events: none;
}
