/* ============================================================
   EAZYPROO ADMIN — Modern White + Green Design System
   Rewritten 2026. Light-first, emerald/teal accents, gradients.
   ============================================================ */

/* ----------  DESIGN TOKENS  ---------- */
:root {
    color-scheme: light;

    --g-50:  #ecfdf5;
    --g-100: #d1fae5;
    --g-200: #a7f3d0;
    --g-300: #6ee7b7;
    --g-400: #34d399;
    --g-500: #10b981;
    --g-600: #059669;
    --g-700: #047857;
    --g-800: #065f46;
    --teal:  #0d9488;

    --accent: var(--g-600);
    --accent-strong: var(--g-700);
    --accent-soft: rgba(16, 185, 129, .12);
    --accent-softer: rgba(16, 185, 129, .07);
    --accent-ring: rgba(16, 185, 129, .35);
    --grad-accent: linear-gradient(135deg, #34d399 0%, #059669 55%, #0d9488 100%);
    --grad-accent-soft: linear-gradient(135deg, rgba(52, 211, 153, .16), rgba(13, 148, 136, .14));
    --grad-brand: linear-gradient(135deg, #10b981, #0d9488);

    --bg: #eef3f1;
    --bg-tint-1: rgba(16, 185, 129, .10);
    --bg-tint-2: rgba(13, 148, 136, .08);
    --surface: #ffffff;
    --surface-2: #f6faf8;
    --surface-3: #eef4f1;
    --sidebar: rgba(255, 255, 255, .82);
    --input-bg: #ffffff;

    --text: #0f1f1a;
    --text-soft: #2f4a41;
    --muted: #5d7068;
    --dim: #8aa099;

    --border: rgba(15, 38, 30, .08);
    --border-soft: rgba(15, 38, 30, .055);
    --border-strong: rgba(15, 38, 30, .14);

    --green: #059669;
    --green-soft: rgba(5, 150, 105, .12);
    --red: #e11d48;
    --red-soft: rgba(225, 29, 72, .1);
    --amber: #d97706;
    --amber-soft: rgba(217, 119, 6, .12);
    --blue: #2563eb;
    --blue-soft: rgba(37, 99, 235, .12);
    --violet: #7c3aed;
    --violet-soft: rgba(124, 58, 237, .12);
    --slate: #475569;
    --slate-soft: rgba(71, 85, 105, .1);

    --shadow-xs: 0 1px 2px rgba(16, 40, 32, .05);
    --shadow-sm: 0 1px 2px rgba(16, 40, 32, .04), 0 4px 12px -6px rgba(16, 40, 32, .12);
    --shadow-md: 0 1px 3px rgba(16, 40, 32, .05), 0 14px 34px -16px rgba(16, 40, 32, .22);
    --shadow-lg: 0 24px 60px -28px rgba(7, 89, 70, .35);
    --shadow-accent: 0 12px 26px -10px rgba(5, 150, 105, .5);

    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-pill: 999px;

    --ease: cubic-bezier(.22, 1, .36, 1);
}

[data-theme="dark"] {
    color-scheme: dark;
    --accent: var(--g-400);
    --accent-strong: var(--g-300);
    --accent-soft: rgba(52, 211, 153, .16);
    --accent-softer: rgba(52, 211, 153, .08);
    --accent-ring: rgba(52, 211, 153, .4);
    --grad-accent: linear-gradient(135deg, #34d399, #10b981 60%, #0d9488);
    --grad-accent-soft: linear-gradient(135deg, rgba(52, 211, 153, .2), rgba(13, 148, 136, .16));

    --bg: #07120e;
    --bg-tint-1: rgba(16, 185, 129, .14);
    --bg-tint-2: rgba(13, 148, 136, .12);
    --surface: #0f1d17;
    --surface-2: #122620;
    --surface-3: rgba(22, 48, 39, .47);
    --sidebar: rgba(14, 28, 22, .8);
    --input-bg: rgba(255, 255, 255, .03);

    --text: #ecfdf5;
    --text-soft: #c7e7da;
    --muted: #8fb0a4;
    --dim: #5f7d72;

    --border: rgba(160, 255, 220, .1);
    --border-soft: rgba(160, 255, 220, .06);
    --border-strong: rgba(160, 255, 220, .16);

    --green-soft: rgba(52, 211, 153, .16);
    --red: #fb7185;
    --red-soft: rgba(251, 113, 133, .14);
    --amber: #fbbf24;
    --amber-soft: rgba(251, 191, 36, .14);
    --blue: #60a5fa;
    --blue-soft: rgba(96, 165, 250, .14);
    --violet: #a78bfa;
    --violet-soft: rgba(167, 139, 250, .14);
    --slate-soft: rgba(148, 163, 184, .14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px -8px rgba(0, 0, 0, .5);
    --shadow-md: 0 18px 44px -22px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body.admin-body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: 'Instrument Sans', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -.01em;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.025em; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }

.muted { color: var(--muted); }
.eyebrow {
    font-size: 11px; font-weight: 700; letter-spacing: .14em;
    text-transform: uppercase; color: var(--accent);
}

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); background-clip: padding-box; }

/* ----------  AMBIENT BACKGROUND  ---------- */
.ambient-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background:
        radial-gradient(680px 420px at 0% -5%, var(--bg-tint-1), transparent 60%),
        radial-gradient(720px 480px at 100% 0%, var(--bg-tint-2), transparent 58%),
        radial-gradient(900px 600px at 60% 120%, var(--accent-softer), transparent 60%);
}
.ambient-grid::after {
    content: ""; position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(circle at 50% 0%, #000, transparent 72%);
    mask-image: radial-gradient(circle at 50% 0%, #000, transparent 72%);
    opacity: .5;
}

/* ----------  APP SHELL  ---------- */
.admin-shell {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: 274px minmax(0, 1fr);
    min-height: 100vh;
}

/* ----------  SIDEBAR  ---------- */
.sidebar {
    position: sticky; top: 0; align-self: start; height: 100vh;
    display: flex; flex-direction: column;
    padding: 22px 16px 18px;
    background: var(--sidebar);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-right: 1px solid var(--border);
}
.sidebar-brand { padding: 4px 8px 18px; }
.brand-mark { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.brand-mark strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.brand-mark-logo { display: inline-flex; max-width: 100%; min-width: 0; }
.brand-logo-image {
    display: block;
    height: 58px;
    max-width: 190px;
    object-fit: contain;
    object-position: left center;
    width: auto;
}
.brand-symbol {
    display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 13px;
    font-size: 14px; font-weight: 800; color: #fff;
    background: var(--grad-accent);
    box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.sidebar nav { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nav-group { margin-bottom: 18px; }
.nav-label {
    padding: 0 12px 8px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
    text-transform: uppercase; color: var(--dim);
}
.nav-link {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 3px; border-radius: 12px;
    font-size: 13.5px; font-weight: 600; color: var(--text-soft);
    transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.nav-link:hover { background: var(--accent-softer); color: var(--text); }
.nav-link.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 700; }
.nav-link.active::before {
    content: ""; position: absolute; left: -6px; top: 50%;
    transform: translateY(-50%); width: 3px; height: 20px;
    border-radius: 999px; background: var(--grad-accent);
}
.nav-icon {
    display: grid; place-items: center; width: 30px; height: 30px;
    border-radius: 9px; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--border-soft);
    flex-shrink: 0; transition: all .2s var(--ease);
}
.nav-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover .nav-icon { color: var(--accent); border-color: var(--accent-ring); }
.nav-link.active .nav-icon { color: #fff; background: var(--grad-accent); border-color: transparent; box-shadow: var(--shadow-accent); }

.sidebar-status {
    display: flex; align-items: center; gap: 11px;
    margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.sidebar-status strong { display: block; font-size: 12.5px; font-weight: 700; }
.sidebar-status small { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; }
.status-dot {
    width: 9px; height: 9px; border-radius: 50%; background: var(--g-500);
    box-shadow: 0 0 0 4px var(--green-soft); flex-shrink: 0;
    animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); }
    50% { box-shadow: 0 0 0 7px transparent; }
}

/* ----------  MAIN + TOPBAR  ---------- */
.main { min-width: 0; padding: 18px 30px 56px; }
.topbar {
    position: sticky; top: 12px; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 12px 16px; margin-bottom: 22px; border-radius: var(--r-lg);
    background: var(--sidebar);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.topbar-copy { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.topbar-menu {
    display: none; flex-direction: column; gap: 4px;
    width: 38px; height: 38px; border-radius: 11px;
    border: 1px solid var(--border); background: var(--surface);
    cursor: pointer; align-items: center; justify-content: center;
}
.topbar-menu span { width: 16px; height: 2px; border-radius: 2px; background: var(--text-soft); }
.topbar-search { position: relative; display: flex; align-items: center; flex: 1; max-width: 460px; }
.topbar-search span {
    position: absolute; right: 12px; font-size: 11px; font-weight: 700; color: var(--dim);
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 3px 7px; border-radius: 7px; pointer-events: none;
}
.topbar-search input {
    width: 100%; padding: 11px 56px 11px 40px; border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%235d7068' stroke-width='2' stroke-linecap='round'><circle cx='8' cy='8' r='6'/><path d='M13 13l3 3'/></svg>") no-repeat 13px center;
    font-size: 13.5px; transition: border-color .2s, box-shadow .2s;
}
.topbar-search input::placeholder { color: var(--dim); }
.topbar-search input:focus { outline: none; border-color: var(--accent-ring); box-shadow: 0 0 0 4px var(--accent-soft); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-kicker {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}
.page-heading { margin-bottom: 24px; }
.page-title { font-size: 28px; font-weight: 800; line-height: 1.08; }
.page-subtitle { margin-top: 7px; font-size: 14px; color: var(--muted); }

.user-pill {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 10px 6px 14px; border-radius: var(--r-pill);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.user-pill form { display: flex; }
.avatar {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
    color: #fff; font-weight: 800; font-size: 14px;
    background: var(--grad-accent); box-shadow: var(--shadow-accent);
}
.theme-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px; border-radius: var(--r-md);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-soft); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .2s var(--ease);
}
.theme-toggle::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--grad-accent); }
.theme-toggle:hover { border-color: var(--accent-ring); color: var(--text); }

/* ----------  BUTTONS  ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--r-md);
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-size: 13.5px; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: transform .14s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s;
    box-shadow: var(--shadow-xs);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--accent-ring); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-primary { color: #fff; border-color: transparent; background: var(--grad-accent); box-shadow: var(--shadow-accent); }
.btn-primary:hover { box-shadow: 0 16px 32px -10px rgba(5, 150, 105, .6); border-color: transparent; filter: saturate(1.06); }
.btn-danger { color: #fff; border-color: transparent; background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 12px 26px -10px rgba(225, 29, 72, .5); }
.btn-danger:hover { border-color: transparent; box-shadow: 0 16px 32px -10px rgba(225, 29, 72, .6); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-icon { padding: 9px; width: 38px; height: 38px; border-radius: 11px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }

/* ----------  CARDS & PANELS  ---------- */
.card, .panel {
    position: relative; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.card { padding: 18px; }
.panel { padding: 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-title { font-size: 16px; font-weight: 800; }
.row-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.row-title { font-size: 14px; font-weight: 700; color: var(--text); }

.resource-stats, .grid-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px; margin-bottom: 22px;
}
.stat-card { display: flex; flex-direction: column; gap: 8px; padding: 20px; overflow: hidden; transition: transform .18s var(--ease), box-shadow .25s var(--ease); }
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--grad-accent); border-radius: 4px 0 0 4px; opacity: .9; }
.stat-card::after { content: ""; position: absolute; top: -40px; right: -40px; width: 130px; height: 130px; border-radius: 50%; background: var(--grad-accent-soft); filter: blur(6px); opacity: .8; pointer-events: none; }
.stat-card > span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); position: relative; }
.stat-card > strong { font-size: 26px; font-weight: 800; letter-spacing: -.03em; position: relative; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-accent { color: var(--accent); }

.trend-up, .trend-down { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; font-style: normal; padding: 3px 9px; border-radius: var(--r-pill); width: fit-content; }
.trend-up { color: var(--green); background: var(--green-soft); }
.trend-up::before { content: "▲"; font-size: 8px; }
.trend-down { color: var(--red); background: var(--red-soft); }
.trend-down::before { content: "▼"; font-size: 8px; }

.green { color: var(--green); }
.red { color: var(--red); }
.blue { color: var(--blue); }
.violet { color: var(--violet); }

/* ============================================================
   DASHBOARD WIDGETS  (tail-* layout)
   ============================================================ */
.openai-billing-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 1.1fr) minmax(280px, 1.35fr) minmax(230px, .8fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background:
        radial-gradient(520px 180px at 0% 0%, var(--accent-soft), transparent 66%),
        linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,255,255,.34)),
        var(--surface);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
[data-theme="dark"] .openai-billing-card {
    background:
        radial-gradient(520px 180px at 0% 0%, var(--accent-soft), transparent 66%),
        linear-gradient(135deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
        var(--surface);
}
.openai-billing-card::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -120px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: var(--grad-accent-soft);
    filter: blur(10px);
    pointer-events: none;
}
.openai-billing-card.is-warning { border-color: rgba(217, 119, 6, .28); }
.openai-billing-card.is-warning .openai-billing-icon { color: var(--amber); background: var(--amber-soft); border-color: rgba(217, 119, 6, .25); }
.openai-billing-main { display: flex; align-items: center; gap: 14px; min-width: 0; position: relative; z-index: 1; }
.openai-billing-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-ring);
    border-radius: 15px;
}
.openai-billing-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.openai-billing-main small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.openai-billing-main strong { display: block; margin-top: 3px; font-size: 28px; font-weight: 850; letter-spacing: -.04em; line-height: 1; color: var(--text); }
.openai-billing-main p { margin-top: 7px; font-size: 12.5px; line-height: 1.45; color: var(--muted); max-width: 420px; }
.openai-billing-meter { position: relative; z-index: 1; min-width: 0; }
.openai-billing-meter-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.openai-billing-meter-head span { font-size: 12px; font-weight: 800; color: var(--muted); }
.openai-billing-meter-head b { font-size: 13px; font-weight: 850; color: var(--text); }
.openai-billing-progress { height: 10px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }
.openai-billing-progress span {
    display: block;
    height: 100%;
    width: var(--value, 0%);
    min-width: 8px;
    border-radius: inherit;
    background: var(--grad-accent);
    transition: width .45s var(--ease);
}
.openai-billing-card.is-warning .openai-billing-progress span { background: linear-gradient(135deg, #fbbf24, #d97706); }
.openai-billing-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.openai-billing-meta span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 5px 9px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
}
.openai-billing-meta b { color: var(--text-soft); }
.openai-billing-side { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; z-index: 1; }
.openai-billing-side div { padding: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); }
.openai-billing-side span { display: block; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.openai-billing-side strong { display: block; margin-top: 5px; font-size: 16px; font-weight: 850; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.openai-billing-refresh { position: relative; z-index: 1; white-space: nowrap; }
.openai-billing-refresh:disabled { opacity: .65; cursor: wait; }
.tail-dashboard { display: flex; flex-direction: column; gap: 22px; margin-bottom: 22px; }
.tail-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; }
.tail-metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-content: start; }

.tail-metric-card {
    position: relative; display: flex; flex-direction: column; gap: 8px;
    padding: 20px; border-radius: var(--r-lg); overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
    transition: transform .18s var(--ease), box-shadow .25s var(--ease), border-color .2s;
}
.tail-metric-card::after { content: ""; position: absolute; top: -50px; right: -50px; width: 150px; height: 150px; border-radius: 50%; background: var(--grad-accent-soft); opacity: .7; filter: blur(4px); pointer-events: none; }
.tail-metric-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent-ring); }
.tail-card-icon {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
    color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-ring);
    position: relative; z-index: 1;
}
.tail-card-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tail-metric-card small { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); position: relative; z-index: 1; }
.tail-metric-card strong { font-size: 30px; font-weight: 800; letter-spacing: -.035em; line-height: 1; position: relative; z-index: 1; }

/* Target card with gauge */
.tail-target-card {
    position: relative; padding: 24px; border-radius: var(--r-xl); overflow: hidden;
    background:
        radial-gradient(420px 200px at 80% -20%, var(--accent-soft), transparent 60%),
        var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
    display: flex; flex-direction: column;
}
.tail-panel-menu { position: absolute; top: 18px; right: 20px; color: var(--dim); font-weight: 800; letter-spacing: 1px; }
.tail-target-card h2 { font-size: 17px; font-weight: 800; }
.tail-target-card > p { font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.target-gauge {
    --progress: 50%;
    position: relative; width: 220px; height: 124px; margin: 22px auto 8px;
    border-radius: 220px 220px 0 0; overflow: hidden;
}
.target-gauge::before {
    content: ""; position: absolute; inset: 0;
    border-radius: 220px 220px 0 0;
    background: conic-gradient(from -90deg at 50% 100%, var(--g-400) 0%, var(--g-600) calc(var(--progress) * .5 * var(--gauge-fill, 1)), var(--surface-3) 0);
    -webkit-mask: radial-gradient(circle at 50% 100%, transparent 64px, #000 65px);
    mask: radial-gradient(circle at 50% 100%, transparent 64px, #000 65px);
}
.target-gauge > div { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; z-index: 1; }
.target-gauge strong { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.target-gauge span { font-size: 12px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 3px 10px; border-radius: var(--r-pill); display: inline-block; margin-top: 2px; }
.target-note { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.5; margin: 6px 4px 16px; }
.target-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.target-split div { text-align: center; }
.target-split dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.target-split dd { margin: 4px 0 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }

/* Analytics row */
.tail-analytics-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 22px; }
.tail-chart-card, .tail-statistics-card {
    padding: 22px; border-radius: var(--r-lg);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.tail-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.tail-card-head h2 { font-size: 16px; font-weight: 800; }
.tail-card-head p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.tail-card-head > span { color: var(--dim); font-weight: 800; letter-spacing: 1px; }

/* Bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 10px; }
.bar-chart span {
    position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center;
    height: 100%;
}
.bar-chart span::before {
    content: ""; width: 100%; max-width: 30px; height: var(--bar, 40%);
    border-radius: 9px 9px 4px 4px;
    background: linear-gradient(180deg, var(--g-400), var(--g-600));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
    transition: height .5s var(--ease), filter .2s;
}
.bar-chart span:hover::before { filter: brightness(1.08) saturate(1.1); }
.bar-chart em { position: absolute; bottom: -22px; font-size: 11px; font-style: normal; font-weight: 600; color: var(--muted); }

/* Health stack */
.health-stack { display: flex; flex-direction: column; gap: 12px; }
.health-stack div {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border-soft);
}
.health-stack span { font-size: 13px; color: var(--muted); font-weight: 600; }
.health-stack strong { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }

/* Statistics line chart */
.tail-statistics-card { margin-bottom: 0; }
.range-pills { display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border-soft); }
.range-pills span { padding: 7px 14px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.range-pills span.active { color: #fff; background: var(--grad-accent); box-shadow: var(--shadow-accent); }

.line-chart {
    position: relative; display: flex; align-items: flex-end; justify-content: space-between;
    height: 230px; padding: 16px 6px 26px;
    background:
        linear-gradient(var(--border-soft) 1px, transparent 1px) 0 0 / 100% 25%;
    border-radius: var(--r-md);
}
.line-chart span { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.line-chart span::before {
    content: ""; position: absolute; bottom: var(--point, 40%); left: 50%;
    width: 11px; height: 11px; margin-left: -5px; margin-bottom: -5px;
    border-radius: 50%; background: var(--g-600);
    border: 2.5px solid var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); z-index: 2;
}
.line-chart span::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0;
    height: var(--point, 40%);
    background: linear-gradient(180deg, var(--accent-soft), transparent);
    -webkit-mask: linear-gradient(#000, #000); z-index: 0;
}
.line-chart em { position: absolute; bottom: -22px; font-size: 11px; font-style: normal; font-weight: 600; color: var(--muted); }

/* Lower grid */
.dashboard-grid, .tail-lower-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 22px; }
.timeline-panel { display: flex; flex-direction: column; }

/* ============================================================
   TABLES & LISTS
   ============================================================ */
.table-list { display: flex; flex-direction: column; gap: 8px; }
.table-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border-soft);
    transition: background .2s, border-color .2s, transform .15s var(--ease);
}
.table-row:hover { background: var(--surface); border-color: var(--accent-ring); transform: translateX(2px); box-shadow: var(--shadow-sm); }
.table-link { color: var(--accent); font-weight: 700; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.resource-panel { padding: 0; overflow: hidden; }
.resource-head { padding: 22px 22px 18px; flex-wrap: wrap; }
.resource-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.resource-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.resource-search .input { min-width: 220px; }
.resource-filter {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 4px 4px 10px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border-soft);
}
.resource-filter > span {
    font-size: 11px; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase; color: var(--muted);
}
.resource-filter .select, .resource-filter .custom-select { min-width: 150px; }
.resource-filter .custom-select-trigger {
    min-height: 36px; padding: 8px 11px;
    border-color: transparent; background: var(--surface);
}
.per-page-select { min-width: 120px; }

.resource-table-wrap { overflow-x: auto; }
.resource-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.resource-table thead th {
    position: sticky; top: 0;
    padding: 13px 18px; text-align: left;
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.resource-table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.resource-table tbody tr { transition: background .15s; }
.resource-table tbody tr:hover { background: var(--accent-softer); }
.resource-table tbody tr:last-child td { border-bottom: none; }
.select-col { width: 44px; text-align: center; }
.resource-table input[type="checkbox"], .bulk-bar input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--g-600); cursor: pointer; }

.product-table-cell { display: flex; align-items: center; gap: 12px; }
.product-table-thumb {
    width: 44px; height: 44px; border-radius: 11px; object-fit: contain; padding: 4px;
    background: var(--surface-3); border: 1px solid var(--border-soft); flex-shrink: 0;
}

.brand-preview {
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    display: flex;
    gap: 14px;
    padding: 14px;
}

.brand-preview img {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    height: 72px;
    object-fit: contain;
    padding: 10px;
    width: 120px;
}

.brand-preview span {
    color: var(--text);
    font-weight: 800;
}

.compact-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compact-table th, .compact-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.compact-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.compact-empty, .empty-state {
    display: grid; place-items: center; text-align: center;
    min-height: 160px; padding: 32px; color: var(--muted); font-size: 13.5px;
    background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-md);
}

/* Bulk action bar */
.bulk-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin: 0 22px 18px; padding: 14px 18px; border-radius: var(--r-md);
    background: var(--accent-softer); border: 1px solid var(--accent-ring);
}
.bulk-status span { font-weight: 800; font-size: 14px; }
.bulk-status small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.bulk-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-action-select, .bulk-value-control { min-width: 150px; }
.bulk-textarea-control { min-width: min(520px, 80vw); min-height: 94px; }
.bulk-editor-backdrop {
    position: fixed; inset: 0; z-index: 9999;
    display: block; padding: 22px 28px; overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    background: rgba(15, 23, 42, .46); backdrop-filter: blur(10px);
}
.bulk-editor-backdrop[hidden] { display: none !important; }
.bulk-editor-modal {
    position: relative; width: min(1760px, 100%); min-height: calc(100vh - 44px);
    margin: 0 auto; display: flex; flex-direction: column;
    overflow: visible; border-radius: 24px;
    background: var(--surface); border: 1px solid var(--border-strong);
    box-shadow: 0 32px 120px rgba(15, 23, 42, .30);
}
.bulk-editor-head {
    position: sticky; top: -22px; z-index: 4;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
    padding: 18px 24px 16px; border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    border-radius: 24px 24px 0 0;
}
.bulk-editor-head h2 { margin: 4px 0 4px; font-size: 24px; letter-spacing: 0; }
.bulk-editor-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.bulk-editor-close {
    width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto;
    border: 1px solid var(--border-soft); border-radius: var(--r-md);
    background: var(--surface-2); color: var(--text); cursor: pointer;
    font-size: 24px; line-height: 1; transition: all .18s var(--ease);
}
.bulk-editor-close:hover { border-color: var(--accent-ring); color: var(--accent-strong); transform: translateY(-1px); }
.bulk-editor-body {
    overflow: visible;
    padding: 18px 24px 24px;
    display: flex; flex-direction: column; gap: 18px;
    flex: 1 1 auto;
}
.bulk-editor-section {
    border: 1px solid var(--border-soft); border-radius: 18px;
    background: var(--surface-2); overflow: visible;
}
.bulk-editor-section-head {
    padding: 16px 18px; border-bottom: 1px solid var(--border-soft);
    background: var(--surface);
}
.bulk-editor-section-head h3 { margin: 0 0 4px; font-size: 15px; }
.bulk-editor-section-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.bulk-editor-grid {
    display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px;
    padding: 16px 18px;
}
.bulk-editor-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bulk-field {
    position: relative;
    display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 124px;
    padding: 14px; border-radius: var(--r-md);
    border: 1px solid var(--border-soft); background: var(--surface);
    transition: border-color .18s, background .18s, box-shadow .18s;
}
.bulk-field.is-enabled {
    border-color: var(--accent-ring);
    background: var(--accent-softer);
    box-shadow: 0 10px 28px rgba(15, 118, 79, .08);
}
.bulk-field > span {
    display: flex; align-items: center; gap: 9px;
    color: var(--text); font-weight: 800; font-size: 12.5px;
}
.bulk-field > small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.45;
}
.bulk-field input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--g-600); }
.bulk-field .input, .bulk-field .select, .bulk-field .textarea, .bulk-field .custom-select { width: 100%; }
.bulk-field .custom-select.is-open { z-index: 60; }
.bulk-field .input, .bulk-field .select, .bulk-field .custom-select-trigger { min-height: 44px; }
.bulk-field .textarea { min-height: 128px; }
.bulk-multi-options {
    display: grid;
    gap: 7px;
    max-height: 178px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: var(--input-bg);
}
.bulk-multi-options label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border-radius: 10px;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    transition: background .18s var(--ease), color .18s var(--ease);
}
.bulk-multi-options label:hover,
.bulk-multi-options label:has(input:checked) {
    background: var(--accent-softer);
    color: var(--accent-strong);
}
.bulk-multi-options input[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}
.bulk-field-wide { grid-column: span 2; }
.bulk-field:not(.is-enabled) .input,
.bulk-field:not(.is-enabled) .select,
.bulk-field:not(.is-enabled) .textarea,
.bulk-field:not(.is-enabled) .custom-select-trigger,
.bulk-field:not(.is-enabled) .bulk-multi-options {
    opacity: .82;
}
.bulk-editor-footer {
    position: sticky; bottom: -22px; z-index: 4;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    padding: 14px 24px; border-top: 1px solid var(--border-soft);
    background: var(--surface);
    border-radius: 0 0 24px 24px;
}
.bulk-editor-footer > span { color: var(--muted); font-size: 13px; }
.bulk-editor-footer > div { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 980px) {
    .bulk-editor-backdrop { padding: 14px; }
    .bulk-editor-modal { min-height: calc(100vh - 28px); }
    .bulk-editor-head { top: -14px; }
    .bulk-editor-footer { bottom: -14px; }
    .bulk-editor-grid, .bulk-editor-grid-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .bulk-editor-backdrop { padding: 10px; }
    .bulk-editor-modal { min-height: calc(100vh - 20px); border-radius: 18px; }
    .bulk-editor-head { top: -10px; border-radius: 18px 18px 0 0; }
    .bulk-editor-footer { bottom: -10px; border-radius: 0 0 18px 18px; }
    .bulk-editor-head, .bulk-editor-body, .bulk-editor-footer { padding-left: 16px; padding-right: 16px; }
    .bulk-editor-grid, .bulk-editor-grid-wide { grid-template-columns: 1fr; }
    .bulk-field-wide { grid-column: auto; }
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: var(--r-pill);
    font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
    text-transform: capitalize; line-height: 1.4;
    background: var(--slate-soft); color: var(--slate);
    border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }

.badge-active, .badge-paid, .badge-completed, .badge-public, .badge-available,
.badge-in-stock, .badge-resolved, .badge-open { color: var(--green); background: var(--green-soft); }

.badge-pending, .badge-processing, .badge-preorder, .badge-low, .badge-partially-refunded,
.badge-draft, .badge-reserved, .badge-normal { color: var(--amber); background: var(--amber-soft); }

.badge-blocked, .badge-failed, .badge-cancelled, .badge-out-of-stock, .badge-urgent,
.badge-unpaid, .badge-high { color: var(--red); background: var(--red-soft); }

.badge-refunded, .badge-private, .badge-archived, .badge-disabled, .badge-inactive,
.badge-closed { color: var(--slate); background: var(--slate-soft); }

.badge-admin, .badge-staff { color: var(--violet); background: var(--violet-soft); }
.badge-customer { color: var(--blue); background: var(--blue-soft); }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.admin-form { display: flex; flex-direction: column; gap: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--text-soft); letter-spacing: .01em; }

.input, .select, .textarea, .money-input, .file-input {
    width: 100%; padding: 11px 14px; border-radius: var(--r-md);
    border: 1px solid var(--border-strong); background: var(--input-bg); color: var(--text);
    font-size: 13.5px; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input:focus, .select:focus, .textarea:focus, .money-input:focus, .file-input:focus {
    outline: none; border-color: var(--accent-ring); box-shadow: 0 0 0 4px var(--accent-soft);
}
.select {
    appearance: none; cursor: pointer; padding-right: 38px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%235d7068' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 5l4 4 4-4'/></svg>");
    background-repeat: no-repeat; background-position: right 14px center;
}
.select.is-enhanced-select {
    display: none !important;
}
.custom-select {
    position: relative;
    min-width: 150px;
}
.custom-select[hidden] {
    display: none !important;
}
.custom-select-trigger {
    width: 100%;
    min-height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 13px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-strong);
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.custom-select-trigger:hover,
.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus {
    outline: none;
    border-color: var(--accent-ring);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.custom-select-trigger:disabled {
    cursor: not-allowed;
    opacity: .62;
}
.custom-select-trigger svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    transition: transform .18s var(--ease);
}
.custom-select.is-open .custom-select-trigger svg {
    transform: rotate(180deg);
}
.custom-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 40;
    max-height: 260px;
    overflow: auto;
    padding: 6px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.custom-select-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 11px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    text-align: left;
}
.custom-select-option:hover,
.custom-select-option.is-selected {
    background: var(--accent-softer);
    color: var(--accent-strong);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.textarea-tall { min-height: 200px; }
.file-input { padding: 9px 12px; cursor: pointer; }
.file-input::file-selector-button {
    margin-right: 12px; padding: 7px 14px; border-radius: 9px; border: none; cursor: pointer;
    background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 12.5px;
}

.checkbox-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-soft); cursor: pointer; }
.checkbox-line input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--g-600); }
.checkbox-card {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    border-radius: var(--r-md); background: var(--surface-2);
    border: 1px solid var(--border-soft); cursor: pointer; font-size: 13.5px; font-weight: 600;
    transition: border-color .2s, background .2s;
}
.checkbox-card:hover { border-color: var(--accent-ring); }
.checkbox-card input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--g-600); }

.standalone-form { max-width: 760px; }
.settings-panel { display: flex; flex-direction: column; gap: 22px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }

/* Money / order form helpers */
.money-input { font-variant-numeric: tabular-nums; }
.money-list, .live-money-list { display: flex; flex-direction: column; gap: 10px; }
.money-list > div, .live-money-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 13px; }
.money-total, .line-total { font-weight: 800; font-variant-numeric: tabular-nums; }
.line-total { font-size: 15px; color: var(--accent); }
.summary-notes { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.danger-soft { color: var(--red); background: var(--red-soft); border-color: transparent; }

/* Rich text field */
.rich-field { border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--input-bg); }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.rich-toolbar button, .rich-row button { padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-soft); font-size: 12.5px; font-weight: 700; cursor: pointer; transition: all .15s; }
.rich-toolbar button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.rich-surface, .rich-textarea { min-height: 180px; padding: 14px 16px; border: none; outline: none; background: transparent; line-height: 1.6; width: 100%; resize: vertical; }
.rich-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Image preview */
.image-preview {
    display: grid; place-items: center; min-height: 160px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px dashed var(--border-strong); overflow: hidden;
}
.image-preview img { max-width: 100%; max-height: 240px; object-fit: contain; }

/* ============================================================
   TABS
   ============================================================ */
.tab-bar { display: inline-flex; gap: 4px; padding: 5px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); margin-bottom: 22px; flex-wrap: wrap; }
.tab-button { padding: 9px 16px; border-radius: 10px; border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: all .2s var(--ease); }
.tab-button:hover { color: var(--text); }
.tab-button.active { color: #fff; background: var(--grad-accent); box-shadow: var(--shadow-accent); }
.tab-panel { animation: fadeIn .3s var(--ease); }
.tab-panel[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   DETAIL VIEWS
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; margin-bottom: 22px; }
.detail-list { display: flex; flex-direction: column; gap: 2px; }
.detail-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.detail-list > div:last-child { border-bottom: none; }
.detail-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.detail-value { font-size: 14px; font-weight: 700; text-align: right; }
.detail-block { padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); }

/* ============================================================
   CUSTOMER PROFILE
   ============================================================ */
.profile-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; }
.profile-panel { display: flex; flex-direction: column; gap: 18px; }
.profile-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.profile-avatar {
    display: grid; place-items: center; width: 80px; height: 80px; border-radius: 24px;
    font-size: 30px; font-weight: 800; color: #fff;
    background: var(--grad-accent); box-shadow: var(--shadow-accent);
}
.account-panel { display: flex; flex-direction: column; gap: 14px; }
.status-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); }

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
.auth-wrap {
    display: grid; min-height: 100vh; place-items: center; padding: 24px; position: relative; z-index: 1;
    background:
        radial-gradient(700px 460px at 15% 0%, var(--bg-tint-1), transparent 55%),
        radial-gradient(680px 480px at 100% 100%, var(--bg-tint-2), transparent 55%),
        var(--bg);
}
.auth-card {
    width: min(440px, 100%); padding: 36px; border-radius: var(--r-xl);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: relative; overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad-accent); }
.auth-card .brand-mark {
    display: inline-block; font-size: 22px; font-weight: 800; letter-spacing: -.02em;
    background: var(--grad-accent); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: var(--accent-strong);
}
.auth-card .brand-mark-logo {
    background: transparent;
    display: inline-flex;
    -webkit-text-fill-color: currentColor;
}
.auth-card .brand-logo-image {
    height: 72px;
    max-width: 260px;
}
.auth-title { margin: 22px 0 8px; font-size: 27px; font-weight: 800; }
.auth-card .btn-primary { width: 100%; padding: 13px; font-size: 14.5px; margin-top: 4px; }

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.flash, .error-box, .alert-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; border-radius: var(--r-md); margin-bottom: 22px;
    font-size: 13.5px; font-weight: 600;
}
.flash { color: var(--green); background: var(--green-soft); border: 1px solid rgba(5,150,105,.25); }
.flash::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--g-600); color: #fff; font-size: 12px; flex-shrink: 0; }
.error-box, .alert-danger { color: var(--red); background: var(--red-soft); border: 1px solid rgba(225,29,72,.25); }
.error-box::before, .alert-danger::before { content: "!"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.alert-card { color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(217,119,6,.25); }

.command-center, .command-card { padding: 20px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border-soft); }
.command-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.command-copy { font-size: 13px; color: var(--muted); line-height: 1.5; }
.import-checklist { display: flex; flex-direction: column; gap: 10px; }
.import-checklist li, .import-checklist > div { display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: 13.5px; color: var(--text-soft); }
.placeholder-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mini-stat, .mini-item { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); }
.quick-grid, .compact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.quick-tile { padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); transition: border-color .2s, transform .15s var(--ease); }
.quick-tile:hover { border-color: var(--accent-ring); transform: translateY(-2px); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-nav, .queue-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 22px; border-top: 1px solid var(--border-soft); }
.pagination-summary { font-size: 12.5px; color: var(--muted); }
.pagination-links { display: flex; gap: 6px; flex-wrap: wrap; }
.page-link {
    display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 12px;
    border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
    font-size: 13px; font-weight: 700; color: var(--text-soft);
    transition: all .18s var(--ease);
}
.page-link:hover:not(.disabled):not(.active) { border-color: var(--accent-ring); color: var(--accent-strong); transform: translateY(-1px); }
.page-link.active { color: #fff; background: var(--grad-accent); border-color: transparent; box-shadow: var(--shadow-accent); }
.page-link.disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================
   SUPPORT INBOX  (chat)
   ============================================================ */
.inbox-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; align-items: start; }
.inbox-side { display: flex; flex-direction: column; gap: 16px; }
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.inbox-detail { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.ticket-list { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.ticket-item {
    display: block; padding: 14px; border-radius: var(--r-md);
    background: var(--surface-2); border: 1px solid var(--border-soft);
    cursor: pointer; transition: all .18s var(--ease);
}
.ticket-item:hover { border-color: var(--accent-ring); transform: translateX(2px); }
.ticket-item.active { border-color: transparent; background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--g-600); }
.ticket-subject { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.ticket-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }

.chat-panel { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.thread { display: flex; flex-direction: column; gap: 16px; padding: 22px; max-height: 56vh; overflow-y: auto; }
.message { display: flex; flex-direction: column; gap: 6px; max-width: 78%; }
.message.staff { align-self: flex-end; align-items: flex-end; }
.message.customer { align-self: flex-start; }
.message-meta { font-size: 11px; color: var(--muted); font-weight: 600; }
.bubble, .message-text {
    padding: 12px 16px; border-radius: 16px; font-size: 13.5px; line-height: 1.55;
    background: var(--surface-2); border: 1px solid var(--border-soft);
}
.message.staff .bubble, .message.staff .message-text {
    color: #fff; border-color: transparent; background: var(--grad-accent);
    border-bottom-right-radius: 5px;
}
.message.customer .bubble, .message.customer .message-text { border-bottom-left-radius: 5px; }
.message.internal .bubble, .bubble.internal { background: var(--amber-soft); border-color: rgba(217,119,6,.25); color: var(--amber); }

.composer { padding: 18px 22px; border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.composer-grid { display: grid; gap: 12px; }
.composer .textarea { background: var(--surface); }

/* ============================================================
   ORDER CREATE WORKSPACE
   ============================================================ */
.order-create-shell, .order-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.order-form-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.order-form-customer, .order-form-items { display: flex; flex-direction: column; gap: 16px; }
.order-summary-panel { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 16px; }
.order-lines { display: flex; flex-direction: column; gap: 12px; }
.order-line {
    display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
    padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft);
}

/* ============================================================
   LICENSE KEYS
   ============================================================ */
.keys-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.key-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.key-add-form { display: flex; flex-direction: column; gap: 12px; }
.key-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft); }
.key-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--text-soft); }
.linked-panel { padding: 18px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); }
.live-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr)); gap: 12px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .openai-billing-card { grid-template-columns: 1fr 1fr; }
    .openai-billing-side { grid-column: 1 / -1; }
    .openai-billing-refresh { justify-self: start; }
    .tail-dashboard-grid, .tail-analytics-grid { grid-template-columns: 1fr; }
    .order-create-shell, .order-workspace, .keys-layout { grid-template-columns: 1fr; }
    .order-summary-panel { position: static; }
}
@media (max-width: 1024px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 80; width: 280px;
        transform: translateX(-102%); transition: transform .28s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: none; }
    .topbar-menu { display: flex; }
    .main { padding: 14px 18px 48px; }
    .profile-grid, .inbox-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .openai-billing-card, .openai-billing-side { grid-template-columns: 1fr; }
    .openai-billing-card { padding: 16px; }
    .tail-metric-grid, .form-grid, .two-col { grid-template-columns: 1fr; }
    .page-title { font-size: 23px; }
    .topbar-search { display: none; }
    .topbar-actions .btn { display: none; }
    .topbar-actions .user-pill, .topbar-actions .theme-toggle { display: flex; }
    .detail-grid, .dashboard-grid, .tail-lower-grid { grid-template-columns: 1fr; }
    .resource-head, .bulk-bar { flex-direction: column; align-items: stretch; }
    .message { max-width: 90%; }
}

/* ============================================================
   LIVE MOTION LAYER — animated charts + UI choreography
   Added 2026. Pure CSS; respects prefers-reduced-motion.
   ============================================================ */

/* Registered custom props so charts can interpolate */
@property --gauge-fill { syntax: '<number>'; inherits: true; initial-value: 0; }

/* ----------  EASING + REUSABLE KEYFRAMES  ---------- */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-spring: cubic-bezier(.34, 1.56, .64, 1); }

@keyframes riseIn   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes navIn    { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes popIn    { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes floatSoft{ 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* ----------  PAGE ENTRANCE CHOREOGRAPHY (staggered)  ---------- */
.page-head { animation: fadeUp .5s var(--ease-out) both; }

.tail-metric-grid > *, .stat-grid > .stat-card,
.tail-analytics-grid > *, .tail-lower-grid > *,
.dashboard-grid > *, .panel, .card, .resource-wrap, .detail-card, .profile-grid > * {
    animation: riseIn .6s var(--ease-out) both;
}
.tail-metric-grid > *:nth-child(1), .stat-grid > .stat-card:nth-child(1) { animation-delay: .04s; }
.tail-metric-grid > *:nth-child(2), .stat-grid > .stat-card:nth-child(2) { animation-delay: .10s; }
.tail-metric-grid > *:nth-child(3), .stat-grid > .stat-card:nth-child(3) { animation-delay: .16s; }
.tail-metric-grid > *:nth-child(4), .stat-grid > .stat-card:nth-child(4) { animation-delay: .22s; }
.tail-analytics-grid > *:nth-child(1) { animation-delay: .20s; }
.tail-analytics-grid > *:nth-child(2) { animation-delay: .28s; }
.tail-lower-grid > *:nth-child(1), .dashboard-grid > *:nth-child(1) { animation-delay: .30s; }
.tail-lower-grid > *:nth-child(2), .dashboard-grid > *:nth-child(2) { animation-delay: .38s; }
.tail-lower-grid > *:nth-child(3), .dashboard-grid > *:nth-child(3) { animation-delay: .46s; }

/* sidebar nav slides in */
.nav-link { animation: navIn .45s var(--ease-out) both; }
.nav-group:nth-child(1) .nav-link:nth-child(1) { animation-delay: .02s; }
.nav-group .nav-link:nth-child(2) { animation-delay: .06s; }
.nav-group .nav-link:nth-child(3) { animation-delay: .10s; }
.nav-group .nav-link:nth-child(4) { animation-delay: .14s; }
.nav-group .nav-link:nth-child(5) { animation-delay: .18s; }

/* table rows cascade in */
.resource-table tbody tr { animation: fadeUp .4s var(--ease-out) both; }
.resource-table tbody tr:nth-child(1){animation-delay:.04s}
.resource-table tbody tr:nth-child(2){animation-delay:.08s}
.resource-table tbody tr:nth-child(3){animation-delay:.12s}
.resource-table tbody tr:nth-child(4){animation-delay:.16s}
.resource-table tbody tr:nth-child(5){animation-delay:.20s}
.resource-table tbody tr:nth-child(6){animation-delay:.24s}
.resource-table tbody tr:nth-child(7){animation-delay:.28s}
.resource-table tbody tr:nth-child(8){animation-delay:.32s}
.resource-table tbody tr:hover { background: var(--accent-softer); }

/* ----------  LIVE BAR CHART  ---------- */
.bar-chart span::before {
    transform-origin: bottom center;
    background:
        linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0) 42%) no-repeat,
        linear-gradient(180deg, var(--g-400), var(--g-600));
    background-size: 100% 220%, 100% 100%;
    animation: barGrow .85s var(--ease-out) both, barSheen 3.6s ease-in-out infinite;
}
@keyframes barGrow { from { transform: scaleY(0); opacity: .35; } to { transform: scaleY(1); opacity: 1; } }
@keyframes barSheen { 0% { background-position: 0 -120%, 0 0; } 60%,100% { background-position: 0 220%, 0 0; } }
.bar-chart span:nth-child(1)::before  { animation-delay: .25s, 0s;   }
.bar-chart span:nth-child(2)::before  { animation-delay: .31s, .2s;  }
.bar-chart span:nth-child(3)::before  { animation-delay: .37s, .4s;  }
.bar-chart span:nth-child(4)::before  { animation-delay: .43s, .6s;  }
.bar-chart span:nth-child(5)::before  { animation-delay: .49s, .8s;  }
.bar-chart span:nth-child(6)::before  { animation-delay: .55s, 1s;   }
.bar-chart span:nth-child(7)::before  { animation-delay: .61s, 1.2s; }
.bar-chart span:nth-child(8)::before  { animation-delay: .67s, 1.4s; }
.bar-chart span:nth-child(9)::before  { animation-delay: .73s, 1.6s; }
.bar-chart span:nth-child(10)::before { animation-delay: .79s, 1.8s; }
.bar-chart span:nth-child(11)::before { animation-delay: .85s, 2s;   }
.bar-chart span:nth-child(12)::before { animation-delay: .91s, 2.2s; }
/* most recent bar glows like live data */
.bar-chart span:last-child::before { box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 16px -2px var(--accent-ring); }
.bar-chart span:hover::before { transform: scaleY(1.02); filter: brightness(1.08) saturate(1.12); }

/* ----------  LIVE GAUGE (sweeps up on load)  ---------- */
.target-gauge { animation: gaugeFill 1.5s var(--ease-out) .25s both; }
@keyframes gaugeFill { from { --gauge-fill: 0; } to { --gauge-fill: 1; } }
.target-gauge::after {
    content: ""; position: absolute; inset: 0; border-radius: 220px 220px 0 0;
    box-shadow: 0 0 30px -6px var(--accent-ring); opacity: 0; pointer-events: none;
    animation: gaugeGlow 2.6s ease-in-out 1.4s infinite;
}
@keyframes gaugeGlow { 0%,100% { opacity: 0; } 50% { opacity: .8; } }
.target-gauge strong { animation: popIn .5s var(--ease-spring) 1s both; }

/* ----------  LIVE LINE CHART (points pop + latest pings)  ---------- */
.line-chart span::before {
    transform-origin: center;
    animation: dotPop .55s var(--ease-spring) both;
}
.line-chart span::after { transform-origin: bottom; animation: areaRise .7s var(--ease-out) both; }
@keyframes dotPop  { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes areaRise{ from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.line-chart span:nth-child(1)  ::before, .line-chart span:nth-child(1)::after  { animation-delay: .30s; }
.line-chart span:nth-child(2)  ::before, .line-chart span:nth-child(2)::after  { animation-delay: .36s; }
.line-chart span:nth-child(3)  ::before, .line-chart span:nth-child(3)::after  { animation-delay: .42s; }
.line-chart span:nth-child(4)  ::before, .line-chart span:nth-child(4)::after  { animation-delay: .48s; }
.line-chart span:nth-child(5)  ::before, .line-chart span:nth-child(5)::after  { animation-delay: .54s; }
.line-chart span:nth-child(6)  ::before, .line-chart span:nth-child(6)::after  { animation-delay: .60s; }
.line-chart span:nth-child(7)  ::before, .line-chart span:nth-child(7)::after  { animation-delay: .66s; }
.line-chart span:nth-child(8)  ::before, .line-chart span:nth-child(8)::after  { animation-delay: .72s; }
.line-chart span:nth-child(9)  ::before, .line-chart span:nth-child(9)::after  { animation-delay: .78s; }
.line-chart span:nth-child(10) ::before, .line-chart span:nth-child(10)::after { animation-delay: .84s; }
.line-chart span:nth-child(11) ::before, .line-chart span:nth-child(11)::after { animation-delay: .90s; }
.line-chart span:nth-child(12) ::before, .line-chart span:nth-child(12)::after { animation-delay: .96s; }
/* latest point keeps a live "incoming data" ping */
.line-chart span:last-child::before {
    animation: dotPop .55s var(--ease-spring) 1s both, dotPing 2.2s ease-out 1.4s infinite;
}
@keyframes dotPing {
    0%   { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 0 var(--accent-ring); }
    70%,100% { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 12px rgba(16,185,129,0); }
}

/* ----------  BUTTON SHINE + ICON LIFE  ---------- */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
    content: ""; position: absolute; top: 0; left: -130%; width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
    transform: skewX(-18deg); transition: left .6s var(--ease-out); pointer-events: none;
}
.btn-primary:hover::after { left: 140%; }
.btn-primary:active { transform: translateY(1px) scale(.99); }
.tail-metric-card:hover .metric-icon, .stat-card:hover .stat-icon { animation: floatSoft 1.4s var(--ease) infinite; }

/* metric numbers tick in */
.tail-metric-card strong, .stat-card strong, .target-split dd { animation: fadeUp .5s var(--ease-out) .3s both; }

/* status dots quietly breathe */
.badge.is-active::before, .badge.is-paid::before, .status-dot {
    animation: pulse 2.4s var(--ease) infinite;
}

/* topbar + sidebar settle in */
.topbar { animation: fadeUp .5s var(--ease-out) both; }
.brand, .sidebar-brand { animation: popIn .55s var(--ease-spring) both; }

/* count-up helper: hide value until JS reveals (no flash), graceful if JS off */
.js-count.is-counting { color: inherit; }

/* re-trigger charts when scrolled into view */
.replay { animation: none !important; }
.replay.in-view .bar-chart span::before { animation: barGrow .85s var(--ease-out) both, barSheen 3.6s ease-in-out infinite; }
.replay.in-view .line-chart span::before { animation: dotPop .55s var(--ease-spring) both; }
.replay.in-view .target-gauge { animation: gaugeFill 1.5s var(--ease-out) both; }

/* ----------  ACCESSIBILITY: honor reduced motion  ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    :root { --gauge-fill: 1; }
    .target-gauge { --gauge-fill: 1; }
}

/* ============================================================
   PRODUCT EDITOR — modern two-column layout + Quill theming
   ============================================================ */
.product-editor { display: flex; flex-direction: column; gap: 18px; }

/* sticky action bar */
.pe-actionbar {
    position: sticky; top: 12px; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    padding: 12px 16px; border-radius: var(--r-lg);
    background: var(--sidebar); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.pe-actionbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pe-actionbar .btn { display: inline-flex; align-items: center; gap: 7px; }
.pe-slugchip { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border-soft); padding: 6px 12px; border-radius: var(--r-pill); }

.pe-alert { padding: 14px 18px; border-radius: var(--r-md); font-size: 13.5px; }
.pe-alert-error { background: var(--red-soft); border: 1px solid rgba(225,29,72,.25); color: #9f1239; }
.pe-alert-error ul { margin: 6px 0 0; padding-left: 18px; }
.pe-alert-error li { margin-top: 2px; }

/* two-column grid */
.product-editor-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.pe-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.pe-side { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 88px; min-width: 0; }

/* cards */
.pe-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; animation: riseIn .5s var(--ease-out) both; }
.pe-card-head { padding: 18px 22px; border-bottom: 1px solid var(--border-soft); background: linear-gradient(180deg, var(--surface-2), transparent); }
.pe-card-head h2 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.pe-card-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.pe-card-body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.pe-stack { gap: 22px; }
.pe-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field-hint { font-size: 12px; color: var(--muted); margin: -3px 0 2px; }

/* input affix (slug prefix) */
.input-affix { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--input-bg); transition: border-color .2s, box-shadow .2s; }
.input-affix:focus-within { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-affix-pre { display: flex; align-items: center; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--border-soft); white-space: nowrap; }
.input-affix .input { border: none !important; box-shadow: none !important; border-radius: 0; flex: 1; }

/* media */
.pe-media { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; }
.pe-media-preview { aspect-ratio: 1; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.pe-media-preview img { width: 100%; height: 100%; object-fit: cover; }
.pe-media-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; font-weight: 600; }
.pe-media-fields { display: flex; flex-direction: column; gap: 16px; }

/* margin readout */
.pe-margin { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: var(--r-md); background: var(--green-soft); border: 1px solid rgba(5,150,105,.18); }
.pe-margin span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.pe-margin strong { font-size: 15px; font-weight: 800; color: var(--green); letter-spacing: -.01em; }

.pe-bottom-actions { justify-content: flex-end; }

/* ----------  SUNEDITOR THEME (matched to green design)  ---------- */
.sun-editor {
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    font-family: inherit; background: var(--input-bg); overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}
.sun-editor:focus-within { border-color: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.sun-editor .se-toolbar {
    background: var(--surface-2); outline: none;
    border-bottom: 1px solid var(--border-soft);
}
.sun-editor .se-toolbar-separator-vertical { background-color: var(--border); }
.sun-editor .se-btn { color: var(--text-soft); border-radius: 7px; transition: background .15s, color .15s; }
.sun-editor .se-btn:enabled:hover,
.sun-editor .se-btn:enabled:focus { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; outline: none; }
.sun-editor .se-btn:enabled.active,
.sun-editor .se-btn:enabled.on { color: var(--accent-strong); background: var(--accent-soft); }
.sun-editor .se-btn-tray { padding: 7px 8px; }
.sun-editor .se-btn-module-border { border: none; }
.sun-editor .se-wrapper .se-wrapper-inner { background: var(--input-bg); }
.sun-editor .sun-editor-editable {
    font-family: inherit; color: var(--text); line-height: 1.7; padding: 16px 18px;
    background: var(--input-bg);
}
.sun-editor .sun-editor-editable a { color: var(--accent-strong); }
.sun-editor .sun-editor-editable blockquote {
    border-left: 3px solid var(--accent); background: var(--accent-softer);
    margin: 8px 0; padding: 8px 16px; border-radius: 0 8px 8px 0; color: var(--text-soft);
}
.sun-editor .sun-editor-editable h1,
.sun-editor .sun-editor-editable h2,
.sun-editor .sun-editor-editable h3 { font-weight: 800; letter-spacing: -.01em; }
.sun-editor .se-resizing-bar { background: var(--surface-2); border-top: 1px solid var(--border-soft); color: var(--muted); }
.sun-editor .se-navigation { color: var(--muted); }
.sun-editor .se-dialog .se-dialog-inner { color: var(--text); }
.sun-editor .se-dialog .se-btn-primary,
.sun-editor .se-submenu .se-btn-primary { background: var(--grad-accent); color: #fff; border: none; box-shadow: var(--shadow-accent); }
.sun-editor .se-list-layer { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); background: var(--surface); }
.sun-editor .se-list-basic li button:hover,
.sun-editor .se-list-basic li button:focus { background: var(--accent-soft); color: var(--accent-strong); }
.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text { background: var(--text); color: #fff; }
.se-editor { width: 100%; min-height: 160px; }

@media (max-width: 1024px) {
    .product-editor-grid { grid-template-columns: 1fr; }
    .pe-side { position: static; }
}
@media (max-width: 720px) {
    .pe-media { grid-template-columns: 1fr; }
    .pe-grid-2 { grid-template-columns: 1fr; }
    .pe-actionbar { position: static; }
}
/* Product editor dropdown sections */
.product-editor .pe-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 16px;
}
.product-editor .pe-card-head > h2,
.product-editor .pe-card-head > p {
    grid-column: 1;
    min-width: 0;
}
.product-editor .pe-card-head > .pe-section-toggle {
    grid-column: 2;
    grid-row: 1 / span 2;
}
.pe-section-toggle {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    border-radius: var(--r-pill);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 11.5px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, border-color .18s, color .18s, box-shadow .18s;
}
.pe-section-toggle:hover,
.pe-section-toggle:focus {
    border-color: var(--accent-ring);
    color: var(--accent-strong);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-softer);
    outline: none;
}
.pe-section-toggle svg {
    transition: transform .18s ease;
}
.pe-card.is-collapsed .pe-section-toggle svg {
    transform: rotate(-90deg);
}
.pe-card.is-collapsed > .pe-card-body {
    display: none;
}

/* Product FAQ Q/A builder */
.faq-builder {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.faq-builder-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.faq-builder-item {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    overflow: hidden;
}
.faq-builder-item summary {
    list-style: none;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    cursor: pointer;
    user-select: none;
}
.faq-builder-item summary::-webkit-details-marker {
    display: none;
}
.faq-builder-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--r-pill);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11.5px;
    font-weight: 900;
}
.faq-builder-item summary strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text);
}
.faq-builder-remove {
    appearance: none;
    border: 1px solid rgba(225,29,72,.22);
    color: #be123c;
    background: rgba(225,29,72,.07);
    border-radius: var(--r-pill);
    padding: 6px 10px;
    font-size: 11.5px;
    font-weight: 800;
    cursor: pointer;
}
.faq-builder-remove:hover,
.faq-builder-remove:focus {
    background: rgba(225,29,72,.12);
    outline: none;
}
.faq-builder-fields {
    border-top: 1px solid var(--border-soft);
    padding: 14px;
    display: grid;
    gap: 14px;
    background: var(--surface);
}
.faq-builder-add {
    align-self: flex-start;
}
@media (max-width: 720px) {
    .pe-section-toggle span {
        display: none;
    }
    .faq-builder-item summary {
        grid-template-columns: 1fr auto;
    }
    .faq-builder-count {
        display: none;
    }
}


/* AI SEO automation page */
.seo-page { display: grid; gap: 18px; }
.seo-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
    align-items: stretch;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background:
        radial-gradient(circle at 12% 0%, var(--accent-softer), transparent 30%),
        linear-gradient(135deg, var(--surface), var(--surface-2));
    box-shadow: var(--shadow-sm);
}
.seo-hero h1 { margin: 6px 0 8px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
.seo-hero p { margin: 0; color: var(--muted); max-width: 740px; line-height: 1.65; }
.seo-config-card {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px;
    display: grid;
    align-content: center;
    gap: 5px;
    background: var(--surface);
}
.seo-config-card span { width: max-content; border-radius: var(--r-pill); padding: 5px 10px; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.seo-config-card.is-ready span { background: rgba(0,167,106,.12); color: var(--accent-strong); }
.seo-config-card.is-missing span { background: rgba(225,29,72,.10); color: #be123c; }
.seo-config-card strong { font-size: 18px; color: var(--text); }
.seo-config-card small { color: var(--muted); line-height: 1.5; }
.seo-stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.seo-stat-grid article {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    padding: 16px;
    display: grid;
    gap: 8px;
}
.seo-stat-grid span { color: var(--muted); font-size: 12px; font-weight: 800; }
.seo-stat-grid strong { font-size: 25px; letter-spacing: -.03em; color: var(--text); }
.seo-filters { display: grid; grid-template-columns: 1.4fr 1fr .8fr 1fr auto; gap: 12px; align-items: end; }
.seo-filters label { display: grid; gap: 7px; }
.seo-filters label > span { font-size: 12px; color: var(--muted); font-weight: 850; }
.seo-filter-actions { display: flex; gap: 8px; }
.seo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    position: sticky;
    top: 14px;
    z-index: 4;
}
.seo-toolbar > div:first-child { display: inline-flex; align-items: baseline; gap: 7px; color: var(--muted); }
.seo-toolbar > div:first-child strong { color: var(--accent-strong); font-size: 22px; }
.seo-toolbar-actions { display: flex; gap: 10px; align-items: center; }
.seo-products-form.is-running { cursor: progress; }
.seo-progress-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(0,167,106,.24);
    border-radius: var(--r-lg);
    background:
        radial-gradient(circle at 12% 0%, rgba(0,167,106,.10), transparent 34%),
        var(--surface);
    box-shadow: var(--shadow-sm);
}
.seo-progress-card[hidden] { display: none !important; }
.seo-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.seo-progress-top > div:first-child { display: grid; gap: 4px; min-width: 0; }
.seo-progress-top strong { color: var(--text); font-size: 14px; }
.seo-progress-top span { color: var(--muted); font-size: 12px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-progress-numbers { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.seo-progress-numbers strong { font-size: 20px; letter-spacing: -.03em; color: var(--accent-strong); }
.seo-progress-numbers em { font-style: normal; border-radius: var(--r-pill); padding: 5px 9px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 900; }
.seo-progress-line {
    height: 11px;
    overflow: hidden;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
}
.seo-progress-line span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width .28s ease;
}
.seo-progress-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.seo-progress-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-pill);
    padding: 5px 9px;
    color: var(--muted);
    background: var(--surface-2);
    font-size: 11.5px;
    font-weight: 800;
}
.seo-progress-meta strong { color: var(--text); }
.seo-progress-log {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.seo-progress-log li.is-error { color: #be123c; }
.seo-product-list { display: grid; gap: 10px; }
.seo-product-head,
.seo-product-row {
    display: grid;
    grid-template-columns: 72px minmax(260px, 1.35fr) 110px 150px minmax(260px, 1fr) 230px;
    gap: 14px;
    align-items: center;
}
.seo-product-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    padding: 0 16px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.seo-product-row {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}
.seo-row-check,
.seo-check-all { display: inline-flex; gap: 8px; align-items: center; }
.seo-product-info { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: center; }
.seo-product-info img { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border-soft); }
.seo-product-info p { margin: 5px 0 0; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.seo-score { width: 76px; height: 60px; border-radius: var(--r-md); display: grid; place-items: center; align-content: center; border: 1px solid var(--border); background: var(--surface-2); }
.seo-score strong { font-size: 22px; line-height: 1; }
.seo-score span { font-size: 11px; color: var(--muted); }
.seo-score.good { background: rgba(0,167,106,.10); color: var(--accent-strong); border-color: rgba(0,167,106,.24); }
.seo-score.mid { background: rgba(245,158,11,.10); color: #b45309; border-color: rgba(245,158,11,.24); }
.seo-score.bad { background: rgba(225,29,72,.08); color: #be123c; border-color: rgba(225,29,72,.20); }
.status-pill { display: inline-flex; align-items: center; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border-soft); padding: 6px 10px; font-size: 11px; font-weight: 900; text-transform: capitalize; color: var(--muted); }
.status-draft-ready,
.status-applied { background: rgba(0,167,106,.10); color: var(--accent-strong); border-color: rgba(0,167,106,.24); }
.status-failed { background: rgba(225,29,72,.08); color: #be123c; border-color: rgba(225,29,72,.20); }
.seo-error { display: block; margin-top: 7px; color: #be123c; font-size: 11px; line-height: 1.35; }
.seo-meta-preview { min-width: 0; }
.seo-meta-preview strong { display: block; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.seo-meta-preview p { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 5px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.seo-meta-preview span,
.seo-keywords span { display: inline-flex; border-radius: var(--r-pill); padding: 4px 8px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 850; }
.seo-row-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.seo-draft-preview { grid-column: 2 / -1; border-top: 1px solid var(--border-soft); padding-top: 12px; color: var(--muted); }
.seo-draft-preview summary { cursor: pointer; font-weight: 900; color: var(--accent-strong); }
.seo-draft-preview div { margin-top: 10px; border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface-2); padding: 12px; }
.seo-keywords { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
@media (max-width: 1320px) {
    .seo-product-head { display: none; }
    .seo-product-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
    .seo-product-row > .seo-score,
    .seo-product-row > div:nth-child(4),
    .seo-product-row > .seo-meta-preview,
    .seo-row-actions,
    .seo-draft-preview { grid-column: 2 / -1; }
    .seo-row-actions { justify-content: flex-start; }
}
@media (max-width: 900px) {
    .seo-hero { grid-template-columns: 1fr; }
    .seo-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .seo-filters { grid-template-columns: 1fr; }
    .seo-toolbar { position: static; flex-direction: column; align-items: stretch; }
    .seo-toolbar-actions { flex-direction: column; align-items: stretch; }
}
@media (max-width: 620px) {
    .seo-stat-grid { grid-template-columns: 1fr; }
    .seo-product-row { grid-template-columns: 1fr; }
    .seo-product-row > * { grid-column: 1 !important; }
    .seo-product-info { grid-template-columns: 44px 1fr; }
}

.product-seo-summary {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px;
    background: var(--surface-2);
}
.product-seo-summary div { display: grid; gap: 4px; }
.product-seo-summary span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.product-seo-summary strong { color: var(--text); text-transform: capitalize; }
.product-seo-summary.good { background: rgba(0,167,106,.08); border-color: rgba(0,167,106,.20); }
.product-seo-summary.good strong { color: var(--accent-strong); }
.product-seo-summary.mid { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.22); }
.product-seo-summary.bad { background: rgba(225,29,72,.06); border-color: rgba(225,29,72,.18); }
@media (max-width: 720px) {
    .product-seo-summary { grid-template-columns: 1fr; }
}

/* AI SEO page refinements */
.seo-ai-note {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(0,167,106,.18);
    border-radius: var(--r-lg);
    background: linear-gradient(135deg, rgba(0,167,106,.10), rgba(255,255,255,.86));
    box-shadow: var(--shadow-sm);
    color: var(--muted);
    padding: 14px 18px;
}
.seo-ai-note strong {
    color: var(--accent-strong);
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.seo-ai-note span {
    font-size: 13px;
    font-weight: 750;
    line-height: 1.5;
}
.seo-filters-panel,
.seo-toolbar,
.seo-toolbar-actions,
.seo-mode-wrap {
    overflow: visible;
}
.seo-filters-panel {
    z-index: 25;
}
.seo-toolbar {
    position: relative;
    top: auto;
    z-index: 10;
}
.seo-filters .custom-select,
.seo-toolbar-actions .custom-select,
.seo-mode-wrap .custom-select {
    width: 100%;
    min-width: 0;
}
.seo-filters .custom-select-menu,
.seo-toolbar-actions .custom-select-menu,
.seo-mode-wrap .custom-select-menu {
    z-index: 120;
    max-height: 220px;
}
.seo-mode-wrap {
    display: grid;
    gap: 5px;
    min-width: 280px;
}
.seo-mode-wrap small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.seo-draft-preview .seo-keywords {
    max-height: 170px;
    overflow: auto;
}
@media (max-width: 900px) {
    .seo-ai-note { align-items: flex-start; flex-direction: column; }
    .seo-mode-wrap { min-width: 0; }
}

/* ---------- AI SEO product banner generation ---------- */
.ai-banner-admin-card {
    background: linear-gradient(135deg, rgba(0,167,106,.08), rgba(255,255,255,.92));
    border: 1px solid rgba(0,167,106,.18);
    border-radius: 24px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 18px 40px rgba(15,23,42,.05);
    display: grid;
    gap: 16px;
    padding: 18px;
}

.ai-banner-admin-head {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.ai-banner-admin-head small {
    color: #62776d;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}

.ai-banner-admin-preview {
    background: #ffffff;
    border: 1px solid rgba(15,23,42,.08);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.ai-banner-admin-preview img {
    aspect-ratio: 5 / 2;
    display: block;
    height: auto;
    object-fit: cover;
    width: 100%;
}

.seo-banner-chip {
    align-items: center;
    background: rgba(0,167,106,.1);
    border: 1px solid rgba(0,167,106,.18);
    border-radius: 999px;
    color: #008a59;
    display: inline-flex;
    font-size: 11px;
    font-weight: 900;
    margin-top: 8px;
    padding: 5px 9px;
    text-transform: uppercase;
}

.seo-banner-chip.is-muted {
    background: #f3f6f5;
    border-color: #dbe7e2;
    color: #6b7b73;
}

.seo-banner-chip.is-error {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #e11d48;
}

.seo-draft-banner {
    border: 1px solid rgba(0,167,106,.18);
    border-radius: 16px;
    display: block;
    margin: 12px 0;
    max-height: 180px;
    object-fit: cover;
    width: 100%;
}

/* ---------- AI SEO product box thumbnail generation ---------- */
.ai-banner-admin-card.is-thumbnail {
    background: linear-gradient(135deg, rgba(0,167,106,.06), rgba(255,255,255,.96));
}

.ai-thumbnail-admin-preview {
    justify-self: start;
    max-width: 260px;
    width: 100%;
}

.ai-thumbnail-admin-preview img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}


.ai-transparent-thumbnail-action {
    align-items: center;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(0,167,106,.16);
    border-radius: 18px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 13px;
}

.ai-transparent-thumbnail-action strong {
    color: var(--text);
    display: block;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: -.01em;
}

.ai-transparent-thumbnail-action span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.45;
    margin-top: 3px;
}

.ai-transparent-thumbnail-action .btn {
    flex-shrink: 0;
    justify-content: center;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .ai-transparent-thumbnail-action {
        align-items: stretch;
        flex-direction: column;
    }
}

.seo-draft-thumbnail {
    border: 1px solid rgba(0,167,106,.18);
    border-radius: 18px;
    display: block;
    margin: 12px 0;
    max-height: 180px;
    object-fit: cover;
    width: 180px;
}

/* Universal admin image upload preview */
.uploaded-image-preview,
.current-image-preview {
    margin-top: 10px;
    min-height: 86px;
    border: 1px dashed rgba(15, 23, 42, .16);
    border-radius: 18px;
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.uploaded-image-preview img,
.current-image-preview img,
.image-upload-row img,
.field input[type="file"] + img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 130px !important;
    max-height: 96px !important;
    object-fit: contain !important;
}
.uploaded-image-preview small,
.current-image-preview small {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

/* Homepage AI SEO card */
.seo-home-panel {
    display: grid;
    gap: 18px;
    padding: 22px;
}
.seo-home-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}
.seo-home-head h2 {
    margin: 6px 0 6px;
    font-size: 22px;
    font-weight: 850;
    color: #0f172a;
}
.seo-home-head p {
    margin: 0;
    color: #64748b;
    max-width: 760px;
    line-height: 1.6;
}
.seo-home-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.seo-home-grid article {
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 20px;
    background: #f8fafc;
    padding: 16px;
    min-height: 118px;
}
.seo-home-grid span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
}
.seo-home-grid strong {
    color: #0f172a;
    font-size: 15px;
    line-height: 1.45;
}
.seo-home-grid p,
.seo-home-grid small {
    margin: 0;
    color: #475569;
    line-height: 1.55;
}
.seo-home-keywords {
    padding-top: 0;
}
.seo-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
@media (max-width: 1100px) {
    .seo-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .seo-home-head { flex-direction: column; }
    .seo-home-grid { grid-template-columns: 1fr; }
}

/* Product editor: official OpenAI system requirements research */
.requirements-ai-toolbar {
    align-items: center;
    background: linear-gradient(135deg, rgba(16, 185, 129, .08), rgba(255, 255, 255, .96));
    border: 1px solid rgba(16, 185, 129, .18);
    border-radius: 16px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 13px 14px;
}

.requirements-ai-copy {
    align-items: center;
    display: flex;
    gap: 11px;
    min-width: 0;
}

.requirements-ai-copy > span:last-child {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.requirements-ai-copy strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

.requirements-ai-copy small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.requirements-ai-icon {
    align-items: center;
    background: #fff;
    border: 1px solid rgba(16, 185, 129, .22);
    border-radius: 12px;
    color: #059669;
    display: inline-flex;
    flex: 0 0 38px;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.requirements-ai-button {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: transparent;
    color: #fff;
    flex: 0 0 auto;
    gap: 7px;
    justify-content: center;
    min-width: 142px;
}

.requirements-ai-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #0fae78, #047857);
    color: #fff;
}

.requirements-ai-button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.requirements-ai-button.is-loading svg {
    animation: requirementsAiPulse .9s ease-in-out infinite alternate;
}

.requirements-ai-status,
.requirements-ai-sources {
    border-radius: 13px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.5;
    margin-top: 12px;
    padding: 11px 13px;
}

.requirements-ai-status.is-loading {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.requirements-ai-status.is-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.requirements-ai-status.is-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
}

.requirements-ai-sources {
    background: #f8fbf9;
    border: 1px solid var(--border-soft);
    display: grid;
    gap: 10px;
}

.requirements-ai-sources-head {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.requirements-ai-sources-head strong {
    color: var(--text);
    font-size: 12px;
}

.requirements-ai-sources-head span {
    background: #e9f8f0;
    border-radius: 999px;
    color: #047857;
    font-size: 10px;
    font-weight: 850;
    padding: 4px 8px;
    text-transform: capitalize;
}

.requirements-ai-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.requirements-ai-source-list a {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    color: #0f766e;
    display: inline-flex;
    font-size: 10.5px;
    font-weight: 750;
    max-width: 100%;
    overflow: hidden;
    padding: 6px 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.requirements-ai-sources p {
    color: var(--muted);
    font-size: 11px;
    margin: 0;
}

@keyframes requirementsAiPulse {
    from { transform: translateX(0); }
    to { transform: translateX(3px); }
}

@media (max-width: 640px) {
    .requirements-ai-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .requirements-ai-button {
        width: 100%;
    }

    .requirements-ai-sources-head {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Bulk OpenAI system requirements */
.requirements-bulk-launch {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.requirements-bulk-launch::before {
    background: currentColor;
    border-radius: 999px;
    box-shadow: 6px 0 0 currentColor, 12px 0 0 currentColor;
    content: '';
    height: 4px;
    opacity: .65;
    width: 4px;
}

.requirements-bulk-backdrop {
    align-items: center;
    background: rgba(15, 30, 24, .48);
    backdrop-filter: blur(10px);
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 1400;
}

.requirements-bulk-backdrop:not([hidden]) {
    display: flex;
}

body.requirements-bulk-open {
    overflow: hidden;
}

.requirements-bulk-modal {
    background: #fff;
    border: 1px solid rgba(17, 125, 84, .12);
    border-radius: 28px;
    box-shadow: 0 40px 120px rgba(9, 31, 22, .28);
    display: flex;
    flex-direction: column;
    max-height: min(880px, calc(100vh - 48px));
    overflow: hidden;
    width: min(920px, 100%);
}

.requirements-bulk-head,
.requirements-bulk-footer {
    align-items: center;
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.requirements-bulk-head {
    background:
        radial-gradient(circle at 85% 12%, rgba(33, 206, 139, .12), transparent 34%),
        linear-gradient(180deg, #ffffff, #f9fcfa);
    border-bottom: 1px solid #e6eee9;
    padding: 24px 28px;
}

.requirements-bulk-head h2 {
    color: #10251c;
    font-size: 25px;
    letter-spacing: -.03em;
    margin: 4px 0 5px;
}

.requirements-bulk-head p {
    color: #688076;
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
    max-width: 650px;
}

.requirements-bulk-body {
    overflow: auto;
    padding: 24px 28px 28px;
}

.requirements-bulk-settings,
.requirements-bulk-progress {
    display: grid;
    gap: 20px;
}

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

.requirements-bulk-option {
    display: grid;
    gap: 8px;
}

.requirements-bulk-option-wide {
    grid-column: 1 / -1;
}

.requirements-bulk-option > span {
    color: #253f34;
    font-size: 13px;
    font-weight: 800;
}

.requirements-bulk-option small {
    color: #82948c;
    font-size: 12px;
    line-height: 1.45;
}

.requirements-bulk-check {
    align-items: flex-start;
    background: #f8fbf9;
    border: 1px solid #e0ebe5;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    padding: 15px 16px;
}

.requirements-bulk-check input {
    accent-color: #0fa66d;
    height: 18px;
    margin-top: 2px;
    width: 18px;
}

.requirements-bulk-check span {
    display: grid;
    gap: 3px;
}

.requirements-bulk-check strong {
    color: #1c342a;
    font-size: 13px;
}

.requirements-bulk-check small {
    color: #758b81;
    font-size: 12px;
    line-height: 1.45;
}

.requirements-bulk-warning {
    align-items: center;
    background: #fff9e8;
    border: 1px solid #f4df9b;
    border-radius: 16px;
    color: #765d16;
    display: flex;
    font-size: 12px;
    font-weight: 700;
    gap: 10px;
    line-height: 1.5;
    padding: 13px 15px;
}

.requirements-bulk-warning::before {
    align-items: center;
    background: #ffecad;
    border-radius: 999px;
    content: '!';
    display: inline-flex;
    flex: 0 0 24px;
    font-size: 13px;
    font-weight: 900;
    height: 24px;
    justify-content: center;
}

.requirements-bulk-progress-head {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.requirements-bulk-progress-head > div {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.requirements-bulk-progress-head span {
    color: #13845c;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.requirements-bulk-progress-head strong {
    color: #142a21;
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.requirements-bulk-progress-head b {
    color: #0f9d67;
    font-size: 24px;
}

.requirements-bulk-track {
    background: #e8f1ec;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.requirements-bulk-track span {
    background: linear-gradient(90deg, #18c783, #078d5d);
    border-radius: inherit;
    display: block;
    height: 100%;
    transition: width .28s ease;
    width: 0;
}

.requirements-bulk-stats {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.requirements-bulk-stats > div {
    background: #f8fbf9;
    border: 1px solid #e3ece7;
    border-radius: 17px;
    display: grid;
    gap: 5px;
    padding: 13px 15px;
}

.requirements-bulk-stats span {
    color: #7b8e85;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.requirements-bulk-stats strong {
    color: #193228;
    font-size: 22px;
}

.requirements-bulk-log {
    border: 1px solid #e4ede8;
    border-radius: 18px;
    display: grid;
    max-height: 320px;
    overflow: auto;
}

.requirements-bulk-log:empty {
    display: none;
}

.requirements-bulk-log-row {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 12px 14px;
}

.requirements-bulk-log-row + .requirements-bulk-log-row {
    border-top: 1px solid #edf2ef;
}

.requirements-bulk-log-marker {
    align-items: center;
    background: #ebf8f1;
    border-radius: 11px;
    color: #0d9963;
    display: inline-flex;
    font-size: 14px;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.requirements-bulk-log-row.is-skipped .requirements-bulk-log-marker {
    background: #f1f4f2;
    color: #77877f;
}

.requirements-bulk-log-row.is-failed .requirements-bulk-log-marker {
    background: #fff0ef;
    color: #d54035;
}

.requirements-bulk-log-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.requirements-bulk-log-row strong {
    color: #1b3128;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.requirements-bulk-log-row small {
    color: #7a8d84;
    font-size: 12px;
    line-height: 1.4;
}

.requirements-bulk-footer {
    background: #fbfdfc;
    border-top: 1px solid #e6eee9;
    padding: 18px 28px;
}

.requirements-bulk-footer > span {
    color: #6e8278;
    font-size: 12px;
    font-weight: 700;
}

.requirements-bulk-footer > div {
    display: flex;
    gap: 10px;
}

@media (max-width: 760px) {
    .requirements-bulk-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .requirements-bulk-modal {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 92vh;
        width: 100%;
    }

    .requirements-bulk-head,
    .requirements-bulk-body,
    .requirements-bulk-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .requirements-bulk-grid,
    .requirements-bulk-stats {
        grid-template-columns: 1fr 1fr;
    }

    .requirements-bulk-option-wide {
        grid-column: 1 / -1;
    }

    .requirements-bulk-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .requirements-bulk-footer > div {
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .requirements-bulk-grid,
    .requirements-bulk-stats {
        grid-template-columns: 1fr;
    }

    .requirements-bulk-option-wide {
        grid-column: auto;
    }

    .requirements-bulk-head h2 {
        font-size: 21px;
    }

    .requirements-bulk-footer > div {
        display: grid;
        grid-template-columns: 1fr;
    }
}
