/*
 * Sales report dashboard. Theme follows aivi.com: Manrope, black and white with pill buttons,
 * a soft blush tint and warm brown accent.
 */
:root {
    --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --ink: #0a0a0a;
    --ink-2: #454a53;
    --muted: #72757e;
    --line: #ececec;
    --line-strong: #d9dcdf;
    --page: #f8f8f8;
    --surface: #fff;
    --blush: #f9ebe4;
    --blush-strong: #f2d9cc;
    --cream: #fff6dc;
    --brown: #934824;
    /* AIVI plum (aivi.com --brand-primary-plum), used where the theme was black */
    --primary: #79193e;
    --primary-dark: #5f1230;
    --primary-soft: #f2e8e8;
    --success: #1e7a43;
    --success-bg: #e7f5ec;
    --error: #b42318;
    --error-bg: #fdeceb;
    --warn: #8a5a00;
    --warn-bg: #fff4d6;
    --info: #1f4fa3;
    --info-bg: #eaf1fd;
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar: 288px;
    --topbar: 64px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Brand wordmark ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-tag { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--line-strong); padding-left: 10px; }+/* Bold burgundy divider, then the product name in burgundy. */
+.brand-tag { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; color: var(--primary); border-left: 2px solid var(--primary); padding: 8px 0 8px 12px; line-height: 1.2; }
/* Bold burgundy divider, then the product name in burgundy. */
.brand-tag {font-size: 12px;font-weight: 700;letter-spacing: .12em;text-transform: uppercase;white-space: nowrap;color: var(--primary);border-left: 2px solid var(--primary);padding: 8px 0 8px 12px;line-height: 1.2;}

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; }
.sidebar .brand { height: 44px; padding: 0 10px; margin-bottom: 22px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px; margin: 14px 0 6px; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; white-space: nowrap; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav a[aria-current="page"] { background: var(--primary); color: #fff; font-weight: 600; }
.nav .soon { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--blush); color: var(--brown); }
.nav a[aria-current="page"] .soon { background: rgba(255, 255, 255, .18); color: #fff; }
.scrim { display: none; }

/* Brand menu: one collapsible group per brand, its pages inside. */
.brand-nav { list-style: none; margin: 0 -4px; padding: 0 4px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.brand-group > summary, .brand-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.brand-group > summary { list-style: none; cursor: pointer; transition: background .15s, color .15s; }
.brand-group > summary::-webkit-details-marker { display: none; }
.brand-group > summary:hover { background: var(--primary-soft); color: var(--primary); }
.brand-group > summary.is-current { color: var(--primary); font-weight: 700; }
.brand-group > summary .icon { margin-left: auto; width: 16px; height: 16px; transform: rotate(-90deg); transition: transform .15s; }
.brand-group[open] > summary .icon { transform: none; }
.brand-abbr { min-width: 32px; font-style: italic; font-weight: 600; color: var(--ink); }
.brand-group > .nav { grid-template-columns: minmax(0, 1fr); margin: 2px 0 8px 14px; padding-left: 6px; border-left: 1px solid var(--line); }
.brand-group > .nav a, .brand-group > .nav .nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; white-space: nowrap; }
.brand-group > .nav .nav-item.is-disabled { cursor: not-allowed; color: var(--muted); font-weight: 500; }
.brand-group > .nav .soon { padding: 2px 6px; }
.brand-group > .nav a > span:not(.soon), .brand-group > .nav .nav-item > span:not(.soon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand-group > .nav .soon { flex: none; }
.brand-link { text-decoration: none; transition: background .15s, color .15s; }
.brand-link:hover { background: var(--primary-soft); color: var(--primary); }
.brand-link[aria-current="page"] { background: var(--primary); color: #fff; font-weight: 600; }
.brand-link[aria-current="page"] .brand-abbr { color: #fff; }
.brand-link .brand-abbr { display: inline-flex; }
.brand-item.is-disabled { cursor: not-allowed; color: var(--muted); }
.brand-item.is-disabled .brand-abbr { color: var(--muted); }
.brand-item .soon { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--page); color: var(--muted); }
.sidebar-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: rgba(248, 248, 248, .88); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .crumbs { font-size: 13px; color: var(--muted); }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 28px; max-width: 1240px; width: 100%; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 640px; }

/* ---------- User menu ---------- */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { border-color: var(--line-strong); }
.user-menu .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-menu .who b { font-size: 13px; font-weight: 600; }
.user-menu .who small { font-size: 11px; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blush); color: var(--brown); font-weight: 700; font-size: 13px; }
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }
.user-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 290px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(16, 24, 40, .14); overflow: hidden; }
.user-panel header { display: flex; gap: 12px; align-items: center; padding: 16px; background: linear-gradient(135deg, var(--blush), var(--cream)); }
.user-panel header b { display: block; font-size: 15px; }
.user-panel header span { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.user-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; padding: 14px 16px; font-size: 13px; }
.user-panel dt { color: var(--muted); }
.user-panel dd { margin: 0; text-align: right; font-weight: 500; }
.user-panel footer { padding: 12px 16px 16px; border-top: 1px solid var(--line); }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--primary); background: var(--surface); color: var(--primary); font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--primary); color: #fff; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, select.input { height: 42px; width: 100%; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 14px var(--font); transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(121, 25, 62, .12); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Cards, stats, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; }
.card-head a { font-size: 13px; font-weight: 600; text-decoration: none; }
.card-head a:hover { color: var(--primary); }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.stack { display: grid; gap: 18px; }

.stat { padding: 18px 20px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.stat .label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); }
.stat-feature { background: linear-gradient(135deg, var(--blush), var(--cream)); border-color: var(--blush-strong); }
.stat-feature .label, .stat-feature .hint { color: var(--brown); }
.stat .value.warn { color: var(--warn); }
.stat .value.error { color: var(--error); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.meter { height: 8px; border-radius: 999px; background: var(--page); overflow: hidden; display: flex; }
.meter span { display: block; height: 100%; }
.meter .m-ok { background: var(--primary); }
.meter .m-pending { background: var(--blush-strong); }
.meter .m-warn { background: #e0a43a; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fcfcfc; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfaf9; }
.table td.num, .table th.num { text-align: right; }
.table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.table .clip { max-width: 240px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-accepted, .badge-success { background: var(--success-bg); color: var(--success); }
.badge-failed, .badge-error { background: var(--error-bg); color: var(--error); }
.badge-pending, .badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--page); color: var(--ink-2); }
.badge-neutral::before { display: none; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

/* Report Download: form, Sales ⋮ Return tabs, icon actions */
/* Generate form: grouped type list on the left, filters + summary on the right */
.gen-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 22px; }
.gen-types { margin: 0; padding: 0 22px 0 0; border: 0; border-right: 1px solid var(--line); display: grid; gap: 2px; align-content: start; }
.gen-group { margin: 10px 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gen-group:first-of-type { margin-top: 0; }
.gen-type { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 10px; cursor: pointer; }
.gen-type:hover { background: var(--page); }
.gen-type input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; flex: none; }
.gen-type span { display: grid; min-width: 0; }
.gen-type b { font-size: 14px; font-weight: 600; color: var(--ink); }
.gen-type small { font-size: 12px; color: var(--muted); }
.gen-type:has(input:checked) { background: var(--primary-soft); }
.gen-type:has(input:checked) b { color: var(--primary); }
.gen-type:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.gen-main { display: grid; gap: 16px; align-content: start; position: sticky; top: 16px; align-self: start; }
.gen-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.gen-summary { display: grid; gap: 3px; padding: 14px 16px; border-radius: 12px; background: var(--page); border: 1px solid var(--line); }
.gen-summary > span { font-size: 12px; color: var(--muted); }
.gen-summary b { font-size: 15px; font-weight: 600; color: var(--ink); }
.gen-summary code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.gen-summary code:empty { display: none; }
.gen-submit { width: 100%; justify-content: center; }
/* One row; with many report types it scrolls sideways instead of wrapping. */
.type-tabs { display: flex; align-items: center; margin: 4px 0 12px; padding: 0 4px 4px 18px; overflow-x: auto; scrollbar-width: thin; }
.type-tabs a { position: relative; flex: none; white-space: nowrap; padding: 6px 2px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; }
.type-tabs a + a { margin-left: 26px; }
.type-tabs a + a::before { content: "\22EE"; position: absolute; left: -16px; color: var(--muted); font-weight: 700; }
.type-tabs a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--primary); transform: scaleX(0); transition: transform .15s; }
.type-tabs a:hover { color: var(--primary); }
.type-tabs a:hover::after, .type-tabs a[aria-current="page"]::after { transform: none; }
.type-tabs a[aria-current="page"] { color: var(--primary); }
.table .icon-col { width: 44px; text-align: center; padding-left: 6px; padding-right: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--page); color: var(--ink); }
.icon-btn-danger:hover { background: var(--error-bg); color: var(--error); }
@media (max-width: 860px) { .gen-form { grid-template-columns: minmax(0, 1fr); } .gen-main { position: static; } .gen-types { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--line); } }
@media (max-width: 520px) { .gen-fields { grid-template-columns: minmax(0, 1fr); } }

/* General Settings: add form and inline edit row */
.settings-form, .settings-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px 18px; align-items: start; }
.settings-form > .alert, .settings-edit > .alert, .settings-form > div, .settings-edit > .btns { grid-column: 1 / -1; margin: 0; }
.settings-edit > .btns { display: flex; gap: 8px; }
.settings-form textarea.input, .settings-edit textarea.input { height: auto; min-height: 42px; padding: 10px 14px; resize: vertical; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.input[readonly] { background: var(--page); color: var(--muted); }
.settings-table .setting-value span { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-table td .badge { margin-left: 6px; vertical-align: 1px; }
.settings-table td:nth-child(2) { white-space: nowrap; }
.settings-table tr.is-editing td { background: var(--primary-soft); }
.icon-btn.is-disabled { opacity: .3; cursor: not-allowed; }
@media (max-width: 760px) { .settings-form, .settings-edit { grid-template-columns: minmax(0, 1fr); } }

/* Popup (native <dialog>) */
.modal { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(16, 24, 40, .25); }
.modal::backdrop { background: rgba(14, 16, 26, .45); }
.modal header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.modal-body { display: grid; gap: 14px; padding: 18px 20px; }
.modal-body p { margin: 0; overflow-wrap: anywhere; }
.modal-body textarea.input { height: auto; padding: 10px 14px; resize: vertical; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--page); border-radius: 0 0 var(--radius) var(--radius); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg.icon { width: 34px; height: 34px; color: var(--line-strong); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

pre.code { margin: 0; max-height: 520px; overflow: auto; padding: 16px; background: #0e101a; color: #e6e6e6; border-radius: var(--radius-sm); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.toolbar .field { min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .btns { display: flex; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500; text-decoration: none; color: var(--ink-2); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blush); color: var(--brown); font-weight: 700; font-size: 13px; }
.steps b { display: block; }

.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 26px 28px; border-radius: var(--radius); background: linear-gradient(120deg, var(--blush) 0%, var(--cream) 100%); border: 1px solid var(--blush-strong); margin-bottom: 18px; }
.hero h1 { font-size: 26px; }
.hero p { margin: 6px 0 0; color: var(--ink-2); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-art { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; background: radial-gradient(120% 90% at 0% 0%, #fbe3d6 0%, var(--blush) 40%, var(--cream) 100%); overflow: hidden; }
.auth-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(147, 72, 36, .16), rgba(147, 72, 36, 0) 70%); }
.auth-art h2 { font-size: 40px; line-height: 1.1; font-weight: 300; letter-spacing: -.02em; max-width: 440px; }
.auth-art h2 b { font-weight: 700; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: var(--ink-2); }
.auth-art li { display: flex; gap: 10px; align-items: center; }
.auth-art li svg.icon { color: var(--brown); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.auth-form h1 { font-size: 26px; }
.auth-form .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .12); }
    #nav-open:checked ~ .sidebar { transform: none; }
    #nav-open:checked ~ .scrim { display: block; }
    .scrim { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .25); }
    .menu-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px; }
    .grid-2, .grid-detail { grid-template-columns: minmax(0, 1fr); }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-art { display: none; }
    .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .user-menu .who { display: none; }
    .topbar .crumbs { display: none; }
    .user-panel { width: min(290px, calc(100vw - 32px)); }
}

/* CSV viewer: compact cells, one line each, header stays visible while scrolling */
.csv-view { max-height: 70vh; }
.csv-view .table th { position: sticky; top: 0; z-index: 1; }
.csv-view .table td { padding: 9px 14px; white-space: nowrap; font-size: 13px; }

/* ERP failed-records worklist: reason chips, selection and the bulk retry bar */
.reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #fcfcfc; }
.reasons-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chip-reason { gap: 8px; max-width: 360px; }
.chip-reason .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-count { flex: none; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--error-bg); color: var(--error); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.chip[aria-current="true"] .chip-count { background: rgba(255, 255, 255, .22); color: #fff; }
.table th.check, .table td.check { width: 36px; padding-right: 0; }
.table td.check input, .table th.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.table tr.is-selected td { background: var(--primary-soft); }
.table td.error-text { color: var(--error); max-width: 320px; }
.table td.row-actions { white-space: nowrap; text-align: right; }
.table td.row-actions form { display: inline; }
.table td.row-actions .btn + .btn, .table td.row-actions form + .btn { margin-left: 6px; }
.match-prompt { padding: 10px 20px; background: var(--info-bg); color: var(--info); font-size: 13px; text-align: center; }
.match-prompt a { font-weight: 700; margin-left: 6px; }
.bulk-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.bulk-bar.is-active { background: var(--blush); border-top-color: var(--blush-strong); box-shadow: 0 -6px 16px rgba(16, 24, 40, .06); }
.bulk-count { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.bulk-bar:not(.is-active) .bulk-count b { font-weight: 500; color: var(--muted); }
.bulk-bar:not(.is-active) .bulk-clear { display: none; }
.bulk-clear { font-size: 12px; font-weight: 600; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bulk-hint { flex-basis: 100%; font-size: 12px; color: var(--warn); }
@media (max-width: 720px) { .bulk-actions, .bulk-actions .btn { width: 100%; } }

/* Magento To Sales DB */
.grid-detail-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .grid-detail-wide { grid-template-columns: 1fr; } }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.stat-alert { border-color: #f3c7c3; background: linear-gradient(135deg, var(--error-bg), var(--surface)); }
.stat .label .badge { margin-left: auto; }
.error-text { color: var(--error); }
.warn-text { color: var(--warn); font-weight: 600; }
.clip-sm { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; margin-top: 4px; }
.card-note { margin: 0; padding: 12px 20px 0; font-size: 13px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.swatch-shipment, .bar-shipment { background: var(--primary); }
.swatch-return, .bar-return { background: #3b6fc4; }
.day-chart { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 6px; height: 180px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.day { position: relative; display: grid; grid-template-rows: 1fr auto; gap: 6px; outline: none; }
.day-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; border-radius: 6px; padding: 0 2px; }
.day:hover .day-bars, .day:focus .day-bars { background: #f6f1ef; }
.bar { width: min(12px, 40%); min-height: 0; border-radius: 4px 4px 0 0; }
.day-label { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; padding-bottom: 6px; }
.day-label small { display: block; font-size: 10px; }
.day-tip { position: absolute; bottom: calc(100% - 20px); left: 50%; transform: translateX(-50%); z-index: 3; display: none; min-width: 120px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--ink); color: #fff; font-size: 12px; line-height: 1.5; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); }
.day-tip b { display: block; }
.day:hover .day-tip, .day:focus .day-tip { display: block; }
.day:first-child .day-tip, .day:nth-child(2) .day-tip { left: 0; transform: none; }
.day:last-child .day-tip, .day:nth-last-child(2) .day-tip { left: auto; right: 0; transform: none; }
.chart-table { margin-top: 12px; font-size: 13px; }
.chart-table summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.chart-table .table { margin-top: 8px; }

/* ---------- Sidebar: menu groups (Magento Integration, ERP Integration) ---------- */
.nav-group > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--primary-soft); color: var(--primary); }
.nav-group > summary.is-current { color: var(--primary); font-weight: 600; }
.nav-group > summary > span:not(.nav-chev) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-group .nav-chev { margin-left: auto; display: inline-flex; }
.nav-group .nav-chev .icon { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform .15s; }
.nav-group[open] > summary .nav-chev .icon { transform: none; }
.nav.nav-sub { margin: 2px 0 4px 16px; padding-left: 6px; border-left: 1px solid var(--line); }

/* ---------- Dashboard: Magento + ERP overview ---------- */
.dash-hero { align-items: start; }
.dash-hero p { display: flex; align-items: center; gap: 8px; }
.dash-updated { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dash-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dash-dot-ok { background: var(--success); }
.dash-dot-warn { background: var(--warn); }
.dash-attention { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.dash-attention li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); font-weight: 500; }
.dash-attention li.is-error { background: var(--error-bg); color: var(--error); }
.dash-attention li .icon { flex: none; width: 16px; height: 16px; }
.dash-attention li a { margin-left: auto; white-space: nowrap; color: inherit; font-weight: 600; }
.dash-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 16px; }
.dash-node { display: grid; gap: 2px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--page); color: var(--ink); text-decoration: none; min-width: 0; }
a.dash-node:hover { background: var(--primary-soft); }
.dash-node-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.dash-node-head .icon { width: 14px; height: 14px; }
.dash-node b { font-size: 16px; }
.dash-node .muted { font-size: 12px; }
.dash-arrow { display: grid; justify-items: center; color: var(--muted); font-size: 20px; line-height: 1; }
.dash-arrow small { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dash-title { display: flex; gap: 10px; align-items: center; }
.dash-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.dash-row-end { margin-left: auto; font-size: 13px; }
.swatch-in, .bar-in { background: var(--primary); }
.swatch-out, .bar-out { background: #3b6fc4; }
.dash-activity { list-style: none; margin: 0; padding: 0; }
.dash-activity li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); }
.dash-activity li:first-child { border-top: 0; }
.dash-activity li > div { display: grid; min-width: 0; }
.dash-activity li > div a { color: var(--ink); text-decoration: none; font-weight: 600; }
.dash-activity li > div a:hover { color: var(--primary); }
.dash-activity .clip { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-time { font-size: 11px; line-height: 1.3; color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 900px) {
    .dash-flow { grid-template-columns: minmax(0, 1fr); }
    .dash-arrow { transform: rotate(90deg); }
    .dash-arrow small { display: none; }
}

/* ---------- Sync Exceptions: categories ---------- */
.badge.cat-connection { background: var(--error-bg); color: var(--error); }
.badge.cat-timeout { background: var(--warn-bg); color: var(--warn); }
.badge.cat-save_error { background: var(--blush); color: var(--brown); }
.badge.cat-skipped { background: var(--page); color: var(--ink-2); }
.ok-text { color: var(--success); font-weight: 600; }
