/* ==========================================================================
   Staff service management app
   ========================================================================== */
body.app { background: var(--surface-2); }
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy-900); color: #b8c3dc; display: flex; flex-direction: column; padding: 1.1rem .85rem; }
.sidebar .brand { color: #fff; padding: .25rem .5rem 1.25rem; }
.sidebar .brand small { color: #7f8db0; }
.side-nav { list-style: none; padding: 0; margin: 0; display: grid; gap: .15rem; }
.side-nav .label { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #6a7898; padding: 1rem .75rem .35rem; font-weight: 700; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: #c9d3ea; text-decoration: none; font-weight: 600; font-size: .93rem; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a[aria-current="page"] { background: rgba(47,107,255,.22); color: #fff; box-shadow: inset 3px 0 0 var(--blue-500); }
.side-nav .count { margin-left: auto; background: var(--amber-500); color: var(--navy-950); font-size: .72rem; font-weight: 800; padding: .05rem .45rem; border-radius: 999px; }
/* Related staff links share native, keyboard-accessible submenus. */
.side-nav .nav-group > summary { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .6rem .75rem; border-radius: 10px; color: #c9d3ea; font-size: .84rem; font-weight: 700; line-height: 1.4; cursor: pointer; list-style: none; }
.side-nav .nav-group > summary::-webkit-details-marker { display: none; }
.side-nav .nav-group > summary:hover, .side-nav .nav-group[open] > summary { background: rgba(255,255,255,.06); color: #fff; }
.side-nav .nav-group:has(a[aria-current="page"]) > summary { color: #fff; }
.nav-group-label { flex: 1; min-width: 0; }
.nav-group-chevron { width: .45rem; height: .45rem; flex: none; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
.nav-group[open] > summary .nav-group-chevron { transform: rotate(45deg); }
.side-subnav { display: grid; gap: .1rem; list-style: none; margin: .25rem 0 .5rem 1.25rem; padding: 0 0 0 .5rem; border-left: 1px solid rgba(255,255,255,.14); }
.side-nav .side-subnav a { min-height: 40px; padding: .48rem .5rem; gap: .45rem; font-size: .82rem; }
.side-subnav .icon { width: 1rem; height: 1rem; }
.sidebar nav { margin-bottom: 1rem; }
@media (max-width: 960px) { .side-nav .side-subnav a { min-height: 44px; } }
.side-user { margin-top: auto; padding: .9rem .75rem .25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .88rem; }
.side-user strong { display: block; color: #fff; }
.side-user .role { display: inline-block; margin: .2rem 0 .6rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(15,181,166,.2); color: #6fe6d9; font-size: .75rem; font-weight: 700; }
.side-user form { display: inline; }
.side-user a, .side-user button { color: #c9d3ea; font-size: .85rem; }
.side-user .links { display: flex; gap: 1rem; flex-wrap: wrap; }

.topbar { display: none; }
.main { min-width: 0; padding: clamp(1rem, 3vw, 2rem); }
.staff-toolbar { display: flex; justify-content: flex-end; margin-bottom: .75rem; }
.maintenance-notifications { position: relative; z-index: 35; }
.notification-bell { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer; list-style: none; }
.notification-bell::-webkit-details-marker { display: none; }
.notification-bell:hover, .maintenance-notifications[open] .notification-bell { background: var(--blue-50); color: var(--blue-600); }
.notification-bell .icon { width: 22px; height: 22px; }
.notification-count { position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; background: var(--red-600); color: #fff; font-size: .68rem; font-weight: 800; border: 2px solid #fff; }
.notification-panel { position: absolute; top: calc(100% + .5rem); right: 0; width: min(370px, calc(100vw - 2rem)); max-height: min(580px, calc(100dvh - 180px)); overflow-y: auto; overscroll-behavior: contain; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.notification-heading { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
.notification-heading h2 { font-size: 1rem; margin: 0 0 .25rem; }
.notification-heading p { font-size: .8rem; margin: 0; color: var(--ink-3); }
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification-list li + li { border-top: 1px solid var(--line); }
.notification-list a { display: grid; gap: .25rem; padding: .9rem 1.1rem; text-decoration: none; color: var(--ink); overflow-wrap: anywhere; }
.notification-list a:hover { background: var(--blue-50); }
.notification-item-title { font-size: .9rem; font-weight: 750; line-height: 1.4; }
.notification-item-customer { font-size: .78rem; color: var(--ink-3); }
.notification-item-date { font-size: .78rem; color: #8a5300; font-weight: 700; }
.notification-overdue { color: #a52424; }
.notification-empty, .notification-more { margin: 0; padding: 1.25rem 1.1rem; color: var(--ink-3); font-size: .85rem; }
.notification-footer { display: grid; gap: .5rem; padding: 1rem 1.1rem; border-top: 1px solid var(--line); font-size: .82rem; font-weight: 700; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); margin: 0; font-weight: 800; }
.page-head .sub { margin: .25rem 0 0; color: var(--ink-3); }
.dashboard-actions { flex-wrap: nowrap; }
@media (max-width: 560px) {
  .dashboard-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; width: 100%; }
  .dashboard-actions > .btn { min-height: 44px; padding: .65rem .5rem; font-size: .82rem; gap: .35rem; }
  .dashboard-actions > .btn .icon { width: 1rem; height: 1rem; }
}
.breadcrumb { font-size: .85rem; margin-bottom: .35rem; color: var(--ink-3); }
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue-600); }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; background: var(--navy-900); color: #fff; }
  .topbar .brand { color: #fff; font-size: 1rem; }
  .topbar .brand-mark { width: 34px; height: 34px; }
  .topbar .btn { --btn-fg: #fff; --btn-bd: rgba(255,255,255,.25); --btn-bg: transparent; }
  .sidebar { position: fixed; inset: 0 30% 0 0; max-width: 300px; z-index: 60; transform: translateX(-105%); transition: transform .25s ease; height: 100%; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(7,15,34,.5); z-index: 55; }
}

/* ---------- Stats ---------- */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); margin-bottom: 1.5rem; }
.stat { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: #c7d6f5; box-shadow: var(--shadow-sm); color: var(--ink); }
.stat .service-icon, .stat-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--blue-100); color: var(--blue-600); flex: none; }
.stat-icon.warn { background: var(--amber-100); color: #9a5d00; }
.stat-icon.danger { background: var(--red-100); color: var(--red-600); }
.stat-icon.ok { background: var(--green-100); color: var(--green-600); }
.stat-icon.teal { background: var(--teal-100); color: #07857a; }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: .85rem; color: var(--ink-3); font-weight: 600; }

.dash-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }

/* ---------- Job list (mobile-friendly cards) ---------- */
.job-list { list-style: none; margin: 0; padding: 0; }
.job-list > li + li { border-top: 1px solid var(--line); }
.job { display: flex; gap: .9rem; padding: .95rem 1.25rem; align-items: flex-start; text-decoration: none; color: var(--ink); }
a.job:hover { background: var(--blue-50); color: var(--ink); }
.job-main { flex: 1; min-width: 0; }
.job-title { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; }
.job-meta { display: flex; flex-wrap: wrap; gap: .25rem .8rem; font-size: .84rem; color: var(--ink-3); margin-top: .15rem; }
.job-meta .icon { width: 1em; height: 1em; }
.job-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex: none; text-align: right; }
.job-type { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none; background: var(--blue-100); color: var(--blue-600); }
.job-type.installation { background: var(--teal-100); color: #07857a; }
.date-overdue { color: var(--red-600); font-weight: 700; }
.date-today { color: #9a5d00; font-weight: 700; }
.next-action { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 700; color: var(--blue-600); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-600), var(--teal-500)); border-radius: inherit; }

/* ---------- Filters ---------- */
.filters { padding: 1rem 1.25rem; }
.filters .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: .75rem; }
.filters .field > label { font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.filters .field input, .filters .field select { min-height: 42px; font-size: .92rem; }
.filters .field-search { grid-column: span 2; }
@media (max-width: 560px) { .filters .field-search { grid-column: auto; } }
.filter-toggle { display: none; }
@media (max-width: 700px) {
  .filter-toggle { display: inline-flex; }
  .filters.collapsed .form-grid > .field:not(.field-search), .filters.collapsed .filter-extra { display: none; }
}
.seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.seg a { padding: .4rem .85rem; border-radius: 999px; text-decoration: none; font-weight: 650; font-size: .88rem; color: var(--ink-2); }
.seg a[aria-current="true"] { background: var(--navy-900); color: #fff; }
.seg .n { opacity: .7; margin-left: .2rem; }

/* ---------- Ticket detail ---------- */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-side { display: grid; gap: 1.25rem; position: sticky; top: 1rem; }
@media (max-width: 1100px) { .ticket-side { position: static; order: -1; } }
.tracker { list-style: none; margin: 0; padding: 1rem 1.25rem; display: flex; gap: .25rem; overflow-x: auto; }
.tracker li { flex: 1 0 92px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; font-size: .74rem; font-weight: 650; color: var(--ink-3); position: relative; }
.tracker li::before { content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--line-2); z-index: 0; }
.tracker li:first-child::before { display: none; }
.tracker .pip { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); font-size: .75rem; }
.tracker li.done { color: var(--ink-2); }
.tracker li.done .pip { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.tracker li.done::before, .tracker li.current::before { background: var(--green-600); }
.tracker li.current { color: var(--blue-600); }
.tracker li.current .pip { border-color: var(--blue-600); background: var(--blue-100); color: var(--blue-600); box-shadow: 0 0 0 4px rgba(47,107,255,.15); }
.next-hint { display: flex; gap: .7rem; align-items: center; padding: .85rem 1.25rem; border-top: 1px solid var(--line); background: var(--blue-50); color: #1a3f9e; font-weight: 650; font-size: .93rem; border-radius: 0 0 var(--radius) var(--radius); }

.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: .55rem 1.25rem; margin: 0; font-size: .93rem; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prose-pre { white-space: pre-line; }
.people { display: flex; flex-wrap: wrap; gap: .4rem; }
.person { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem .2rem .25rem; border-radius: 999px; background: var(--surface-3); font-size: .85rem; font-weight: 600; }
.avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy-700); color: #fff; font-size: .7rem; font-weight: 800; text-transform: uppercase; }

.action-card { border-color: #c9d9ff; box-shadow: 0 8px 28px -14px rgba(22,83,240,.45); }
.action-card .card-head { background: var(--blue-50); border-radius: var(--radius) var(--radius) 0 0; }
.action-list { display: grid; gap: .6rem; }
.action-list .btn { justify-content: flex-start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface-2); }
.panel + .panel { margin-top: .75rem; }
details.panel > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "▾"; margin-left: auto; color: var(--ink-3); }
details.panel[open] > summary { margin-bottom: .85rem; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 34px 1fr; gap: .75rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .k { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); }
.feed .k .icon { width: 1.05rem; height: 1.05rem; }
.feed .k-quotation, .feed .k-agreement { background: var(--amber-100); color: #9a5d00; }
.feed .k-closed, .feed .k-report { background: var(--green-100); color: var(--green-600); }
.feed .k-assignment, .feed .k-created { background: var(--blue-100); color: var(--blue-600); }
.feed .k-schedule, .feed .k-reschedule { background: var(--teal-100); color: #07857a; }
.feed .msg { font-size: .93rem; overflow-wrap: anywhere; }
.feed .meta { font-size: .8rem; color: var(--ink-3); }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; gap: .75rem; align-items: center; padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); }
.doc-list li:last-child { border-bottom: 0; }
.doc-list .grow { flex: 1; min-width: 0; }
.doc-list strong { display: block; }

.sub-section + .sub-section { margin-top: 1.25rem; }
.card + .card { margin-top: 1.25rem; }
.dash-grid > .card + .card, .ticket-side > .card + .card { margin-top: 0; }
.ticket-main > .card + .card { margin-top: 1.25rem; }
.dash-grid > .card + .card, .ticket-side > .card + .card { margin-top: 0; }

/* Quotation editor */
.line-items-wrap { padding: 0 1.5rem 1.25rem; }
.items-table, .items-table tbody { display: block; width: 100%; }
.items-table tbody { display: grid; gap: .75rem; }
.items-table .item-row { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(85px, .65fr) minmax(90px, .7fr) minmax(145px, 1fr) minmax(105px, .8fr) auto; gap: .75rem; align-items: end; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.items-table td { display: flex; flex-direction: column; min-width: 0; padding: 0; border: 0; }
.items-table td > label:not(.line-delete), .items-table .line-label { margin-bottom: .35rem; color: var(--ink-3); font-size: .74rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.items-table input:not([type=checkbox]) { width: 100%; min-width: 0; min-height: 44px; padding: .55rem .7rem; color: var(--ink); font: inherit; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); transition: background .15s, border-color .15s, box-shadow .15s; }
.items-table input:not([type=checkbox]):hover { border-color: #9fb8f5; background: var(--surface); }
.items-table input:not([type=checkbox]):focus { outline: none; border-color: var(--blue-500); background: var(--surface); box-shadow: var(--focus); }
.items-table input::placeholder { color: var(--ink-3); }
.items-table .line-total-cell { justify-content: end; min-height: 68px; padding: .45rem .75rem; border-radius: var(--radius-sm); background: var(--blue-50); }
.items-table .line-total { color: var(--navy-800); font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items-table .line-remove { justify-content: end; min-height: 68px; }
.items-table .line-remove .btn { min-width: 42px; min-height: 44px; }
.items-table .line-delete { display: flex; align-items: center; gap: .35rem; min-height: 44px; padding: .5rem; border-radius: var(--radius-sm); color: var(--red-600); font-size: .8rem; font-weight: 650; cursor: pointer; }
.items-table .line-delete input { accent-color: var(--red-600); }
.items-table .error { margin: .35rem 0 0; color: var(--red-600); }
.items-table tr.deleted { opacity: .5; }
.items-table tr.deleted input:not([type=checkbox]) { text-decoration: line-through; }
@media (max-width: 1050px) {
  .items-table .item-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-table .line-description { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .line-items-wrap { padding: 0 1rem 1rem; }
  .items-table .item-row { gap: .7rem; padding: .8rem; }
  .items-table td:nth-child(4) { grid-column: 1 / -1; }
}
.totals { margin-left: auto; width: min(100%, 340px); display: grid; grid-template-columns: 1fr auto; gap: .45rem 1.5rem; padding: 1rem 1.25rem; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--ink-3); }
.totals dd { margin: 0; text-align: right; font-weight: 650; }
.totals .grand { font-size: 1.15rem; font-weight: 800; color: var(--ink); padding-top: .45rem; border-top: 1px solid var(--line); }
.quotation-form-totals .tax-rate-label { align-self: center; }
.quotation-form-totals .tax-rate-field { width: 110px; }
.quotation-form-totals .tax-rate-field input { text-align: right; }
.item-errors td { padding-top: 0; }

.upcoming-dates { display: flex; flex-wrap: wrap; gap: .5rem; }
.upcoming-dates span { padding: .35rem .7rem; border-radius: 8px; background: var(--surface-3); font-weight: 650; font-size: .88rem; }


/* Status bars on reports */
.bar-row { display: grid; grid-template-columns: 190px 1fr 40px; gap: .75rem; align-items: center; padding: .35rem 0; font-size: .9rem; }
.bar-row .bar { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: var(--blue-500); border-radius: inherit; min-width: 2px; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr 40px; } .bar-row .bar { grid-column: 1 / -1; order: 3; } }

/* Pagination */
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--line); font-size: .9rem; flex-wrap: wrap; }

/* Responsive tables become cards on phones */
@media (max-width: 700px) {
  .table.stack-sm thead { display: none; }
  .table.stack-sm tr { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
  .table.stack-sm td { border: 0; padding: .15rem 0; }
  .table.stack-sm td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
  .table.stack-sm td.primary { grid-column: 1 / -1; }
}

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: radial-gradient(700px 400px at 100% 0%, rgba(15,181,166,.3), transparent 60%), var(--navy-900); color: #c9d3ea; padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: space-between; }
.login-art .brand { color: #fff; }
.login-art .company-brand { gap: 14px; max-width: 100%; }
.company-brand-emblem { display: grid; place-items: center; width: 78px; height: 78px; flex: none; padding: 6px; background: #fff; border: 1px solid #e5e8ed; border-radius: 21px; }
.company-brand-emblem img { display: block; width: 100%; height: auto; }
.company-brand-copy { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.company-brand-name { color: #fff; font-family: Georgia, 'Times New Roman', serif; font-size: 35px; font-weight: 700; line-height: 1; letter-spacing: -.035em; }
.company-brand-tagline { color: #aab6c9; font-size: 12px; line-height: 1.4; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.company-brand-divider { color: #d91422; margin-inline: .2em; }
@media (max-width: 480px) {
  .login-art .company-brand { gap: 11px; }
  .company-brand-emblem { width: 62px; height: 62px; padding: 4px; border-radius: 17px; }
  .company-brand-name { font-size: 28px; }
  .company-brand-tagline { font-size: 9px; }
}
.login-art h1 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.4rem); }
.login-form-wrap { display: grid; place-items: center; padding: 2rem 1.25rem; }
.login-card { width: min(420px, 100%); }
@media (max-width: 800px) { .login-page { grid-template-columns: 1fr; } .login-art { padding: 1.5rem; } .login-art .hide-sm { display: none; } }

/* ---------- Printable formal documents ---------- */
body.doc { background: var(--surface-3); }
.doc-toolbar { display: flex; gap: .75rem; justify-content: center; padding: 1rem; flex-wrap: wrap; }
.sheet { width: min(210mm, 100% - 1.5rem); margin: 0 auto 2rem; background: #fff; padding: clamp(1.25rem, 4vw, 16mm); box-shadow: var(--shadow); border-radius: 4px; font-size: .92rem; }
.sheet-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; padding-bottom: 1rem; border-bottom: 3px solid var(--navy-900); margin-bottom: 1.25rem; flex-wrap: wrap; }
.sheet-company { font-size: 1.15rem; font-weight: 800; color: var(--navy-900); letter-spacing: .01em; margin: 0 0 .25rem; }
.sheet-company-details { flex: 1 1 400px; min-width: 0; }
.sheet-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.sheet-brand .sheet-company { min-width: 0; margin: 0; }
.sheet-logo { display: block; width: 160px; max-width: 100%; height: auto; flex: none; }
@media screen and (max-width: 480px) {
  .sheet-brand { gap: .75rem; }
  .sheet-brand .sheet-company { font-size: .95rem; }
  .sheet-logo { width: 100px; }
}
.sheet-head .contact { font-size: .82rem; color: var(--ink-2); line-height: 1.5; }
.sheet-title { text-align: right; }
.sheet-title h1 { font-size: 1.6rem; margin: 0; color: var(--blue-600); letter-spacing: .04em; text-transform: uppercase; }
.sheet h2 { font-size: 1rem; margin: 1.5rem 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.sheet .table th { background: var(--navy-900); color: #fff; }
.sheet .kv { font-size: .88rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 2.5rem; }
.signatures div { border-top: 1px solid var(--ink); padding-top: .4rem; font-size: .85rem; color: var(--ink-2); }
.sheet-foot { margin-top: 2rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--ink-3); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

@media print {
  @page { size: A4; margin: 12mm; }
  body, body.doc, body.app { background: #fff !important; }
  .no-print, .doc-toolbar, .sidebar, .topbar, .alerts { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .sheet { box-shadow: none; width: auto; margin: 0; padding: 0; }
  .sheet .table th { background: #eee !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

.range-out { display: inline-block; font-weight: 800; color: var(--blue-600); font-variant-numeric: tabular-nums; }

/* ---------- Sectioned forms (customer form) ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .form-layout { grid-template-columns: 1fr; } .form-layout > .form-aside { order: -1; position: static; } }
.form-aside { position: sticky; top: 1rem; }
.form-card { overflow: hidden; }
.form-card > .form-errors { margin: 1.25rem 1.5rem 0; }
.form-section { padding: 1.5rem; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section-head { display: flex; gap: .85rem; align-items: center; margin-bottom: 1.1rem; }
.form-section-head h2 { font-size: 1.05rem; margin: 0; }
.form-section-head p { margin: 0; font-size: .87rem; color: var(--ink-3); }
.form-section-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--blue-100); color: var(--blue-600); flex: none; }
.form-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.form-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.form-footer { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--surface-2); border-top: 1px solid var(--line); }
@media (max-width: 560px) { .form-footer { flex-direction: column-reverse; align-items: stretch; } .form-footer .cluster { flex-direction: column; } .form-footer .btn { width: 100%; } }
.field input::placeholder, .field textarea::placeholder { color: #9aa6bd; }

.type-cards { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.type-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; min-height: 92px; padding: .85rem .6rem; text-align: center; border: 1.5px solid var(--line-2); border-radius: var(--radius); background: #fff; cursor: pointer; font-weight: 650; font-size: .88rem; color: var(--ink-2); transition: border-color .15s, background .15s, box-shadow .15s, transform .12s; }
.type-card:hover { border-color: #9fb8f5; transform: translateY(-1px); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); transition: background .15s, color .15s; }
.type-card:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); color: var(--ink); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }
.type-card:has(input:checked) .type-card-icon { background: var(--blue-600); color: #fff; }
.type-card:has(input:focus-visible) { box-shadow: var(--focus); }
.type-card:has(input:checked)::after { content: "✓"; position: absolute; top: .4rem; right: .55rem; font-size: .75rem; font-weight: 800; color: var(--blue-600); }

.aside-title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; }
.tip-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .6rem; font-size: .9rem; color: var(--ink-2); }
fieldset.field { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
fieldset.field > legend { margin-bottom: .55rem; }

/* ---------- Shared pieces for redesigned forms ---------- */
.form-section > .form-grid + .form-grid, .form-section > .form-grid + .field, .form-section > .field + .form-grid { margin-top: 1rem; }
.aside-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; font-size: .9rem; }
.aside-facts li { display: flex; gap: .6rem; align-items: flex-start; }
.aside-facts .icon { color: var(--blue-600); margin-top: .15rem; }
.form-aside { display: grid; gap: 1.25rem; }

/* Large option cards with a description (ticket type, role) */
.option-cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.option-card { position: relative; display: flex; gap: .85rem; align-items: flex-start; padding: 1rem 1.1rem; border: 1.5px solid var(--line-2); border-radius: var(--radius); background: #fff; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.option-card:hover { border-color: #9fb8f5; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card strong { display: block; font-size: .98rem; }
.option-card small { display: block; color: var(--ink-3); font-size: .84rem; line-height: 1.45; margin-top: .15rem; }
.option-card .type-card-icon { flex: none; }
.option-card:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(47,107,255,.15); }
.option-card:has(input:checked) .type-card-icon { background: var(--blue-600); color: #fff; }
.option-card:has(input:focus-visible) { box-shadow: var(--focus); }
.option-card:has(input:checked)::after { content: "✓"; position: absolute; top: .55rem; right: .7rem; font-size: .8rem; font-weight: 800; color: var(--blue-600); }

/* Pill radio group (priority) */
.pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.pill { position: relative; display: inline-flex; align-items: center; gap: .4rem; min-height: 42px; padding: .45rem 1rem; border: 1.5px solid var(--line-2); border-radius: 999px; background: #fff; font-weight: 650; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--dot, var(--ink-3)); }
.pill-low { --dot: #8b97ad; } .pill-normal { --dot: var(--blue-500); } .pill-high { --dot: var(--amber-500); } .pill-urgent { --dot: var(--red-600); }
.pill:has(input:checked) { border-color: var(--dot); background: color-mix(in srgb, var(--dot) 10%, #fff); color: var(--ink); }
.pill:has(input:focus-visible) { box-shadow: var(--focus); }

/* Big toggle row for single checkboxes (e.g. "job finished") */
.toggle-row { display: flex; gap: .85rem; align-items: flex-start; padding: 1rem 1.1rem; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.toggle-row input { width: 1.3rem; height: 1.3rem; margin-top: .1rem; accent-color: var(--blue-600); flex: none; }
.toggle-row strong { display: block; }
.toggle-row small { color: var(--ink-3); }
.toggle-row:has(input:checked) { border-style: solid; border-color: var(--green-600); background: var(--green-100); }

/* Compact sidebar so the account links stay visible on shorter screens */
.side-nav a { padding: .5rem .75rem; }
.side-nav .label { padding: .8rem .75rem .25rem; }
.sidebar .brand { padding-bottom: .9rem; }
.side-user { padding-top: .75rem; }
.spread > .form-section-head { margin-bottom: 0; }
.field .help ul { margin: .25rem 0 0; padding-left: 1.1rem; display: grid; gap: .1rem; }

/* The shared company logo fits the sidebar and mobile header. */
.sidebar .brand.staff-brand { display: flex; gap: 9px; padding: .25rem .5rem .9rem; }
.staff-brand .company-brand-emblem { width: 52px; height: 52px; padding: 4px; border-radius: 14px; }
.staff-brand .company-brand-copy { gap: 5px; }
.staff-brand .company-brand-name { font-size: 24px; }
.staff-brand .company-brand-tagline { font-size: 8px; letter-spacing: .025em; }
.topbar .brand.staff-brand { display: flex; gap: 8px; max-width: calc(100% - 90px); }
.topbar .company-brand-emblem { width: 44px; height: 44px; border-radius: 12px; }
.topbar .company-brand-name { font-size: 22px; }
.topbar .company-brand-tagline { font-size: 7px; }

/* ---------- Quotation letterhead ---------- */
.quotation-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(210px, .8fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
  margin-bottom: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  break-inside: avoid;
}
.quotation-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--navy-900);
}
.quotation-logo { display: block; width: 260px; max-width: 100%; height: auto; margin: .25rem 0 1rem; }
.quotation-company-name { margin: 0 0 .65rem; max-width: 40ch; color: var(--navy-900); font-size: .75rem; font-weight: 800; line-height: 1.6; letter-spacing: .055em; }
.quotation-contact { display: grid; gap: .25rem; font-style: normal; font-size: .8rem; line-height: 1.55; color: var(--ink-2); overflow-wrap: anywhere; }
.quotation-contact a { color: inherit; text-decoration: none; }
.quotation-contact a:hover { text-decoration: underline; }
.quotation-contact-divider { padding: 0 .2rem; color: var(--ink-3); }
.quotation-heading { padding: 1.15rem 1.25rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.quotation-heading h1 { margin: 0; color: var(--blue-600); font-size: clamp(1.35rem, 2.5vw, 1.75rem); font-weight: 800; line-height: 1.2; letter-spacing: .09em; text-transform: uppercase; }
.quotation-number { margin: .45rem 0 1rem; color: var(--ink); font-size: .9rem; font-weight: 700; overflow-wrap: anywhere; }
.quotation-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem 1rem; margin: 0 0 .85rem; font-size: .78rem; line-height: 1.5; }
.quotation-meta dt { color: var(--ink-3); }
.quotation-meta dd { margin: 0; color: var(--navy-900); font-weight: 650; text-align: right; }
.sheet .quotation-header { padding: 0 0 1.3rem; border: 0; border-radius: 0; }
.sheet .quotation-header::before { inset: auto 0 0; height: 3px; }
.sheet .quotation-logo { width: 240px; }
.sheet .quotation-company-name { font-size: .68rem; }
.sheet .quotation-contact { font-size: .72rem; }
.sheet .quotation-heading { padding: .95rem 1rem; }
.sheet .quotation-heading h1 { font-size: 1.45rem; }
@media screen and (max-width: 600px) {
  .quotation-header { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .quotation-logo { width: 235px; }
  .quotation-heading { width: 100%; }
}
@media print {
  .quotation-header { grid-template-columns: minmax(0, 1.25fr) minmax(180px, .8fr); gap: 8mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet .quotation-header { margin-bottom: 6mm; padding-bottom: 6mm; }
  .sheet .quotation-logo { width: 62mm; }
  .quotation-heading { background: #fff !important; }
  .quotation-heading h1 { font-size: 17pt; }
  .quotation-number { font-size: 10pt; }
  .quotation-meta { font-size: 8.5pt; }
}

@media print {
  .quotation-document .sheet { display: flex; flex-direction: column; min-height: 269mm; font-size: 9.5pt; line-height: 1.5; }
  .quotation-document .sheet > * { flex-shrink: 0; }
  .quotation-document .sheet h2 { margin-top: 4mm; margin-bottom: 2mm; font-size: 10pt; }
  .quotation-document .sheet .kv { gap: 1.5mm 4mm; font-size: 9pt; }
  .quotation-document .sheet .table { font-size: 9pt; }
  .quotation-document .sheet .table th, .quotation-document .sheet .table td { padding: 2.5mm 3mm; }
  .quotation-document .totals { padding: 3mm; margin-top: 3mm; margin-bottom: 3mm; }
  .quotation-document .signatures { margin-top: auto; padding-top: 8mm; padding-bottom: 5mm; break-inside: avoid; }
  .quotation-document .sheet-foot { margin-top: 6mm; font-size: 8pt; }
}

/* Maintenance reminder dismissal controls and neutral schedule dates. */
.notification-controls { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem .7rem .3rem 1.1rem; font-size: .78rem; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.notification-controls form, .notification-list form { margin: 0; }
.notification-list li { display: flex; align-items: center; }
.notification-list li > a { flex: 1; min-width: 0; }
.notification-list li > form { flex: none; padding-right: .55rem; }
.notification-delete { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: 44px; min-height: 44px; padding: .5rem; background: #fff; color: var(--ink-3); border: 0; border-radius: 8px; font: inherit; cursor: pointer; }
.notification-delete:hover { color: var(--red-600); background: #fff; }
.notification-delete:disabled { opacity: .5; cursor: wait; }
.notification-error { margin: 0; padding: .75rem 1rem; color: var(--red-600); font-size: .8rem; }
.schedule-date-cell { min-width: 240px; }
.schedule-date-cell .upcoming-dates { margin-bottom: .35rem; }
.schedule-date-cell .upcoming-dates span { font-size: .76rem; padding: .25rem .5rem; }

/* Document spacing and quotation page layout. */
.job-report-document .sheet .two-col { column-gap: 2.5rem; }
.job-report-document .sheet .kv { column-gap: 2rem; }
.job-report-document .sheet .site-measurements { row-gap: 1.75rem; column-gap: 4.5rem; }
@media print {
  /* Repeating table-footer space keeps document content above the service footer. */
  .quotation-document .sheet-foot { display: none; }
  .quotation-document .table-wrap { overflow: visible; }
  .quotation-document .table thead { display: table-header-group; }
  .quotation-document .table tr, .quotation-document .totals { break-inside: avoid; }
}

/* Match quotation print headers to the job report palette. */
.quotation-document .quotation-header::before { background: var(--navy-900); }
.quotation-document .quotation-header .quotation-heading { background: #fff !important; border-color: var(--line); }
.quotation-document .quotation-header .quotation-heading h1 { color: var(--blue-600); text-align: right; }
.quotation-document .quotation-header .quotation-number { color: var(--ink); text-align: right; }

/* Match quotation item headers to the totals background in preview and print. */
.quotation-document .sheet .table th {
  background: #f1f1f1 !important;
  color: var(--navy-900) !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Quotation and proforma documents share the same customer-facing layout. */
.quotation-print-layout { width: 100%; table-layout: fixed; border-collapse: collapse; }
.quotation-print-layout > tbody > tr > td { padding: 0; vertical-align: top; }
.quotation-footer-space { display: none; }
.quotation-document .quotation-header { margin-bottom: 0; }
.quotation-document .quotation-parties {
  margin: 0 0 1rem;
  padding: .5rem 0 1rem;
}
.quotation-document .quotation-parties h2 {
  margin-top: 0;
  padding: .35rem .6rem;
  background: #f1f1f1;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.quotation-document .quotation-parties .kv { padding: 0 .6rem; }
.quotation-document .quotation-parties > div:first-child .kv dt { font-weight: 700; }
.quotation-document.proforma-document .sheet .quotation-parties .kv dt { font-weight: 800; color: var(--ink); }
@media (min-width: 601px) {
  .quotation-document .quotation-parties > div:first-child h2 { margin-right: -1.5rem; }
}
.quotation-document .sheet .quotation-term-heading { border: 0; padding-bottom: 0; text-decoration: none; }
.totals { background: #f1f1f1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.quotation-document .totals dt:not(.grand),
.quotation-document .totals dd:not(.grand) { font-weight: 700; }
.btn.remove-new, .btn.remove-new:hover, .items-table .line-delete { background: #fff; }
.quotation-service-footer { margin: auto calc(-1 * clamp(1.25rem, 4vw, 16mm)) calc(-1 * clamp(1.25rem, 4vw, 16mm)); padding-top: 1rem; }
.quotation-service-footer img { display: block; width: 100%; height: auto; }
.quotation-service-gallery { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; gap: 1mm; min-height: 18mm; padding: 1mm 3mm 2mm; border-top: 1px solid var(--line); background: #fff; color: #14365d; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.quotation-service-item { min-width: 0; margin: 0; text-align: center; }
.quotation-service-photo { display: block; position: relative; width: var(--service-photo-width); height: 10.8mm; margin: 0 auto; overflow: hidden; }
.quotation-service-footer .quotation-service-photo img { position: absolute; top: -11.2mm; left: 50%; width: 90mm; max-width: none; height: auto; transform: translateX(var(--service-photo-offset)); }
.quotation-service-item figcaption { margin-top: .5mm; font: 700 6pt/3mm Arial, sans-serif; overflow-wrap: anywhere; }
.quotation-footer-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem 1rem; padding: .3rem 1rem; font-size: .65rem; color: var(--ink-3); }
.quotation-document .signatures .quotation-signature { display: flex; flex-direction: column; border: 0; padding-top: 0; }
.proforma-document .signatures .quotation-signature { grid-column: 2; }
.quotation-signature-line { display: block; height: 14mm; margin-top: auto; margin-bottom: .4rem; border-bottom: 1px solid var(--ink); }
@media screen {
  .quotation-document .sheet { min-height: 297mm; display: flex; flex-direction: column; }
  .quotation-document .sheet > * { flex-shrink: 0; }
}
@media print {
  .quotation-document .sheet { display: block; width: 186mm; min-height: 0; margin: 0 auto; }
  .quotation-print-layout { height: 284mm; }
  .quotation-signatures-row { height: 1px; break-inside: avoid; }
  .quotation-document .sheet .quotation-header { margin-bottom: 0; }
  .quotation-document .quotation-parties { padding: 2mm 0 4mm; margin-bottom: 4mm; }
  .quotation-document .sheet .quotation-parties h2 { margin-top: 0; }
  .quotation-document .sheet .signatures { margin-top: 6mm; padding: 0; }
  .quotation-footer-space { display: table-footer-group; }
  .quotation-footer-space td { height: 28mm; padding: 0; }
  .quotation-service-footer { display: block; position: fixed; bottom: 0; left: 0; right: 0; margin: 0; padding: 0; break-inside: avoid; }
  .quotation-service-gallery { padding-right: 6mm; padding-left: 6mm; }
  .quotation-footer-meta { flex-wrap: nowrap; align-items: center; min-height: 5mm; padding: 1mm 12mm; font-size: 7pt; }
}

@media print {
  .quotation-document .quotation-term { break-inside: avoid; }
  .quotation-document .sheet h2 { break-after: avoid; }
}
