/* MaidClean — design system. Tokens first, then base, layout, components, pages. */

:root {
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-ink: #1e3a8a;
  --brand-soft: #eff6ff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #0f172a;
  --muted: #5b6577;
  --border: #e2e6ec;
  --focus: #93c5fd;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --s-scheduled: #64748b;
  --s-en_route: #b45309;
  --s-in_progress: #2563eb;
  --s-completed: #15803d;
  --s-cancelled: #dc2626;
  --s-no_show: #7c3aed;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .15);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #3b82f6;
    --brand-hover: #60a5fa;
    --brand-ink: #bfdbfe;
    --brand-soft: #172554;
    --bg: #0b0f17;
    --surface: #131a26;
    --surface-2: #1b2433;
    --text: #e5e9f0;
    --muted: #97a3b6;
    --border: #273246;
    --focus: #1d4ed8;
    --danger-soft: #3b1212;
    --warning-soft: #3a2a0c;
    --success-soft: #0d2e1a;
    --s-scheduled: #94a3b8;
    --s-en_route: #f59e0b;
    --s-in_progress: #60a5fa;
    --s-completed: #4ade80;
    --s-cancelled: #f87171;
    --s-no_show: #a78bfa;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- admin shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem .75rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: .25rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); padding: .25rem .5rem .75rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); color: #fff;
}
.brand-mark .icon { width: 18px; height: 18px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .9rem .6rem .3rem; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; border-radius: var(--radius);
  color: var(--text); font-weight: 500; font-size: .95rem;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
button.nav-link { width: 100%; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); }
.nav-link .count { margin-left: auto; background: var(--danger); color: #fff; font-size: .72rem; padding: 0 .45rem; border-radius: 999px; line-height: 1.5; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: .75rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem; color: var(--text); }
.user-chip:hover { text-decoration: none; background: var(--surface-2); border-radius: var(--radius); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; justify-content: space-between; gap: .5rem;
  background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem 1rem; position: sticky; top: 0; z-index: 20;
}
.content { padding: 1.5rem 2rem 3rem; width: 100%; max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: .2rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { font-size: .875rem; color: var(--muted); margin-bottom: .35rem; display: flex; gap: .35rem; flex-wrap: wrap; }

.banner { background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid var(--border); padding: .5rem 2rem; font-size: .9rem; }
.banner a { color: inherit; text-decoration: underline; }

.backdrop { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 300px); z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .topbar { display: flex; }
  .content { padding: 1rem 1rem 3rem; }
  .banner { padding: .5rem 1rem; }
}

/* ---------- field app shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; min-height: 56px;
}
.app-header h1 { font-size: 1.1rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 1rem 1rem 6.5rem; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .55rem; color: var(--muted); font-size: .75rem; font-weight: 600;
  min-height: 56px; justify-content: center;
}
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a[aria-current="page"] { color: var(--brand); }
.bottom-nav .icon { width: 22px; height: 22px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .5rem .95rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .925rem; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: .3rem .65rem; font-size: .85rem; }
.btn-lg { min-height: 54px; padding: .8rem 1.2rem; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .8s linear infinite;
}
.btn-primary.is-loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-status-en_route { background: var(--s-en_route); border-color: var(--s-en_route); color: #fff; }
.btn-status-check_in { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-status-check_out { background: var(--s-completed); border-color: var(--s-completed); color: #fff; }
.btn-status-en_route:hover, .btn-status-check_in:hover, .btn-status-check_out:hover { filter: brightness(1.08); background-image: none; }
.inline-form { display: inline; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-body { padding: 1.1rem 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 1.02rem; }
.card + .card { margin-top: 1rem; }
.grid > .card + .card, .layout-2-1 > .card + .card, .kanban .card + .card { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.stack > * + * { margin-top: 1rem; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .layout-2-1, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } .card-body { padding: 1rem; } .card-head { padding: .8rem 1rem; } }

.stat { padding: 1rem 1.15rem; }
.stat .label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: .5rem; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter.warn > span { background: var(--s-en_route); }

/* ---------- badges, chips, avatars ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; line-height: 1.5; white-space: nowrap; border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.badge-scheduled { color: var(--s-scheduled); }
.badge-en_route { color: var(--s-en_route); }
.badge-in_progress { color: var(--s-in_progress); }
.badge-completed { color: var(--s-completed); }
.badge-cancelled { color: var(--s-cancelled); }
.badge-no_show { color: var(--s-no_show); }
.badge-skipped { color: var(--s-scheduled); }
.badge-confirmed { color: #0f766e; }
.badge-rescheduled { color: var(--s-en_route); }
.badge-draft { color: var(--s-scheduled); }
.badge-sent { color: var(--s-in_progress); }
.badge-paid, .badge-accepted, .badge-won { color: var(--s-completed); }
.badge-void, .badge-rejected, .badge-lost, .badge-overdue { color: var(--s-cancelled); }
.badge-viewed, .badge-negotiating { color: var(--s-en_route); }
.badge-canceled { color: var(--s-cancelled); }
.badge-pending, .badge-quoted { color: var(--s-en_route); }
.badge-new, .badge-contacted { color: var(--s-in_progress); }
.badge-neutral { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); font-size: .82rem; font-weight: 600; color: var(--text); }
.chip-flag-vip { background: #fef3c7; color: #92400e; }
.chip-flag-attention, .chip-flag-late_payment { background: #ffedd5; color: #9a3412; }
.chip-flag-do_not_book { background: #fee2e2; color: #991b1b; }
[hidden] { display: none !important; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--brand); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: .78rem; font-weight: 700; color: #fff; background: var(--brand);
}
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }

/* ---------- alerts / flash ---------- */
.flash-stack { display: grid; gap: .5rem; margin-bottom: 1rem; }
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid; font-size: .95rem; }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.alert-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand-ink); }
.alert .alert-body { flex: 1; color: var(--text); }
.alert .alert-body strong { color: inherit; }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 .25rem; font-size: 1.2rem; line-height: 1; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .9rem; }
.field .hint { color: var(--muted); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time],
input[type=url], input[type=search], input[type=color], select, textarea {
  width: 100%; min-height: 42px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
input[type=color] { padding: .2rem; width: 64px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-size: .85rem; margin: 0; font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.25rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .9rem 1rem 1rem; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 .35rem; }
.pick-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.pick-list label { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .9rem; background: var(--surface); }
.pick-list input { accent-color: var(--brand); width: 16px; height: 16px; }
.pick-list label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 220px; }
.search-row { display: flex; gap: .5rem; }
.search-row input { flex: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .6rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.row-link { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: .6rem 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem 1rem; text-align: right; }
  .table.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; }
  .table.responsive td.num { justify-content: space-between; }
  .table.responsive td[data-label=""]::before { content: none; }
}

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list-row { display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
.list-row .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.kv dd { margin: 0; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; opacity: .6; margin-bottom: .5rem; }
.empty h3 { color: var(--text); }

/* ---------- job cards ---------- */
.job-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--svc, var(--brand));
  border-radius: var(--radius-lg); padding: .85rem 1rem; color: var(--text); box-shadow: var(--shadow);
}
.job-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); border-left-color: var(--svc, var(--brand)); }
.job-card + .job-card { margin-top: .75rem; }
.job-card .top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.job-card .time { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.job-card .who { font-weight: 700; margin-top: .25rem; }
.job-card .where { color: var(--muted); font-size: .92rem; display: flex; gap: .35rem; align-items: flex-start; }
.job-card .meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; align-items: center; font-size: .85rem; color: var(--muted); }
.progress-inline { display: inline-flex; align-items: center; gap: .4rem; }
.progress-inline .meter { width: 70px; margin: 0; }
.job-card.is-cancelled { opacity: .6; }

/* ---------- job detail (field app) ---------- */
.job-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; box-shadow: var(--shadow); }
.job-hero .when { font-size: 1.35rem; font-weight: 800; }
.address-block { display: flex; gap: .75rem; align-items: flex-start; }
.address-block .icon { color: var(--brand); margin-top: 3px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin-top: .9rem; }
.quick-actions .btn { white-space: normal; text-align: center; line-height: 1.25; min-height: 48px; }
.note-box { background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); border-radius: var(--radius); padding: .7rem .9rem; font-size: .95rem; white-space: pre-line; }
.note-box strong { display: block; color: var(--warning); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .15rem; }
.action-bar {
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 25; padding: .6rem 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--border);
}
.action-bar .inner { max-width: 680px; margin: 0 auto; display: grid; gap: .5rem; }
.has-action-bar .app-main { padding-bottom: 11rem; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; margin: .9rem 0 .25rem; }
.stepper .step { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
.stepper .step::before { content: ""; display: block; height: 5px; border-radius: 99px; background: var(--surface-2); margin-bottom: .35rem; }
.stepper .step.done::before { background: var(--s-completed); }
.stepper .step.current::before { background: var(--brand); }
.stepper .step.current { color: var(--text); }
.stepper .step time { display: block; font-weight: 500; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .9rem 1rem .35rem; background: var(--surface-2); }
.checklist-item { border-bottom: 1px solid var(--border); display: flex; align-items: center; padding-right: .5rem; }
.checklist-item .ci-form { flex: 1; min-width: 0; }
.checklist-item label, .checklist-item .ci-row { display: flex; align-items: center; gap: .85rem; padding: .7rem 1rem; min-height: 52px; cursor: pointer; }
.checklist-item input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--s-completed); flex: none; }
.checklist-item .ci-label { flex: 1; }
.checklist-item.done .ci-label { color: var(--muted); text-decoration: line-through; }
.checklist-item .ci-by { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.checklist-item.saving { opacity: .6; }
.checklist[aria-disabled="true"] label { cursor: not-allowed; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin-top: .5rem; }
.photo-grid a, .photo-grid .ph { display: block; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center; background: var(--surface); }
.dropzone .icon { width: 30px; height: 30px; color: var(--brand); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 .9rem .6rem; font-size: .92rem; }
.timeline li::before { content: ""; position: absolute; left: -1.42rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.timeline time { color: var(--muted); font-size: .82rem; display: block; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cal-nav { display: flex; align-items: center; gap: .35rem; }
.cal-nav h2 { margin: 0 .5rem; font-size: 1.1rem; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg a { padding: .45rem .8rem; font-weight: 600; font-size: .88rem; color: var(--text); border-right: 1px solid var(--border); }
.seg a:last-child { border-right: 0; }
.seg a:hover { text-decoration: none; background: var(--surface-2); }
.seg a[aria-current="page"] { background: var(--brand); color: #fff; }

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--border); gap: 1px; }
.month-grid .dow { background: var(--surface-2); padding: .4rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: center; }
.month-cell { background: var(--surface); min-height: 112px; padding: .35rem; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month-cell.other { background: var(--surface-2); }
.month-cell.other .daynum { opacity: .5; }
.month-cell .daynum { font-size: .8rem; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }
.month-cell .daynum a { color: inherit; }
.month-cell.today .daynum a { background: var(--brand); color: #fff; border-radius: 99px; padding: 0 .4rem; }
.cal-pill {
  display: block; font-size: .75rem; padding: .1rem .35rem; border-radius: 4px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--svc, var(--brand)) 14%, var(--surface)); border-left: 3px solid var(--svc, var(--brand));
}
.cal-pill:hover { text-decoration: none; filter: brightness(.97); }
.cal-pill.st-completed { opacity: .65; }
.cal-pill.st-cancelled, .cal-pill.st-skipped { text-decoration: line-through; opacity: .5; }
.cal-more { font-size: .75rem; font-weight: 700; }
@media (max-width: 760px) {
  .month-cell { min-height: 64px; padding: .25rem; }
  .month-cell .cal-pill { display: none; }
  .month-cell .cal-count { display: inline-block; }
}
.cal-count { display: none; font-size: .72rem; font-weight: 700; background: var(--brand); color: #fff; border-radius: 99px; padding: 0 .4rem; align-self: flex-start; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.week-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-height: 200px; display: flex; flex-direction: column; min-width: 0; }
.week-col.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.week-col .head { padding: .5rem .6rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline; }
.week-col .head a { font-weight: 700; color: var(--text); }
.week-col .body { padding: .45rem; display: grid; gap: .4rem; align-content: start; }
.mini-job { display: block; border-radius: var(--radius); padding: .4rem .5rem; font-size: .8rem; color: var(--text); background: color-mix(in srgb, var(--svc, var(--brand)) 10%, var(--surface)); border-left: 3px solid var(--svc, var(--brand)); }
.mini-job:hover { text-decoration: none; filter: brightness(.97); }
.mini-job strong { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-job .sm { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mini-job.st-cancelled, .mini-job.st-skipped { opacity: .5; text-decoration: line-through; }
.add-link { font-size: .8rem; color: var(--muted); padding: .25rem; text-align: center; border-radius: var(--radius); }
.add-link:hover { background: var(--surface-2); text-decoration: none; }
@media (max-width: 1100px) { .week-grid { grid-template-columns: 1fr; } .week-col { min-height: 0; } .week-col .body:empty::after { content: "—"; color: var(--muted); padding: .2rem .3rem; } }

/* ---------- kanban (leads) ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { background: var(--surface-2); border-radius: var(--radius-lg); padding: .6rem; min-height: 200px; }
.kanban-col h3 { font-size: .85rem; display: flex; justify-content: space-between; padding: .2rem .3rem .5rem; margin: 0; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .7rem; box-shadow: var(--shadow); font-size: .9rem; }
.kanban-card + .kanban-card { margin-top: .5rem; }
@media (max-width: 900px) { .kanban { grid-template-columns: repeat(5, 260px); } }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 1.35rem; padding-bottom: 1.25rem; }
.auth-card .brand-mark { width: 40px; height: 40px; border-radius: 11px; }
.auth-foot { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.lang-switch { display: flex; gap: .75rem; justify-content: center; margin-top: 1rem; font-size: .85rem; }
.lang-switch a[aria-current="true"] { font-weight: 700; color: var(--text); }

/* ---------- portal ---------- */
.portal { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.portal-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.portal-head img { max-height: 48px; max-width: 160px; object-fit: contain; }
.live-status { border-left: 4px solid var(--s-in_progress); }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .25rem; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { cursor: pointer; color: var(--border); }
.stars label .icon { width: 34px; height: 34px; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f59e0b; }
.stars label .icon { fill: currentColor; }
.stars input:focus-visible + label { outline: 3px solid var(--focus); border-radius: 4px; }
.score { color: #f59e0b; font-weight: 700; letter-spacing: 1px; }

/* ---------- invoice ---------- */
.invoice-doc { background: var(--surface); max-width: 820px; margin: 0 auto; padding: 2.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.invoice-doc .head { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-bottom: 2rem; }
.invoice-doc .logo { max-height: 64px; max-width: 200px; object-fit: contain; }
.invoice-doc .totals { margin-left: auto; width: min(320px, 100%); }
.invoice-doc .totals div { display: flex; justify-content: space-between; padding: .3rem 0; }
.invoice-doc .totals .grand { border-top: 2px solid var(--text); font-weight: 800; font-size: 1.1rem; margin-top: .3rem; padding-top: .5rem; }
.print-bar { max-width: 820px; margin: 1rem auto; display: flex; gap: .5rem; justify-content: flex-end; padding: 0 1rem; }
@media (max-width: 640px) { .invoice-doc { padding: 1.25rem; border-radius: 0; border-left: 0; border-right: 0; } }
@media print {
  body { background: #fff; }
  .print-bar, .no-print { display: none !important; }
  .invoice-doc { border: 0; padding: 0; max-width: none; }
}

/* ---------- misc ---------- */
.copy-field { display: flex; gap: .5rem; }
.copy-field input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.bar-chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; align-items: end; height: 180px; padding-top: 1rem; }
.bar-chart .bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: .3rem; font-size: .75rem; color: var(--muted); }
.bar-chart .bar span.b { width: 100%; max-width: 46px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-chart .bar .v { font-weight: 700; color: var(--text); font-size: .72rem; white-space: nowrap; }
.quote-lines div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dashed var(--border); font-size: .93rem; }
.quote-total { display: flex; justify-content: space-between; font-size: 1.4rem; font-weight: 800; padding-top: .6rem; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: .25rem 0; }
.offline-pill { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
@media (max-width: 640px) { .stat .value { font-size: 1.3rem; white-space: nowrap; } .stat { padding: .85rem .9rem; } }
.card-head-wrap { flex-wrap: wrap; row-gap: .5rem; }
.card-head-wrap .tabs { max-width: 100%; overflow-x: auto; }
