/* Screen layouts. */

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--surface); }
/* Option A "Clear water" (8 Nov 2026): still water with one ripple under a navy shade
   that keeps the brand row and the headline readable. Source and prompt:
   design-options/login/. The navy colour shows while the image loads or if it fails. */
.auth-art {
  position: relative; background-color: var(--brand); color: #fff; padding: var(--space-10); display: flex; flex-direction: column; justify-content: space-between;
  background-image: linear-gradient(180deg, rgb(6 30 96 / 0.62) 0%, rgb(6 30 96 / 0.18) 46%, rgb(4 20 64 / 0.78) 100%), url("../images/sign-in-water-1200.webp");
  background-size: cover; background-position: center;
}
.auth-art h2 { color: #fff; font-size: 1.75rem; max-width: 18ch; line-height: 1.2; text-wrap: balance; }
.auth-art p { opacity: 0.88; max-width: 40ch; margin-top: 12px; }
.auth-art h2, .auth-art p, .auth-points { text-shadow: 0 1px 14px rgb(0 8 30 / 0.45); }
.auth-art .brand { padding: 0; }
.auth-points { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.auth-points li { display: flex; gap: 10px; align-items: center; opacity: 0.9; }
.auth-points .icon { color: var(--accent); }
.auth-form-wrap { display: grid; place-items: center; padding: var(--space-8) var(--space-6); padding-bottom: max(var(--space-8), env(safe-area-inset-bottom)); }
.auth-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: var(--space-4); }
.auth-form h1 { font-size: var(--text-2xl); }
.auth-form .sub { color: var(--text-muted); margin-top: -8px; }
.auth-foot { font-size: var(--text-sm); color: var(--text-muted); text-align: center; }
.boot-stages { margin-top: var(--space-2); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art {
    min-height: 200px; gap: var(--space-5);
    padding: max(var(--space-6), env(safe-area-inset-top)) var(--space-5) var(--space-6);
    background-image: linear-gradient(180deg, rgb(6 30 96 / 0.62) 0%, rgb(6 30 96 / 0.22) 50%, rgb(4 20 64 / 0.8) 100%), url("../images/sign-in-water-720.webp");
  }
  /* Phones keep the brand and the one-line promise; the longer copy is for wide screens. */
  .auth-art h2 { font-size: 1.05rem; max-width: 26ch; font-weight: 600; }
  .auth-art p, .auth-points { display: none; }
}

/* ------------------------------------------------------------- dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }

/* -------------------------------------------------------- technician day */
.day-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-4); flex-wrap: wrap; }
.day-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.day-strip::-webkit-scrollbar { display: none; }
.day-pill {
  flex: none; min-width: 52px; min-height: 56px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: var(--text-xs); color: var(--text-muted); font-weight: 600;
}
.day-pill strong { font-size: var(--text-lg); color: var(--text); }
.day-pill[aria-current="date"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.day-pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.day-pill[aria-pressed="true"] strong { color: var(--on-primary); }
.visit-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.visit-card + .visit-card { margin-top: var(--space-3); }
.visit-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; width: 100%; border: 0; background: none; text-align: left; }
.visit-time { text-align: center; min-width: 64px; }
.visit-time strong { display: block; font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.visit-time span { font-size: var(--text-xs); color: var(--text-muted); }
.visit-title { font-weight: 650; }
.visit-sub { font-size: var(--text-sm); color: var(--text-muted); }
.visit-detail { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.visit-detail .btn { flex: 1; }
.next-action { border-left: 4px solid var(--accent); }

/* ---------------------------------------------------------------- jobs */
.toolbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.search { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 420px; }
.search .input { padding-left: 40px; }
.search .search-icon { position: absolute; left: 4px; }
.search-toggle { display: none; }
.job-cards { display: none; }
.job-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.job-card:first-child { border-top: 0; }
.job-card a { color: inherit; text-decoration: none; }
.job-card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.jobs-split { height: calc(100dvh - 180px); min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; position: relative; }
.jobs-split .split-pane-b { background: var(--bg); }
.pane-list .row { padding-inline: 14px; }
.pane-list .row[aria-current="true"] { background: var(--selection); box-shadow: inset 3px 0 0 var(--primary); }
.pane-detail { padding: var(--space-5); }
@media (max-width: 1100px) { .jobs-split { display: none; } }
@media (max-width: 760px) {
  .table-wrap.jobs-table { display: none; }
  .job-cards { display: block; }
  .search { max-width: none; }
}

/* ------------------------------------------------------------ job page */
.job-head { display: flex; gap: var(--space-4); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--space-4); }
.job-head .crumbs { font-size: var(--text-sm); color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.job-head .crumbs a { color: inherit; }
.job-number { font-family: var(--font-mono); font-weight: 600; color: var(--text-muted); font-size: var(--text-sm); }
.job-head-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
/* The title takes the row first; the actions wrap below it rather than squeezing
   it into a narrow column. 360px is roughly where a title still reads as a line. */
.job-head-main { flex: 1 1 360px; min-width: 0; }
.job-head h1 { overflow-wrap: anywhere; }
.job-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .job-head { gap: var(--space-3); }
  .job-head .actions { margin-left: 0; width: 100%; flex-wrap: nowrap; }
  .job-head .actions .btn:not(.btn-icon) { flex: 1 1 0; min-width: 0; justify-content: center; }
}
.job-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-5); align-items: start; }
.job-side { display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: var(--space-4); }
.job-tabs { display: none; margin-bottom: var(--space-4); }
@media (max-width: 1100px) { .job-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
@media (max-width: 900px) {
  .job-layout { grid-template-columns: 1fr; }
  .job-side { position: static; }
  .job-tabs { display: flex; }
  .job-layout [data-section] { display: none; }
  .job-layout [data-section][data-active="true"] { display: block; }
  .job-side[data-section] { display: none; }
  .job-side[data-section][data-active="true"] { display: flex; }
}
.next-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); box-shadow: var(--shadow-1); margin-bottom: var(--space-4); }
.next-card .label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.next-card .title { font-weight: 650; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 4px; border-top: 1px solid var(--border); min-height: 56px; }
.task-row:first-child { border-top: 0; }
.task-row .task-title { font-weight: 550; overflow-wrap: anywhere; }
.task-row.is-done .task-title { color: var(--text-muted); text-decoration: line-through; }
.task-row .task-meta { font-size: var(--text-sm); color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.task-row .overdue { color: var(--danger); font-weight: 650; }
.task-row .pending { font-size: var(--text-xs); color: var(--text-muted); display: inline-flex; gap: 4px; align-items: center; }
.task-row .task-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.move-btns { display: none; }
.task-row:focus-within .move-btns, .reorder-list.keyboard .move-btns { display: inline-flex; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file-tile { display: flex; flex-direction: column; gap: 6px; border: 0; background: none; padding: 0; text-align: left; color: inherit; }
.file-tile .pimg { --ar: 4 / 3; }
.file-tile .file-name { font-size: var(--text-sm); font-weight: 600; }
.file-tile .file-meta { font-size: var(--text-xs); color: var(--text-muted); }
.pdf-tile { aspect-ratio: 4 / 3; border-radius: var(--radius); background: var(--surface-sunken); display: grid; place-items: center; color: var(--danger); }
.uploads { display: flex; flex-direction: column; gap: 10px; }
.upload-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.upload-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--skeleton); }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer .textarea { min-height: 44px; height: 44px; resize: none; }
.viewer-frame { width: 100%; height: min(70dvh, 720px); border: 0; border-radius: var(--radius); background: var(--surface-sunken); }
.viewer-img { max-height: 70dvh; margin: 0 auto; border-radius: var(--radius); }

/* ------------------------------------------------------------ schedule */
.week { 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; }
.week-day { background: var(--surface); min-height: 420px; display: flex; flex-direction: column; min-width: 0; }
.week-day-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: 6px; position: sticky; top: 0; background: var(--surface); }
.week-day-head strong { font-size: var(--text-lg); }
.week-day-head span { font-size: var(--text-sm); color: var(--text-muted); font-weight: 600; }
.week-day[data-today="true"] .week-day-head strong { color: var(--primary); }
.week-day[data-today="true"] .week-day-head { box-shadow: inset 0 3px 0 var(--primary); }
.week-day[data-weekend="true"] { background: var(--surface-2); }
.week-day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sched-item {
  display: block; padding: 8px 10px; border-radius: 8px; background: var(--st-bg, var(--info-bg)); color: var(--text); text-decoration: none;
  border-left: 3px solid var(--st, var(--info)); font-size: var(--text-sm); min-width: 0; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%;
}
.sched-item .t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--st, var(--info)); }
.sched-item .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-item .c { color: var(--text-muted); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-item[data-visit-status="completed"] { opacity: 0.7; }
.sched-item[data-visit-status="cancelled"] { text-decoration: line-through; opacity: 0.6; }
.sched-item[data-status] { --st: var(--st-scheduled); --st-bg: var(--st-scheduled-bg); }
.sched-item[data-status="in_progress"] { --st: var(--st-in_progress); --st-bg: var(--st-in_progress-bg); }
.sched-item[data-status="monitoring"] { --st: var(--st-monitoring); --st-bg: var(--st-monitoring-bg); }
.sched-item[data-status="completed"], .sched-item[data-status="closed"] { --st: var(--st-completed); --st-bg: var(--st-completed-bg); }
.agenda { display: none; }
@media (max-width: 1100px) and (orientation: portrait), (max-width: 760px) {
  .week { display: none; }
  .agenda { display: block; }
}
.agenda-day + .agenda-day { margin-top: var(--space-4); }
.agenda-day h3 { margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }

/* --------------------------------------------------------------- settings */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: var(--space-4); }
.settings-nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-weight: 600; }
.settings-nav a:hover { background: var(--surface-sunken); }
.settings-nav a[aria-current="page"] { background: var(--selection); color: var(--primary); }
.setting-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.setting-row:first-child { border-top: 0; }
.setting-row .text { flex: 1; min-width: 0; }
.setting-row .title { font-weight: 600; }
.setting-row .desc { font-size: var(--text-sm); color: var(--text-muted); }
.pref-table { width: 100%; border-collapse: collapse; }
.pref-table th { text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 0; }
.pref-table th.c, .pref-table td.c { text-align: center; width: 90px; }
.pref-table td { padding: 6px 0; border-top: 1px solid var(--border); }
.pref-table td .switch { justify-content: center; }
@media (max-width: 760px) {
  /* Two 90px switch columns left the descriptions about 120px wide on a phone. */
  .pref-table th.c, .pref-table td.c { width: 64px; }
  .pref-table td:first-child { padding-right: 8px; }
}
.device-status { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.device-status .ib { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.install-steps { counter-reset: step; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.install-steps li { counter-increment: step; display: flex; gap: 10px; align-items: flex-start; }
.install-steps li::before { content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--selection); color: var(--primary); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.theme-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.theme-card { border: 2px solid var(--border); border-radius: var(--radius-lg); padding: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; align-items: center; font-weight: 600; font-size: var(--text-sm); color: var(--text-2); }
.theme-card[aria-checked="true"] { border-color: var(--primary); color: var(--primary); }
.theme-swatch { width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; display: grid; grid-template-columns: 28% 1fr; }
.theme-swatch.light { background: #f2f4f8; } .theme-swatch.light i { background: #061E60; }
.theme-swatch.dark { background: #090c17; } .theme-swatch.dark i { background: #0b1a45; }
.theme-swatch.system { background: linear-gradient(135deg, #f2f4f8 50%, #090c17 50%); } .theme-swatch.system i { background: linear-gradient(135deg, #061E60 50%, #0b1a45 50%); }
@media (max-width: 900px) { .settings { grid-template-columns: 1fr; } .settings-nav { position: static; flex-direction: row; overflow-x: auto; } .settings-nav a { flex: none; } }

/* ----------------------------------------------------------- success page */
.success-page { max-width: 560px; margin: var(--space-8) auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.success-page .facts { width: 100%; text-align: left; margin-top: var(--space-3); }
.success-page .next { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: var(--space-3); }

/* --------------------------------------------------------------- gallery */
.gallery-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.gallery-item h3 { display: flex; gap: 8px; align-items: center; }
.gallery-item .num { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.gallery-demo { padding: 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 72px; }

/* ------------------------------------------- job page inside narrow containers
   The same job page renders full width, inside the desktop split preview, and on
   phones; it adapts to the space it actually has, not only to the viewport. */
.job-main, .job-embedded { container-type: inline-size; }
.task-add-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--space-3); align-items: end; }
@container (max-width: 620px) {
  .task-add-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .task-add-grid .field:first-child { grid-column: 1 / -1; }
  .task-add-grid .btn { grid-column: 1 / -1; }
}
@container (max-width: 900px) {
  .job-embedded .job-layout { grid-template-columns: minmax(0, 1fr); }
  .job-embedded .job-side { position: static; }
}
.pane-detail.job-embedded .job-head .actions { margin-left: 0; }
