/* ==========================================================================
   ExclusiveBabyDivaFL Enterprise: design system
   Palette taken from the crown logo: true black, crown gold, warm ivory.
   ========================================================================== */

:root {
    --ink: #0b0a08;
    --ink-2: #1a1814;
    --ink-3: #2b2720;
    --gold: #c9962f;
    --gold-strong: #a97a1c;
    --gold-bright: #e3bd62;
    --gold-soft: #f7eed9;
    --gold-tint: #fcf8ef;
    --bg: #f6f4ef;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --line: #e9e4da;
    --line-strong: #d9d2c3;
    --text: #1a1814;
    --muted: #756f65;
    --faint: #a39d92;
    --success: #2f7d4f;
    --success-soft: #e5f3ea;
    --warning: #a86b0c;
    --warning-soft: #fdf1dc;
    --danger: #b3372b;
    --danger-soft: #fbe7e4;
    --info: #3b5f8a;
    --info-soft: #e7eef7;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(20, 16, 8, .05);
    --shadow: 0 1px 2px rgba(20, 16, 8, .04), 0 8px 24px rgba(20, 16, 8, .06);
    --shadow-lg: 0 24px 64px rgba(12, 10, 6, .24);
    --sidebar: 264px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --serif: "Playfair Display", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0; color: var(--ink); }
h1, h2, h3, h4, b, strong, .stat-value, .donut b, .date-tile b, .measure-chips b, .hero-ring-inner strong, .totals-box b { font-variant-numeric: lining-nums; }
h1:focus { outline: none; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
::selection { background: var(--gold-soft); }

/* ---------- Text helpers ---------- */
.muted { color: var(--muted); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-gold { color: var(--gold-strong) !important; }
.prewrap { white-space: pre-wrap; margin: 0; }
.eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-strong); }
.link { color: var(--gold-strong); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font-size: inherit; }
.link:hover { color: var(--ink); }
.link-strong { font-weight: 600; color: var(--ink); }
.link-strong:hover { color: var(--gold-strong); }
.icon { flex: none; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
    background: var(--ink); color: #d8d3c8; display: flex; flex-direction: column;
    background-image: linear-gradient(160deg, rgba(201, 150, 47, .09) 0, transparent 38%), repeating-linear-gradient(135deg, transparent 0 22px, rgba(201, 150, 47, .035) 22px 23px);
}
.main-column { margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.content { padding: 28px 36px 56px; width: 100%; max-width: 1680px; margin: 0 auto; }
.sidebar-scrim, .dropdown-scrim { display: none; }
.dropdown-scrim { display: block; position: fixed; inset: 0; z-index: 25; }

.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 20px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand-logo { width: 46px; height: 46px; border-radius: 50%; object-fit: contain; background: #fff; padding: 4px; box-shadow: 0 0 0 2px var(--gold), 0 6px 18px rgba(0, 0, 0, .4); }
.brand-text b { display: block; font: 600 17px var(--serif); color: #fff; letter-spacing: .2px; }
.brand-text small { display: block; font-size: 11px; color: #9c968a; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-label { margin: 18px 12px 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #6f695e; }
.nav-label:first-child { margin-top: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 10px;
    color: #c7c1b5; font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
}
.nav-link .icon { color: #8d877b; transition: color .15s; }
.nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-link:hover .icon { color: var(--gold-bright); }
.nav-link.active { background: linear-gradient(90deg, rgba(201, 150, 47, .22), rgba(201, 150, 47, .06)); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-link.active .icon { color: var(--gold-bright); }
.side-footer { display: flex; align-items: center; gap: 10px; margin: 12px; padding: 12px 14px; border: 1px solid rgba(201, 150, 47, .25); border-radius: 12px; background: rgba(255, 255, 255, .03); }
.side-footer b { display: block; color: #fff; font-size: 12.5px; }
.side-footer small { color: #8d877b; font-size: 11px; }
.unit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(201, 150, 47, .18); }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30; height: 68px; display: flex; align-items: center; gap: 16px; padding: 0 36px;
    background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.menu-toggle { display: none !important; }
.global-search {
    flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.global-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 150, 47, .14); background: #fff; }
.global-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; }
.global-search kbd { font: 500 10.5px var(--font); color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: #fff; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 35; min-width: 280px; background: #fff; border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; animation: pop .14s ease-out;
}
.dropdown-title { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; }
.dropdown-empty { margin: 4px 10px 12px; color: var(--muted); font-size: 13px; }
.dropdown-footer { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--gold-strong); }
.notify-menu { width: 340px; max-height: 420px; overflow-y: auto; }
.notify-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; }
.notify-item:hover { background: var(--surface-2); }
.notify-item b { display: block; font-size: 13px; font-weight: 600; }
.notify-item small { color: var(--muted); font-size: 12px; }
.notify-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex: none; }
.notify-dot.danger { background: var(--danger); }
.notify-dot.muted { background: var(--line-strong); }
.notify-item.unread { background: var(--gold-tint); }
.notify-item small { display: block; }
.notify-item small.notify-time { font-size: 11px; margin-top: 2px; }
.dropdown-title .small-link { float: right; text-transform: none; letter-spacing: 0; font-size: 12px; }
.notify-btn { position: relative; }
.notify-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); transition: border-color .15s; }
.user-chip:hover { border-color: var(--line-strong); }
.user-chip-text { text-align: left; line-height: 1.2; }
.user-chip-text b { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.user-chip-text small { font-size: 11px; color: var(--muted); }
.user-menu { width: 260px; }
.user-menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu-head b { display: block; font-size: 14px; }
.user-menu-head small { color: var(--muted); font-size: 12px; }
.menu-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; border: 0; background: none; font-size: 13.5px; font-weight: 500; color: var(--text); text-align: left; }
.menu-link:hover { background: var(--surface-2); }
.menu-link.danger { color: var(--danger); }
.menu-link.danger:hover { background: var(--danger-soft); }

.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, #1f1b14, #3a3226); color: var(--gold-bright); font-weight: 700; font-size: 12px; letter-spacing: .02em;
}
.avatar.sm { width: 32px; height: 32px; font-size: 11.5px; background: var(--gold-soft); color: var(--gold-strong); }
.avatar.lg { width: 42px; height: 42px; font-size: 14px; }
.avatar.xl { width: 72px; height: 72px; font-size: 22px; font-family: var(--serif); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--gold); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
    border: 1px solid transparent; font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .tab:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(201, 150, 47, .3); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 4px 12px rgba(11, 10, 8, .18); }
.btn-primary .icon { color: var(--gold-bright); }
.btn-primary:hover:not(:disabled) { background: var(--ink-3); }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-strong); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #962b21; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-lg { height: 48px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
    background: transparent; color: var(--muted); transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line); background: #fff; }
.icon-btn.bordered:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-strong); }
.icon-btn.danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font: 600 30px/1.15 var(--serif); margin: 6px 0 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-header h1 .badge { font-family: var(--font); }
.page-header p { margin: 0; color: var(--muted); max-width: 680px; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: 13px; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); margin-bottom: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head.padded { padding: 18px 22px 0; }
.card-head h3 { font: 600 18px var(--serif); }
.card-head .eyebrow { margin-bottom: 3px; }
.card-head .muted { font-size: 12.5px; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.grid-2, .grid-3-2, .grid-2-1 { display: grid; gap: 18px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Side-by-side tables (Reports) stack sooner, so neither has to scroll. */
@media (max-width: 1500px) { .grid-2.table-pair { grid-template-columns: minmax(0, 1fr); } }
.grid-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-grid.compact .stat-card { padding: 14px 16px; }
.stat-grid.compact .stat-value { font-size: 22px; margin-top: 6px; }
.stat-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.stat-card.linked:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.tone-gold { background: var(--gold-soft); color: var(--gold-strong); }
.tone-ink { background: #ece9e2; color: var(--ink); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.stat-value { display: block; font: 600 26px/1.2 var(--serif); color: var(--ink); margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-note { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Dashboard ---------- */
.hero {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 30px;
    padding: 34px 44px; margin-bottom: 18px; border-radius: 18px; color: #fff; background: var(--ink);
    background-image: radial-gradient(circle at 85% 20%, rgba(201, 150, 47, .28), transparent 42%), repeating-linear-gradient(120deg, transparent 0 34px, rgba(201, 150, 47, .06) 34px 35px);
}
.hero::after { content: ""; position: absolute; left: 38%; right: -10%; bottom: -60px; height: 90px; background: var(--gold); transform: rotate(-6deg); opacity: .9; border-radius: 50% 0 0 0; }
.hero-copy { position: relative; z-index: 1; max-width: 560px; }
.hero-kicker { font-size: 11px; letter-spacing: .18em; color: var(--gold-bright); font-weight: 600; }
.hero h2 { color: #fff; font: 600 34px/1.1 var(--serif); margin: 10px 0 12px; }
.hero h2 em { color: var(--gold-bright); }
.hero p { color: #bdb6a9; margin: 0 0 14px; }
.hero-link { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-bright); font-weight: 600; font-size: 13px; }
.hero-ring { --pct: 0; position: relative; z-index: 1; width: 164px; height: 164px; border-radius: 50%; flex: none; margin-right: 24px;
    background: conic-gradient(var(--gold-bright) calc(var(--pct) * 1%), rgba(255, 255, 255, .1) 0); display: grid; place-items: center; }
.hero-ring-inner { width: 130px; height: 130px; border-radius: 50%; background: var(--ink); display: grid; place-content: center; text-align: center; }
.hero-ring-inner strong { font: 600 34px var(--serif); color: #fff; }
.hero-ring-inner span { font-size: 11px; color: #a39c8e; letter-spacing: .08em; text-transform: uppercase; }

.pipeline { display: flex; flex-direction: column; gap: 4px; }
.pipeline-row { display: grid; grid-template-columns: 180px 1fr 30px; align-items: center; gap: 16px; padding: 8px 6px; border-radius: 9px; }
.pipeline-row:hover { background: var(--surface-2); }
.pipeline-name b { display: block; font-size: 13.5px; font-weight: 600; }
.pipeline-name small { display: block; font-size: 11.5px; color: var(--muted); }
.pipeline-row strong { text-align: right; font-size: 15px; }
.bar { height: 8px; border-radius: 99px; background: #efebe3; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-strong), var(--gold-bright)); transition: width .4s ease; }

.due-list { display: flex; flex-direction: column; }
.due-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.due-item:last-child { border-bottom: 0; }
.due-item:hover .due-copy b { color: var(--gold-strong); }
.date-tile { width: 44px; height: 48px; flex: none; border-radius: 10px; border: 1px solid var(--line); display: grid; place-content: center; text-align: center; background: var(--gold-tint); }
.date-tile b { font: 600 18px/1 var(--serif); }
.date-tile small { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--gold-strong); }
.date-tile.overdue { background: var(--danger-soft); border-color: #f1c9c3; }
.date-tile.overdue small { color: var(--danger); }
.due-copy { flex: 1; min-width: 0; }
.due-copy b { display: block; font-size: 13.5px; font-weight: 600; }
.due-copy small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.due-meta small { font-size: 11.5px; color: var(--muted); }

.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch.gold { background: var(--gold); }
.swatch.ink { background: var(--ink); }
.bar-chart { display: flex; align-items: flex-end; gap: 18px; height: 220px; padding: 10px 6px 0; border-bottom: 1px solid var(--line);
    background: repeating-linear-gradient(to top, transparent 0 54px, #f1ede5 54px 55px); }
.bar-group { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.bar-pair i { width: min(22px, 38%); border-radius: 6px 6px 2px 2px; transition: height .4s ease; }
.bar-pair i.gold { background: linear-gradient(180deg, var(--gold-bright), var(--gold-strong)); }
.bar-pair i.ink { background: linear-gradient(180deg, #4a4337, var(--ink)); }
.bar-group small { font-size: 11.5px; color: var(--muted); padding-bottom: 6px; }
.donut-wrap { display: flex; align-items: center; gap: 28px; padding: 8px 4px; }
.donut { width: 150px; height: 150px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.donut > div { width: 96px; height: 96px; border-radius: 50%; background: #fff; display: grid; place-content: center; text-align: center; }
.donut b { font: 600 26px var(--serif); }
.donut small { font-size: 11px; color: var(--muted); }
.legend { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.legend span { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; color: var(--ink); }

/* ---------- Toolbar, search, chips, tabs ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-input { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; min-width: 260px; flex: 0 1 340px; background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--faint); }
.search-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 150, 47, .12); }
.search-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .15s; }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.select-sm { height: 36px; padding: 0 30px 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23756f65' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; font-size: 13px; color: var(--text); outline: none; }
.select-sm:focus { border-color: var(--gold); }
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field-inline input { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--gold-strong); }
/* Scrolls sideways on narrow screens without showing a scrollbar. The divider is an inset shadow so the
   active underline sits inside the strip; an underline hanging below it made the strip scrollable. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; height: 42px; padding: 0 16px; border: 0; background: none; font-weight: 600; font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab span { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eeeae2; color: var(--muted); }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--gold); }
.tab.active span { background: var(--gold-soft); color: var(--gold-strong); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap.flush { margin: 0 -22px -20px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f0ece4; vertical-align: middle; }
.table td > b, .table td > strong { font-weight: 600; }
.table td small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.table td small.note { font-style: italic; white-space: pre-line; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.hover tbody tr:hover, .table tr.clickable:hover { background: var(--gold-tint); }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; white-space: nowrap; }
.table .center { text-align: center; }
.table td.wrap { white-space: normal; max-width: 420px; color: var(--muted); }
.table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.table tfoot tr.grand td { font-size: 14px; color: var(--ink); }
.table .select-sm { height: 30px; font-size: 12px; }
.row-actions { white-space: nowrap; text-align: right; width: 1%; }
.row-actions > * { vertical-align: middle; }
.measure-card header .row-actions { width: auto; flex: none; }
.measure-card header .person { flex: 1; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { display: block; font-weight: 600; }
.person small { display: block; color: var(--muted); font-size: 12px; }
.person.lg { margin-bottom: 14px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 7px; background: #f1ede5; color: #5c564c; font-size: 12px; font-weight: 500; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { background: #f0ede6; color: #5c564c; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.role-pill { display: inline-block; padding: 3px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; background: #f0ede6; color: #4b463d; }
.role-administrator { background: var(--ink); color: var(--gold-bright); }
.role-manager { background: var(--gold-soft); color: var(--gold-strong); }
.role-finance { background: var(--success-soft); color: var(--success); }
.role-production { background: var(--info-soft); color: var(--info); }
.role-hr { background: #f3e8f1; color: #7b3f6e; }
.audit-action { font-weight: 600; font-size: 12.5px; }
.audit-action.danger { color: var(--danger); }
.audit-action.success { color: var(--success); }
.audit-action.info { color: var(--info); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: #4b463d; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .measure-row input, .input-action input {
    width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--text);
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 70px; padding: 10px 12px; resize: vertical; }
.field select { appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23756f65' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.field input:focus, .field select:focus, .field textarea:focus, .measure-row input:focus, .input-action input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 150, 47, .14); }
.field input.invalid, .field select.invalid, .field textarea.invalid { border-color: var(--danger); }
.field.align-end, .check.align-end { justify-content: flex-end; flex-direction: row; align-items: center; gap: 8px; align-self: end; height: 40px; }
.validation-message { color: var(--danger); font-size: 12px; }
.validation-errors { color: var(--danger); font-size: 12.5px; margin: 0 0 10px; padding-left: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-hint { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.form-section { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.form-section h4, .section-head h4 { font: 600 15px var(--serif); margin-bottom: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; flex-wrap: wrap; }
.section-head h4 { margin: 0; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 13px; color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 40px !important; height: 46px !important; border-radius: 12px !important; }
.input-icon .reveal { position: absolute; right: 8px; border: 0; background: none; color: var(--gold-strong); font-size: 12px; font-weight: 600; padding: 6px 8px; }
.input-action { display: flex; gap: 8px; }
.summary-strip { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--gold-tint); border: 1px solid #efe2c3; font-size: 13px; color: var(--muted); }
.summary-strip b { color: var(--ink); margin-left: 4px; }
.preview-number { font: 600 16px ui-monospace, Consolas, monospace; color: var(--gold-strong); padding: 9px 0; }

/* Order editor line items */
.line-items { display: flex; flex-direction: column; gap: 10px; }
.line-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.line-main { display: grid; grid-template-columns: 1.6fr 1fr 1.1fr 1fr .6fr .6fr 1fr 1fr 34px; gap: 10px; align-items: end; }
.line-main .field.sm input { padding: 0 8px; }
.line-total { display: flex; flex-direction: column; gap: 6px; }
.line-total span { font-size: 12.5px; font-weight: 600; color: #4b463d; }
.line-total b { height: 40px; display: flex; align-items: center; font-weight: 700; }
.line-main .icon-btn { margin-bottom: 3px; }
.line-extra { margin-top: 10px; }
.line-extra summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--gold-strong); list-style: none; }
.line-extra summary::before { content: "+ "; }
.line-extra[open] summary::before { content: "− "; }
.line-extra[open] .form-grid { margin-top: 10px; }
.totals-section { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.totals-box { border: 1px solid var(--line); border-radius: 12px; padding: 6px 16px; background: #fff; }
.totals-box > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.totals-box > div:last-child { border-bottom: 0; }
.totals-box span { color: var(--muted); }
.totals-box .with-input input, .totals-box .with-input select { width: 150px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; text-align: right; outline: none; background: #fff; }
.totals-box .with-input select { text-align: left; }
.totals-box .grand { border-bottom-style: solid; }
.totals-box .grand span { color: var(--ink); font-weight: 600; }
.totals-box .grand b { font: 700 20px var(--serif); color: var(--ink); }

/* Measurements */
.measure-rows { display: flex; flex-direction: column; gap: 6px; }
.measure-row { display: grid; grid-template-columns: 1fr 1.2fr .8fr 1.3fr 34px; gap: 8px; align-items: center; }
.measure-row.head span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.measure-row input { height: 36px !important; }
.measure-row .value-input { font-weight: 700; color: var(--gold-strong); }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.measure-card { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.measure-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.measure-card footer { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.measure-group h5 { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.measure-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.measure-chips span { border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; background: var(--gold-tint); min-width: 0; }
.measure-chips small { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.measure-chips b { display: block; font: 700 15px var(--serif); color: var(--gold-strong); overflow-wrap: anywhere; }
.measure-chips span.wide { grid-column: span 2; }
.measure-chips span.full { grid-column: 1 / -1; }
.measure-peek { border-top: 1px solid var(--line); padding: 10px 0; }
.measure-peek summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.measure-peek summary span { color: var(--muted); font-size: 12px; }
.measure-peek .measure-chips { margin-top: 10px; }

/* Order detail */
.stepper-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.stepper { flex: 1; display: flex; align-items: flex-start; overflow-x: auto; }
.step { flex: 1; min-width: 86px; position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; border: 0; background: none; padding: 0 4px; }
.step::before { content: ""; position: absolute; top: 14px; left: calc(-50% + 16px); right: calc(50% + 16px); height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--gold); }
.step-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--line-strong); background: #fff; color: var(--muted); position: relative; z-index: 1; transition: all .15s; }
.step.done .step-dot { background: var(--gold); border-color: var(--gold); color: #fff; }
.step.current .step-dot { background: var(--ink); border-color: var(--ink); color: var(--gold-bright); box-shadow: 0 0 0 5px rgba(201, 150, 47, .2); }
.step-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; }
.step.current .step-label { color: var(--ink); }
.step:hover .step-dot { border-color: var(--gold); }
.stepper-side { display: flex; align-items: center; gap: 10px; flex: none; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.doc-row > div { flex: 1; min-width: 0; }
.doc-row b { display: block; font-size: 13.5px; }
.doc-row small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.doc-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); flex: none; }
.meta-list { display: grid; grid-template-columns: 120px 1fr; gap: 9px 12px; margin: 0; font-size: 13.5px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.note-box { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--gold-tint); border: 1px solid #efe2c3; font-size: 13px; }

/* Customer profile */
.profile-hero { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.profile-hero-text { flex: 1; min-width: 240px; }
.profile-hero h1 { font: 600 30px var(--serif); margin: 4px 0 8px; }
.contact-line { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.contact-line a, .contact-line span { display: inline-flex; align-items: center; gap: 6px; }
.contact-line a:hover { color: var(--gold-strong); }
.profile-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-card h3 { font: 600 20px var(--serif); margin-top: 6px; }
.profile-card .meta-list { width: 100%; text-align: left; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Production kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kanban-col { background: #efece5; border-radius: 14px; padding: 10px; min-height: 240px; }
.kanban-col header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 4px 6px 10px; }
.kanban-col header b { display: block; font-size: 13.5px; }
.kanban-col header small { display: block; color: var(--muted); font-size: 11.5px; }
.kanban-col .count { min-width: 26px; height: 22px; padding: 0 7px; border-radius: 99px; background: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; }
.kanban-empty { text-align: center; padding: 22px 0; font-size: 12px; color: var(--faint); border: 1.5px dashed var(--line-strong); border-radius: 10px; }
.kanban-card { background: #fff; border-radius: 11px; padding: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-left: 3px solid var(--line-strong); transition: box-shadow .15s, transform .15s; }
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card.prio-high { border-left-color: var(--gold); }
.kanban-card.prio-urgent { border-left-color: var(--danger); }
.kanban-card.overdue { background: linear-gradient(0deg, #fff, #fff 70%, #fdf1ef); }
.kc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kc-number { font-size: 12px; font-weight: 700; color: var(--gold-strong); }
.kc-number:hover { text-decoration: underline; }
.kc-client { display: block; margin-top: 5px; font-size: 14px; }
.kc-garment { margin: 3px 0 8px; font-size: 12.5px; color: var(--muted); }
.kc-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.kc-meta span { display: inline-flex; align-items: center; gap: 6px; }
.kc-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.kc-actions .icon-btn { width: 30px; height: 30px; }

/* People & compliance */
.progress { height: 6px; border-radius: 99px; background: #efebe3; overflow: hidden; width: 120px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-strong), var(--gold-bright)); border-radius: 99px; }
.policy-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.policy { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.policy:hover { border-color: var(--line-strong); }
.policy.accepted { border-color: #e6cf96; background: var(--gold-tint); }
.policy input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--gold-strong); flex: none; }
.policy b { font-size: 13.5px; }
.policy p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hbar { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.hbar b { text-align: right; }
.hbar small { color: var(--muted); }

/* Admin */
.role-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.role-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.role-option:hover { border-color: var(--line-strong); }
.role-option.selected { border-color: var(--gold); background: var(--gold-tint); box-shadow: 0 0 0 3px rgba(201, 150, 47, .12); }
.role-option input { accent-color: var(--gold-strong); margin-top: 3px; }
.role-option b { display: block; font-size: 13.5px; }
.role-option small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.credential-box { border: 1px dashed var(--gold); background: var(--gold-tint); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.credential-box small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.credential-box b { font-size: 16px; overflow-wrap: anywhere; }
.result-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--line); border-radius: 8px; }
.result-row:hover { background: var(--gold-tint); }
.result-row > span:nth-child(2) { flex: 1; min-width: 0; }
.result-row b { display: block; font-size: 13.5px; }
.result-row small { display: block; font-size: 12px; color: var(--muted); }

/* ---------- Modal, confirm, toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(11, 10, 8, .55); backdrop-filter: blur(4px); animation: fade .15s ease-out; overflow-y: auto; }
.modal-panel { width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1120px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font: 600 22px var(--serif); margin-top: 3px; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.footer-spacer { flex: 1; }
/* Above the file viewer (85) so "Delete this file?" can be answered from inside it; below toasts (90). */
.confirm-backdrop { z-index: 88; }
.confirm-panel { padding: 26px 26px 20px; text-align: center; align-items: center; }
.confirm-panel h2 { font: 600 20px var(--serif); margin: 14px 0 6px; }
.confirm-panel p { color: var(--muted); margin: 0 0 20px; font-size: 13.5px; }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); }
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.confirm-actions { display: flex; gap: 10px; width: 100%; }
.confirm-actions .btn { flex: 1; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slide-in .2s ease-out; }
.toast span { flex: 1; }
.toast .icon-btn { color: #9c968a; width: 26px; height: 26px; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.toast-success > .icon { color: #7fd29d; }
.toast-error { background: #5b1a14; }
.toast-error > .icon { color: #ffb3a8; }
.toast-info > .icon { color: var(--gold-bright); }

/* ---------- Empty, loading, misc ---------- */
.empty-state { text-align: center; padding: 42px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state h3 { font: 600 18px var(--serif); margin-top: 6px; }
.empty-state p { margin: 0 0 8px; max-width: 420px; color: var(--muted); font-size: 13.5px; }
.empty-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); }
.access-denied { max-width: 480px; margin: 60px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.access-denied h1 { font: 600 28px var(--serif); }
.access-denied p { color: var(--muted); margin: 0 0 10px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager > div { display: flex; align-items: center; gap: 10px; }
.pager b { color: var(--ink); }
.page-loading { min-height: 50vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--gold-soft); border-top-color: var(--gold); animation: spin .8s linear infinite; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.skeleton-grid div, .table-skeleton { height: 140px; border-radius: var(--radius); background: linear-gradient(90deg, #eeebe4 0, #f7f5f0 40%, #eeebe4 80%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.table-skeleton { height: 320px; border-radius: 0; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 11px; font-size: 13.5px; margin-bottom: 16px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--success-soft); color: var(--success); }
.alert .icon { margin-top: 2px; }

#blazor-error-ui { display: none; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; }
#blazor-error-ui .reload { color: var(--gold-bright); font-weight: 600; margin: 0 8px; }
#blazor-error-ui .dismiss { cursor: pointer; opacity: .7; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Authentication ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-brand { position: relative; overflow: hidden; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; padding: 60px 48px; }
.auth-lines { position: absolute; top: -40px; left: -80px; display: flex; flex-direction: column; gap: 14px; transform: rotate(-32deg); }
.auth-lines i { display: block; width: 520px; height: 2px; background: var(--gold); opacity: .75; }
.auth-wave { position: absolute; left: -10%; right: -20%; bottom: -90px; height: 170px; background: var(--gold); border-radius: 60% 40% 0 0; transform: rotate(-8deg); }
.auth-wave::before { content: ""; position: absolute; inset: 14px 0 0; background: #fff; border-radius: 60% 40% 0 0; }
.auth-brand-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-logo { width: 132px; height: 132px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 4px var(--gold), 0 20px 50px rgba(0, 0, 0, .5); margin-bottom: 26px; }
.auth-logo img { width: 92px; height: 92px; object-fit: contain; }
.auth-brand h2 { color: #fff; font: 500 44px/1.1 var(--serif); letter-spacing: .5px; }
.auth-tagline { display: flex; flex-direction: column; margin: 12px 0 30px; font: italic 500 20px var(--serif); color: var(--gold-bright); }
.auth-tagline span:last-child { padding-left: 42px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: #c9c3b6; font-size: 14px; }
.auth-points .icon { color: var(--gold-bright); width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(201, 150, 47, .14); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: linear-gradient(180deg, #fff, var(--bg)); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card-logo { display: none; width: 64px; height: 64px; object-fit: contain; margin-bottom: 18px; }
.auth-card-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-strong); margin-bottom: 18px; }
.auth-card-icon.danger { background: var(--danger-soft); color: var(--danger); }
.auth-card h1 { font: 600 32px var(--serif); margin: 8px 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 26px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; }
.auth-help { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 22px; color: var(--muted); font-size: 12.5px; text-align: center; }
.auth-back, .auth-back-form button { display: inline-flex; align-items: center; gap: 6px; justify-content: center; width: 100%; margin-top: 18px; color: var(--muted); font-size: 13px; font-weight: 500; background: none; border: 0; }
.auth-back:hover, .auth-back-form button:hover { color: var(--ink); }
.auth-footer { margin-top: 40px; color: var(--faint); font-size: 12px; }
.password-rules { margin: 0; padding: 12px 14px 12px 32px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: grid; gap: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .line-main { grid-template-columns: repeat(4, minmax(0, 1fr)) 34px; }
    .line-main .field:first-child { grid-column: span 2; }
    .form-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3-2, .grid-2-1, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .policy-list { grid-template-columns: 1fr; }
    .totals-section { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(11, 10, 8, .45); }
    .main-column { margin-left: 0; }
    .menu-toggle { display: inline-grid !important; }
    .topbar { padding: 0 16px; gap: 10px; }
    .global-search kbd, .user-chip-text { display: none; }
    .content { padding: 20px 16px 48px; }
    .hero { padding: 26px; }
    .hero-ring { display: none; }
    .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid .span-3, .form-grid .span-4 { grid-column: 1 / -1; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card-logo { display: block; }
    .stepper-card { flex-direction: column; align-items: stretch; }
}
@media (max-width: 640px) {
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .form-grid.cols-3, .form-grid.cols-4, .form-grid.cols-5 { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2 { grid-column: auto; }
    .line-main { grid-template-columns: 1fr 1fr; }
    .line-main .field:first-child { grid-column: 1 / -1; }
    .measure-row { grid-template-columns: 1fr 1fr; }
    .measure-row.head { display: none; }
    .page-header h1 { font-size: 25px; }
    .search-input { min-width: 0; flex: 1 1 100%; }
    .modal-backdrop { padding: 0; align-items: end; }
    .modal-panel { max-height: 94vh; border-radius: 18px 18px 0 0; }
    .donut-wrap { flex-direction: column; }
    .pipeline-row { grid-template-columns: 1fr 60px 24px; }
    .pipeline-name small { display: none; }
    .notify-menu { width: calc(100vw - 32px); right: -60px; }
}

/* ---------- Printing app pages (e.g. Reports) ---------- */
@media print {
    .sidebar, .topbar, .toolbar, .header-actions, .toast-stack, .row-actions, .pager, .tabs { display: none !important; }
    .main-column { margin: 0; }
    .content { padding: 0; }
    body { background: #fff; }
    .card, .stat-card { box-shadow: none; break-inside: avoid; }
}

/* Figures read best in the sans face with tabular, lining numerals. */
.stat-value, .hero-ring-inner strong, .donut b, .totals-box .grand b, .date-tile b, .measure-chips b {
    font-family: var(--font); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums;
}
.stat-value { font-size: 24px; }
/* Text wraps so a table fits the screen (long details, product lists); figures, tags, badges, phones and actions stay on one line. */
.table td { white-space: normal; overflow-wrap: break-word; }
.table td.num, .table td.row-actions, .table td.nowrap, .table .phone-text { white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table td small.note { white-space: pre-line; }   /* design notes keep their line breaks */
.table td.row-actions .icon-btn { width: 30px; height: 30px; }
@media (max-width: 1440px) {
    .content { padding: 24px 24px 48px; }
    .table th, .table td { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 1320px) {
    .table th, .table td { padding-left: 8px; padding-right: 8px; }
    .table td.row-actions .icon-btn { width: 28px; height: 28px; }
}
.search-clear { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); padding: 0; }
.search-clear:hover { background: var(--line); color: var(--ink); }
.toolbar-count { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
