/* ==========================================================================
   The building blocks every page uses. One look everywhere.
   Dark versions of every colour are in dark.css.
   ========================================================================== */

/* ---------- Buttons ----------
   .btn                 the normal button (white)
   .btn-primary         the one main action of a place (blue)
   .btn-quiet           no frame, for small side actions
   .btn-danger          quiet red text (never a loud red block)
   .btn-sm  .btn-icon  .btn-block */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: var(--ctrl-h); padding: 0 14px; white-space: nowrap;
    font-size: var(--fs-md); font-weight: 600; line-height: 1;
    color: #1e293b; background-color: #ffffff;
    border: 1px solid #dbe2ea; border-radius: var(--r-md);
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn .fa-solid { font-size: 0.95em; color: #64748b; }
.btn:hover { background-color: #f8fafc; border-color: #c8d2de; }
.btn:active { background-color: #f1f5f9; }
.btn:disabled { opacity: 0.5; box-shadow: none; }
.btn:disabled:hover { background-color: #ffffff; border-color: #dbe2ea; }
.btn-primary { color: #ffffff; background-color: #2563eb; border-color: #2563eb; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2); }
.btn-primary .fa-solid { color: #ffffff; }
.btn-primary:hover { background-color: #1d4ed8; border-color: #1d4ed8; }
.btn-primary:active { background-color: #1e40af; }
.btn-primary:disabled:hover { background-color: #2563eb; border-color: #2563eb; }
.btn-quiet { color: #475569; background-color: transparent; border-color: transparent; box-shadow: none; }
.btn-quiet:hover { color: #1e293b; background-color: #f1f5f9; border-color: transparent; }
.btn-quiet:disabled:hover { background-color: transparent; border-color: transparent; }
.btn-danger { color: #b91c1c; }
.btn-danger .fa-solid { color: #dc2626; }
.btn-danger:hover { color: #991b1b; background-color: #fef2f2; border-color: #f5c2c2; }
.btn-sm { height: var(--ctrl-h-sm); padding: 0 10px; font-size: var(--fs-sm); gap: 6px; }
.btn-icon { width: var(--ctrl-h); padding: 0; }
.btn-icon.btn-sm { width: var(--ctrl-h-sm); }
.btn-block { width: 100%; }
.btn.is-busy { pointer-events: none; opacity: 0.7; }
.btn.is-busy .fa-solid { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Segmented switch (In stock | Pending order …) ---------- */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background-color: #f1f4f8; border: 1px solid #e6ebf1; border-radius: 10px; }
.seg-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
    font-size: var(--fs-md); font-weight: 500; color: #475569; background-color: transparent;
    border: 0; border-radius: 7px; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg-btn .fa-solid { font-size: 12px; color: #94a3b8; }
.seg-btn:hover { color: #1e293b; }
.seg-btn.is-active { color: #1d4ed8; font-weight: 600; background-color: #ffffff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04); }
.seg-btn.is-active .fa-solid { color: #3b6fe0; }
.count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px;
    font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; color: #64748b;
    background-color: #e8edf3; border-radius: var(--r-pill);
}
.is-active > .count { color: #1d4ed8; background-color: #dbe8fd; }

/* ---------- Chips (filters, manufacturers) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: var(--chip-h); padding: 0 11px;
    font-size: var(--fs-sm); font-weight: 500; color: #334155; background-color: #ffffff;
    border: 1px solid #e2e8f0; border-radius: var(--r-pill);
    transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.chip:hover { border-color: #c8d2de; background-color: #f8fafc; }
.chip.is-active { color: #1d4ed8; background-color: #eff6ff; border-color: #9dbaf5; }
.chip.is-off { color: #94a3b8; border-style: dashed; }
.chip .count { height: 16px; min-width: 18px; padding: 0 5px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); }
.label { font-size: var(--fs-sm); font-weight: 600; color: #334155; }
.label-opt { font-weight: 400; color: #94a3b8; }
.hint { font-size: var(--fs-sm); color: #64748b; }
.input, .select, .textarea {
    width: 100%; height: var(--ctrl-h); padding: 0 11px;
    font-size: var(--fs-base); color: #1e293b; background-color: #ffffff;
    border: 1px solid #d5dde7; border-radius: var(--r-md);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #9aa6b8; }
.input:hover, .select:hover, .textarea:hover { border-color: #c2cdd9; }
.input:focus, .select:focus, .textarea:focus { border-color: #6f9cf0; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); outline: none; }
.input:disabled, .select:disabled, .textarea:disabled { color: #64748b; background-color: #f8fafc; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: #ef8f8f; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1); }
.textarea { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.45; resize: vertical; }
/* A textarea with the .input class looks the same as .textarea and is as tall as its rows (3 by default). */
textarea.input { height: auto; min-height: 0; padding: 9px 11px; line-height: 1.45; resize: vertical; }
.select {
    appearance: none; padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm { height: var(--ctrl-h-sm); font-size: var(--fs-md); }
/* Our dropdown (js/core/select.js): the closed field is a button that looks like .select; the list is the app's menu. */
.cselect-native { display: none; }
.cselect { display: flex; align-items: center; text-align: left; }
.cselect-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cselect.is-open { border-color: #6f9cf0; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.cselect-pop {
    position: fixed; z-index: calc(var(--z-toast) - 10); display: flex; flex-direction: column; gap: 4px; max-width: min(420px, calc(100vw - 16px));
    padding: 5px; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.05);
}
.cselect-search { flex: none; }
.cselect-list { position: relative; display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; outline: none; }
.cselect-opt {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; text-align: left;
    font-size: var(--fs-md); font-weight: 500; color: #334155; background-color: transparent; border: 0; border-radius: 7px; cursor: pointer;
}
.cselect-pop.is-sm .cselect-opt { min-height: 30px; padding: 4px 9px; }
.cselect-lines { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.cselect-lines small { font-size: var(--fs-xs); font-weight: 400; color: #64748b; }
.cselect-opt .fa-check { flex: none; font-size: 11px; color: #3b6fe0; }
.cselect-opt.is-active { color: #0f172a; background-color: #f3f6fa; }
.cselect-opt.is-selected { color: #1d4ed8; }
.cselect-opt:disabled { color: #a3afc0; cursor: default; }
.cselect-box { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; background-color: #fff; border: 1.5px solid #c3cddb; border-radius: 4px; }
.cselect-opt.is-selected .cselect-box { background-color: #2563eb; border-color: #2563eb; }
.cselect-opt.is-selected .cselect-box .fa-check { font-size: 9px; color: #fff; }
.cselect-box.is-all { border-radius: 50%; }
.cselect-pop.is-multi .cselect-opt.is-all { margin-bottom: 3px; box-shadow: 0 4px 0 -3px #eef2f6; }
.cselect.is-picked { color: #1d4ed8; border-color: #9cbcf5; background-color: #f5f9ff; }
.cselect-group { padding: 8px 10px 3px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #94a3b8; }
.cselect-empty { padding: 10px; font-size: var(--fs-md); color: #64748b; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 40px; }
.input-eye {
    position: absolute; top: 3px; right: 3px; width: 30px; height: 30px;
    color: #94a3b8; background-color: transparent; border: 0; border-radius: var(--r-sm);
}
.input-eye:hover { color: #475569; background-color: #f1f5f9; }
.input-search { position: relative; }
.input-search .fa-magnifying-glass { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #94a3b8; pointer-events: none; }
.input-search .input { padding-left: 34px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); color: #334155; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; cursor: pointer; }
.form-error { font-size: var(--fs-md); color: #b91c1c; }

/* A form inside a window keeps the window's own spacing; .stack spaces its children the same way. */
.form-flat { display: contents; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ---------- Cards ---------- */
.card { background-color: #ffffff; border: 1px solid #e5eaf0; border-radius: var(--r-lg); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 14px var(--sp-4); border-bottom: 1px solid #eef2f6; }
.card-title { font-size: var(--fs-base); font-weight: 600; color: #0f172a; }
.card-sub { font-size: var(--fs-sm); color: #64748b; }
.card-body { padding: var(--sp-4); }
.card-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 12px var(--sp-4); border-top: 1px solid #eef2f6; background-color: #fafbfd; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Tables ----------
   .table            a calm list (13px, lines between rows only, no vertical lines)
   .table.is-sheet   spreadsheet feel: 12px, tight rows, row numbers */
.table-wrap { overflow: auto; }
/* A table straight inside a card follows the card's rounded corners (the grey heading row must not stick out). */
.card > .table-wrap { border-radius: calc(var(--r-lg) - 1px); }
/* Something under the table in the same card (the "Nothing here" note): only the top corners are rounded, so the line under the header stays straight. */
.card > .table-wrap:has(+ :not([hidden])) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th {
    position: sticky; top: 0; z-index: 1;
    padding: 9px 12px; text-align: left; white-space: nowrap;
    font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #64748b;
    background-color: #f6f8fb; border-bottom: 1px solid #e5eaf0;
}
.table td { padding: 10px 12px; color: #1e293b; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.table tbody tr { transition: background-color var(--t-fast) var(--ease); }
/* Only with a mouse: on a phone a tapped row would stay lit. */
@media (hover: hover) { .table tbody tr:hover { background-color: #f8fafc; } }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-picked { background-color: #dbe8ff; }
/* The row you opened stays clearly lit (a blue bar on its left) until another row is opened. */
.table tbody tr.is-picked > td { background-color: #dbe8ff; }
.table tbody tr.is-picked > td:first-child { box-shadow: inset 4px 0 0 #2563eb; }
.table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .is-tight { width: 1%; white-space: nowrap; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { display: block; font-size: var(--fs-sm); color: #64748b; }
.table.is-sheet { font-size: var(--fs-sm); }
.table.is-sheet th { padding: 7px 10px; }
.table.is-sheet td { padding: 5px 10px; border-bottom-color: #e8edf3; }
.table.is-sheet .row-no { width: 36px; padding: 5px 6px; text-align: center; font-size: var(--fs-xs); color: #94a3b8; background-color: #f8fafc; }
.ellipsis { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Badges (soft) ----------
   .badge + one tone: is-blue is-green is-amber is-red is-grey is-purple
   .badge-invoice  the invoice number (its own teal, used for nothing else) */
.badge {
    display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; white-space: nowrap;
    font-size: var(--fs-sm); font-weight: 600; line-height: 1;
    color: #475569; background-color: #f1f5f9; border: 1px solid #e2e8f0; border-radius: var(--r-sm);
}
.badge .fa-solid { font-size: 0.85em; }
.badge.is-blue { color: #1d4ed8; background-color: #eff6ff; border-color: #c7d9fb; }
.badge.is-green { color: #15803d; background-color: #ecfdf3; border-color: #c3ebd2; }
.badge.is-amber { color: #b45309; background-color: #fff8eb; border-color: #f6dca8; }
.badge.is-red { color: #b91c1c; background-color: #fef2f2; border-color: #f8cccc; }
.badge.is-purple { color: #6d28d9; background-color: #f5f1ff; border-color: #e0d5fb; }
.badge.is-grey { color: #475569; background-color: #f1f5f9; border-color: #e2e8f0; }
.badge-invoice {
    display: inline-flex; align-items: center; height: 24px; padding: 0 8px; white-space: nowrap;
    font-size: var(--fs-md); font-weight: 600; letter-spacing: 0.01em;
    color: #0f6b62; background-color: #e8f6f4; border: 1px solid #b9e3dd; border-radius: var(--r-sm);
}
a.badge-invoice:hover { color: #0b5750; background-color: #dcf1ee; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background-color: #94a3b8; }
.dot.is-green { background-color: #22a05a; }
.dot.is-amber { background-color: #e09a1b; }
.dot.is-red { background-color: #e04848; }
.dot.is-blue { background-color: #3b6fe0; }

/* ---------- Notes (a calm message inside a page or window) ---------- */
.note {
    display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px;
    font-size: var(--fs-md); color: #334155; background-color: #f6f9ff; border: 1px solid #dbe6fb; border-radius: var(--r-md);
}
.note > .fa-solid { margin-top: 3px; color: #3b6fe0; }
.note strong { color: #0f172a; }
.note.is-warn { background-color: #fffaf0; border-color: #f5e0b5; }
.note.is-warn > .fa-solid { color: #d48a12; }
.note.is-ok { background-color: #f3fbf6; border-color: #cdebd9; }
.note.is-ok > .fa-solid { color: #22a05a; }
.note.is-error { background-color: #fff6f6; border-color: #f6d0d0; }
.note.is-error > .fa-solid { color: #dc2626; }

/* ---------- Tabs ---------- */
/* Many tabs on a narrow screen scroll sideways (swipe), without a scrollbar showing. */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid #e5eaf0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; white-space: nowrap; flex: none;
    font-size: var(--fs-md); font-weight: 500; color: #64748b; background-color: transparent;
    border: 0; border-bottom: 2px solid transparent;
    transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tab:hover { color: #1e293b; }
.tab.is-active { color: #1d4ed8; font-weight: 600; border-bottom-color: #2563eb; }

/* ---------- Steps (an order's way: offer → booked → documents → permit → next in line → shipped) ---------- */
.steps { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; font-size: var(--fs-sm); font-weight: 500; color: #94a3b8; background-color: #f5f7fa; border-radius: var(--r-pill); }
.step .fa-solid { font-size: 11px; }
.step.is-done { color: #15803d; background-color: #ecfdf3; }
.step.is-now { color: #1d4ed8; font-weight: 600; background-color: #eff6ff; box-shadow: inset 0 0 0 1px #c7d9fb; }
.step.is-wait { color: #b45309; background-color: #fff8eb; }
.step-sep { width: 10px; height: 1px; background-color: #d5dde7; }

/* ---------- Dropdown menus ---------- */
.dropdown { position: relative; }
.menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-menu);
    min-width: 210px; padding: 6px; display: flex; flex-direction: column;
    background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.05);
}
.menu-right { left: auto; right: 0; }
.menu-head { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; }
.menu-head strong { font-size: var(--fs-md); color: #0f172a; }
.menu-head span { font-size: var(--fs-sm); color: #64748b; }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; text-align: left;
    font-size: var(--fs-md); font-weight: 500; color: #334155; background-color: transparent; border: 0; border-radius: 7px;
}
.menu-item .fa-solid { width: 16px; text-align: center; font-size: 13px; color: #94a3b8; }
.menu-item:hover { color: #0f172a; background-color: #f3f6fa; }
.menu-item.is-active { color: #1d4ed8; background-color: #eff6ff; }
.menu-item.is-active .fa-solid { color: #3b6fe0; }
.menu:has(.has-sub) { min-width: 360px; }
.menu-item.has-sub { height: auto; min-height: 34px; padding: 7px 10px; align-items: flex-start; }
.menu-item.has-sub .fa-solid { margin-top: 3px; }
.menu-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 300px; white-space: normal; }
.menu-sub { font-size: var(--fs-xs); font-weight: 400; line-height: 1.35; color: #64748b; }
.menu-item.is-danger { color: #b91c1c; }
.menu-item.is-danger .fa-solid { color: #dc2626; }
.menu-sep { height: 1px; margin: 5px 4px; background-color: #eef2f6; }
.menu-label { padding: 8px 10px 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #94a3b8; }

/* ---------- Windows (modals). They close only with X, Cancel or Save, never by clicking outside. ---------- */
.modal-back {
    position: fixed; inset: 0; z-index: var(--z-modal);
    display: flex; align-items: flex-start; justify-content: center; padding: 6vh var(--sp-4) var(--sp-6); overflow: hidden;
    background-color: rgba(15, 23, 42, 0.38);
    animation: fade-in var(--t-med) var(--ease);
}
.modal {
    width: 100%; max-width: 560px; display: flex; flex-direction: column;
    /* A long window never makes the page scroll: its title and buttons stay, only its middle scrolls. */
    max-height: calc(100vh - 6vh - 24px); max-height: calc(100dvh - 6vh - 24px);
    background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-xl);
    box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.3);
    animation: pop-in var(--t-med) var(--ease);
}
.modal.is-wide { max-width: 860px; }
.modal.is-xl { max-width: 1180px; }
.modal.is-narrow { max-width: 420px; }
.modal-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: 18px 20px 12px; }
.modal-title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: 650; color: #0f172a; }
.modal-title .fa-solid { color: #3b6fe0; font-size: 0.95em; }
.modal-sub { margin-top: 3px; font-size: var(--fs-md); color: #64748b; }
.modal-x { width: 32px; height: 32px; flex: none; color: #94a3b8; background-color: transparent; border: 0; border-radius: var(--r-md); }
.modal-x:hover { color: #334155; background-color: #f1f5f9; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--sp-4); padding: 4px 20px 20px; }
.modal-body > * { flex: none; }
.modal.is-scrolled .modal-head { position: relative; box-shadow: 0 1px 0 #e8edf3, 0 6px 10px -8px rgba(15, 23, 42, 0.18); z-index: 1; }
.modal.has-more .modal-foot { box-shadow: 0 -6px 10px -8px rgba(15, 23, 42, 0.18); }
.modal-foot { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding: 14px 20px; border-top: 1px solid #eef2f6; background-color: #fafbfd; border-radius: 0 0 var(--r-xl) var(--r-xl); }
body.has-modal { overflow: hidden; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } }

/* A small text link that adds or opens something ("+ Details", "+ Add a note", "+ Add a cost"). */
.lt-desc-add { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; padding: 0; font-size: var(--fs-sm); font-weight: 600; color: #3b6fe0; background-color: transparent; border: 0; cursor: pointer; }
.lt-desc-add .fa-solid { font-size: 10px; }
.lt-desc-add:hover { color: #1d4ed8; text-decoration: underline; }

/* ---------- Messages: always bottom middle ---------- */
.toasts { position: fixed; left: 50%; bottom: 54px; z-index: var(--z-toast); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: min(560px, calc(100vw - 32px)); padding: 11px 12px 11px 14px;
    font-size: var(--fs-md); color: #1e293b; background-color: #ffffff;
    border: 1px solid #e2e8f0; border-left: 3px solid #3b6fe0; border-radius: 10px;
    box-shadow: 0 12px 28px -10px rgba(15, 23, 42, 0.25);
    pointer-events: auto; animation: pop-in var(--t-med) var(--ease);
}
.toast > .fa-solid { color: #3b6fe0; }
.toast.is-ok { border-left-color: #22a05a; }
.toast.is-ok > .fa-solid { color: #22a05a; }
.toast.is-error { border-left-color: #dc2626; }
.toast.is-error > .fa-solid { color: #dc2626; }
.toast.is-warn { border-left-color: #e09a1b; }
.toast.is-warn > .fa-solid { color: #e09a1b; }
.toast-text { flex: 1; }
/* The time left, as a bar that runs out along the bottom (coloured like the message). */
.toast { position: relative; overflow: hidden; }
.toast-time { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background-color: #3b6fe0; opacity: 0.55; transform-origin: left center; animation: toast-time linear forwards; pointer-events: none; }
.toast.is-ok .toast-time { background-color: #22a05a; }
.toast.is-error .toast-time { background-color: #dc2626; }
.toast.is-warn .toast-time { background-color: #e09a1b; }
@keyframes toast-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast-time { animation-timing-function: steps(10); } }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); }

/* ---------- Dashboard boxes ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }
.stat {
    display: flex; gap: 14px; align-items: flex-start; padding: 18px;
    color: inherit; background-color: #ffffff; border: 1px solid #e5eaf0; border-radius: var(--r-lg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
a.stat:hover { color: inherit; border-color: #c9d6e6; box-shadow: 0 6px 16px -10px rgba(15, 23, 42, 0.2); }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none; border-radius: 10px; color: #3b6fe0; background-color: #eff6ff; }
.stat.is-green .stat-icon { color: #1f9254; background-color: #ecfdf3; }
.stat.is-amber .stat-icon { color: #c27a0e; background-color: #fff6e5; }
.stat.is-purple .stat-icon { color: #7046d6; background-color: #f5f1ff; }
.stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: var(--fs-md); font-weight: 500; color: #64748b; }
.stat-value { font-size: 1.857rem; font-weight: 650; line-height: 1.15; color: #0f172a; font-variant-numeric: tabular-nums; }
.stat-value.is-empty { color: #cbd5e1; }
.stat-sub { font-size: var(--fs-sm); color: #94a3b8; }

/* ---------- Empty places ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px var(--sp-4); text-align: center; }
.empty > .fa-solid { font-size: 28px; color: #c5d0de; margin-bottom: 6px; }
.empty-title { font-size: var(--fs-lg); font-weight: 600; color: #334155; }
.empty-text { max-width: 460px; color: #64748b; font-size: var(--fs-md); }
.empty .btn { margin-top: 10px; }

/* ---------- Pills: where an order stands, in a few words (one per row) ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 10px; white-space: nowrap;
    font-size: var(--fs-sm); font-weight: 600; line-height: 1;
    color: #475569; background-color: #f1f5f9; border: 1px solid transparent; border-radius: var(--r-pill);
}
.pill > span { overflow: hidden; text-overflow: ellipsis; }
.pill .fa-solid { font-size: 0.85em; }
.pill.is-blue { color: #1d4ed8; background-color: #eff6ff; border: 1px solid #c7d9fb; }
.pill.is-green { color: #15803d; background-color: #ecfdf3; border: 1px solid #c3ebd2; }
.pill.is-amber { color: #b45309; background-color: #fff8eb; border: 1px solid #f6dca8; }
.pill.is-red { color: #b91c1c; background-color: #fef2f2; border: 1px solid #f8cccc; }
.pill.is-grey { color: #475569; background-color: #f1f5f9; border: 1px solid #e2e8f0; }
.pill.is-purple { color: #6d28d9; background-color: #f5f3ff; border: 1px solid #ddd6fe; }
.pill-more { margin-left: 6px; font-size: var(--fs-sm); color: #94a3b8; white-space: nowrap; }

/* ---------- Side panel (the order panel): slides in from the right, closes with X ---------- */
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-menu) + 10);
    width: min(680px, 100vw); display: flex; flex-direction: column;
    background-color: #f8fafc; border-left: 1px solid #dbe2ea;
    box-shadow: -18px 0 40px -24px rgba(15, 23, 42, 0.35);
    animation: drawer-in var(--t-med) var(--ease);
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); padding: 16px 20px 14px; background-color: #ffffff; border-bottom: 1px solid #e5eaf0; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-4) 20px 40px; display: flex; flex-direction: column; gap: var(--sp-4); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }

/* ---------- Checklist (done / to do / waiting / later) ---------- */
.checklist { display: flex; flex-direction: column; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: var(--fs-md); color: #334155; border-bottom: 1px solid #eef2f6; }
.check-row:last-child { border-bottom: 0; }
.check-mark { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; font-size: 10px; border-radius: 50%; color: #94a3b8; background-color: #eef2f6; }
.check-row.is-ok { color: #64748b; }
.check-row.is-ok .check-mark { color: #15803d; background-color: #dcf5e5; }
.check-row.is-todo { font-weight: 600; color: #0f172a; }
.check-row.is-todo .check-mark { color: #ffffff; background-color: #2563eb; }
.check-row.is-wait .check-mark { color: #a8540a; background-color: #ffe9c2; }
.check-row.is-red .check-mark { color: #ffffff; background-color: #dc2626; }
.check-text { flex: 1; min-width: 0; }
.check-warn { font-size: var(--fs-sm); font-weight: 600; color: #b45309; white-space: nowrap; }

/* ---------- Date field: typed and shown as dd-mm-yyyy, with the app's own calendar ---------- */
.datef { position: relative; display: block; }
.datef .input { padding-right: 38px; font-variant-numeric: tabular-nums; }
.datef-btn { position: absolute; top: 3px; right: 3px; width: 30px; height: 30px; color: #94a3b8; background-color: transparent; border: 0; border-radius: var(--r-sm); }
.datef-btn:hover { color: #1d4ed8; background-color: #eff6ff; }
.datef-btn:disabled { opacity: 0.5; }
.cal {
    position: fixed; z-index: calc(var(--z-toast) - 10); width: 276px; padding: 12px;
    background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-lg);
    box-shadow: 0 16px 36px -12px rgba(15, 23, 42, 0.28), 0 2px 6px rgba(15, 23, 42, 0.06);
    animation: pop-in var(--t-fast) var(--ease);
}
.cal-head { display: flex; align-items: center; gap: 2px; margin-bottom: 8px; }
.cal-title { flex: 1; text-align: center; font-size: var(--fs-md); font-weight: 650; color: #0f172a; }
.cal-nav { width: 28px; height: 28px; font-size: 11px; color: #64748b; background-color: transparent; border: 0; border-radius: var(--r-sm); }
.cal-nav:hover { color: #0f172a; background-color: #f1f5f9; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { padding: 4px 0; text-align: center; font-size: var(--fs-xs); font-weight: 600; color: #94a3b8; }
.cal-day { height: 34px; font-size: var(--fs-md); font-variant-numeric: tabular-nums; color: #1e293b; background-color: transparent; border: 0; border-radius: var(--r-md); }
.cal-day:hover { background-color: #eff6ff; }
.cal-day.is-other { color: #b6c0ce; }
.cal-day.is-today { font-weight: 700; color: #1d4ed8; box-shadow: inset 0 0 0 1px #9dbaf5; }
.cal-day.is-picked { font-weight: 600; color: #ffffff; background-color: #2563eb; box-shadow: none; }
.cal-day:disabled { color: #d5dce6; background-color: transparent; cursor: default; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef2f6; }
.tcal { width: 340px; }
.tcal-quick { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.tcal-quick .chip { padding: 2px 8px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.tcal-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.tcal-h { margin: 0 0 4px; font-size: var(--fs-xs); font-weight: 600; color: #94a3b8; }
.tcal-grid { display: grid; gap: 2px; }
.tcal-grid.is-hours { grid-template-columns: repeat(6, 1fr); }
.tcal-grid.is-mins { grid-template-columns: repeat(3, 1fr); }
.tcal-tile { height: 30px; padding: 0; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: #1e293b; background-color: transparent; border: 0; border-radius: var(--r-md); }
.tcal-tile:hover { background-color: #eff6ff; }
.tcal-tile.is-picked { font-weight: 600; color: #ffffff; background-color: #2563eb; }

/* ---------- Hover card: details over a short label (js/core/hovercard.js) ---------- */
[data-hc] { cursor: default; }
.hc {
    position: absolute; z-index: calc(var(--z-modal) + 5); width: max-content; max-width: min(340px, calc(100vw - 16px)); padding: 12px 14px;
    font-size: var(--fs-sm); line-height: 1.45; color: #334155; background-color: #ffffff;
    border: 1px solid #e2e8f0; border-radius: var(--r-md); box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.22);
}
.hc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: var(--fs-md); font-weight: 600; color: #0f172a; }
.hc-head .fa-solid { width: 16px; text-align: center; color: #64748b; }
.hc-head .badge { margin-left: auto; }
.hc-list { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; }
.hc-list dt { color: #64748b; }
.hc-list dd { margin: 0; text-align: right; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; color: #0f172a; }
.hc-list dd.is-green { color: #15803d; }
.hc-list dd.is-amber { color: #a8540a; }
.hc-list dd.is-red { color: #b91c1c; }
.hc-sub { margin: 10px 0 6px; padding-top: 8px; font-weight: 600; color: #0f172a; border-top: 1px solid #eef2f6; }
.hc-note { margin: 6px 0 0; color: #64748b; }
.hc-checks { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.hc-checks li { display: flex; align-items: baseline; gap: 8px; }
.hc-checks .fa-solid { width: 12px; font-size: 10px; text-align: center; }
.hc-checks .is-ok { color: #94a3b8; }
.hc-checks .is-ok .fa-solid { color: #16a34a; }
.hc-checks .is-todo .fa-solid { color: #2563eb; }
.hc-checks .is-wait .fa-solid { color: #d97706; }
.hc-checks .is-later .fa-solid { color: #94a3b8; }


/* ---------- The e-mail window (js/core/compose.js) ---------- */
.modal.mc-window { max-width: 860px; }
.mc { display: flex; flex-direction: column; border: 1px solid #e2e8f0; border-radius: var(--r-lg); background-color: #ffffff; overflow: hidden; }
.mc-head { display: flex; flex-direction: column; border-bottom: 1px solid #e2e8f0; }
.mc-line { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 4px 14px; border-bottom: 1px solid #eef2f6; }
.mc-line:last-child { border-bottom: 0; }
.mc-line.is-invalid { background-color: #fff6f6; }
.mc-lbl { flex: none; width: 64px; font-size: var(--fs-sm); font-weight: 600; color: #64748b; }
.mc-from { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: var(--fs-md); color: #334155; }
.mc-from small { font-size: var(--fs-xs); color: #94a3b8; }
.mc-from small.is-warn { color: #b45309; }
.mc-input { flex: 1; min-width: 0; height: 32px; padding: 0; font-size: var(--fs-base); color: #1e293b; background-color: transparent; border: 0; outline: none; }
.mc-input::placeholder { color: #9aa6b8; }
.mc-input.is-subject { font-weight: 600; }
.mc-save { display: flex; align-items: center; gap: 8px; padding: 6px 14px 8px 90px; font-size: var(--fs-sm); color: #475569; background-color: #f8fafc; border-bottom: 1px solid #eef2f6; }
.mc-cc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.mc-chips { display: contents; }
.mc-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; font-size: var(--fs-sm); color: #1d4ed8; background-color: #eff6ff; border: 1px solid #c7d9fb; border-radius: var(--r-pill); }
.mc-chip button { width: 20px; height: 20px; font-size: 10px; color: #64748b; background-color: transparent; border: 0; border-radius: 50%; }
.mc-chip button:hover { color: #b91c1c; background-color: #fde8e8; }
.mc-chip.is-fixed { padding: 0 10px; gap: 6px; color: #475569; background-color: #f1f5f9; border-color: #e2e8f0; }
.mc-chip.is-fixed i { font-size: 10px; color: #94a3b8; }
.mc-window .mc + .hint, .mc-window .note + .mc { margin-top: 12px; }
.mc-staff { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 8px 90px; border-bottom: 1px solid #eef2f6; }
.mc-staff-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; font-size: var(--fs-sm); font-weight: 600; color: #475569; background-color: #ffffff; border: 1px dashed #c2cdd9; border-radius: var(--r-pill); }
.mc-staff-btn .fa-solid { font-size: 10px; }
.mc-staff-btn:hover { color: #1d4ed8; border-color: #8fb0f2; }
.mc-staff-btn.is-on { color: #15803d; background-color: #f0faf4; border-style: solid; border-color: #b9e3c8; }
.mc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 10px; background-color: #f8fafc; border-bottom: 1px solid #eef2f6; }
.mc-tool { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 30px; height: 30px; padding: 0 7px; font-size: 13px; color: #475569; background-color: transparent; border: 0; border-radius: var(--r-sm); }
.mc-tool:hover { color: #0f172a; background-color: #eaeff5; }
.mc-tool.is-wide { font-size: var(--fs-sm); font-weight: 600; }
.mc-caret { font-size: 9px; color: #94a3b8; }
.mc-sep { width: 1px; height: 18px; margin: 0 5px; background-color: #e2e8f0; }
.mc-pick { position: relative; display: inline-flex; }
.mc-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 5; display: flex; gap: 6px; padding: 8px; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.18); }
.mc-pop.is-list { flex-direction: column; gap: 1px; min-width: 130px; padding: 5px; }
.mc-size { padding: 6px 10px; text-align: left; color: #334155; background-color: transparent; border: 0; border-radius: 6px; }
.mc-size:hover { background-color: #f3f6fa; }
.mc-size.is-s2 { font-size: 12px; }
.mc-size.is-s3 { font-size: 14px; }
.mc-size.is-s4 { font-size: 17px; }
.mc-size.is-s5 { font-size: 21px; }
.mc-dot { width: 22px; height: 22px; padding: 0; font-size: 10px; color: #94a3b8; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: 50%; }
.mc-dot:hover { box-shadow: 0 0 0 2px #c7d9fb; }
.mc-swatch { position: absolute; left: 7px; right: 7px; bottom: 4px; height: 3px; border-radius: 2px; }
.is-c0 { background-color: #1f2937; }
.is-c1 { background-color: #64748b; }
.is-c2 { background-color: #2563eb; }
.is-c3 { background-color: #15803d; }
.is-c4 { background-color: #b45309; }
.is-c5 { background-color: #c0392b; }
.is-c6 { background-color: #7c3aed; }
.is-m0 { background-color: #fef08a; }
.is-m1 { background-color: #bbf7d0; }
.is-m2 { background-color: #bfdbfe; }
.is-m3 { background-color: #fecaca; }
.mc-link { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background-color: #f6f9ff; border-bottom: 1px solid #dbe6fb; }
.mc-link .fa-link { color: #3b6fe0; }
.mc-link .input { flex: 1; min-width: 0; }
.mc-area { min-height: 230px; max-height: 46vh; overflow-y: auto; padding: 16px 18px; font-size: 15px; line-height: 1.6; color: #1f2937; outline: none; }
.mc-area.is-invalid { background-color: #fff6f6; }
.mc-area p { margin: 0 0 12px; }
.mc-area ul, .mc-area ol { margin: 0 0 12px; padding-left: 22px; }
.mc-area a { color: #2563eb; }
.mc-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid #eef2f6; }
.mc-file { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; font-size: var(--fs-sm); font-weight: 600; color: #334155; background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--r-md); }
.mc-file .fa-file-pdf { color: #d8412f; }
.mc-file a { color: #94a3b8; }
.mc-file a:hover { color: #2563eb; }
@media (max-width: 640px) {
    .mc-line { flex-wrap: wrap; gap: 2px 10px; }
    .mc-lbl { width: auto; }
    .mc-save, .mc-staff { padding-left: 14px; }
}

/* ---------- Tables whose headings stay under the app header while the page scrolls ---------- */
.table-wrap.is-sticky { overflow: clip; border-radius: 0 !important; }
.table-wrap.is-sticky .table thead th { top: calc(var(--hdr-h, 0px) + var(--bar-h, 0px)); z-index: 3; }
/* The block above a table that sticks with it (tabs, filters, search, the top pagination): --bar-h is its height. */
.sticky-bar { position: sticky; top: var(--hdr-h, 0px); z-index: 6; margin-top: -10px; padding-top: 10px; background-color: #f5f7fa; }
.card-head { min-height: 8px; background-color: #ffffff; border: 1px solid #e5eaf0; border-bottom-color: #eef2f6; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card.is-joined { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
/* Phones, portrait and landscape (r642): only the table's heading row stays on top, as a floating copy
   (core/phonescroll.js); the block above the table scrolls away. */
@media (max-width: 760px), (max-height: 500px) {
    .table-wrap.is-sticky { overflow: auto; }
    .table-wrap.is-sticky .table thead th { top: 0; }
    .sticky-bar { position: static; margin-top: 0; padding-top: 0; }
}
.table-wrap.sh-float { position: fixed; margin: 0; border-radius: 0 !important; z-index: calc(var(--z-header) - 1); overflow: hidden !important; }
.sh-float { background-color: #f6f8fb; border-bottom: 1px solid #e5eaf0; box-shadow: 0 6px 12px -8px rgba(15, 23, 42, 0.25); }
.sh-float .table { margin: 0; table-layout: fixed; }
.sh-float .table th { position: static; }

/* ---------- Pagination (on top and at the bottom of a table) ---------- */
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 14px; font-size: var(--fs-sm); color: #64748b; }
/* The bar fills its row, so the page sizes and arrows sit on the right, on top as at the bottom (every table). */
.pager-bar { flex: 1 1 auto; min-width: 0; }
.pager-gap { flex: 1; }
.pager-unsort { margin-right: 4px; }
.pager-info { font-variant-numeric: tabular-nums; }
.pager-sizes { display: inline-flex; gap: 2px; padding: 2px; background-color: #f1f4f8; border: 1px solid #e6ebf1; border-radius: 8px; }
.pager-size { height: 24px; min-width: 34px; padding: 0 8px; font-size: var(--fs-sm); font-weight: 500; color: #475569; background: none; border: 0; border-radius: 6px; cursor: pointer; }
.pager-size:hover { color: #1e293b; }
.pager-size.is-active { font-weight: 600; color: #1d4ed8; background-color: #ffffff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
.pager-nav { display: inline-flex; align-items: center; gap: 6px; }
.pager-page { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; font-size: 11px; color: #475569; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-sm); cursor: pointer; }
.pager-btn:hover:not(:disabled) { color: #1d4ed8; border-color: #c7d9fb; }
.pager-btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- A heading's menu: sort, default sort, show only some values ---------- */
.th-menu { position: fixed; z-index: 450; /* above windows: a menu opened inside a window */ width: 240px; padding: 6px; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14); }
.th-menu .menu-item { width: 100%; }
.th-menu-sep { height: 1px; margin: 6px 0; background-color: #eef2f6; }
.th-menu-title { padding: 4px 8px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #94a3b8; }
.th-menu .input { height: 30px; margin: 2px 0 6px; font-size: var(--fs-sm); }
.th-values { max-height: 220px; overflow: auto; }
.th-value { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: var(--fs-sm); color: #334155; border-radius: var(--r-sm); cursor: pointer; }
.th-value:hover { background-color: #f5f7fa; }
.th-value input { width: 14px; height: 14px; margin: 0; accent-color: #2563eb; }
.th-value small { margin-left: auto; color: #94a3b8; font-variant-numeric: tabular-nums; }
.th-filtered { margin-left: 4px; font-size: 9px; color: #3b6fe0; }

/* ---------- Text that opens for editing on a double click ---------- */
[data-dbl-edit] { cursor: text; border-radius: var(--r-sm); transition: background-color var(--t-fast) var(--ease); }
[data-dbl-edit]:hover { background-color: #f8fafc; }

/* ---------- Row numbers (#) and row marks ---------- */
.table .col-no { width: 44px; padding: 0 4px 0 10px !important; text-align: left; }
.table th.col-no { padding: 9px 4px 9px 20px !important; }  /* the # sits over the middle of the numbers */
.no-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 22px; padding: 0 6px; font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; color: #94a3b8; background: none; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; }
.no-btn:hover { color: #1d4ed8; background-color: #ffffff; border-color: #dbe5f5; }
.no-dot { position: absolute; top: 2px; right: 0; width: 6px; height: 6px; border-radius: 50%; }
.mk-menu { width: 230px; }
.mk-tones { display: flex; gap: 8px; padding: 4px 8px 8px; }
.mk-tone { width: 22px; height: 22px; padding: 0; border: 2px solid #ffffff; border-radius: 50%; box-shadow: 0 0 0 1px #d5dde8; cursor: pointer; }
.mk-tone.is-on { box-shadow: 0 0 0 2px #1e293b; }
.mk-by { margin: 0 8px 4px; font-size: var(--fs-xs); color: #94a3b8; }
.mk-tone.is-yellow, .no-dot.is-yellow { background-color: #f5d562; }
.mk-tone.is-green, .no-dot.is-green { background-color: #74cf9b; }
.mk-tone.is-blue, .no-dot.is-blue { background-color: #8cb4f5; }
.mk-tone.is-pink, .no-dot.is-pink { background-color: #f3a3c4; }
.mk-tone.is-purple, .no-dot.is-purple { background-color: #b9a2f2; }
.table tbody tr.is-mk-yellow > td { background-color: #fff8dc !important; }
.table tbody tr.is-mk-green > td { background-color: #eaf8ef !important; }
.table tbody tr.is-mk-blue > td { background-color: #eaf2ff !important; }
.table tbody tr.is-mk-pink > td { background-color: #fdedf4 !important; }
.table tbody tr.is-mk-purple > td { background-color: #f3eefe !important; }
/* A marked row's number stands out a little more. */
.table tbody tr.is-mk .no-btn { font-size: calc(var(--fs-xs) + 1px); font-weight: 800; color: #334155; }
/* Column marks: the same colours as rows, a shade stronger on the heading. */
.table .is-cm-yellow { background-color: #fff8dc !important; }
.table .is-cm-green { background-color: #eaf8ef !important; }
.table .is-cm-blue { background-color: #eaf2ff !important; }
.table .is-cm-pink { background-color: #fdedf4 !important; }
.table .is-cm-purple { background-color: #f3eefe !important; }
.table thead .is-cm-yellow { background-color: #fbecb4 !important; }
.table thead .is-cm-green { background-color: #d3f0de !important; }
.table thead .is-cm-blue { background-color: #d6e5fd !important; }
.table thead .is-cm-pink { background-color: #f9d9e7 !important; }
.table thead .is-cm-purple { background-color: #e6dcfc !important; }
.mk-log { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.mk-log-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; font-size: var(--fs-md); color: #334155; border-bottom: 1px solid #eef2f6; }
.mk-log-row small { font-size: var(--fs-sm); color: #94a3b8; }
.mk-log-row.is-undone > span { text-decoration: line-through; color: #94a3b8; }
/* Marked rows and columns: plain text turns bold; text that was bold already grows 1px and turns deep blue. */
.table tbody tr.is-mk > td, .table tbody td[class*="is-cm-"], .table thead th[class*="is-cm-"] { font-weight: 650; }
.table tbody tr.is-mk > td :is(strong, b, .cell-main, .pr-price, .pr-code, .sl-n, .sl-cust-name, .sl-name),
.table tbody td[class*="is-cm-"] :is(strong, b, .cell-main, .pr-price, .pr-code, .sl-n, .sl-cust-name),
.table thead th[class*="is-cm-"] :is(.sl-name) { font-size: calc(1em + 1px); color: #1e3a8a; }

/* ---------- The timeline (every history: core/timeline.js) ---------- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0 0 0 18px; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 5px; width: 1px; background-color: #e2e8f0; }
.tl-item { position: relative; padding: 9px 0 10px; }
.tl-dot { position: absolute; top: 15px; left: -17px; width: 9px; height: 9px; background-color: #ffffff; border: 2px solid #8b5cf6; border-radius: 50%; }
.tl-item.is-blue .tl-dot { border-color: #6b8de3; }
.tl-item.is-green .tl-dot { border-color: #4caf7d; }
.tl-item.is-amber .tl-dot { border-color: #e0a43a; }
.tl-item.is-red .tl-dot { border-color: #e07a7a; }
.tl-item.is-teal .tl-dot { border-color: #3fa7a0; }
.tl-item.is-grey .tl-dot { border-color: #a3afc0; }
.tl-head { display: flex; align-items: flex-start; gap: 8px; }
.tl-icon { flex: none; width: 16px; margin-top: 3px; font-size: 13px; text-align: center; color: #3b6fe0; }
.tl-item.is-purple .tl-icon { color: #7c4ddb; }
.tl-item.is-green .tl-icon { color: #2f9461; }
.tl-item.is-amber .tl-icon { color: #c2850f; }
.tl-item.is-red .tl-icon { color: #c45656; }
.tl-item.is-teal .tl-icon { color: #23857f; }
.tl-item.is-grey .tl-icon { color: #8492a6; }
.tl-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tl-title { font-size: var(--fs-md); font-weight: 650; line-height: 1.4; color: #0f172a; overflow-wrap: anywhere; }
.tl-count { font-weight: 500; color: #64748b; }
.tl-sub { font-size: var(--fs-sm); color: #64748b; }
.tl-undone { align-self: flex-start; padding: 0 6px; font-size: var(--fs-xs); font-weight: 600; color: #64748b; background-color: #f1f5f9; border-radius: 999px; }
.tl-item.is-undone .tl-title { color: #94a3b8; text-decoration: line-through; }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px; flex: none; max-width: 46%; font-size: var(--fs-sm); color: #64748b; }
.tl-role { padding: 1px 8px; font-size: var(--fs-xs); font-weight: 600; color: #6d3fd0; background-color: #f1ebfd; border-radius: 999px; }
.tl-who { display: inline-flex; align-items: center; gap: 5px; }
.tl-who .fa-regular { font-size: 11px; color: #94a3b8; }
.tl-when { white-space: nowrap; }
.tl-tools { display: flex; align-items: center; flex: none; margin-top: -3px; }
.tl-details { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 0 24px; padding: 0 0 0 16px; font-size: var(--fs-sm); color: #334155; list-style: disc; }
.tl-details li::marker { color: #a3afc0; }
.tl-label { margin-right: 6px; color: #64748b; }
.tl-label::after { content: ":"; }
.tl-old { color: #94a3b8; }
.tl-arrow { margin: 0 6px; font-size: 9px; color: #94a3b8; }
.tl-new { font-weight: 650; color: #0f172a; overflow-wrap: anywhere; }
.timeline.is-compact .tl-item { padding: 6px 0 7px; }
.timeline.is-compact .tl-dot { top: 12px; }
@media (max-width: 640px) {
    .tl-head { flex-wrap: wrap; }
    .tl-meta { order: 3; flex-basis: 100%; justify-content: flex-start; max-width: none; padding-left: 24px; }
}

/* VIP: a gold crown (always) or a purple star (this order only). */
.vip-ico { display: inline-flex; align-items: center; justify-content: center; margin-left: 6px; font-size: 12px; line-height: 1; vertical-align: 1px; }
.vip-ico.is-always { color: #c7930a; }
.vip-ico.is-order { color: #7c3aed; }

/* A read-only order (orderview.js): the facts in a calm grid above the lines. */
.ov-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ov-fact { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid #e5eaf0; border-radius: var(--r-md); background-color: #f8fafc; min-width: 0; }
.ov-fact > span { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.ov-fact > strong { font-size: var(--fs-md); font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ov-fact > strong small { flex-basis: 100%; font-weight: 400; font-size: var(--fs-sm); color: #64748b; }
.ov-fact .pill { height: auto; padding: 4px 10px; line-height: 1.35; white-space: normal; }

/* Not paid: orange, a little redder than Partly paid (amber). */
.badge.is-orange { color: #c2410c; background-color: #fff4ed; border-color: #fbd3b9; }
.pill.is-orange { color: #c2410c; background-color: #fff4ed; border: 1px solid #fbd3b9; }

/* ---------- Photo viewer (lightbox) ---------- */
.lbx { position: fixed; inset: 0; z-index: calc(var(--z-toast) - 20); display: flex; flex-direction: column; background-color: rgba(10, 14, 24, 0.96); }
.lbx-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #e2e8f0; }
.lbx-cap { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.lbx-n { font-size: var(--fs-sm); color: #94a3b8; font-variant-numeric: tabular-nums; }
.lbx-acts { display: flex; gap: 6px; }
.lbx-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; color: #e2e8f0; background: none; border: 0; border-radius: var(--r-md); }
.lbx-btn:hover { color: #ffffff; background-color: rgba(255, 255, 255, 0.1); }
.lbx-stage { position: relative; display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; padding: 0 56px; }
.lbx-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.lbx-pdf { width: min(1000px, 100%); height: 100%; border: 0; border-radius: 4px; background-color: #ffffff; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.lbx-th > i { display: grid; place-items: center; width: 100%; height: 100%; color: #cbd5e1; font-size: 18px; }
.lbx-nav { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -22px; color: #e2e8f0; background-color: rgba(255, 255, 255, 0.08); border: 0; border-radius: 50%; }
.lbx-nav:hover { background-color: rgba(255, 255, 255, 0.18); }
.lbx-nav.is-prev { left: 8px; }
.lbx-nav.is-next { right: 8px; }
.lbx-strip { display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto; }
.lbx-th { flex: none; width: 72px; height: 54px; padding: 0; overflow: hidden; background: none; border: 2px solid transparent; border-radius: 6px; opacity: 0.6; }
.lbx-th img { width: 100%; height: 100%; object-fit: cover; }
.lbx-th.is-on { border-color: #6b97f0; opacity: 1; }
@media (max-width: 760px) { .lbx-stage { padding: 0 8px; } .lbx-nav { display: none; } }

/* ---------- Guides (the ? button and /help) ---------- */
.guide-body { line-height: 1.55; }
.guide-body p { margin: 0 0 10px; }
.guide-body ul { margin: 0 0 12px; padding-left: 20px; }
.guide-body li + li { margin-top: 4px; }
.guide-h { margin: 16px 0 8px; padding-top: 12px; font-size: var(--fs-base); border-top: 1px solid #eef2f6; }
.guide-btn { width: 36px; height: 36px; font-size: 17px; border-radius: var(--r-md); }
.guide-steps { margin: 0 0 12px; padding-left: 22px; }
.guide-steps li { padding-left: 4px; }
.guide-steps li + li { margin-top: 6px; }
.guide-steps li::marker { font-weight: 700; color: #3b6fe0; }
.guide-see { margin: 6px 0 0; padding-top: 10px; font-size: var(--fs-sm); border-top: 1px dashed #e2e8f0; }
/* Admin menu: the Vasco pages at the top, a thin line under them, with how many wait */
.menu-item.is-group-vasco.is-group-end { margin-bottom: 6px; box-shadow: 0 6px 0 -5px #dde6f3; }
.menu-item .menu-count { margin-left: auto; }

/* Sortable table headings (heading menu): the arrow keeps a clear gap from the title, on every page */
.pr-th { white-space: nowrap; }
.pr-sort { margin-left: 8px; font-size: 9px; color: #c5d0de; }
.pr-th.is-sorted { color: #1d4ed8; }
.pr-th.is-sorted .pr-sort { color: #3b6fe0; }
/* The dealer's hover card (js/dealers/card.js). */
.dl-hc-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dl-hc-list li { display: flex; flex-direction: column; gap: 1px; }
.dl-hc-list li > span { display: flex; align-items: center; gap: 6px; }
.dl-hc-list.is-kept li { flex-direction: row; justify-content: space-between; gap: 14px; }
.dl-hc-list b { font-weight: 600; color: #6d4ad1; }
.dl-hc-list small { color: #64748b; }
.dl-hc-cust { margin: -2px 0 8px; }
.dl-hc-foot { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 8px; border-top: 1px solid #eef2f6; }
/* To-dos: the Done window (what was done) and "Done for you" (My Day, Dashboard). */
.td-done-sec { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.td-done-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.td-done-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font: inherit; font-size: var(--fs-sm); color: #334155; background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px; cursor: pointer; text-align: left; }
.td-done-chip i { font-size: 10px; color: #94a3b8; }
.td-done-chip:hover { border-color: #9dbaf5; background-color: #f5f8ff; }
.td-done-chip.is-change { color: #1e40af; background-color: #eff6ff; border-color: #c9dafb; }
.td-done-chip.is-on { color: #15803d; background-color: #f0fdf4; border-color: #86efac; }
.td-done-chip.is-on i { color: #15803d; }
.td-check.is-done-mark { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; color: #ffffff; background-color: #22a35a; border: 0; border-radius: 50%; font-size: 11px; }
.td-what-full { display: flex; gap: 8px; margin-top: 6px; padding: 6px 10px; font-size: var(--fs-sm); color: #14532d; white-space: pre-line; background-color: #f0fdf4; border-left: 3px solid #22a35a; border-radius: 4px; }
.td-what-full i { margin-top: 3px; font-size: 11px; color: #22a35a; }
.td-chip.td-what { max-width: 360px; overflow: hidden; color: #15803d; text-overflow: ellipsis; white-space: nowrap; }
.td-chip.td-what i { margin-right: 4px; font-size: 10px; }
.td-group.is-forme .td-group-title { color: #15803d; }
.td-seen-all { margin-left: auto; }

/* ---------- A list to pick from or open (r627): one framed list, rows split by thin lines, no box per row ---------- */
.pick-list { display: flex; flex-direction: column; max-height: 52vh; overflow: auto; background-color: #ffffff; border: 1px solid #e2e8f0; border-radius: var(--r-lg); }
.pick-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 11px 16px;
    font: inherit; text-align: left; text-decoration: none; color: inherit; cursor: pointer;
    background-color: transparent; border: 0; border-bottom: 1px solid #eef2f6;
    transition: background-color var(--t-fast) var(--ease);
}
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover, .pick-row:focus-visible { background-color: #f5f8ff; outline: none; }
.pick-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pick-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pick-main strong { overflow: hidden; font-weight: 600; color: #0f172a; white-space: nowrap; text-overflow: ellipsis; }
.pick-sub { overflow: hidden; font-size: var(--fs-sm); color: #64748b; white-space: nowrap; text-overflow: ellipsis; }
.pick-side { display: flex; align-items: center; gap: 12px; flex: none; }
.pick-side .pick-amount { font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; }
.pick-side .pill { min-width: 118px; justify-content: center; }
.pick-lead .badge-invoice { min-width: 78px; justify-content: center; }
.pick-go { font-size: 12px; color: #cbd5e1; transition: color var(--t-fast) var(--ease); }
.pick-row:hover .pick-go { color: #3b6fe0; }
.pick-empty { margin: 0; padding: 14px 16px; color: #94a3b8; }
@media (max-width: 640px) { .pick-row { flex-wrap: wrap; } .pick-side .pill { min-width: 0; } }
.mc-window .mc-sub { margin: 0 0 10px; }
.mc-window .note { margin-bottom: 10px; }

/* Read-only tables in windows on a phone (r640, core/cardtable.js marks the cells): one card per row. The main text
   over the full width; the numbers below in equal boxes, each with its label; other texts as a small label and the
   value; the totals (tfoot) as one line, label left and amount right. The same look in every window. */
@media (max-width: 760px) {
    .modal .table-wrap:has(> .table.is-cards) { overflow-x: visible; border: 0; }
    .modal .table.is-cards { min-width: 0; width: 100%; }
    .modal .table.is-cards thead { display: none; }
    .modal .table.is-cards, .modal .table.is-cards tbody, .modal .table.is-cards tfoot { display: block; }
    .modal .table.is-cards tbody tr { display: grid; grid-template-columns: repeat(var(--card-cols, 4), minmax(0, 1fr)); gap: 6px; padding: 12px 0; border-bottom: 1px solid #eef2f6; background: none; }
    .modal .table.is-cards tbody tr:last-child { border-bottom: 0; }
    .modal .table.is-cards td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; }
    .modal .table.is-cards td.card-main { grid-column: 1 / -1; padding-bottom: 2px; }
    .modal .table.is-cards td.card-wide, .modal .table.is-cards td.card-text { grid-column: 1 / -1; }
    .modal .table.is-cards td.card-hide { display: none; }
        .modal .table.is-cards td.card-text::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
    .modal .table.is-cards td.card-num { padding: 6px 4px; text-align: center; background-color: #f8fafc; border-radius: var(--r-md); }
    .modal .table.is-cards td.card-num::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
    .modal .table.is-cards tfoot tr { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0 2px; border-top: 1px solid #e2e8f0; }
    .modal .table.is-cards tfoot td { display: block; padding: 0; border: 0; font-weight: 700; }
    .modal .table.is-cards tfoot td:empty { display: none; }
}
.pwa-steps { margin: 0; padding: 12px 14px; line-height: 1.6; background-color: #f6f8fb; border: 1px solid #e5eaf0; border-radius: var(--r-md); }
.pwa-icons { display: flex; flex-direction: column; gap: 8px; }
.pwa-icon-row { display: flex; flex-wrap: wrap; gap: 14px; }
.pwa-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px; font-size: var(--fs-sm); font-weight: 600; color: #334155; border: 1px solid #e5eaf0; border-radius: var(--r-md); }
.pwa-icon:hover { color: #1d4ed8; background-color: #f6f8fb; }
.pwa-icon img { width: 56px; height: 56px; }
.pwa-go { margin-left: auto; }
