/* ============================================================
   CRM theme — modern, playful, light + dark
   Same class contract as v1: every page keeps working.
   ============================================================ */
:root {
    --bg:          #f2f5fb;
    --surface:     #ffffff;
    --surface-2:   #f8fafd;
    --border:      #e4e9f4;
    --text:        #17203a;
    --text-2:      #5a6479;
    --text-3:      #97a0b5;
    --primary:     #3b5bfd;
    --primary-600: #2b48e0;
    --primary-50:  #eef2ff;
    --accent:      #7c3aed;
    --grad:        linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    --green:       #16a34a;
    --green-bg:    #e8f9f0;
    --red:         #dc2626;
    --red-bg:      #feeeee;
    --amber:       #d97706;
    --amber-bg:    #fff6e4;
    --blue:        #2563eb;
    --blue-bg:     #eaf2ff;
    --purple:      #7c3aed;
    --purple-bg:   #f3edff;
    --gray:        #64748b;
    --gray-bg:     #eef2f7;
    --radius:      14px;
    --shadow:      0 1px 3px rgba(23, 32, 58, .06), 0 1px 2px rgba(23, 32, 58, .04);
    --shadow-md:   0 6px 18px rgba(23, 32, 58, .09);
    --shadow-lg:   0 16px 40px rgba(23, 32, 58, .16);
    --sidebar-w:   250px;
    --sidebar-bg:  linear-gradient(180deg, #0e1630 0%, #101b3f 60%, #131c44 100%);
    --ring:        0 0 0 3px rgba(59, 91, 253, .18);
}

[data-theme="dark"] {
    --bg:          #0b1120;
    --surface:     #121a30;
    --surface-2:   #16203a;
    --border:      #23304f;
    --text:        #e7ecf7;
    --text-2:      #a7b1c8;
    --text-3:      #6d7891;
    --primary:     #6d8bff;
    --primary-600: #5877f5;
    --primary-50:  #1a2547;
    --grad:        linear-gradient(135deg, #5b54e8 0%, #3f7bf6 100%);
    --green:       #4ade80;
    --green-bg:    #10301f;
    --red:         #f87171;
    --red-bg:      #3a1620;
    --amber:       #fbbf24;
    --amber-bg:    #382a10;
    --blue:        #7aa5ff;
    --blue-bg:     #14224a;
    --purple:      #b195ff;
    --purple-bg:   #251b44;
    --gray:        #94a3b8;
    --gray-bg:     #1b2440;
    --shadow:      0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md:   0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg:   0 16px 40px rgba(0, 0, 0, .6);
    --sidebar-bg:  linear-gradient(180deg, #0a1020 0%, #0d142c 100%);
    --ring:        0 0 0 3px rgba(109, 139, 255, .25);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    color: var(--text);
    background: var(--bg);
}
body { transition: background .25s ease, color .25s ease; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(79, 70, 229, .25); }

/* slim, theme-aware scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--text-3) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand img {
    width: 38px; height: 38px; border-radius: 10px;
    box-shadow: 0 4px 14px rgba(59, 91, 253, .45);
    transition: transform .25s ease;
}
.sidebar-brand:hover img { transform: rotate(-6deg) scale(1.06); }
.brand-name { font-weight: 700; color: #fff; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: #7d8aa5; }

.sidebar-nav { flex: 1; padding: 10px 10px 20px; }
.nav-section {
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #5d6b8c;
    margin: 18px 8px 6px;
    font-weight: 700;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #b5c0d4;
    padding: 9px 12px;
    border-radius: 10px;
    margin-bottom: 2px;
    font-weight: 500;
    position: relative;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-link svg { width: 18px; height: 18px; flex: none; transition: transform .18s ease; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; transform: translateX(3px); }
.nav-link:hover svg { transform: scale(1.12); }
.nav-link.active {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 6px 16px rgba(59, 91, 253, .35);
}
.nav-link.active::before {
    content: "";
    position: absolute;
    left: -10px; top: 20%;
    height: 60%; width: 4px;
    border-radius: 99px;
    background: #8ab4ff;
}
.sidebar-foot { padding: 14px 16px; font-size: 11.5px; color: #5d6b8c; }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    height: 62px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.page-title { font-size: 18px; font-weight: 700; margin: 0; flex: 1; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    width: 38px; height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, transform .15s ease;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--gray-bg); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.menu-toggle { display: none; }

/* theme toggle: sun/moon swap */
#themeToggle .moon { display: none; }
[data-theme="dark"] #themeToggle .sun { display: none; }
[data-theme="dark"] #themeToggle .moon { display: block; }

.user-menu { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    background: none;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 5px 8px;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: background .15s ease;
}
.user-btn:hover { background: var(--gray-bg); }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 3px 10px rgba(59, 91, 253, .35);
}
.user-name { font-weight: 600; }
.chev { width: 15px; height: 15px; color: var(--text-3); transition: transform .2s ease; }
.user-menu:hover .chev { transform: translateY(1px); }

.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 210px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.dropdown.open { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dropdown a { display: block; padding: 10px 14px; color: var(--text); transition: background .12s ease, padding-left .12s ease; }
.dropdown a:hover { background: var(--gray-bg); text-decoration: none; padding-left: 18px; }

/* ---------- Content ---------- */
.content { padding: 26px; max-width: 1500px; width: 100%; }

/* gentle entry animation for each page */
@keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
.content > * { animation: rise-in .35s ease both; }
.content > *:nth-child(2) { animation-delay: .04s; }
.content > *:nth-child(3) { animation-delay: .08s; }
.content > *:nth-child(4) { animation-delay: .12s; }
.content > *:nth-child(5) { animation-delay: .16s; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head h2 { margin: 0; font-size: 17px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: box-shadow .2s ease, border-color .2s ease, background .25s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* ---------- Stat tiles ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    gap: 13px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--grad);
    opacity: 0;
    transition: opacity .18s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat:hover::after { opacity: 1; }
.stat-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    transition: transform .2s ease;
}
.stat:hover .stat-icon { transform: scale(1.1) rotate(-4deg); }
.stat-icon svg { width: 20px; height: 20px; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 21px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tone-blue   { background: var(--blue-bg);   color: var(--blue); }
.tone-green  { background: var(--green-bg);  color: var(--green); }
.tone-red    { background: var(--red-bg);    color: var(--red); }
.tone-amber  { background: var(--amber-bg);  color: var(--amber); }
.tone-purple { background: var(--purple-bg); color: var(--purple); }
.tone-gray   { background: var(--gray-bg);   color: var(--gray); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.data th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-2);
    font-weight: 700;
    padding: 11px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty {
    padding: 42px 20px;
    text-align: center;
    color: var(--text-3);
}
.row-danger td { background: var(--red-bg) !important; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
    transition: transform .12s ease;
}
tr:hover .badge { transform: scale(1.04); }
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn-primary {
    background: var(--grad);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 91, 253, .3);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(59, 91, 253, .4); filter: brightness(1.05); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: none; color: var(--primary); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ---------- Forms ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 15px 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--red); }
input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=month], input[type=search], select, textarea {
    font: inherit;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    width: 100%;
    transition: border-color .15s ease, box-shadow .15s ease, background .25s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; min-height: 74px; }
.field-help { font-size: 12px; color: var(--text-3); }
.form-actions {
    display: flex;
    gap: 9px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox-row input { width: auto; accent-color: var(--primary); }
input[type=checkbox] { accent-color: var(--primary); }

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar input[type=search], .filter-bar input[type=text] { width: 230px; }
.filter-bar select { width: auto; min-width: 140px; }
.filter-bar input[type=date] { width: auto; }

/* ---------- Alerts → animated toasts ---------- */
.toasts {
    position: fixed;
    top: 74px;
    right: 22px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: none; }
}
.toasts .alert {
    animation: toast-in .3s ease both;
    box-shadow: var(--shadow-lg);
    margin: 0;
    padding-right: 38px;
    position: relative;
    overflow: hidden;
}
.toasts .alert.hide { opacity: 0; transform: translateX(30px); transition: all .3s ease; }
.toast-close {
    position: absolute;
    top: 8px; right: 8px;
    background: none; border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: inherit;
    opacity: .6;
}
.toast-close:hover { opacity: 1; }
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert-error   { background: var(--red-bg);   color: var(--red);   border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert-info    { background: var(--blue-bg);  color: var(--blue);  border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    gap: 5px;
    padding: 14px 16px;
    flex-wrap: wrap;
}
.page-link {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 9px;
    border: 1px solid var(--border);
    color: var(--text-2);
    font-weight: 600;
    font-size: 13px;
    transition: all .15s ease;
}
.page-link:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.page-link.active { background: var(--grad); color: #fff; border-color: transparent; }
.page-gap { align-self: center; color: var(--text-3); }

/* ---------- Misc ---------- */
.muted { color: var(--text-3); font-size: 12.5px; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.mono { font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.mb-0 { margin-bottom: 0; }
.stock-pill { font-weight: 700; font-variant-numeric: tabular-nums; }
.progress {
    height: 7px;
    border-radius: 99px;
    background: var(--gray-bg);
    overflow: hidden;
    min-width: 70px;
}
.progress > span {
    display: block; height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transition: width .6s cubic-bezier(.22, 1, .36, 1);
}
.progress > span.warn { background: linear-gradient(90deg, #fbbf24, #d97706); }
.progress > span.danger { background: linear-gradient(90deg, #f87171, #dc2626); }

.cat-toggle { transition: transform .15s ease; }
.cat-toggle:hover { transform: scale(1.3); color: var(--primary) !important; }

details summary { transition: opacity .15s ease; }

/* ---------- Document (invoice/quote) view ---------- */
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.doc-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -.02em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.doc-meta { color: var(--text-2); font-size: 13.5px; line-height: 1.65; }
.doc-totals { margin-left: auto; width: 300px; max-width: 100%; }
.doc-totals table { width: 100%; border-collapse: collapse; }
.doc-totals td { padding: 6px 0; }
.doc-totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.doc-totals tr.grand td {
    font-size: 17px;
    font-weight: 800;
    border-top: 2px solid var(--text);
    padding-top: 10px;
}

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(900px 500px at 15% 10%, rgba(79, 70, 229, .35), transparent 60%),
        radial-gradient(800px 500px at 85% 90%, rgba(59, 130, 246, .3), transparent 60%),
        #0d1330;
    padding: 20px;
}
.login-card {
    width: 400px;
    max-width: 100%;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 36px;
    animation: rise-in .45s ease both;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand img { width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 6px 18px rgba(59, 91, 253, .4); }
.login-brand h1 { font-size: 19px; margin: 0; }
.login-brand span { color: var(--text-3); font-size: 13px; }
.login-card .field { margin-bottom: 15px; }

/* ---------- Line-item editor ---------- */
.items-editor th { background: var(--surface-2); }
.items-editor input, .items-editor select { min-width: 70px; }
.items-editor .remove-row,
.remove-row {
    color: var(--red);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 7px;
    transition: background .12s ease, transform .12s ease;
}
.items-editor .remove-row:hover, .remove-row:hover { background: var(--red-bg); transform: scale(1.15); }

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .page-actions, .no-print, .alert, .toasts { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; max-width: none; }
    .content > * { animation: none !important; }
    .card { border: none; box-shadow: none; }
    body { background: #fff; color: #000; }
    .doc-title { color: #17203a; background: none; -webkit-background-clip: unset; background-clip: unset; }
}

/* ---------- Accessibility: honour reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(10, 14, 30, .55);
        backdrop-filter: blur(2px);
        z-index: 35;
    }
    .sidebar-overlay.show { display: block; }
    .main { margin-left: 0; }
    .icon-btn.menu-toggle { display: inline-flex; }
    .user-name, .chev { display: none; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .filter-bar input[type=search] { width: 100%; }
    .toasts { left: 16px; right: 16px; max-width: none; }
}

/* ---------- Subscription banner + billing ---------- */
.sub-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px 18px; border-radius: var(--radius, 12px); margin-bottom: 18px;
    font-size: 13.5px; border: 1px solid;
    animation: rise-in .35s ease both;
}
.sub-banner-warn   { background: var(--amber-bg); border-color: var(--amber); color: var(--text); }
.sub-banner-danger { background: var(--red-bg);   border-color: var(--red);   color: var(--text); }
.plan-ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.plan-ring svg { transform: rotate(-90deg); }
.plan-ring .ring-bg   { stroke: var(--border); }
.plan-ring .ring-val  { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.plan-ring .ring-text {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; text-align: center;
}
.plan-ring .ring-text strong { font-size: 26px; line-height: 1; }
.plan-ring .ring-text span { font-size: 11px; color: var(--text-3); }
.cycle-switch { display: inline-flex; background: var(--surface-2, var(--bg)); border: 1px solid var(--border); border-radius: 11px; padding: 4px; gap: 4px; }
.cycle-switch label { padding: 8px 18px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--text-2); position: relative; }
.cycle-switch input { position: absolute; opacity: 0; }
.cycle-switch label:has(input:checked) { background: var(--grad); color: #fff; box-shadow: 0 4px 10px rgba(59,91,253,.3); }
.cycle-switch .save-tag { font-size: 10.5px; font-weight: 800; margin-left: 6px; opacity: .9; }
.mod-pick { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 12px; padding: 13px 14px; margin-top: 10px; cursor: pointer; transition: .15s; }
.mod-pick:hover { border-color: var(--primary); }
.mod-pick.on { border-color: var(--primary); background: var(--primary-bg, rgba(79,70,229,.07)); }
.mod-pick.base { cursor: default; border-style: dashed; }
.mod-pick input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.mod-pick .mp-info { flex: 1; }
.mod-pick .mp-info strong { display: block; font-size: 14px; }
.mod-pick .mp-info span { color: var(--text-2); font-size: 12.5px; }
.mod-pick .mp-price { font-weight: 800; white-space: nowrap; }
