/* Engineer Timewriting: one stylesheet for the sign-in and timesheet pages. */

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --head: #f8f9fb;
  --head-weekend: #eef0f4;
  --hover: #f5f7fa;
  --line: #e4e7ec;
  --line-strong: #c8ced8;
  --text: #1b2029;
  --muted: #5e6776;
  --faint: #8b93a1;
  --accent: #1f5fc8;
  --accent-hover: #194fa8;
  --accent-weak: #e7effd;
  --accent-text: #ffffff;
  --weekend: #f6f7f9;
  --today-col: #fffbea;
  --row-focus: rgba(31, 95, 200, 0.05);
  --filled: #f2f6fe;
  --capex: #6a3fc1;
  --capex-bg: #efe8fc;
  --revex: #0d7653;
  --revex-bg: #e1f4ec;
  --danger: #b4231a;
  --danger-bg: #fdeceb;
  --warn: #8a5800;
  --warn-bg: #fff4d9;
  --ok: #0d7653;
  --ok-bg: #e1f4ec;
  --info-bg: #eaf1fd;
  --yellow: #fff59a;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.16);
  --radius: 10px;
  --w-label: 300px;
  --w-type: 92px;
  --w-total: 64px;
  --w-day: 44px;
  --h-head: 46px;
  --row-h: 40px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --surface: #161a20;
    --head: #1b2028;
    --head-weekend: #20262f;
    --hover: #1d222a;
    --line: #2a303a;
    --line-strong: #3b4350;
    --text: #e7eaef;
    --muted: #a3abb8;
    --faint: #7c8594;
    --accent: #6ea3ff;
    --accent-hover: #8db7ff;
    --accent-weak: #1b2a43;
    --accent-text: #0b1222;
    --weekend: #191d24;
    --today-col: #2a2614;
    --row-focus: rgba(110, 163, 255, 0.07);
    --filled: #1a2333;
    --capex: #c4a8ff;
    --capex-bg: #2a2143;
    --revex: #5fd3a7;
    --revex-bg: #12302a;
    --danger: #ff8d84;
    --danger-bg: #3a1c1a;
    --warn: #f0c35a;
    --warn-bg: #352b12;
    --ok: #5fd3a7;
    --ok-bg: #12302a;
    --info-bg: #17243a;
    --yellow: #5a5314;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.muted { color: var(--muted); }

/* ------------------------------------------------------------------ brand */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand svg { width: 28px; height: 28px; flex: none; }
.brand-lg { font-size: 20px; }
.brand-lg svg { width: 36px; height: 36px; }
.bm-bg { fill: var(--accent); }
.bm-line { stroke: var(--accent-text); stroke-width: 2; opacity: 0.55; }
.bm-pin { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.bm-cell { fill: var(--accent-text); opacity: 0.85; }
.bm-hot { fill: var(--yellow); opacity: 1; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--hover); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary.attention { box-shadow: 0 0 0 4px var(--accent-weak); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 42px; font-size: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }

/* --------------------------------------------------------------- sign in */

.signin-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.signin { width: 100%; max-width: 420px; display: grid; gap: 20px; justify-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.signin-card { width: 100%; padding: 28px; display: grid; gap: 16px; }
.signin-card h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.signin-card > p { margin: -8px 0 0; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; }
.field small { color: var(--muted); font-size: 12.5px; }
.field input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-message { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--danger-bg); color: var(--danger); }
.name-check { padding: 12px; border-radius: 8px; background: var(--warn-bg); color: var(--text); }
.name-check p { margin: 0 0 10px; }
.name-options { display: flex; flex-wrap: wrap; gap: 8px; }
.signin-foot { margin: 0; text-align: center; font-size: 13px; }
.signin a:not(.btn) { color: var(--accent); }
.signin a:not(.btn):hover { color: var(--accent-hover); }

/* --------------------------------------------------------------- app page */

.app-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-label { margin: 0; min-width: 170px; text-align: center; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.user { justify-self: end; display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.meta { flex: none; margin: 0; font-size: 12.5px; color: var(--faint); }

.notices { flex: none; display: grid; gap: 8px; }
.notices:empty { display: none; }
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.notice-text { flex: 1 1 320px; }
.notice-list { flex-basis: 100%; margin: 2px 0 0; padding-left: 20px; }
.notice-info { background: var(--info-bg); }
.notice-warn { background: var(--warn-bg); }
.notice-warn strong { color: var(--warn); }
.notice-error { background: var(--danger-bg); color: var(--danger); }
.notice-view { background: var(--accent-weak); box-shadow: inset 4px 0 0 var(--accent); }
.notice-view .notice-text { color: var(--text); }
.viewing-as .topbar { box-shadow: inset 0 -3px 0 var(--accent); }

/* --------------------------------------------------------------- the grid */

.grid-wrap {
  flex: 1;
  min-height: 220px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}
.grid-wrap.busy { opacity: 0.55; cursor: progress; }

.grid {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
  font-variant-numeric: tabular-nums;
}
.col-label { width: var(--w-label); }
.col-type { width: var(--w-type); }
.col-total { width: var(--w-total); }
.col-day { width: var(--w-day); }

.grid th, .grid td {
  padding: 0;
  height: var(--row-h);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background-color: var(--surface);
  text-align: center;
  vertical-align: middle;
  font-weight: 400;
}
.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: var(--h-head);
  background-color: var(--head);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.grid thead tr.totals th {
  top: var(--h-head);
  height: 32px;
  color: var(--text);
  font-size: 13px;
  border-bottom: 1px solid var(--line-strong);
}
.grid thead th.weekend { background-color: var(--head-weekend); }
.grid thead .c-label { padding: 0 12px; text-align: left; }
.totals-label { font-weight: 600; }
.daytotal { font-weight: 600 !important; }
.daytotal.over { color: var(--danger) !important; background-color: var(--danger-bg) !important; }
.grand { font-weight: 700 !important; }

.dow { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.dom { display: block; margin: 1px auto 0; width: 24px; height: 22px; line-height: 22px; color: var(--text); font-size: 14px; font-weight: 650; }
.grid thead th.today .dom { border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.grid thead th.focus-col { box-shadow: inset 0 -3px 0 var(--accent); color: var(--text); }

.sticky-1 { position: sticky; left: 0; z-index: 2; text-align: left !important; }
.sticky-2 { position: sticky; left: var(--w-label); z-index: 2; }
.sticky-3 { position: sticky; left: calc(var(--w-label) + var(--w-type)); z-index: 2; box-shadow: inset -1px 0 0 var(--line-strong); }
.grid thead .sticky-1, .grid thead .sticky-2, .grid thead .sticky-3 { z-index: 5; }

td.weekend { background-color: var(--weekend); }
td.today { background-color: var(--today-col); }
.week-start { box-shadow: inset 1px 0 0 var(--line-strong); }
.grid thead th.week-start.focus-col { box-shadow: inset 1px 0 0 var(--line-strong), inset 0 -3px 0 var(--accent); }

.c-total { font-weight: 650; }
.c-type { padding: 0 6px !important; }

.cell {
  display: block;
  width: 100%;
  height: calc(var(--row-h) - 1px);
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cell:hover { background: var(--hover); }
.cell:not(:placeholder-shown) { background: var(--filled); font-weight: 600; }
.cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--surface); }
.cell.invalid { background: var(--danger-bg); color: var(--danger); }

tr.focus-row > td { background-image: linear-gradient(var(--row-focus), var(--row-focus)); }
tr.flash > td { animation: flash 1.2s ease-out; }
@keyframes flash { from { background-image: linear-gradient(var(--accent-weak), var(--accent-weak)); } }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.pill-capex { background: var(--capex-bg); color: var(--capex); }
.pill-revex { background: var(--revex-bg); color: var(--revex); }
.pill-problem { outline: 2px dashed var(--warn); outline-offset: 1px; }

.badge { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

/* job and other-time label cells: number, location and owner on top, description below */
.job-cell { vertical-align: top !important; padding: 2px 4px 2px 12px !important; }
.job-box {
  display: grid;
  grid-template-columns: auto 36px 36px minmax(0, 1fr) 24px;
  grid-template-rows: 18px 18px;
  column-gap: 4px;
  row-gap: 1px;
  align-items: center;
  height: calc(var(--row-h) - 5px);
}
.job-head, .job-details { display: contents; }
.job-no { grid-row: 1; grid-column: 1; font-weight: 700; font-size: 13.5px; letter-spacing: 0.01em; }
.job-details .loc { grid-row: 1; grid-column: 2; text-align: center; }
.job-details .owner { grid-row: 1; grid-column: 3; text-align: center; }
.job-head .badge { grid-row: 1; grid-column: 4; justify-self: start; }
.job-head .remove-row { grid-row: 1 / 3; grid-column: 5; }
.job-details .desc { grid-row: 2; grid-column: 1 / 5; }
.detail {
  width: 100%;
  min-width: 0;
  height: 18px;
  padding: 0 3px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}
.detail:hover { border-color: var(--line); }
.detail:focus { outline: none; border-color: var(--accent); background: var(--surface); color: var(--text); }
.detail::placeholder { color: var(--faint); }
.job-details .desc { padding-left: 0; }
.job-details .desc:hover, .job-details .desc:focus { padding-left: 3px; }

.remove-row { width: 24px; height: 24px; font-size: 17px; opacity: 0.55; }
tr:hover .remove-row, .remove-row:focus-visible { opacity: 1; }
.other-cell { padding: 0 4px 0 12px !important; }
.other-head { display: flex; align-items: center; gap: 6px; }
.other-name { flex: 1; min-width: 0; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.other-label { flex: 1; height: 28px; font-size: 13.5px; color: var(--text); }

.closed-note { color: var(--muted); font-style: italic; text-align: left !important; padding: 0 12px !important; }

/* section headings, adders and the empty state */
.section-row th, .section-row td { height: 34px; background-color: var(--head); border-bottom-color: var(--line-strong); }
.section-title { padding: 0 12px !important; font-size: 13px; font-weight: 700 !important; color: var(--text); }
.section-hint { margin-left: 10px; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.section-other .section-row th, .section-other .section-row td { border-top: 1px solid var(--line-strong); }

.adder-row td { height: 52px; }
.adder-cell { padding: 0 10px !important; }
.adder-fill, .section-fill { background-color: var(--surface); }
.combo, .other-adder { position: relative; display: flex; align-items: center; }
.combo-plus { position: absolute; left: 10px; color: var(--accent); font-weight: 700; pointer-events: none; }
.combo-input, .other-select {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 26px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}
.combo-input:focus, .other-select:focus { outline: none; border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.other-select { appearance: none; cursor: pointer; color: var(--muted); }
.combo-hint:not(:empty) {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 6;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--text);
  font-size: 12.5px;
  white-space: normal;
  box-shadow: var(--shadow-lg);
}

.empty-row td { height: auto; }
.empty-cell { padding: 14px 12px !important; }
.empty-cell p { margin: 0 0 8px; color: var(--muted); }

.listbox {
  position: fixed;
  z-index: 40;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.listbox li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  cursor: pointer;
}
.listbox li[aria-selected="true"], .listbox li:hover { background: var(--accent-weak); }
.listbox .opt-tag { font-size: 11px; font-weight: 600; color: var(--muted); }
.listbox .opt-empty { color: var(--muted); font-weight: 400; cursor: default; }

/* ------------------------------------------------------------- save bar */

.savebar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.savebar-status { flex: 1; min-width: 0; }
.save-status { font-weight: 600; }
.save-status[data-tone="ok"] { color: var(--ok); }
.save-status[data-tone="warn"] { color: var(--warn); }
.save-status[data-tone="muted"] { color: var(--muted); }
.savebar-totals { display: flex; gap: 14px; color: var(--muted); white-space: nowrap; }
.savebar-totals strong { color: var(--text); font-variant-numeric: tabular-nums; }
.savebar-actions { display: flex; gap: 8px; }
.savebar-actions .btn-primary { min-width: 92px; }

/* ---------------------------------------------------------- toast, dialog */

.toast {
  position: fixed;
  left: 50%;
  bottom: 76px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast[data-tone="error"] { background: var(--danger); color: #fff; }
.toast-action { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

.dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(10, 14, 20, 0.45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { padding: 16px 20px 20px; overflow: auto; }
.dialog-body > p { margin-top: 0; }
.dialog-wide { width: min(1240px, calc(100vw - 32px)); }
.journal-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table.journal-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.journal-table th, table.journal-table td { padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.journal-table thead th { position: sticky; top: 0; background: var(--head); font-weight: 650; white-space: normal; vertical-align: bottom; }
table.journal-table .num { text-align: right; }
table.journal-table .yellow { background: var(--yellow); }
table.journal-table tr.balancing td { font-weight: 650; border-bottom: 2px solid var(--line-strong); }
.preview-total { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.preview-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 14px; }
.preview-meta dt { color: var(--muted); }
.preview-meta dd { margin: 0; font-weight: 600; }
.preview-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.preview-table th, .preview-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.preview-table thead th { font-size: 12.5px; }
.preview-table th.yellow { background: var(--yellow); }
.preview-table .num { text-align: right; }
.preview-table tfoot th { border-bottom: 0; }

/* ------------------------------------------------------- my timesheets */

.home-page { min-height: 100vh; }
.home { max-width: 960px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 16px; }
.home-wide { max-width: 1280px; }
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 24px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.hero h1 { margin: 2px 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.hero-status { margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; margin-right: 8px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.status-inline { display: none; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-muted { background: var(--head); color: var(--muted); }

.sheets-card { padding: 0; overflow: hidden; }
.sheets-head { padding: 20px 24px 12px; }
.sheets-head h1, .sheets-head h2 { margin: 0 0 4px; font-size: 17px; }
.sheets-head p { margin: 0; }
.sheets-head-actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.sheets-head-actions > div { flex: 1 1 320px; }
.sheets-head-actions h1 { font-size: 20px; letter-spacing: -0.01em; }

/* New timesheet */
.new-panel { margin: 0 24px 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--info-bg); display: grid; gap: 14px; }
.new-grid { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: flex-start; }
.new-field { display: grid; gap: 6px; font-weight: 600; }
.new-field select { height: 34px; min-width: 180px; }
.new-choice { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.new-choice legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.new-choice .check { color: var(--text); flex-wrap: wrap; }
.new-choice .small { margin: -4px 0 0 24px; font-size: 13px; }
.new-choice .new-sub { margin: -2px 0 2px 26px; font-size: 14px; }
.new-choice .new-sub:has(input:disabled) { opacity: 0.6; }
.new-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Deleting a month */
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn-danger:hover { filter: brightness(0.92); }
.btn-danger-ghost { color: var(--danger); }
.confirm-row td { padding: 12px 24px; background: var(--danger-bg); border-top: 0; }
.confirm-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.confirm-actions { display: flex; gap: 8px; }
.pad { margin: 0; padding: 4px 24px 24px; }
.sheets { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sheets th, .sheets td { padding: 11px 24px; border-top: 1px solid var(--line); text-align: left; font-weight: 400; }
.sheets thead th { background: var(--head); color: var(--muted); font-size: 12px; font-weight: 600; }
.sheets tbody th a { color: var(--text); font-weight: 650; text-decoration: none; }
.sheets tbody th a:hover { text-decoration: underline; }
.sheets .num { text-align: right; }
.row-actions { text-align: right !important; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 6px; }
.reuse-row td { padding: 12px 24px; background: var(--info-bg); border-top: 0; }
.reuse-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reuse-select { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* -------------------------------------------------------------- admin page */

.topbar-title { justify-self: center; font-weight: 650; color: var(--muted); }
.admin-card { padding: 0; overflow: visible; }
.card-head { padding: 20px 24px 4px; }
.card-head h1, .card-head h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.01em; }
.card-head p { margin: 0; }
.workbook-option { margin-top: 10px; color: var(--text); }
.card-body { padding: 16px 24px 24px; }
.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--head);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-weak); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone.disabled { opacity: 0.55; pointer-events: none; }
.dropzone-icon { font-size: 26px; line-height: 1; color: var(--accent); }
.steps { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: flex-start; gap: 10px; }
.step-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
[data-tone="ok"] > .step-icon { background: var(--ok-bg); color: var(--ok); }
[data-tone="error"] > .step-icon { background: var(--danger-bg); color: var(--danger); }
[data-tone="error"] { color: var(--danger); }
[data-tone="busy"] > .step-icon { border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.home > * { min-width: 0; }
.journals { table-layout: fixed; }
.journals thead th:nth-child(1) { width: 32%; }
.journals thead th:nth-child(3) { width: 168px; }
.journals th, .journals td { vertical-align: middle; }
.row-note { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.download-cell { white-space: nowrap; }
.download-cell .btn, .workbooks > summary { white-space: nowrap; }
.download-cell > * + * { margin-left: 6px; }
.workbooks { position: relative; display: inline-block; }
.workbooks > summary { list-style: none; }
.workbooks > summary::-webkit-details-marker { display: none; }
.workbook-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  min-width: 200px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.link-btn { padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; }
.link-btn:hover, .link-btn:focus-visible { background: var(--accent-weak); outline: none; }
.journal-row > td { padding: 4px 12px 20px !important; border-top: 0 !important; }
.checks { margin-top: 12px; padding: 10px 14px; border-radius: 8px; }
.checks ul { margin: 6px 0 0; padding-left: 20px; }
.checks-warn { background: var(--warn-bg); }
.checks-ok { background: var(--ok-bg); color: var(--ok); }

.chip-inline { margin: 0 0 0 8px; font-size: 11.5px; }
.staff td, .staff th { vertical-align: middle; }
.rate-prefix { margin-right: 4px; color: var(--muted); }
.rate-input { width: 90px; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-variant-numeric: tabular-nums; }
.rate-input:invalid { border-color: var(--danger); }
.add-input { flex: 1; min-width: 180px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.password { font-size: 13px; margin-right: 6px; }
.password-cell { white-space: nowrap; }
.password-cell .link-btn { padding: 4px 6px; }
.staff tr.removing th, .staff tr.removing td { text-decoration: line-through; color: var(--muted); }
.staff tr.removing .row-actions { text-decoration: none; }
.staff tr.pending th, .staff tr.pending td { background: var(--info-bg); }
.former { margin-top: 16px; }
.former summary { cursor: pointer; font-weight: 600; }
.former ul { margin: 6px 0 0; padding-left: 20px; }
.staff-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.staff-status { display: flex; align-items: center; gap: 8px; }
.staff-status[data-tone="ok"] { color: var(--ok); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.copy-select { height: 26px; max-width: 190px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: 12.5px; font-weight: 400; cursor: pointer; }
.readonly .adder-row, .readonly .remove-row { display: none; }
.readonly .cell, .readonly .detail { cursor: default; }

.password-wrap { position: relative; display: block; }
.password-wrap input { width: 100%; padding-right: 46px; }
.peek-btn { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.peek-btn:hover { background: var(--hover); color: var(--text); }
.peek-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.peek-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.peek-btn { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.peek-btn .slash { display: none; }
.peek-btn.showing { background: var(--accent-weak); color: var(--accent); }
.peek-btn.showing .slash { display: inline; }
.field .password-wrap input { box-sizing: border-box; }
.link-all { font-weight: 650; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }

html.framed body { display: none !important; }
/* ------------------------------------------------- settings, forgot and reset */

.settings { max-width: 720px; margin: 0 auto; padding: 24px 16px 40px; display: grid; gap: 16px; }
.settings > * { min-width: 0; }
.page-title { margin: 4px 0 0; font-size: 24px; letter-spacing: -0.01em; }
.settings-card { padding: 20px 24px 24px; display: grid; gap: 14px; }
.settings-card h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.settings-card p { margin: 0; }
.facts { margin: 0; display: grid; gap: 8px; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.settings-form { display: grid; gap: 14px; max-width: 440px; }
.settings-form .btn { justify-self: start; }
.form-ok { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); }
.signin-alt { margin: 0; text-align: center; font-size: 13.5px; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
#status-actions { display: grid; gap: 8px; }
#status-actions:empty { display: none; }

/* -------------------------------------------------------- admin: emails */

#staff { overflow-x: auto; }
.staff th, .staff td { padding-left: 12px; padding-right: 12px; }
.email-input { width: 210px; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.email-input.invalid { border-color: var(--danger); }
.email-field { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.email-text { overflow-wrap: anywhere; }
.add-row .email-input { height: 34px; border-radius: 8px; }
.office { margin-top: 22px; }
.office h3 { margin: 0 0 4px; font-size: 15px; }
.office > p { margin: 0 0 8px; }

/* ------------------------------------------------------------- fireworks */

.fireworks { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; }

/* ----------------------------------------------------------- small screens */

@media (max-width: 760px) {
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .settings-card { padding: 18px 16px 20px; }
  :root { --w-label: 150px; --w-type: 68px; --w-total: 48px; --w-day: 42px; }
  .topbar { grid-template-columns: auto 1fr auto; height: 56px; padding: 0 8px; gap: 4px; }
  .brand span { display: none; }
  .month-nav { justify-self: center; }
  .month-label { min-width: 0; font-size: 16px; }
  .user-name { display: none; }
  .app-main { padding: 10px; gap: 10px; }
  .sticky-2, .sticky-3 { position: static; box-shadow: none; }
  .grid thead .sticky-2, .grid thead .sticky-3 { position: sticky; left: auto; }
  .job-details .loc, .job-details .owner { display: none; }
  .job-head .badge { grid-column: 2 / 5; }
  .section-hint { display: none; }
  .savebar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 10px; }
  .savebar-totals { order: 3; flex-basis: 100%; gap: 10px; font-size: 13px; }
  .savebar-actions .btn { padding: 0 10px; }
  .toast { bottom: 110px; }
  .home { padding: 16px 10px 32px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 24px; }
  .sheets th, .sheets td { padding: 10px 12px; }
  .sheets-card .sheets th:nth-child(2), .sheets-card .sheets td:nth-child(2),
  .sheets-card .sheets th:nth-child(4), .sheets-card .sheets td:nth-child(4) { display: none; }
  .status-inline { display: block; width: fit-content; margin-top: 4px; font-size: 11.5px; font-weight: 600; }
  .row-actions .btn { display: flex; width: 100%; padding: 0 10px; }
  .row-actions .btn + .btn { margin: 6px 0 0; }
  .reuse-row td { padding: 12px; }
  .confirm-row td { padding: 12px; }
  .new-panel { margin: 0 12px 12px; }
  .topbar-title { display: none; }
  .card-head { padding: 16px 16px 4px; }
  .card-body { padding: 12px 16px 16px; }
  .download-cell { white-space: normal; }
  .download-cell > * { margin: 0 6px 6px 0 !important; }
  .journal-row > td { padding: 4px 12px 16px !important; }
  .journals thead th:nth-child(1) { width: 36%; }
  .journals thead th:nth-child(3) { width: 96px; }
}
