﻿/* =====================================================================
   QF Technology ERP: design system
   One stylesheet for every page. Change colors/sizes in :root only.
   ===================================================================== */
:root {
    --primary: #1d63ed;
    --primary-hover: #1652c7;
    --primary-soft: #e8f0fe;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-alt: #f9fafc;
    --border: #e5e8ef;
    --border-strong: #cfd5df;
    --text: #1f2937;
    --muted: #6b7280;
    --subtle: #9aa4b2;
    --danger: #c0352b;
    --danger-hover: #a52b22;
    --danger-soft: #fdecea;
    --success: #16794c;
    --success-soft: #e7f6ee;
    --warning-soft: #fff4d6;
    --focus-ring: 0 0 0 3px rgba(29, 99, 237, .25);
    --radius: 12px;
    --radius-sm: 8px;
    --control-h: 40px;          /* every input, select and button has the same height */
    --sidebar-w: 248px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
}

/* ===== Base ===== */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, "Segoe UI", Roboto, "Kantumruy Pro", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); }

h1, h2, h3 { color: var(--text); }

.muted { color: var(--muted); }

/* ===== Shell (sidebar + content) ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand { display: flex; justify-content: center; padding: 8px 8px 24px; }
.logo-full { width: 180px; max-width: 100%; height: auto; display: block; }
.logo-mark { width: 40px; height: 40px; display: none; }
.login-logo { width: 220px; max-width: 100%; height: auto; display: block; margin: 0 auto 24px; }

.nav { flex: 1; overflow-y: auto; }   /* the menu takes the space; the user block stays at the bottom */

.nav-group {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--subtle);
    padding: 18px 12px 6px;
}

.nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.nav a i { font-size: 18px; color: var(--muted); }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.active i { color: var(--primary); }

.sidebar-user {
    display: flex;
    flex-wrap: wrap;           /* the buttons get their own row under the name */
    align-items: center;
    gap: 10px;
    padding: 14px 6px 2px;
    border-top: 1px solid var(--border);
}
.avatar {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-weight: 700;
}
.user-info { flex: 1 1 calc(100% - 46px); min-width: 0; }   /* the whole row next to the avatar */
.user-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;   /* the full name, never cut to "O…"; a long email wraps */
}
.user-role { font-size: 12px; color: var(--muted); }
.user-actions { display: flex; gap: 10px; margin-left: 46px; }   /* phone, password, sign out: under the name */

.content { flex: 1; min-width: 0; padding: 32px 40px; max-width: 1320px; }

/* ===== Page header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}
.page-header h1 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.25; }
.subtitle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 6px 0 0;
    color: var(--muted);
}
.subtitle a { text-decoration: none; }

/* ===== Section tabs: the pages of one menu section (Views/Shared/_SectionTabs) ===== */
.page-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: -8px 0 20px; border-bottom: 1px solid var(--border); }
.page-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; margin-bottom: -1px; color: var(--muted); font-weight: 500; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.page-tabs a:hover { color: var(--text); }
.page-tabs a.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.page-tabs .nav-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* ===== Toolbar (search + filters) ===== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.toolbar select { width: auto; min-width: 160px; }

.search { position: relative; flex: 1 1 320px; max-width: 440px; }
.search i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--subtle);
    pointer-events: none;
}
.search input { padding-left: 40px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--control-h);
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); color: var(--text); border-color: #b9c1cd; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
    transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.icon-btn:disabled { opacity: .35; cursor: default; pointer-events: none; }

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;          /* keeps table corners rounded */
}
.table-wrap { overflow-x: auto; }   /* narrow screens: a wide table scrolls sideways (header and pager stay put) */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.count { color: var(--muted); font-weight: 400; }
.card-body { padding: 24px; }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; }
.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
    padding: 12px 20px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafbff; }

/* Links inside table rows: quiet until hovered */
.table td a:not(.btn):not(.icon-btn) { text-decoration: none; font-weight: 500; }
.table td a:not(.btn):not(.icon-btn):hover { text-decoration: underline; }

/* Numbers: header and values both right-aligned, digits line up */
.table th.num, .table td.num, .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Actions: header and buttons share the same (centered) column */
.table th.actions, .table td.actions, .actions { text-align: center; white-space: nowrap; width: 1%; }
.actions form { display: inline; }
.actions > * + * { margin-left: 6px; }

/* Thumbnail column */
.table td:has(> .thumb) { width: 72px; padding-right: 0; }

code.slug {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 6px;
    color: #4b5563;
    white-space: nowrap;
}

.tree-root td:first-child { font-weight: 600; }
.tree-branch { color: #b0b8c4; margin-right: 8px; }
tr.match td:first-child { background: var(--warning-soft); }

/* Sortable headers */
a.sort { color: inherit; text-decoration: none; }
a.sort:hover { color: var(--primary); }

/* Pager */
.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}
.pager .icon-btn + .icon-btn { margin-left: 6px; }

/* Empty states */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty i { font-size: 40px; display: block; margin-bottom: 10px; color: var(--subtle); }
.empty p { margin: 0 0 16px; }

/* ===== Badges: always text + colour (never colour alone) ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
    margin: 0;
    white-space: nowrap;               /* "Partly received" stays on one line */
}
* + .badge { margin-left: 8px; }   /* space only when the badge follows something */
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-muted { background: #f1f3f6; color: var(--muted); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }     /* HR H3b: absent, no Out */
.void-line { text-decoration: line-through; color: var(--muted); }         /* HR H3b: a clock-in made void */

/* ===== Forms ===== */
.form-card { max-width: 760px; }
.form-card.wide { max-width: 1000px; }
/* A form inside a page-wide card (payments, returns, labels): fields keep the width they have on a form card. */
.form-narrow { max-width: 712px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.field { margin-bottom: 20px; }
.field.full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }   /* three short fields in a row (brand, model, serial) */

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

input, select, textarea {
    width: 100%;
    height: var(--control-h);
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 15px;
    background-color: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:hover, select:hover, textarea:hover { border-color: #b9c1cd; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
input[readonly] { background: var(--bg); color: var(--muted); }
input[readonly]:hover { border-color: var(--border-strong); }

/* Selects: our own chevron, with breathing room from the right edge */
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    cursor: pointer;
    text-overflow: ellipsis;
}

/* Search boxes: hide the browser's own clear "x" styling differences */
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

input[type=checkbox] {
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

input[type=file] { height: auto; padding: 6px; }
input[type=file]::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface-alt);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.required { color: var(--danger); }
/* A red * after the label of every required field whose label has none yet (labels written without asp-for). */
.field:has(input:required, select:required, textarea:required) > label:not(:has(.required))::after {
    content: " *";
    color: var(--danger);
}

/* A group of choices (radio buttons or checkboxes) in a form: its title, then the choices in a row that wraps. */
.field-title { display: block; font-weight: 600; font-size: 14px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 6px 0; }
.choices label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
/* Long tick-lists (accessories, condition): even columns; a long label wraps under itself. */
.choices.ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.choices.ticks label { align-items: flex-start; }
.choices.ticks input { margin-top: 3px; flex-shrink: 0; }
/* The way-in switch at the top of a form card (Receive item / On site / Quick repair). */
.mode-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.field-error { display: block; color: var(--danger); font-size: 13px; margin-top: 6px; }
.field-error:empty { display: none; }
.input-validation-error { border-color: var(--danger) !important; }

.validation-summary-valid { display: none; }
.validation-summary-errors ul {
    margin: 0 0 16px;
    padding: 12px 16px 12px 32px;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius-sm);
}

.form-section {
    font-size: 15px;
    font-weight: 700;
    margin: 4px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.form-section:not(:first-of-type) { margin-top: 12px; }

.section-head {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    margin: 12px 0 10px;
}
.section-head .form-section { border-bottom: 0; }

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    margin: 0 0 10px;
    cursor: pointer;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}
.form-footer .buttons { display: flex; gap: 8px; }

.danger-zone { border-color: #f3c9c4; }

/* Specifications editor */
.spec-table th, .spec-table td { padding: 8px; }
.spec-table td { vertical-align: top; }
.spec-table.hide-kh .kh-col { display: none; }

/* ===== Feedback ===== */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;   /* icon stays on the first line when the message wraps */
    width: fit-content;        /* only as wide as the message, never wider than the page */
    max-width: min(100%, 1000px);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert[hidden] { display: none; }                                        /* a message a page script shows only when needed */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 420px;
    background: var(--text);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    animation: toast-in .2s ease-out;
    transition: opacity .3s;
}
.toast.success i { color: #4ade80; }
.toast.hide { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

dialog.confirm {
    border: 0;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 24px 60px rgba(0,0,0,.22);
}
dialog.confirm::backdrop { background: rgba(15,23,42,.45); }
dialog.confirm h3 { margin: 0 0 8px; font-size: 18px; }
dialog.confirm p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* ===== Login ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 400px; }

/* ===== Photos ===== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.photo {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}
.photo.is-primary { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.photo img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface-alt); display: block; }
.photo-badge { position: absolute; top: 8px; left: 8px; margin: 0; }
.photo-actions {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: 6px;
    border-top: 1px solid var(--border);
}
.photo-actions form { display: inline; }

.upload-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-alt);
    display: block;
}
.thumb-empty { display: grid; place-items: center; color: #b0b8c4; }

/* Live search (list-filters.js): dim the list slightly while new results load */
[data-live-results] { transition: opacity .15s; }
[data-live-results][aria-busy="true"] { opacity: .55; }

/* ===== Tablet: icon-only sidebar ===== */
@media (max-width: 1000px) {
    :root { --sidebar-w: 72px; }
    .nav a { justify-content: center; }
    .nav a span, .nav-group, .user-info { display: none; }
    .sidebar { padding: 16px 10px 10px; }
    .sidebar-user { flex-direction: column; flex-wrap: nowrap; }
    .user-actions { flex-direction: column; align-items: center; margin-left: 0; }
    .content { padding: 20px; }
    .form-grid, .form-grid.three { grid-template-columns: 1fr; }
    .brand { padding: 4px 0 16px; }
    .logo-full { display: none; }
    .logo-mark { display: block; }
    .search { max-width: none; }
}

.menu-toggle { display: none; }
/* ===== Phone: the menu becomes a top bar with a ☰ button; headers, filters and cards stack ===== */
@media (max-width: 640px) {
    .app { flex-direction: column; }
    .sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 50; padding: 8px 12px; border-right: 0;
               border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; align-items: center; }
    .brand { padding: 0; }
    .logo-mark { width: 32px; height: 32px; }
    .menu-toggle { display: inline-grid; margin-left: auto; width: 40px; height: 40px; font-size: 22px; }
    .sidebar .nav, .sidebar .sidebar-user { display: none; }
    .sidebar.open { max-height: 100vh; overflow-y: auto; }
    .sidebar.open .nav { display: block; flex-basis: 100%; margin-top: 8px; }
    .sidebar.open .nav a { justify-content: flex-start; }
    .sidebar.open .nav a span { display: inline; }
    .sidebar.open .nav-group { display: block; }
    .sidebar.open .nav .nav-count { position: static; margin-left: auto; }
    .sidebar.open .sidebar-user { display: flex; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; padding-top: 12px; }
    .sidebar.open .user-info { display: block; }
    .sidebar.open .user-actions { flex-direction: row; margin-left: 46px; }
    .content { padding: 16px 12px; }
    .page-header { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
    .page-header h1 { font-size: 22px; overflow-wrap: anywhere; }
    .toolbar > *, .toolbar select { flex: 1 1 100%; min-width: 0; width: 100%; max-width: none; }
    .toolbar .date-range { display: flex; flex-wrap: wrap; }
    .toolbar .date-filter { display: flex; flex: 1 1 100%; }
    .toolbar .date-filter input { flex: 1; min-width: 0; }
    .card-header { padding: 12px 16px; flex-wrap: wrap; }
    .card-body { padding: 16px; }
    .table th, .table td { padding-left: 12px; padding-right: 12px; }
    .pos, .pos.pos-sell { grid-template-columns: minmax(0, 1fr); }
    .card-body > *, .pos > * { min-width: 0; }
    .form-footer, .form-footer .buttons { flex-wrap: wrap; }   /* text, then the buttons under it */
    .danger-zone .card-body { flex-wrap: wrap; }               /* "Deactivate …" text, then the button */
}

/* Spacing helpers: replace repeated inline style="…" in views (finding 7). !important so they win exactly as the
   inline style did. */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-20 { margin-top: 20px !important; }
.mb-20 { margin-bottom: 20px !important; }
.ml-12 { margin-left: 12px !important; }
.text-small { font-size: 12px !important; }
.inline { display: inline !important; }

/* More helpers for finding 7 (D2): small spacing, widths and alignment, written the same way as above (!important,
   so each wins exactly as the inline style did). Numbers are px; mw = max-width. After .m-0, so "m-0 mt-8" works. */
.mt-2 { margin-top: 2px !important; }
.mt-4 { margin-top: 4px !important; }
.mt-6 { margin-top: 6px !important; }
.mt-8 { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }
.ml-4 { margin-left: 4px !important; }
.ml-6 { margin-left: 6px !important; }
.mx-16 { margin-left: 16px !important; margin-right: 16px !important; }
.pt-0 { padding-top: 0 !important; }
.py-12 { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-24 { padding-top: 24px !important; padding-bottom: 24px !important; }
.py-32 { padding-top: 32px !important; padding-bottom: 32px !important; }
.py-40 { padding-top: 40px !important; padding-bottom: 40px !important; }
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-20 { padding-left: 20px !important; padding-right: 20px !important; }
.mw-200 { max-width: 200px !important; }
.mw-220 { max-width: 220px !important; }
.mw-420 { max-width: 420px !important; }
.text-right { text-align: right !important; }
.card-hint { margin: 8px 16px 12px !important; }   /* a hint under a table, inside its card */
.mt-26 { margin-top: 26px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }
.w-100 { width: 100% !important; }
.w-200 { width: 200px !important; }
.mw-260 { max-width: 260px !important; }
.mw-360 { max-width: 360px !important; }
.mw-640 { max-width: 640px !important; }
.minw-140 { min-width: 140px !important; }
.minw-160 { min-width: 160px !important; }
.minw-200 { min-width: 200px !important; }
.minw-220 { min-width: 220px !important; }
.minw-240 { min-width: 240px !important; }
.grow { flex: 1 !important; }                         /* takes the free width in a row */
.fw-400 { font-weight: 400 !important; }
.pre-line { white-space: pre-line !important; }       /* keeps the line breaks someone typed */
.select-all { user-select: all !important; }          /* one click selects the whole code */
.items-center { align-items: center !important; }
.mt-28 { margin-top: 28px !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-8 { margin-left: 8px !important; }
.mw-150 { max-width: 150px !important; }
.mw-170 { max-width: 170px !important; }
.mw-180 { max-width: 180px !important; }
.mw-190 { max-width: 190px !important; }
.mw-240 { max-width: 240px !important; }
.basis-220 { flex-basis: 220px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-n8 { margin-top: -8px !important; }                 /* pulls a hint up under its field */
.mb-4 { margin-bottom: 4px !important; }
.mb-6 { margin-bottom: 6px !important; }
.mr-12 { margin-right: 12px !important; }
.p-20 { padding: 20px !important; }
.pb-0 { padding-bottom: 0 !important; }
.py-16 { padding-top: 16px !important; padding-bottom: 16px !important; }
.w-56 { width: 56px !important; }
.w-150 { width: 150px !important; }
.h-34 { height: 34px !important; }
.h-40 { height: 40px !important; }
.mw-110 { max-width: 110px !important; }
.mw-280 { max-width: 280px !important; }
.mw-320 { max-width: 320px !important; }
.mw-560 { max-width: 560px !important; }
.flex-130 { flex: 0 1 130px !important; }
.flex-140 { flex: 0 1 140px !important; }
.flex-260 { flex: 0 1 260px !important; }
.flex-320 { flex: 0 1 320px !important; }
.text-11 { font-size: 11px !important; }
.text-13 { font-size: 13px !important; }
.text-14 { font-size: 14px !important; }
.text-15 { font-size: 15px !important; }
.text-16 { font-size: 16px !important; }
.fw-600 { font-weight: 600 !important; }
.ls-1 { letter-spacing: 1px !important; }
.text-center { text-align: center !important; }
.items-start { align-items: flex-start !important; }
.self-end { align-self: flex-end !important; }
.block { display: block !important; }
.d-none { display: none !important; }
.pos-static { position: static !important; }
.border-top { border-top: 1px solid var(--border) !important; }
/* Small layout patterns (D2) */
.stack { display: grid !important; gap: 16px !important; }        /* blocks one under another, 16px apart */
.stack-24 { display: grid !important; gap: 24px !important; }
.row-wrap { display: flex !important; gap: 8px !important; align-items: center !important; flex-wrap: wrap !important; }
.check-row { display: flex !important; gap: 6px !important; align-items: center !important; }   /* a tick box and its text */
.dashed-box { padding: 12px !important; border: 1px dashed var(--border) !important; border-radius: 8px !important; }
.split { display: flex !important; justify-content: space-between !important; align-items: center !important; gap: 16px !important; }   /* text left, button right */
.hstack { display: flex !important; gap: 8px !important; }                 /* things side by side, e.g. buttons */
.wrap-row { display: flex !important; flex-wrap: wrap !important; gap: 8px !important; }
.check-label { font-weight: normal !important; display: flex !important; gap: 8px !important; align-items: center !important; }
.tick-group { display: flex !important; flex-wrap: wrap !important; gap: 6px 16px !important; padding: 6px 0 !important; }
.btn-block { width: 100% !important; justify-content: center !important; }  /* a button as wide as its card */
.auth-brand { padding: 0 0 8px !important; }                               /* sign-in pages */
.auth-title { font-size: 22px !important; margin: 0 0 4px !important; }
.code-grid { display: grid !important; grid-template-columns: repeat(2, max-content) !important; gap: 10px 40px !important; font-size: 17px !important; }   /* 2FA backup codes */
.alert-soft { background: var(--primary-soft) !important; color: var(--text) !important; }
.bg-soft { background: #f8f9fb !important; }
.text-sensitive { color: #8a5a00 !important; }                             /* a sensitive permission */
.is-locked { cursor: default !important; opacity: .4 !important; }

/* Website badge and radio buttons */
.badge-web { background: #f3e8ff; color: #7e22ce; }
input[type=radio] { width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

/* Segmented control (two or three exclusive choices, e.g. website price / stock status) */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: #eef1f6; border: 1px solid var(--border); border-radius: var(--radius-sm); max-width: 100%; flex-wrap: wrap; }
.segmented label { margin: 0; font-weight: 500; cursor: pointer; }
.segmented input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented span { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 6px; color: var(--muted); font-size: 14px; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--border); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Chip toggles (independent on/off options, e.g. Featured / New arrival) */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { margin: 0; font-weight: 500; cursor: pointer; }
.chip-toggle input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip-toggle span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; transition: background .15s, color .15s, border-color .15s; }
.chip-toggle:hover span { border-color: var(--primary); color: var(--text); }
.chip-toggle input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ===== Error page ===== */
.error-page { max-width: 520px; margin: 64px auto; text-align: center; padding: 0 16px; }
.error-icon {
    width: 88px; height: 88px; margin: 0 auto 20px; border-radius: 50%;
    display: grid; place-items: center; font-size: 38px;
    background: var(--surface); color: var(--primary);
    box-shadow: 0 0 0 10px var(--primary-soft), 0 18px 40px rgba(29, 99, 237, .18);
}
.error-page.warn .error-icon { color: #b45309; box-shadow: 0 0 0 10px var(--warning-soft), 0 18px 40px rgba(180, 83, 9, .14); }
.error-page.danger .error-icon { color: var(--danger); box-shadow: 0 0 0 10px var(--danger-soft), 0 18px 40px rgba(192, 53, 43, .14); }
.error-code {
    display: inline-block; margin: 14px 0 0; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.error-page h1 { margin: 12px 0 8px; font-size: 26px; font-weight: 700; }
.error-message { color: var(--muted); margin: 0 auto 26px; max-width: 420px; line-height: 1.6; }
.error-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.error-detail { text-align: left; white-space: pre-wrap; font-size: 12px; background: var(--surface);
                border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 22px; }
.error-ref { margin: 30px 0 0; font-size: 12px; color: var(--subtle); }
.error-ref code { user-select: all; font-size: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.auth .error-page { margin: 0 auto; }

/* ===== Branches & warehouses ===== */
.badge-warning { background: var(--warning-soft); color: #8a5a00; }
.code-chip { display: inline-block; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--text); background: #f1f3f6; border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; vertical-align: middle; white-space: nowrap; }   /* a code (PP1-CASH-KHR) never breaks across lines */
input.upper { text-transform: uppercase; }
input.upper::placeholder { text-transform: none; }

/* Button of a form that is being sent (double-click protection in site.js) */
.btn.is-busy, .icon-btn.is-busy { opacity: .65; cursor: progress; pointer-events: none; position: relative; }
.btn.is-busy::after {
    content: ""; width: 14px; height: 14px; margin-left: 4px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Staff ===== */
.alert-warning { background: var(--warning-soft); color: #8a5a00; }
.action-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.action-row + .action-row { border-top: 1px solid var(--border); }
/* One-time temporary password */
.secret-box { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 32px; padding: 16px 20px;
              background: var(--surface-alt); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.secret-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.secret-value { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 22px; font-weight: 600; letter-spacing: .04em; user-select: all; }
.secret-box .btn { margin-left: auto; }

/* ===== Searchable picker (Views/Shared/_Lookup.cshtml, wwwroot/js/lookup.js) ===== */
.lookup { position: relative; }
.lookup-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.lookup-input { padding-left: 36px; padding-right: 36px; }
.lookup-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px;
                display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.lookup-clear[hidden] { display: none; }
.lookup-clear:hover { background: var(--bg); color: var(--text); }
.lookup-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
               max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
               border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(16, 24, 40, .14); }
.lookup-list li { padding: 8px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.lookup-list li:hover, .lookup-list li.is-active { background: var(--primary-soft); color: var(--primary); }
.lookup-list li.is-current { font-weight: 600; }
.lookup-list li.is-inactive { color: var(--muted); }
.lookup-list li.lookup-empty { color: var(--muted); cursor: default; background: none; }
.toolbar .lookup { flex: 0 1 230px; min-width: 180px; }
.card:has(.lookup) { overflow: visible; }   /* the option list may reach below the card */

/* ===== Password boxes: eye button (site.js) ===== */
.password-box { position: relative; }
.password-box input { padding-right: 44px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px;
                   display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.password-toggle:hover { background: var(--bg); color: var(--text); }
.password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input[type=password]::-ms-reveal { display: none; }   /* Edge's own eye: ours is shown instead */

/* ===== Audit log and "who changed it" ===== */
.alert-info { background: var(--primary-soft); color: var(--primary); }
.date-filter { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; color: var(--muted); font-size: 14px; }
.date-filter input { width: auto; }
.audit-table td { vertical-align: top; }
.audit-details { max-width: 420px; color: var(--text); word-break: break-word; }
.record-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* ===== Stock adjustments ===== */
.nowrap { white-space: nowrap; }
.date-range { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }   /* From and To wrap together */
.card-body + .card-body.add-line, .table-wrap + .card-body.add-line, .empty + .card-body.add-line { border-top: 1px solid var(--border); }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; word-break: break-word; }
.qty-in { color: var(--success); }
.qty-out { color: var(--danger); }
.qty-input { width: 96px; text-align: right; }                         /* a quantity typed in a table row (transfer: what arrived) */
.serial-list { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; word-break: break-word; }
.serial-filter { max-width: 280px; margin-bottom: 10px; }
.serial-pick { display: flex; flex-wrap: wrap; gap: 8px; max-height: 240px; overflow-y: auto; padding: 2px; }
.serial-pick label[hidden], [data-when-add][hidden], [data-when-remove][hidden], [data-serials][hidden] { display: none; }
@media (max-width: 720px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 8px; } }

/* ---------- Purchases: what a purchase is worth, paid and still owed ---------- */
.money-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.money-summary > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.money-summary .label { color: var(--muted); font-size: 13px; }
.money-summary .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 600; border-top: 2px solid var(--border); }
/* A small action that asks for a reason first (e.g. cancel a payment): click to open, then type the reason. */
.inline-action summary { list-style: none; display: inline-flex; cursor: pointer; }
.inline-action summary::-webkit-details-marker { display: none; }
.inline-action[open] summary { margin-bottom: 8px; }
.inline-action form { display: flex; gap: 8px; align-items: center; min-width: 280px; }
.inline-action form input { flex: 1; min-width: 180px; }

/* ---------- Menu: a count next to a link (open alerts) ---------- */
.nav .nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff;
                  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 1000px) {
    .nav .nav-count { position: absolute; top: 2px; right: 6px; margin: 0; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
}

/* Boxes that store capitals (codes, references) show their example text as written, not in capitals. */
input::placeholder { text-transform: none; }

/* A table column with names (products, suppliers): never squeezed to a few letters by the number columns. */
.table td.col-name { min-width: 180px; }

/* Wide lists (Stock on hand, Purchases): a little less space between columns, and headers may use two lines,
   so every column fits on a normal screen without scrolling sideways. */
.table-dense th, .table-dense td { padding-left: 12px; padding-right: 12px; }
.table-dense th { white-space: normal; }
.table-dense td.col-name { min-width: 140px; }
/* Stock movements: long SKUs and serial numbers wrap, so every column fits without sideways scrolling. */
.movements code.slug, .movements .serial-list { white-space: normal; overflow-wrap: anywhere; }
.movements td:nth-child(2) { min-width: 200px; }
/* The small second line under a name (the SKU and its badges). */
.sub-line { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.sub-line > * + .badge { margin-left: 0; }
.sub-line code.slug { white-space: normal; overflow-wrap: anywhere; }   /* long SKUs break instead of widening the column */

/* ---------- Receiving (5d): scan box, serial mode, counted lines ---------- */
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.scan-row { display: flex; gap: 12px; align-items: center; }
.scan-row .scan-box { flex: 1 1 auto; max-width: none; }
.scan-box input { height: 48px; font-size: 18px; }
.scan-status { min-height: 24px; margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.scan-status:empty { display: none; }
.scan-status.ok { color: var(--success); }
.scan-status.warn { color: #9a6700; }
.scan-status.error { color: var(--danger); }
.serial-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px;
               border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); }
.serial-mode[hidden], [data-type-other][hidden] { display: none; }
.receive-table tr.is-waiting td { background: var(--surface-alt); }
.receive-table td.num .btn-sm { margin-top: 4px; }
.inline-count { display: inline-flex; gap: 6px; align-items: center; margin-top: 4px; }
.inline-count .qty-input { width: 88px; height: 32px; }
.col-check { min-width: 190px; }
.serial-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.serial-chip { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 10px; margin: 0;
               border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
               font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
span.serial-chip { padding-right: 10px; }
.serial-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; height: 22px; border-radius: 999px; }
.serial-chip button:hover { color: var(--danger); background: var(--danger-soft); }
.blockers { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.delivery-photo { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 8px 0; }
.delivery-thumb { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
@media (max-width: 720px) {
    .scan-row { flex-wrap: wrap; }
    .scan-row .btn { flex: 1 1 100%; }
    .action-row { flex-wrap: wrap; }
}

/* Receiving: live camera scanning (5d-2) */
.camera-panel { margin-top: 12px; }
.camera-panel[hidden] { display: none; }
.camera-panel video { display: block; width: 100%; max-width: 520px; max-height: 320px; object-fit: cover; background: #111;
                      border-radius: var(--radius-sm); }
.camera-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; max-width: 520px; margin-top: 8px; }

/* ===== Point of sale (M30a) ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.table-wrap .sr-only { left: 0; }   /* a hidden label inside a scrolling table must not widen the page (phone POS) */
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); gap: 20px; align-items: start; }
.pos-main { display: grid; gap: 20px; min-width: 0; }
.pos-scan { padding: 20px; }
.pos-cart { overflow: visible; }      /* the customer picker's list may open below the card's edge */
.pos-name { font-weight: 600; overflow-wrap: anywhere; }
.pos-kh { color: var(--muted); font-size: 13px; }
.pos-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.pos-meta .badge { margin: 0; }
.pos-customer { display: grid; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.pos-customer-now { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.pos-customer-now strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pos-customer-now form { margin: 0; }
.pos-new-customer summary { list-style: none; display: inline-flex; cursor: pointer; }
.pos-new-customer summary::-webkit-details-marker { display: none; }
.pos-new-customer[open] summary { margin-bottom: 10px; }
.pos-new-customer .field { margin-bottom: 10px; }
.pos-cart > .alert { width: auto; margin: 12px 20px 0; }
.pos-lines td { vertical-align: top; }
.pos-lines .serial-chips + .btn { margin-top: 2px; }
.qty-stepper { display: inline-flex; align-items: center; gap: 4px; }
.qty-stepper form { display: inline-flex; margin: 0; }
.qty-stepper .icon-btn { width: 32px; height: 32px; }
.qty-stepper .qty-input { width: 58px; height: 32px; padding: 0 4px; text-align: center; }
.pos-total { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-alt); }
.pos-total .label { font-weight: 700; }
.pos-total .usd { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pos-total .khr { font-size: 16px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.pos-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.pos-cancel { display: flex; align-items: center; gap: 8px; margin: 0; }
.pos-cancel select { width: auto; max-width: 220px; height: 32px; font-size: 13px; }
.pos-till-list { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.pos-till-option { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-weight: 500; cursor: pointer; }
.pos-till-option:hover { border-color: var(--primary); }
.pos-till-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
@media (max-width: 1200px) { .pos { grid-template-columns: 1fr; } }
/* The selling screen (Pos/Index): a wider cart, so product names fit, and a page that may use a wide monitor. */
.content:has(.pos-sell) { max-width: 1520px; }
.pos.pos-sell { grid-template-columns: minmax(0, 1fr) minmax(440px, 560px); }
@media (max-width: 1200px) { .pos.pos-sell { grid-template-columns: 1fr; } }
.pos-actions-sell { display: grid; grid-template-columns: 1fr; justify-content: stretch; gap: 12px; }
.btn-pay { width: 100%; height: 52px; font-size: 16px; justify-content: center; }
.pos-actions-sell .pos-cancel { justify-content: flex-end; }

/* ===== Session warning (site.js, review H2) ===== */
.session-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
                  width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border: 1px solid #e6c36a; border-radius: var(--radius-sm);
                  background: var(--warning-soft); color: #8a5a00; font-weight: 500; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); }
.session-banner[hidden] { display: none; }
.session-banner.is-out { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.session-banner [hidden] { display: none; }

/* ===== Take payment (M30b) ===== */
.pay-fill { margin-top: 6px; }
.pay-result { min-height: 24px; margin: 12px 0 4px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-result.is-ok { background: var(--success-soft); color: var(--success); }
.pay-result.is-warn { background: var(--warning-soft); color: #8a5a00; }
.pay-result.is-error { background: var(--danger-soft); color: var(--danger); }
.pay-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.pay-actions form { margin: 0; }
.table td .pay-actions { margin-top: 0; justify-content: flex-end; }
.pay-dead td { color: var(--muted); }
.pay-dead .pos-name { text-decoration: line-through; }
.pay-summary { margin: 0; padding: 8px 20px; }
.pay-summary > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pay-summary > div:last-child { border-bottom: 0; }
.pay-summary dt { color: var(--muted); }
.pay-summary dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-summary dd span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.pay-summary .pay-waiting dd { color: #8a5a00; }
.pay-summary .pay-due dt { color: var(--text); font-weight: 700; }
.pay-summary .pay-due dd { font-size: 24px; }

/* ----- Discounts (M31): on a cart line, the totals, and Sales → Approvals ----- */
.pos-discount { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 8px 6px 10px; border-radius: var(--radius-sm); background: var(--success-soft); color: var(--success); font-size: 13px; }
.pos-discount > span { flex: 1 1 160px; min-width: 0; }
.pos-discount form { margin: 0; }
.pos-discount .icon-btn { width: 28px; height: 28px; }
.pos-discount.is-waiting { background: var(--primary-soft); color: var(--primary); }
.pos-discount.is-expired { background: var(--warning-soft); color: #8a5a00; }
.pos-discount-why { display: block; color: var(--muted); overflow-wrap: anywhere; }
.pos-discount-ask { margin-top: 8px; }
.pos-discount-ask summary { list-style: none; display: inline-flex; cursor: pointer; }
.pos-discount-ask summary::-webkit-details-marker { display: none; }
.pos-discount-ask[open] summary { margin-bottom: 8px; }
.pos-discount-ask form { display: grid; gap: 8px; max-width: 280px; margin: 0; }
.pos-discount-ask select, .pos-discount-ask input { height: 34px; font-size: 14px; }
.pos-discount-ask .btn { justify-self: start; }
.pos-discount-amount { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 6px; }
.pos-subtotals { margin: 0; padding: 12px 20px 0; border-top: 1px solid var(--border); background: var(--surface-alt); font-size: 14px; }
.pos-subtotals div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.pos-subtotals dt { color: var(--muted); }
.pos-subtotals dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pos-subtotals + .pos-total { border-top: 0; }
/* C2: the paper coupon at the till: its line in the subtotals (with the "take off" button) and the box to type a code. */
.pos-coupon-amount { display: inline-flex; align-items: center; gap: 6px; }
.pos-coupon-amount form { margin: 0; }
.pos-coupon { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.pos-coupon input { flex: 1 1 auto; min-width: 0; height: 40px; text-transform: uppercase; letter-spacing: .04em; }
.approval-list { list-style: none; margin: 0; padding: 0; }
.approval-item { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.approval-item:last-child { border-bottom: 0; }
.approval-what { min-width: 0; }
.approval-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; margin: 12px 0 0; }
.approval-figures dt { font-size: 12px; color: var(--muted); }
.approval-figures dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.approval-form { display: grid; gap: 8px; margin: 0; }
.approval-form input { height: 34px; font-size: 14px; }
.approval-amount { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.approval-amount input { width: 110px; text-align: right; }
.approval-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.approvals-done td { vertical-align: top; }
.approvals-done td:nth-child(2) { min-width: 160px; }
@media (max-width: 900px) {
    .approval-item { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ----- Customer returns (M32): choosing what comes back, and the return page ----- */
.return-lines td { vertical-align: top; }
.return-lines select { width: auto; max-width: 260px; }
.return-qty { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.return-serials { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.return-serials .toggle { margin: 0; }
.return-lines tfoot td { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ----- Print popup (M32b): A5 invoice / refund slip, full or without the company header ----- */
.print-options { display: grid; gap: 8px; margin-top: 16px; }
.print-option { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; }
.print-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.print-option input { margin-top: 3px; }
.print-option span { display: grid; gap: 2px; }
.print-option small { color: var(--muted); font-size: 13px; }
