/* rdm-core - base styles for every instance.
[hidden] { display: none !important; }
   Carried over from the R.D.M portal brand system. Colours are semantic
   variables: /brand.css (generated from the layer's brand.php) overrides
   --brand, --brand-dark, --accent and --bg per instance. Nothing here names
   a client colour directly.
   Mobile first: designed at 380px, side bar from 900px.
   Font: Assistant (self-hosted woff2 in assets/fonts; falls back to system). */

@font-face { font-family: 'Assistant'; src: url('/assets/fonts/assistant-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Assistant'; src: url('/assets/fonts/assistant-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Assistant'; src: url('/assets/fonts/assistant-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
    --brand: #2D5520;
    --brand-dark: #214017;
    --accent: #72BD74;
    --bg: #EAF2E7;
    --bg-2: #D7E5D4;
    --ink: #1E2A1B;
    --muted: #5C6B58;
    --line: #C3D4BF;
    --white: #FFFFFF;
    --st-red: #CC0000;
    --st-orange: #B85C00;
    --st-green: #3C7A33;
    --st-blue: #1F5FA8;
    --radius: 10px;
    --shadow: 0 2px 14px rgba(30, 42, 27, 0.10);
    --side-w: 232px;
    --bottom-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Assistant', -apple-system, 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    direction: rtl;
    min-height: 100dvh;
}
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sprite { display: none; }
.ico { width: 22px; height: 22px; flex: 0 0 22px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.small { font-size: 0.85rem; }

/* ---- App frame ---- */
body.app { padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px)); }
.app-body { min-width: 0; }
.app-main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 40px; width: 100%; }

.topbar-m {
    position: sticky; top: 0; z-index: 20;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
}
.wordmark { font-weight: 700; font-size: 1.1rem; color: var(--brand); text-decoration: none; }
.wordmark-large { font-weight: 700; font-size: 1.6rem; color: var(--brand); }

.support-banner {
    background: var(--st-orange); color: var(--white);
    text-align: center; font-weight: 600; font-size: 0.9rem; padding: 6px 12px;
}

/* Bottom bar (mobile): four slots */
.bottomnav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 25;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--white);
    border-top: 1px solid var(--line);
}
.bottomnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 0.78rem; font-weight: 600;
}
.bottomnav a.is-active { color: var(--brand); }
.bottomnav-ico { position: relative; display: inline-flex; }
.bottomnav .badge { position: absolute; top: -6px; inset-inline-end: -12px; }

/* Side bar (desktop) */
.sidenav { display: none; }

.badge {
    display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--st-red); color: var(--white);
    font-size: 0.72rem; font-weight: 700; line-height: 20px; text-align: center;
}

@media (min-width: 900px) {
    body.app { padding-bottom: 0; display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }
    body.app .support-banner { grid-column: 1 / -1; }
    .topbar-m, .bottomnav { display: none; }
    .app-main { padding: 28px 28px 60px; }
    .sidenav {
        display: flex; flex-direction: column;
        position: sticky; top: 0; height: 100dvh;
        background: var(--white); border-inline-end: 1px solid var(--line);
        padding: 18px 12px;
    }
    .sidenav-brand {
        display: flex; align-items: center; gap: 10px;
        padding: 4px 10px 18px; font-weight: 700; font-size: 1.1rem;
        color: var(--brand); text-decoration: none;
    }
    .sidenav-logo { max-height: 36px; max-width: 120px; }
    .sidenav-items { display: flex; flex-direction: column; gap: 2px; flex: 1; }
    .sidenav-items a {
        display: flex; align-items: center; gap: 10px;
        padding: 9px 10px; border-radius: 8px;
        color: var(--ink); text-decoration: none; font-weight: 600;
    }
    .sidenav-items a:hover { background: var(--bg); }
    .sidenav-items a.is-active { background: var(--bg); color: var(--brand); }
    .sidenav-items .badge { margin-inline-start: auto; }
    .sidenav-user { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
    .sidenav-user a { text-decoration: none; }
}

/* ---- Page ---- */
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 1.35rem; margin: 0 0 4px; color: var(--brand-dark); }
.page-head p { margin: 0; }
.back { display: inline-block; font-size: 0.9rem; margin-bottom: 4px; text-decoration: none; }
.back::before { content: '→ '; }

/* ---- Auth ---- */
body.bare { display: flex; flex-direction: column; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); width: 100%; max-width: 400px; padding: 28px 22px 24px;
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-logo { max-height: 56px; max-width: 180px; margin-bottom: 8px; }
.auth-sub { color: var(--muted); margin-top: 2px; }
.auth-links { text-align: center; margin: 18px 0 0; font-size: 0.95rem; }
.app-foot { text-align: center; padding: 14px 20px 20px; color: var(--muted); font-size: 0.85rem; }
.app-foot span { margin: 0 4px; }

/* ---- Forms ---- */
label { display: block; font-weight: 600; margin: 14px 0 5px; }
input[type="email"], input[type="password"], input[type="text"], input[type="tel"], input[type="url"],
input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"],
input[type="month"], input[type="search"], input[type="file"], select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    font: inherit;
    font-size: 16px; /* iOS: no zoom on focus */
    color: var(--ink);
    min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(45, 85, 32, 0.15); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 10px 0 4px; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.code-input { text-align: center; letter-spacing: 0.5em; font-size: 1.3rem; direction: ltr; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.form-actions form { margin: 0; }
@media (min-width: 640px) {
    .form-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; border-radius: 8px; padding: 10px 18px; min-height: 44px;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-block { width: 100%; margin-top: 18px; }

.fab {
    position: fixed; z-index: 30;
    bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom, 0px));
    inset-inline-end: 16px;
    width: 56px; height: 56px; border-radius: 50%; border: none; padding: 0;
    background: var(--brand); color: var(--white);
    box-shadow: 0 6px 18px rgba(30, 42, 27, 0.35);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.fab:hover { background: var(--brand-dark); }
@media (min-width: 900px) { .fab { bottom: 24px; inset-inline-end: 24px; } }

/* Bottom sheet (quick note, forms over the current screen) */
dialog.sheet {
    border: none; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px;
    max-height: 90dvh; border-radius: 16px 16px 0 0; background: var(--white); color: var(--ink);
    box-shadow: 0 -8px 30px rgba(30, 42, 27, 0.25);
}
dialog.sheet::backdrop { background: rgba(30, 42, 27, 0.45); }
.sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { dialog.sheet { margin: auto; border-radius: var(--radius); } }

/* ---- Notices ---- */
.notice { border-radius: 8px; padding: 11px 14px; margin: 0 0 14px; font-size: 0.95rem; border: 1px solid; }
.notice-error   { background: #FBEFEF; border-color: #E4B8B8; color: var(--st-red); }
.notice-success { background: var(--bg); border-color: var(--line); color: var(--st-green); }
.notice-info    { background: #F3F1E7; border-color: #DDD6B8; color: var(--st-orange); }

.empty-state {
    background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius);
    padding: 36px 20px; text-align: center; color: var(--muted);
}
.empty-state p { margin: 0 0 6px; }

/* ---- Panels ---- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.panel-title { font-size: 1.05rem; margin: 0 0 10px; color: var(--brand-dark); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .panel { padding: 18px 20px; } }
.newform > summary { cursor: pointer; font-weight: 600; color: var(--brand); min-height: 28px; }
.mt { margin-top: 12px; }
.muted { color: var(--muted); }
.prewrap { white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }

/* Menu list (more, settings) */
.menu-list { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.menu-list a {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px;
    color: var(--ink); text-decoration: none; font-weight: 600; border-top: 1px solid var(--line);
}
.menu-list a:first-child { border-top: none; }
.menu-list a:hover { background: var(--bg); }
.menu-list a::after { content: '‹'; margin-inline-start: auto; color: var(--muted); font-size: 1.3rem; }

/* ---- Chips ---- */
.chip { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; background: var(--bg); color: var(--brand-dark); text-decoration: none; }
.chip-muted { background: #EAEAEA; color: var(--muted); }
.chip-c-green  { background: #E3F0E0; color: var(--st-green); }
.chip-c-orange { background: #F7ECDD; color: var(--st-orange); }
.chip-c-red    { background: #FBEFEF; color: var(--st-red); }
.chip-c-blue   { background: #E3ECF7; color: var(--st-blue); }
.chip-c-gray   { background: #EAEAEA; color: #555; }
.chip-c-forest { background: var(--brand); color: var(--white); }

/* ---- Tables ---- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.95rem; }
.table th { background: var(--bg-2); text-align: right; padding: 10px 12px; color: var(--brand-dark); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); }

/* ---- Users ---- */
.userrow { border-top: 1px solid var(--line); padding: 10px 0; }
.userrow:first-of-type { border-top: none; }
.userrow > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-height: 32px; }

/* ---- 2FA setup ---- */
.steps { padding-inline-start: 20px; }
.steps li { margin-bottom: 6px; }
.qr-wrap { text-align: center; margin: 18px 0; }
.qr-wrap #qr { display: inline-block; padding: 12px; background: var(--white); }
.secret {
    font-family: 'Courier New', monospace; direction: ltr; font-size: 1.05rem; letter-spacing: 0.06em;
    background: var(--bg); display: inline-block; padding: 6px 12px; border-radius: 8px;
}

/* ---- Drafts restore bar (drafts.js) ---- */
.draftbar { background: #F3F1E7; border: 1px solid #DDD6B8; border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
.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; }

/* ==== Lists, cards, timeline (customers module) ==== */
.page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.page-head-row h1 { margin: 0; }
.count { font-size: 1rem; font-weight: 400; }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: 0.9rem; }
.btn-danger { color: var(--st-red); }
.btn-link { background: none; border: none; padding: 4px 0; font: inherit; font-size: 0.85rem; color: var(--brand); cursor: pointer; text-decoration: underline; }
.danger-zone { margin-top: 18px; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.inline-form select { width: auto; min-width: 140px; }
.more-fields { margin-top: 14px; }
.more-fields > summary { cursor: pointer; font-weight: 600; color: var(--brand); min-height: 32px; }
fieldset.checks { border: none; padding: 0; margin: 14px 0 0; }
fieldset.checks legend { font-weight: 600; padding: 0; margin-bottom: 4px; }

/* Search bar: field grows, filter and button stay compact on the same line */
.searchbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.searchbar input[type="search"] { flex: 1 1 200px; width: auto; }
.searchbar select { flex: 0 1 160px; width: auto; }

/* Row list (customers, jobs) */
.rows { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-height: 56px; color: var(--ink); text-decoration: none; }
a.row-link:hover { background: var(--bg); }
.row-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.9rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }

/* Customer card */
.card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-title h1 { margin: 0; }
.quick-actions { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 2px; scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.qa {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 8px 16px; border-radius: 22px;
    background: var(--white); border: 1px solid var(--line); color: var(--brand); font-weight: 600; text-decoration: none;
}
.qa:hover { background: var(--bg); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.item { border-top: 1px solid var(--line); padding: 8px 0; }
.item:first-of-type { border-top: none; }
.item > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; min-height: 36px; }

/* Pinned notes: above everything else on the card */
.pinned { display: grid; gap: 8px; margin-bottom: 16px; }
.pin { position: relative; background: #FFF8E1; border: 1px solid #EAD9A0; border-radius: var(--radius); padding: 10px 14px; }
.pin p { margin: 2px 0 0; }
.pin-decision { background: #E8F0FA; border-color: #BCD0EA; }
.pin-fixed { background: #FFF8E1; }
.pin-cat { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.pin-x { margin-top: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; min-height: 44px; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.is-active { color: var(--brand); border-bottom-color: var(--brand); }

.note-form textarea { min-height: 64px; }
.note-form .form-actions { margin-top: 8px; }
.note-form select { width: auto; }
.note-form .btn-primary { margin-inline-start: auto; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.tl-ico { color: var(--muted); margin-top: 2px; }
.tl-body { flex: 1; min-width: 0; }
.tl-body p { margin: 0 0 2px; }
.tl-pin { flex: 0 0 auto; }

/* Files */
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.files li { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.files a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; overflow-wrap: anywhere; }
.files img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; background: var(--bg); }

/* ==== Captures (share to the system, quick note, assign) ==== */
.today-card {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 12px;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink); text-decoration: none; min-height: 56px;
}
.today-card strong { font-size: 1.2rem; color: var(--brand); }
.today-card:hover { background: var(--bg); }
.capture-row { flex-direction: row; align-items: flex-start; gap: 12px; }
.capture-row .thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: 0 0 56px; background: var(--bg); }
.capture-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.capture-text { overflow-wrap: anywhere; }
.capture-body .files { margin-top: 10px; }
.picks { display: grid; gap: 8px; }
.pick { margin: 0; }
.pick-btn {
    width: 100%; min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
    font: inherit; color: var(--ink); text-align: start; cursor: pointer;
}
.pick-btn:hover, .pick-btn:focus-visible { background: var(--bg); border-color: var(--brand); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.file-inline { display: flex; flex-direction: column; align-items: stretch; gap: 4px; font-weight: 400; margin: 10px 0 0; color: var(--muted); font-size: 0.9rem; }
.file-inline input { width: 100%; min-height: 0; border: none; padding: 0; font-size: 0.9rem; }
/* Room under the content so the floating + never covers the last buttons. */
body.app .app-main { padding-bottom: 96px; }

/* Paste-from-clipboard button (quick note, new capture) */
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.btn-paste { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; margin: 0 0 8px; font: inherit; font-size: 0.85rem; color: var(--brand); cursor: pointer; }
.btn-paste[hidden] { display: none; }

/* Jobs (screen 6) */
.job-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.job-actions form { margin: 0; }
.btn-big { min-height: 52px; padding: 10px 22px; font-size: 1.05rem; }
.today-block { margin-bottom: 16px; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines > li + li { border-top: 1px solid var(--line); }
.lines .item summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; padding: 10px 0; cursor: pointer; }
.line-desc { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.line-qty { color: var(--muted); font-size: 0.9rem; grid-column: 1; }
.line-sum { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 600; white-space: nowrap; }
.lines-total { text-align: left; margin: 12px 0 0; font-size: 1.05rem; }
.line-form { padding: 6px 0 12px; }
.line-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 0 10px; margin-bottom: 10px; }

/* Products and stock (screen 7, products profile) */
.stock { color: var(--ink); }
.stock-low { color: var(--st-orange); font-weight: 600; }
.stock-neg { color: var(--st-red); }
.stock-panel { text-align: center; }
.stock-big { font-size: 2.2rem; font-weight: 700; color: var(--brand-dark); margin: 4px 0; }
.stock-big small { font-size: 1rem; font-weight: 400; color: var(--muted); margin-inline-start: 6px; }
.stock-panel .form-actions { justify-content: center; }
.moves { list-style: none; margin: 0; padding: 0; }
.moves li { display: grid; grid-template-columns: 64px 1fr; gap: 0 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.moves li:first-child { border-top: none; }
.moves li > .small { grid-column: 2; }
.move-qty { font-weight: 700; text-align: center; align-self: center; grid-row: span 2; }
.move-in { color: var(--st-green); }
.move-out { color: var(--st-red); }
.move-main { display: flex; flex-wrap: wrap; gap: 2px 10px; }

/* Billing (screen 8) */
.bill-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bill-head .panel-title a { color: inherit; }
.bill-jobs { list-style: none; margin: 0 0 12px; padding: 0; }
.bill-jobs li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.bill-jobs li:first-child { border-top: none; }
.bill-jobs li > .muted { grid-column: 1; }
.bill-jobs li > .ltr { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 600; }
.line-summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; padding: 10px 0; }
.confirm-box { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 14px 0; }

/* Calendar connect */
.cal-buttons { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0 16px; }
@media (min-width: 640px) { .cal-buttons { grid-template-columns: 1fr 1fr; } }
.sync-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sync-bar form { margin: 0; }
.open-sum { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; }
.open-sum a { color: var(--ink); text-decoration: none; }
.open-sum strong { color: var(--st-orange); }

/* Documents tab */
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.stat-tile.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.stat-label { font-size: 0.85rem; color: var(--muted); }
.stat-value { font-size: 1.25rem; color: var(--brand-dark); text-align: right; }
.stat-sub { font-size: 0.8rem; color: var(--muted); }
.doc-groups, .doc-month { margin-bottom: 10px; }
.doc-group, .doc-month { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.doc-group > summary, .doc-month > summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; padding: 12px 14px; cursor: pointer; list-style: none; }
.doc-group > summary::-webkit-details-marker, .doc-month > summary::-webkit-details-marker { display: none; }
.dg-name, .dm-name { font-weight: 700; }
.dg-sum, .dm-sum { font-weight: 700; color: var(--brand-dark); grid-column: 2; grid-row: 1; }
.dg-meta { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); }
.doc-month > summary .muted { grid-column: 1; }
.doc-group[open] > summary, .doc-month[open] > summary { border-bottom: 1px solid var(--line); }
.doc-group .btn { margin: 0 14px 12px; }
.doc-rows { list-style: none; margin: 0; padding: 0 14px; }
.doc-rows li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: center; }
.doc-rows li:first-child { border-top: none; }
.doc-rows li > .small { grid-column: 1; }
.doc-rows .doc-amt { grid-column: 2; grid-row: 1 / span 2; text-align: left; white-space: nowrap; font-weight: 600; }
.doc-rows .doc-amt .chip { font-weight: 600; margin-inline-start: 4px; }
.doc-rows li.is-cancelled { opacity: 0.55; }
.doc-rows a { color: var(--ink); }
.age-warn { color: var(--st-orange); font-weight: 600; }
.age-bad { color: var(--st-red); font-weight: 600; }
.doc-more { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 14px; }
@media (min-width: 900px) {
    .doc-rows li { grid-template-columns: 1.4fr 1.2fr auto; }
    .doc-rows li > .small { grid-column: 2; grid-row: 1; }
    .doc-rows .doc-amt { grid-column: 3; grid-row: 1; }
}

/* One-screen order form */
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; background: var(--bg); }
.seg-opt { flex: 1; margin: 0; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; text-align: center; padding: 8px 6px; border-radius: 999px; font-weight: 600; font-size: 0.92rem; color: var(--muted); cursor: pointer; }
.seg-opt input:checked + span { background: var(--white); color: var(--brand-dark); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brand); }
.cust-results { list-style: none; margin: 4px 0 10px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.cust-results li + li { border-top: 1px solid var(--line); }
.cust-results button { display: block; width: 100%; text-align: right; background: none; border: 0; padding: 10px 12px; font: inherit; cursor: pointer; }
.cust-results button:hover { background: var(--bg); }
.cust-results li.muted { padding: 10px 12px; }
.fixed-customer { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 0; }
.order-lines { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ol-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.ol-main { display: flex; flex-direction: column; gap: 6px; }
.ol-main select, .ol-main input { margin: 0; }
.ol-nums { display: grid; grid-template-columns: 70px 1fr 88px auto; gap: 8px; align-items: end; margin-top: 8px; }
.ol-nums label { margin: 0; font-size: 0.8rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.ol-nums input, .ol-nums select { margin: 0; }
.ol-sum { grid-column: 1 / -2; font-weight: 700; color: var(--brand-dark); }
.ol-remove { color: var(--st-red); text-decoration: none; font-size: 1.1rem; padding: 6px 8px; grid-column: -2 / -1; grid-row: 1; align-self: center; }
.ol-avail { font-weight: 600; }
.order-total { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.order-total dt { color: var(--muted); }
.order-total dd { margin: 0; text-align: left; }
.order-total dd strong { font-size: 1.2rem; color: var(--brand-dark); }
.lines-profit { text-align: left; margin: 4px 0 0; }
.return-line summary { cursor: pointer; padding: 8px 0; }
@media (min-width: 700px) {
    .ol-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; align-items: start; }
    .ol-nums { margin-top: 0; }
}

/* Products: prices, holds, numbered items, rental calendar */
.price-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 4px; margin: 12px 0; }
.price-box legend { font-weight: 700; padding: 0 6px; color: var(--brand-dark); }
.holds, .units { list-style: none; margin: 0; padding: 0; }
.holds li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: center; }
.holds li:first-child, .units li:first-child { border-top: none; }
.holds li > .small { grid-column: 1; }
.holds li > form { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
.units li { border-top: 1px solid var(--line); padding: 6px 0; }
.units summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; cursor: pointer; padding: 4px 0; }
.units .inline-form { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.units .inline-form input, .units .inline-form select { width: auto; flex: 1 1 120px; margin: 0; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.avail-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.ag-head { text-align: center; font-size: 0.8rem; color: var(--muted); padding: 2px 0; }
.ag-cell { background: var(--white); border: 1px solid var(--line); border-radius: 6px; min-height: 52px; padding: 3px 4px; display: flex; flex-direction: column; justify-content: space-between; }
.ag-empty { background: transparent; border: none; }
.ag-day { font-size: 0.75rem; color: var(--muted); }
.ag-free { font-weight: 700; text-align: center; color: var(--st-green); }
.ag-free small { font-weight: 400; color: var(--muted); }
.ag-low .ag-free { color: var(--st-orange); }
.ag-full { background: #FBEFEF; }
.ag-full .ag-free { color: var(--st-red); }
.ag-today { box-shadow: inset 0 0 0 2px var(--brand); }

/* Jobs: list / week / month */
.view-switch { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; }
.view-switch a[role=tab] { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.view-switch a.is-active { background: var(--brand); color: var(--white); border-color: var(--brand); }
.view-sync { margin-inline-start: auto; }
.cal-tools { margin: -4px 0 10px; text-align: center; }
.week { display: flex; flex-direction: column; gap: 8px; }
.week-day { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.week-day.is-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.week-head { display: flex; gap: 8px; align-items: baseline; font-size: 0.95rem; margin: 0 0 6px; }
.week-add { margin-inline-start: auto; text-decoration: none; font-weight: 700; font-size: 1.2rem; color: var(--brand); padding: 0 6px; }
.week-empty { margin: 0; }
.cal-item { display: flex; gap: 8px; align-items: baseline; padding: 7px 10px; margin-bottom: 4px; border-radius: 8px; background: var(--bg); color: var(--ink); text-decoration: none; border-inline-start: 4px solid var(--brand); }
.cal-item:hover { filter: brightness(0.97); }
.cal-time { font-weight: 700; color: var(--brand-dark); }
.cal-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-span { font-size: 0.75rem; color: var(--muted); }
.cal-middle, .cal-end { opacity: 0.75; border-inline-start-style: dashed; }
.st-blue { border-inline-start-color: var(--st-blue); }
.st-orange { border-inline-start-color: var(--st-orange); }
.st-green { border-inline-start-color: var(--st-green); }
.st-red { border-inline-start-color: var(--st-red); }
.st-gray { border-inline-start-color: #999; }
.st-forest { border-inline-start-color: var(--brand-dark); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 8px; }
.mg-cell { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: 3px; background: var(--white); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; overflow: hidden; }
.mg-out { opacity: 0.45; }
.mg-item { display: none; font-size: 0.72rem; line-height: 1.25; padding: 1px 4px; border-radius: 4px; background: var(--bg); border-inline-start: 3px solid var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-span { opacity: 0.75; }
.mg-more { display: none; font-size: 0.7rem; color: var(--muted); }
.mg-count { align-self: center; margin-top: auto; min-width: 22px; text-align: center; border-radius: 999px; background: var(--brand); color: var(--white); font-size: 0.75rem; font-weight: 700; }
@media (min-width: 760px) {
    .mg-cell { min-height: 96px; }
    .mg-item, .mg-more { display: block; }
    .mg-count { display: none; }
    .week { display: grid; grid-template-columns: repeat(7, 1fr); }
    .week-day { min-height: 160px; }
    .cal-item { flex-direction: column; gap: 0; }
    .cal-title { white-space: normal; }
}

/* Open items (screen 5) */
.group-title { font-size: 1rem; margin: 16px 0 6px; color: var(--brand-dark); }
.task-list { list-style: none; margin: 0 0 10px; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.task-list > li + li { border-top: 1px solid var(--line); }
.task > summary { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 11px 14px; cursor: pointer; list-style: none; }
.task > summary::-webkit-details-marker { display: none; }
.task-title { font-weight: 700; flex: 1 1 60%; }
.task-where { flex-basis: 100%; font-size: 0.88rem; color: var(--ink); background: var(--bg); border-radius: 6px; padding: 3px 8px; }
.task-links { flex-basis: 100%; display: flex; gap: 10px; }
.task-form, .task > .prewrap { padding: 0 14px 12px; }
.task[open] > summary { border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
