:root {
    --brand: #F15A24;
    --brand-dark: #C43F0E;
    --ink: #1A1A1A;
    --muted: #6B6B6B;
    --line: #E2E2E2;
    --bg: #F6F6F7;
    --alert: #C0392B;
    --amber: #B26B00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

/* ---- shell ---- */
.topbar {
    background: var(--ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
}

.brand { color: #fff; font-weight: 700; text-decoration: none; }
.brand span { color: var(--brand); }
.brand em { font-style: normal; font-weight: 400; opacity: 0.6; margin-left: 8px; }

.whoami { display: flex; align-items: center; gap: 14px; color: #ddd; }
.whoami form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 20px; }

h1 { font-size: 1.4rem; margin: 0 0 16px; display: flex; align-items: center; gap: 12px; }
h2 { font-size: 1rem; margin: 0 0 12px; }

.crumb { margin: 0 0 12px; }
.crumb a, a { color: var(--brand-dark); }

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

/* ---- KPIs ---- */
.kpis { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    padding: 12px 18px;
    min-width: 150px;
}

.kpi-alert { border-left-color: var(--alert); }
.kpi-value { display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 0.82rem; }

/* ---- filters ---- */
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { min-width: 280px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); }

input, select, button { font: inherit; }

input[type="search"], input[type="text"], input[type="number"], input[type="password"], select {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

input:focus-visible, select:focus-visible, button:focus-visible, tr:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

button { border-radius: 6px; padding: 7px 14px; cursor: pointer; border: 1px solid transparent; }
button:disabled { opacity: 0.55; cursor: default; }
.primary { background: var(--brand); color: #fff; }
.primary:hover:not(:disabled) { background: var(--brand-dark); }
.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.linklike { background: none; border: none; color: inherit; text-decoration: underline; padding: 0; }

/* ---- table ---- */
.grid { width: 100%; border-collapse: collapse; background: #fff; }
.grid th, .grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid thead th { background: #FAFAFA; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: #FFF7F4; }
.grid .num { text-align: right; }
.grid tr.overdue { background: #FDF3F2; }
.grid tr.overdue:hover { background: #FBE9E7; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.block { display: block; }
.price { width: 110px; text-align: right; }

/* ---- pills ---- */
.pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #EFEFEF;
    color: #444;
    margin-left: 6px;
    white-space: nowrap;
}

.status-pending { background: #FFF0E8; color: var(--brand-dark); }
.status-quoted { background: #E8F1FD; color: #1A5FB4; }
.status-purchased { background: #EDE8FD; color: #5B3FB4; }
.status-shipped { background: #E7F6EC; color: #1E7B41; }
.pill-red { background: #FBE9E7; color: var(--alert); }
.pill-amber { background: #FFF4E0; color: var(--amber); }

/* ---- banners ---- */
.banner {
    background: #FFF4E0;
    border: 1px solid #F0D5A0;
    border-left: 4px solid var(--amber);
    color: #6B4400;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.error { color: var(--alert); margin: 8px 0; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager { display: flex; gap: 14px; align-items: center; margin-top: 14px; }

dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

.editreq { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.editreq:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.editreq .reason { font-style: italic; }
.editreq ul { margin: 4px 0; padding-left: 20px; }

/* ---- login ---- */
.loginwrap { display: flex; justify-content: center; padding-top: 8vh; }
.login { width: 340px; }
.login h1 { display: block; margin-bottom: 0; }
.login h1 span { color: var(--brand); }
.login .sub { color: var(--muted); margin: 0 0 20px; }
.login label { display: block; margin-top: 12px; font-weight: 600; }
.login input { width: 100%; margin-top: 4px; }
.login button { width: 100%; margin-top: 18px; }
.validation-message { color: var(--alert); font-size: 0.85rem; }

#blazor-error-ui {
    background: #FFF4E0;
    bottom: 0;
    display: none;
    left: 0;
    padding: 10px 16px;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* ---- admin area (step 10b) ---------------------------------------------------------------- */

.adminnav { display: flex; gap: 16px; margin-left: auto; margin-right: 22px; }
.adminnav a { color: #ddd; text-decoration: none; font-size: 0.9rem; }
.adminnav a:hover { color: var(--brand); text-decoration: underline; }

.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.formgrid label { display: block; font-weight: 600; font-size: 0.85rem; }
.formgrid input, .formgrid select { width: 100%; margin-top: 4px; font-weight: 400; }

.card label.check { display: flex; margin-top: 8px; color: var(--ink); }
label.inline { display: flex; align-items: center; gap: 8px; }
label.inline input { width: 100px; }

.ok { color: #1E7B41; font-weight: 600; }

/* Disabled accounts stay legible but visibly inactive. */
.row-disabled td { opacity: 0.55; }
.row-disabled .pill { opacity: 1; }

.confirm { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.resetform { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.resetform label { font-size: 0.8rem; color: var(--muted); }
.resetform input { display: block; margin-top: 4px; }

.role-rep { background: #E8F1FD; color: #1A5FB4; }
.role-purchasing { background: #FFF0E8; color: var(--brand-dark); }
.role-admin { background: #EDE8FD; color: #5B3FB4; }

/* Audit-log expansion: the before/after pair scrolls inside its own box rather than
   stretching the table. */
.grid tr.expanded, .grid tr.expanded:hover { background: #FAFAFA; cursor: default; }
.beforeafter { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.beforeafter pre {
    margin: 0;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.panels { display: grid; gap: 16px; }
.bignum { font-size: 1.8rem; font-weight: 700; margin: 0 0 14px; line-height: 1.2; }
.bignum .kpi-label { display: block; font-size: 0.82rem; font-weight: 400; }
