/* Prime Client Portal */
:root {
    --navy: #0b2545;
    --navy-2: #13315c;
    --blue: #1d6fd8;
    --green: #16a34a;
    --purple: #7c3aed;
    --red: #dc2626;
    --amber: #d97706;
    --ink: #172033;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f4f6fa;
    --card: #ffffff;
    --radius: 14px;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
a { color: inherit; }
h1, h2 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .25rem; font-size: .75rem; letter-spacing: .12em; font-weight: 700; color: var(--blue); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Forms */
label { display: block; margin: .75rem 0 .3rem; font-weight: 600; font-size: .9rem; }
input, select {
    width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px;
    font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input[type="checkbox"] { width: auto; margin-right: .5rem; }
button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    margin-top: 1rem; padding: .6rem 1.1rem; border: 0; border-radius: 10px;
    background: var(--blue); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.08); }
button.ghost, .button.ghost { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
button.danger { background: var(--red); }
.link-form { display: inline; margin: 0; }
.link-danger { margin: 0; padding: 0; background: none; color: var(--red); font-weight: 600; font-size: inherit; }
.link-danger:hover { filter: none; text-decoration: underline; }
.danger-zone { border-color: #f5c2c2; }
.danger-zone h2 { color: var(--red); }
.check-label { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check-label input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.check-group { margin: 0; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: .35rem; }
.check-group legend { padding: 0 .25rem; font-weight: 600; font-size: .9rem; }
.text-link { color: var(--blue); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Messages */
.notice, .error { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.notice { background: #e8f7ee; color: #14532d; border: 1px solid #bbe5c9; }
.error { background: #fdecec; color: #7f1d1d; border: 1px solid #f5c2c2; }
.error ul { margin: .35rem 0 0; padding-left: 1.2rem; }

/* Brand */
.prime-brand-logo { height: 40px; width: auto; display: block; }
.brand-caption { font-size: .7rem; letter-spacing: .18em; font-weight: 700; color: var(--muted); }
.brand, .side-brand, .login-brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--navy), var(--navy-2)); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 18px; padding: 2rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-card button { width: 100%; }
.login-brand { margin-bottom: 1.5rem; }
.login-foot { margin: 1.25rem 0 0; text-align: center; font-size: .8rem; color: var(--muted); }

/* Shell */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; flex-shrink: 0; background: var(--navy); color: #dbe4f3;
    display: flex; flex-direction: column; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh;
}
.sidebar .side-brand { background: #fff; border-radius: 12px; padding: .6rem .75rem; margin-bottom: 1.25rem; flex-direction: column; align-items: flex-start; gap: .25rem; }
.nav-label { margin: 1rem .5rem .4rem; font-size: .7rem; letter-spacing: .14em; color: #8ea3c4; font-weight: 700; }
.sidebar nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px; text-decoration: none; color: #dbe4f3; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.nav-icon { width: 1.2rem; text-align: center; }
.side-foot { margin-top: auto; font-size: .7rem; letter-spacing: .12em; color: #8ea3c4; }
.side-foot small { display: block; letter-spacing: 0; }
.workspace { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .9rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.top-actions { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.top-actions form { margin: 0; }
.today { color: var(--muted); }
.account-name { font-weight: 600; }
.logout { margin: 0; padding: .4rem .8rem; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.container { max-width: 1440px; margin: 0 auto; padding: 1.5rem 2rem; }

/* Layout pieces */
.page-head { margin-bottom: 1.25rem; }
.page-head p { margin: 0; color: var(--muted); }
.page-head.split { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head.split .button { margin-top: 0; }
.breadcrumb { margin: 0 0 .75rem; font-size: .9rem; color: var(--muted); }
.breadcrumb a { color: var(--blue); text-decoration: none; }
.grid { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.grid.top { align-items: start; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.card.wide, .card.month { margin-bottom: 1.25rem; }
.list { display: flex; flex-direction: column; gap: .25rem; margin-top: 1rem; }
.list-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list-row span { color: var(--muted); font-size: .9rem; }
.client-row {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; margin-bottom: .5rem;
}
a.client-row:hover { border-color: var(--blue); background: #f5f9ff; }
.client-row small { display: block; color: var(--muted); }
.client-row[hidden] { display: none; }
/* Long client lists scroll inside their card, so the page and the search box stay put */
.client-directory { max-height: 32rem; overflow-y: auto; overscroll-behavior: contain; margin-right: -.4rem; padding-right: .4rem; }
.client-directory .client-row { padding: .55rem .8rem; margin-bottom: .35rem; }
.client-directory .client-row small { font-size: .8rem; }
.client-search { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.client-search input { flex: 1; padding-left: 2.2rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat .75rem center; }
.client-search-count { margin: 0; font-size: .85rem; white-space: nowrap; }
.document-actions { display: flex; gap: 1rem; align-items: center; white-space: nowrap; }
.download-link { color: var(--blue); font-weight: 600; text-decoration: none; }
.footnote { text-align: center; font-size: .85rem; }
.row-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.row-actions button { margin-top: .5rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
.inline-form input { margin-top: .5rem; max-width: 200px; }

.access-grid, .upload-grid, .sticker-form {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; align-items: end;
}
.access-grid button, .upload-grid button, .sticker-form button { align-self: end; }
.pending-access { padding: .75rem; background: #f8fafc; border-radius: 10px; margin-bottom: .5rem; }
.pin-admin-form { max-width: 320px; }
.qr { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.qr img { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 10px; }

/* Dashboard */
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.module-card {
    display: flex; align-items: center; gap: .9rem; padding: 1.1rem; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
}
.module-card:hover { border-color: var(--blue); }
.module-card small { display: block; color: var(--muted); }
.module-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 1.2rem; flex-shrink: 0; }
.module-icon.blue { background: #e6f0fd; color: var(--blue); }
.module-icon.green { background: #e7f7ee; color: var(--green); }
.module-icon.purple { background: #f1eafe; color: var(--purple); }
.module-arrow { margin-left: auto; color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.stat-card span { color: var(--muted); font-size: .9rem; }
.stat-card strong { display: block; font-size: 2rem; }

/* Client area */
.client-shell .workspace { width: 100%; }
.welcome { margin-bottom: 1.25rem; }
.welcome p { margin: 0; color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 1.75rem 0 1rem; }
.section-title p { margin: 0; color: var(--muted); }
.pin-card { max-width: 420px; margin-top: 1.25rem; }
.pin-form button { width: 100%; }

/* Digital service sticker */
.sticker-scroll { position: relative; overflow-x: auto; padding-bottom: .5rem; }
.sticker-preview { margin-top: 1.25rem; }
.inspection-sticker {
    min-width: 720px; max-width: 900px; margin: 0 auto; background: #fff; color: #111;
    border: 3px solid var(--navy); border-radius: 18px; overflow: hidden; font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 12px 32px rgba(11, 37, 69, .16);
}
.sticker-top {
    display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 1rem; padding: .9rem 1.25rem;
    background: linear-gradient(180deg, #fff 0%, #f3f6fb 100%); border-bottom: 5px solid transparent;
    border-image: linear-gradient(90deg, var(--navy) 0 50%, var(--red) 50% 100%) 1;
}
.sticker-logo img { max-height: 60px; margin: 0 auto; display: block; }
.sticker-prime img { max-height: 72px; margin: 0 auto; display: block; }
.sticker-columns { display: grid; grid-template-columns: 1fr 1.3fr 1fr; }
.sticker-date { --accent: var(--navy); --tint: #eef3fa; padding: 1rem; text-align: center; background: var(--tint); }
.sticker-date.next { --accent: var(--red); --tint: #fdf1f1; }
.date-title {
    display: block; padding: .5rem; color: #fff; background: var(--accent); font-size: .78rem;
    letter-spacing: .08em; border-radius: 8px; box-shadow: 0 3px 8px rgba(0, 0, 0, .15);
}
.date-readable { display: block; margin: .65rem 0; font-weight: 800; font-size: 1.15rem; color: var(--accent); }
.calendar { background: #fff; border-radius: 12px; padding: .6rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.months, .days, .years { display: grid; gap: 3px; font-size: .75rem; color: #333; }
.days, .years { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed #d5dbe5; }
.months { grid-template-columns: repeat(4, 1fr); }
.days { grid-template-columns: repeat(7, 1fr); }
.years { grid-template-columns: repeat(3, 1fr); }
.months span, .days span, .years span { display: flex; align-items: center; justify-content: center; min-height: 24px; padding: 2px 0; border-radius: 6px; }
.days span { border-radius: 50%; aspect-ratio: 1; min-height: 0; }
.marked { background: var(--accent); color: #fff; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.sticker-center {
    padding: 1.25rem 1.4rem; text-align: center; display: flex; flex-direction: column;
    align-items: center; justify-content: space-between; gap: .9rem;
}
.sticker-center p { margin: 0; }
.sticker-heading { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.sticker-service { font-weight: 900; font-size: 1.15rem; line-height: 1.25; letter-spacing: .05em; color: var(--navy); }
.sticker-client { color: #555; font-size: .95rem; }
.sticker-status {
    display: inline-flex; align-items: center; gap: .45rem; margin-top: .2rem; padding: .45rem 1.1rem;
    border-radius: 999px; font-weight: 800; font-size: .8rem; letter-spacing: .06em; color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
}
.sticker-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.sticker-status.active { background: linear-gradient(135deg, #22c55e, var(--green)); }
.sticker-status.overdue { background: linear-gradient(135deg, #ef4444, var(--red)); }
.sticker-status.pending { background: linear-gradient(135deg, #f59e0b, var(--amber)); }
.sticker-contact { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.sticker-phone { font-size: 1.5rem; font-weight: 700; color: var(--navy); letter-spacing: .02em; text-decoration: none; }
.sticker-phone:hover { color: var(--blue); text-decoration: underline; }
.sticker-web { font-size: .72rem; font-weight: 700; color: #555; letter-spacing: .04em; text-decoration: none; }
.sticker-web:hover { color: var(--blue); text-decoration: underline; }
.sticker-statement {
    font-weight: 700; font-size: .85rem; line-height: 1.4; padding: .65rem .9rem; color: var(--navy);
    background: #f3f6fb; border: 1px solid #d5dbe5; border-left: 5px solid var(--green); border-radius: 8px;
}
.sticker-checks {
    list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start;
    gap: .55rem; font-size: .92rem; color: #555;
}
.sticker-checks li { display: flex; align-items: center; gap: .6rem; }
.sticker-checks .box {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 22px; height: 22px; border: 2px solid #9aa4b2; border-radius: 6px; background: #fff;
    font-size: .95rem; font-weight: 900; line-height: 1;
}
.sticker-checks .checked { font-weight: 700; color: #111; }
.sticker-checks .checked .box { background: var(--green); border-color: var(--green); color: #fff; }
.sticker-technician { font-size: .85rem; padding: .4rem 1rem; border-radius: 999px; background: #f3f6fb; color: #555; letter-spacing: .03em; }
.sticker-technician strong { color: var(--navy); }
.sticker-footer { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.sticker-center small { font-size: .7rem; color: #666; }
.sticker-remove { font-size: .72rem; letter-spacing: .14em; color: var(--red); }

/* Sticker on narrow screens: keep the landscape layout and scale it down to fit (see sticker.blade.php) */
.sticker-scroll.is-scaled { overflow: hidden; }
.sticker-scroll.is-scaled .inspection-sticker { width: 720px; min-width: 720px; box-shadow: none; }

/* Full screen, sideways view opened from the corner button */
.sticker-expand, .sticker-close {
    position: absolute; z-index: 2; display: grid; place-items: center; margin: 0; padding: 0;
    color: #fff; background: rgba(11, 37, 69, .88); border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.sticker-expand { bottom: calc(.5rem + 8px); right: 8px; width: 36px; height: 36px; }
.sticker-close { display: none; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.sticker-scroll.is-expanded {
    position: fixed; inset: 0; z-index: 1000; overflow: hidden; padding: 0; height: auto;
    background: rgba(8, 15, 30, .94);
}
.sticker-scroll.is-expanded .inspection-sticker {
    position: absolute; top: 50%; left: 50%; width: 720px; min-width: 720px; margin: 0;
    transform-origin: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.sticker-scroll.is-expanded .sticker-expand { display: none; }
.sticker-scroll.is-expanded .sticker-close { display: grid; position: fixed; z-index: 3; }
.sticker-expanded, .sticker-expanded body { overflow: hidden; }
@media print { .sticker-expand, .sticker-close { display: none !important; } }

/* Printable QR code */
.qr-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.qr-print-page { margin: 0; min-height: 100vh; background: var(--bg); font-family: Arial, Helvetica, sans-serif; }
.qr-print-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; max-width: 4in; margin: 0 auto; padding: 1.25rem 0 0; }
.qr-print-toolbar .button, .qr-print-toolbar button { margin-top: 0; }
.qr-print-size { text-align: center; color: var(--muted); font-size: .85rem; margin: .75rem 0 0; }
/* Exactly 4in wide x 6in tall, the label size used for printing */
.qr-print-card {
    box-sizing: border-box; width: 4in; height: 6in; margin: .75rem auto 2rem; padding: .3in .28in;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    background: #fff; color: #111; text-align: center; overflow: hidden;
    border: .04in solid var(--navy); border-radius: .18in; box-shadow: 0 12px 32px rgba(11, 37, 69, .16);
}
.qr-print-logo { width: 2.3in; height: auto; }
.qr-print-code { box-sizing: border-box; width: 3in; height: 3in; padding: .06in; border: .02in solid #d5dbe5; border-radius: .1in; }
.qr-print-card p { margin: 0; }
.qr-print-cta {
    width: 100%; box-sizing: border-box; padding: .1in .12in; border-radius: 999px; white-space: nowrap;
    font-size: 12.5pt; font-weight: 900; letter-spacing: .03em; color: #fff; background: var(--navy);
}
.qr-print-message { width: 100%; display: flex; flex-direction: column; align-items: center; gap: .06in; }
.qr-print-note { font-size: 9.5pt; font-style: italic; color: #555; }
.qr-print-service { font-size: 11.5pt; font-weight: 800; letter-spacing: .04em; color: var(--red); }
@media print {
    @page { size: 4in 6in; margin: 0; }
    html, body.qr-print-page { width: 4in; height: 6in; margin: 0; background: #fff; min-height: 0; }
    .qr-print-toolbar, .qr-print-size { display: none; }
    .qr-print-card {
        margin: 0; box-shadow: none; border-radius: 0; page-break-after: avoid; break-after: avoid;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
}

/* Label sheet OL145LP: Letter page, two 6 x 4 in labels, 1.375in top / 1.25in side margins, 0.25in between */
.qr-sheet-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; max-width: 8.5in; margin: 0 auto; padding: 1.25rem 1rem 0; box-sizing: border-box; }
.qr-sheet-toolbar label { margin-top: 0; }
.qr-sheet-toolbar select { min-width: 14rem; }
.qr-sheet-toolbar .button, .qr-sheet-toolbar button { margin-top: 0; }
.qr-strip-settings { flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .5rem 1rem; margin: 0; padding: .5rem .75rem .75rem; border: 1px solid var(--line); border-radius: 10px; }
.qr-strip-settings legend { padding: 0 .35rem; font-weight: 600; font-size: .9rem; }
.qr-strip-setting { display: grid; grid-template-columns: 1fr 4.5rem; gap: .35rem .4rem; }
.qr-strip-setting label { grid-column: 1 / -1; margin: 0 0 -.15rem; }
.qr-strip-setting select:first-of-type { grid-column: 1 / -1; }
.qr-strip-setting select { min-width: 0; }
.qr-sheet-toolbar button[disabled] { opacity: .5; cursor: not-allowed; }
.qr-sheet {
    box-sizing: border-box; width: 8.5in; height: 11in; margin: .75rem auto 2rem; padding: 1.375in 1.25in;
    display: flex; flex-direction: column; gap: .25in; overflow: hidden;
    background: #fff; box-shadow: 0 12px 32px rgba(11, 37, 69, .16);
}
/* The 0.1in inset keeps the printed border inside the die cut if the printer shifts slightly */
.qr-sheet-slot { box-sizing: border-box; width: 6in; height: 4in; padding: .1in; outline: 1px dashed #c3ccd8; }
.qr-sheet-empty { height: 100%; margin: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.qr-print-card.qr-label-landscape {
    width: 100%; height: 100%; margin: 0; padding: .22in .26in; box-shadow: none;
    display: grid; grid-template-columns: 2.85in 1fr; grid-template-rows: auto 1fr auto;
    grid-template-areas: "code logo" "code message" "code service"; column-gap: .25in; align-items: center;
}
.qr-label-landscape .qr-print-code { grid-area: code; width: 2.85in; height: 2.85in; }
.qr-label-landscape .qr-print-logo { grid-area: logo; width: 100%; max-width: 2.1in; justify-self: center; }
.qr-label-landscape .qr-print-message { grid-area: message; }
.qr-label-landscape .qr-print-cta { white-space: normal; font-size: 11.5pt; line-height: 1.2; border-radius: .14in; }
.qr-label-landscape .qr-print-service { grid-area: service; font-size: 10.5pt; line-height: 1.25; }
/* Border strips in the sheet margins: 0.25in from the paper edge and 0.25in from the labels */
.qr-sheet { position: relative; }
.qr-strip-area { position: absolute; box-sizing: border-box; }
.qr-strip-top, .qr-strip-bottom { left: .25in; width: 8in; height: .875in; }
.qr-strip-top { top: .25in; }
.qr-strip-bottom { top: 9.875in; }
.qr-strip-left, .qr-strip-right { top: 1.375in; width: .75in; height: 8.25in; }
.qr-strip-left { left: .25in; }
.qr-strip-right { left: 7.5in; }
.qr-strip {
    box-sizing: border-box; width: 100%; height: 100%; display: flex; align-items: center; gap: .18in; padding: .08in .22in;
    background: #fff; color: var(--navy); border: .03in solid var(--navy); border-radius: .12in;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
/* Side strips are laid out as 8.25 x 0.75 in and turned to run along the edge */
.qr-strip-left .qr-strip, .qr-strip-right .qr-strip { position: absolute; top: 0; left: 0; width: 8.25in; height: .75in; transform-origin: top left; }
.qr-strip-left .qr-strip { transform: rotate(-90deg) translateX(-100%); }
.qr-strip-right .qr-strip { transform: rotate(90deg) translateY(-100%); }
/* Fixed size (the logo is 660 x 288) so the name is measured with the logo's space already taken */
.qr-strip-logo { flex: none; height: .5in; width: 1.15in; object-fit: contain; padding-right: .18in; border-right: .02in solid #d5dbe5; }
.qr-strip-number {
    flex: none; min-width: .7in; height: .6in; box-sizing: border-box; padding: 0 .1in; border-radius: .08in;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--navy); color: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 24pt; font-weight: 900; line-height: 1;
}
.qr-strip-number small { font-size: 7pt; font-weight: 800; letter-spacing: .12em; margin-bottom: .03in; }
.qr-strip-name {
    flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: center;
    font-family: Arial, Helvetica, sans-serif; font-size: 22pt; font-weight: 900; line-height: 1.1; letter-spacing: .02em; text-transform: uppercase;
}
@media print {
    html:has(.qr-sheet), body.qr-print-page:has(.qr-sheet) { width: 8.5in; height: 11in; }
    .qr-sheet-toolbar { display: none; }
    .qr-sheet { margin: 0; box-shadow: none; break-after: avoid; page-break-after: avoid; }
    .qr-sheet-slot { outline: none; }
    .qr-sheet-empty { visibility: hidden; }
    .qr-print-card.qr-label-landscape { border-radius: .18in; }
}

/* Document preview */
.document-preview-page { background: var(--bg); }
.document-preview-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.document-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

@media (max-width: 860px) {
    .admin-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
    .sidebar .nav-label, .side-foot { display: none; }
    .grid.two { grid-template-columns: 1fr; }
    .client-directory { max-height: 60vh; }
    .topbar { flex-wrap: wrap; padding: .75rem 1rem; }
    .container { padding: 1rem; }
    .today { display: none; }
}
.restaurant-switch { margin-top: .75rem; flex-wrap: wrap; }
.restaurant-switch select { width: auto; max-width: 100%; }

/* Calendar: spreadsheet-style service table */
.calendar-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.calendar-chip { margin: 0; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 500; }
.calendar-chip strong { margin-right: .2rem; }
.calendar-chip.active { outline: 2px solid var(--blue); outline-offset: 1px; }
.calendar-tools { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.calendar-tools input { flex: 1 1 240px; width: auto; }
.calendar-tools select { flex: 0 1 200px; width: auto; }
.calendar-count { margin: 0 0 0 auto; }
.sheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.sheet { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .92rem; }
.sheet th, .sheet td { padding: .6rem .8rem; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; white-space: nowrap; }
.sheet th:last-child, .sheet td:last-child { border-right: 0; }
.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet thead th { position: sticky; top: 0; background: #f8fafc; padding: 0; }
.sheet th button { display: flex; justify-content: flex-start; width: 100%; margin: 0; padding: .65rem .8rem; background: none; color: var(--ink); text-align: left; font-weight: 700; border-radius: 0; }
.sheet th button::after { content: " ↕"; color: var(--muted); font-weight: 400; }
.sheet th button.sorted-asc::after { content: " ↑"; color: var(--blue); }
.sheet th button.sorted-desc::after { content: " ↓"; color: var(--blue); }
.sheet tbody tr:nth-child(even) { background: #fafbfd; }
.sheet tbody tr:hover { background: #f5f9ff; }
.status-pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.status-overdue { background: #fde8e8; color: #b91c1c; }
.status-this-week { background: #fef3c7; color: #92400e; }
.status-upcoming { background: #e6f0fd; color: #1d4ed8; }
.status-scheduled { background: #e7f7ee; color: #15803d; }
.status-unscheduled { background: #eef2f6; color: var(--muted); }
.calendar-empty { margin: 1rem 0 0; }

/* Document library (client portal, public QR page, admin preview) */
.doc-month { padding: 0; overflow: hidden; }
.doc-month-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; background: linear-gradient(90deg, #f5f9ff, #fff); border-bottom: 1px solid var(--line); }
.doc-month-head h2 { margin: 0; font-size: 1.1rem; }
.doc-count { flex-shrink: 0; padding: .2rem .65rem; border-radius: 999px; background: #e6f0fd; color: var(--blue); font-size: .78rem; font-weight: 700; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-item { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.25rem; transition: background .15s; }
.doc-item + .doc-item { border-top: 1px solid var(--line); }
.doc-item:hover { background: #f8fafc; }
.doc-icon { flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 52px; border-radius: 8px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; position: relative; }
.doc-icon::before { content: ""; position: absolute; top: 0; right: 0; border-width: 0 12px 12px 0; border-style: solid; border-color: var(--card) var(--card) rgba(0, 0, 0, .12) rgba(0, 0, 0, .12); border-radius: 0 0 0 4px; }
.doc-icon.pdf { background: #fde8e8; color: #b91c1c; }
.doc-icon.image { background: #e7f7ee; color: #15803d; }
.doc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.doc-title { font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; min-width: 0; font-size: .82rem; color: var(--muted); }
.doc-date { flex-shrink: 0; padding: .1rem .5rem; border-radius: 6px; background: #eef2f6; color: var(--ink); font-weight: 600; }
.doc-file { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-actions { flex-shrink: 0; display: flex; gap: .5rem; }
.doc-btn { display: inline-flex; align-items: center; justify-content: center; padding: .5rem .9rem; border-radius: 10px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font-size: .88rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.doc-btn:hover { filter: brightness(1.08); }
.doc-btn.ghost { background: transparent; color: var(--blue); }
.doc-btn.ghost:hover { background: #f5f9ff; filter: none; }
.doc-empty { text-align: center; padding: 2rem 1.25rem; }

@media (max-width: 640px) {
    .section-title > p { display: none; }
    .doc-item { flex-wrap: wrap; align-items: flex-start; padding: 1rem; }
    .doc-icon { width: 38px; height: 46px; }
    .doc-body { flex-basis: calc(100% - 38px - .9rem); }
    .doc-actions { width: 100%; }
    .doc-btn { flex: 1; padding: .65rem .75rem; }
}
.login-link-hint { grid-column: 1 / -1; margin: 0; padding: .55rem .75rem; border-radius: 10px; background: #e7f7ee; color: #15803d; font-size: .88rem; }

/* External users and client access */
.assign-form { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }
.assign-form input { flex: 1 1 260px; width: auto; }
.assign-form button { margin: 0; }
.access-row { align-items: center; }
.access-row > div { display: flex; flex-direction: column; min-width: 0; }
.access-row span { overflow-wrap: anywhere; }
.access-row form { margin: 0; }
button.ghost.danger-ghost { color: var(--red); border-color: var(--red); margin: 0; }
.external-user { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.external-user .list-row { border-bottom: 0; padding: 0; }
.external-user .list-row span { overflow-wrap: anywhere; }
.restaurant-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; font-size: .85rem; }
.restaurant-tag { padding: .2rem .6rem; border-radius: 999px; background: #e6f0fd; color: var(--blue); font-weight: 600; text-decoration: none; }
.restaurant-tag:hover { background: #d4e5fc; }
.user-manage { margin-top: .5rem; }
.user-manage summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: .9rem; }
.user-manage[open] { display: flex; flex-direction: column; gap: .5rem; }
.user-manage form { margin: 0; }
.user-manage .inline-form { flex-wrap: nowrap; }
.user-manage .inline-form input { flex: 1 1 0; min-width: 0; width: auto; }
.user-manage .inline-form button { flex-shrink: 0; margin: 0; }
@media (max-width: 640px) { .user-manage .inline-form { flex-wrap: wrap; } .user-manage .inline-form input { flex-basis: 100%; } }
.user-manage .inline-form input { max-width: none; margin-top: 0; }
.admin-accounts { margin-top: 1.25rem; }
.admin-password-form { flex-wrap: wrap; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.admin-password-form input { flex: 1 1 180px; max-width: 260px; margin-top: 0; }
.admin-password-form button { margin: 0; }

/* Maintenance mode */
.maintenance-banner { padding: .7rem 1rem; margin-bottom: 1rem; border-radius: 10px; background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; font-size: .92rem; }
.maintenance-banner a { color: inherit; font-weight: 700; }
.nav-badge { margin-left: auto; padding: .05rem .45rem; border-radius: 999px; background: #f59e0b; color: #1f2937; font-size: .68rem; font-weight: 800; }
.maintenance-status { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.maintenance-status p { margin: .15rem 0 0; }
.maintenance-dot { flex-shrink: 0; width: 14px; height: 14px; border-radius: 50%; }
.maintenance-status.is-on { border-color: #fcd34d; background: #fffbeb; }
.maintenance-status.is-on .maintenance-dot { background: #f59e0b; box-shadow: 0 0 0 5px rgba(245, 158, 11, .2); }
.maintenance-status.is-off .maintenance-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(22, 163, 74, .15); }
.maintenance-form textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; resize: vertical; }
.maintenance-form input[type="datetime-local"] { max-width: 280px; }
.maintenance-form .check-label { margin-top: .75rem; }
.maintenance-off { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
button.ok { background: var(--green); }
.maintenance-card { text-align: center; max-width: 460px; }
.maintenance-card .login-brand { justify-content: center; }
.maintenance-icon { width: 64px; height: 64px; margin: 1rem auto .75rem; display: grid; place-items: center; border-radius: 50%; background: #fef3c7; color: #d97706; font-size: 2rem; animation: maintenance-spin 8s linear infinite; }
@keyframes maintenance-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .maintenance-icon { animation: none; } }
.maintenance-message { color: var(--ink); line-height: 1.6; white-space: pre-line; }
.maintenance-until { padding: .6rem .8rem; border-radius: 10px; background: #f1f5f9; color: var(--muted); font-size: .92rem; }
.maintenance-admin { margin: .5rem 0 0; font-size: .85rem; }

/* Service hours */
.service-hours-card { margin-bottom: 1.25rem; }
.service-hours-form { display: grid; grid-template-columns: 160px 160px 1fr auto; gap: .75rem; align-items: end; }
.service-hours-form label { margin-top: 0; }
.service-hours-form button { margin: 0; }
@media (max-width: 860px) { .service-hours-form { grid-template-columns: 1fr 1fr; } .service-hours-form .wide-field, .service-hours-form button { grid-column: 1 / -1; } }

/* Calendar: month view */
.view-tabs { display: inline-flex; padding: 4px; border-radius: 12px; background: #e9eef5; gap: 2px; }
.view-tabs a { padding: .45rem 1rem; border-radius: 9px; color: var(--muted); font-weight: 600; text-decoration: none; }
.view-tabs a.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.cal-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: 1rem; }
.cal-toolbar h2 { margin: 0; min-width: 170px; text-align: center; font-size: 1.35rem; }
.cal-nav { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 1.3rem; text-decoration: none; }
.cal-nav:hover { border-color: var(--blue); color: var(--blue); }
.cal-today { margin: 0; padding: .4rem .8rem; }
.cal-tip { margin: 0 0 0 auto; font-size: .85rem; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.25rem; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-weekday { padding: .5rem; background: #f8fafc; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: center; }
.cal-day { min-height: 118px; padding: .35rem; background: var(--card); display: flex; flex-direction: column; gap: 4px; transition: background .15s; }
.cal-day.outside { background: #fafbfc; }
.cal-day.outside .cal-date { color: #b6c0cc; }
.cal-day.past:not(.outside) { background: #fcfcfd; }
.cal-day.drop-target { background: #eaf2ff; box-shadow: inset 0 0 0 2px var(--blue); }
.cal-day.saving { opacity: .55; }
.cal-day-head { display: flex; align-items: center; gap: .3rem; min-height: 26px; cursor: default; }
.cal-date { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 .3rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.cal-date-long { display: none; }
.cal-day.today .cal-date { background: var(--blue); color: #fff; }
.cal-count { padding: 0 .4rem; border-radius: 999px; background: #eef2f6; color: var(--muted); font-size: .7rem; font-weight: 700; }
.cal-add { margin: 0 0 0 auto; width: 24px; height: 24px; padding: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 1.05rem; line-height: 1; opacity: 0; transition: opacity .15s; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; background: #eef2f6; color: var(--blue); }
.cal-event { display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; margin: 0; padding: .3rem .45rem; border-radius: 7px; border: 0; border-left: 3px solid currentColor; font-size: .78rem; font-weight: 500; line-height: 1.25; text-align: left; text-decoration: none; cursor: pointer; }
.cal-event[draggable="true"] { cursor: grab; }
.cal-event.dragging, .cal-chip.dragging { opacity: .4; }
.cal-event:hover { filter: brightness(.97); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.cal-time { font-size: .7rem; font-weight: 700; opacity: .85; }
.cal-name { width: 100%; color: var(--ink); font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.cal-dialog [hidden], .cal-layout [hidden] { display: none !important; }
.cal-side { display: flex; flex-direction: column; gap: 1rem; }
.cal-side .card { padding: 1rem; }
.cal-side h3 { display: flex; align-items: center; gap: .4rem; margin: 0 0 .25rem; font-size: 1rem; }
.cal-side .muted { margin: 0 0 .75rem; font-size: .85rem; }
.cal-unscheduled { display: flex; flex-direction: column; gap: .4rem; max-height: 420px; overflow: auto; }
.cal-chip { padding: .5rem .65rem; border: 1px dashed #cbd5e1; border-radius: 9px; background: #fbfcfe; }
.cal-chip[draggable="true"] { cursor: grab; }
.cal-chip:hover { border-color: var(--blue); }
.cal-chip a { display: block; color: var(--ink); font-weight: 600; font-size: .88rem; text-decoration: none; }
.cal-chip small { color: var(--muted); font-size: .75rem; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .35rem; }
.cal-legend h3 { width: 100%; }
.cal-dialog { width: min(440px, calc(100vw - 2rem)); padding: 1.5rem; border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); }
.cal-dialog::backdrop { background: rgba(11, 37, 69, .45); }
.cal-dialog h2 { margin: 0 0 .5rem; }
.cal-dialog select { width: 100%; }
.cal-dialog-hint { margin: .6rem 0 0; padding: .5rem .7rem; border-radius: 9px; background: #f1f5f9; font-size: .85rem; }
.cal-dialog-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.cal-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: 1.25rem; }
.cal-dialog-actions button { margin: 0; }
.cal-dialog-actions .link-danger { margin-left: auto; }

@media (max-width: 1200px) {
    .cal-layout { grid-template-columns: 1fr; }
    .cal-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
/* Touch screens (iPhone, iPad): no hover, and dragging is unreliable, so show "+" and say "tap" */
.cal-tip-touch { display: none; }
@media (hover: none) {
    .cal-add { opacity: 1; background: #eef2f6; color: var(--blue); }
    .cal-tip-mouse { display: none; }
    .cal-tip-touch { display: inline; }
}
/* Phones: an agenda of the days that have services, plus today */
@media (max-width: 700px) {
    .cal-tip { margin: 0; width: 100%; }
    .cal-grid { display: flex; flex-direction: column; gap: 0; background: var(--card); }
    .cal-weekday { display: none; }
    .cal-day { min-height: 0; padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
    .cal-day.empty:not(.today), .cal-day.outside { display: none; }
    .cal-date { display: inline-flex; align-items: center; min-width: 0; padding: 0; height: auto; background: none !important; color: var(--ink) !important; font-size: .95rem; white-space: nowrap; }
    .cal-date-long { margin-right: .25rem; }
    .cal-date-long { display: inline; }
    .cal-name { -webkit-line-clamp: 3; }
    .cal-day.today .cal-date::after { content: "Today"; margin-left: .5rem; padding: .05rem .5rem; border-radius: 999px; background: var(--blue); color: #fff; font-size: .7rem; }
    .cal-add { opacity: 1; }
    .cal-event { flex-direction: row; align-items: center; gap: .6rem; padding: .55rem .65rem; font-size: .9rem; }
    .cal-time { min-width: 64px; font-size: .78rem; }
    .view-tabs { margin-top: .5rem; }
}

/* Service history */
.service-hours-form { grid-template-columns: 140px 140px 200px 1fr auto; }
.history-card { margin-bottom: 1.25rem; }
.history-card h2 { display: flex; align-items: center; gap: .5rem; }
.history-forms { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.history-add { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .85rem; background: #fbfcfe; }
.history-add summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.history-add .muted { margin: .5rem 0 0; font-size: .88rem; }
.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: .75rem; align-items: end; }
.history-grid button { margin: 0; }
.history-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.history-list li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.history-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.history-list .muted { font-size: .85rem; }
.history-list form { margin: 0; }
.history-check { flex-shrink: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e7f7ee; color: var(--green); font-weight: 800; }
.history-empty { border: 0 !important; }
@media (max-width: 860px) {
    .service-hours-form { grid-template-columns: 1fr 1fr; }
    .history-grid { grid-template-columns: 1fr 1fr; }
    .history-grid button { grid-column: 1 / -1; }
}
.cal-done { display: flex; flex-direction: column; padding: .3rem .45rem; border-radius: 7px; border-left: 3px solid var(--green); background: #f0faf4; color: #15803d; font-size: .78rem; line-height: 1.25; text-decoration: none; opacity: .9; }
.cal-done .cal-name { color: #3f5b4b; font-weight: 500; text-decoration: line-through; text-decoration-color: rgba(21, 128, 61, .35); }
.status-done { background: #f0faf4; color: #15803d; }
@media (max-width: 700px) { .cal-done { flex-direction: row; align-items: center; gap: .6rem; padding: .55rem .65rem; font-size: .9rem; } }
.migrate-command { margin: .75rem 0; padding: .8rem 1rem; border-radius: 10px; background: var(--navy); color: #fff; font-size: 1rem; text-align: left; user-select: all; }

/* Calendar sections and column filters */
.tab-count { margin-left: .3rem; padding: 0 .45rem; border-radius: 999px; background: #dfe7f1; color: var(--muted); font-size: .72rem; }
.view-tabs a.active .tab-count { background: #e6f0fd; color: var(--blue); }
.calendar-tools button { margin: 0; padding: .55rem .9rem; }
.sheet thead .sheet-filters th { position: sticky; top: 41px; padding: .35rem .4rem; background: #fdfdfe; border-bottom: 1px solid var(--line); }
.sheet-filters input, .sheet-filters select { width: 100%; min-width: 90px; margin: 0; padding: .35rem .5rem; border-radius: 7px; font-size: .82rem; font-weight: 400; }
.sheet-filters .is-active { border-color: var(--blue); background: #f2f7ff; }
.sheet-notes { white-space: normal !important; min-width: 180px; max-width: 320px; color: var(--muted); }
.history-list li { flex-wrap: wrap; }
.history-actions { display: flex; align-items: center; gap: 1rem; }
.link-button { margin: 0; padding: 0; background: none; color: var(--blue); font-weight: 600; font-size: inherit; }
.history-edit { width: 100%; margin: .25rem 0 .25rem 40px; padding: .85rem; border-radius: 10px; background: #f8fafc; border: 1px solid var(--line); grid-template-columns: 150px 120px 1fr 1fr; }
.history-edit[hidden] { display: none; }
.history-edit-notes { grid-column: 1 / 4; }
.history-edit-buttons { display: flex; gap: .5rem; }
.history-edit-buttons button { margin: 0; }
.history-list li.is-target { background: #fffbeb; border-radius: 10px; padding-left: .5rem; padding-right: .5rem; }
.sheet-action { width: 1%; }
@media (max-width: 860px) { .history-edit { margin-left: 0; grid-template-columns: 1fr 1fr; } .history-edit-notes { grid-column: 1 / -1; } }
.history-list li > .history-actions { flex: 0 0 auto; flex-direction: row; }

/* Clients page: wider directory with service details */
.client-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.client-stats .stat-card strong { display: block; margin-top: .2rem; font-size: 1.6rem; }
.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover { border-color: var(--blue); }
.text-red { color: #b91c1c; }
.text-amber { color: #b45309; }
.clients-layout { display: grid; gap: 1.25rem; align-items: start; }
.clients-layout.with-form { grid-template-columns: 320px minmax(0, 1fr); }
.new-client-card { position: sticky; top: 1rem; }
.directory-head, .directory-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, .9fr) minmax(0, 1.1fr) 18px; gap: 1rem; align-items: center; }
.directory-head { padding: .5rem .8rem; margin-top: .25rem; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.client-directory { max-height: none; }
.client-directory .directory-row { padding: .75rem .8rem; }
.directory-name { min-width: 0; }
.directory-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.directory-cell { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; font-size: .88rem; color: var(--ink); }
.directory-row .directory-label { display: none; }
.client-directory .directory-row { align-items: center; }
.directory-records { flex-direction: row; flex-wrap: wrap; gap: .35rem .75rem; color: var(--muted); font-size: .82rem; }
.qr-ok { color: var(--green); }
.qr-pending { color: var(--amber); }
.directory-arrow { color: var(--muted); }
@media (max-width: 1200px) {
    .clients-layout.with-form { grid-template-columns: 1fr; }
    .new-client-card { position: static; }
}
@media (max-width: 900px) {
    .client-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .directory-head { display: none; }
    .directory-row { grid-template-columns: 1fr 1fr; gap: .6rem 1rem; }
    .directory-name { grid-column: 1 / -1; }
    .directory-row .directory-label { display: block; color: var(--muted); font-size: .72rem; }
    .client-directory .directory-row { align-items: start; }
    .directory-arrow { display: none; }
}

/* Collapsible menu on phones and small tablets */
.side-top { display: block; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
    .sidebar { padding: .75rem 1rem; }
    .side-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
    .sidebar .side-top .side-brand { padding: .45rem .7rem; margin-bottom: 0; flex-direction: row; align-items: center; gap: .6rem; }
    .side-top .prime-brand-logo { height: 32px; }
    .nav-toggle { display: inline-flex; margin: 0; padding: .55rem .9rem; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; }
    .sidebar.nav-collapsible .side-menu { display: none; }
    .sidebar.nav-collapsible.nav-open .side-menu { display: block; margin-top: .75rem; }
    .sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; }
}
@media (max-width: 600px) {
    .client-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
    .client-stats .stat-card { padding: .6rem .7rem; }
    .client-stats .stat-card span { font-size: .75rem; }
    .client-stats .stat-card strong { font-size: 1.25rem; }
}
