:root {
  color-scheme: dark;
  --canvas: #000;
  --panel: #000;
  --ink: #fff;
  --muted: #b3b3b3;
  --line: #333;
  --line-strong: #777;
  --surface: #000;
  --hover: #242424;
  --accent: #fff;
  --subtle: #151515;
  --highlight: #ffffff;
  --error-text: #fff;
  --radius: 24px;
  --sidebar-width: 218px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid #ddd; outline-offset: 3px; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }

.bar { background: var(--surface); color: #fff; border-bottom: 1px solid var(--line); }
.masthead { display: flex; flex-direction: column; height: 100%; padding: 32px 17px 21px; gap: 42px; }
.brand {
  display: inline-flex;
  align-items: center;
  align-self: start;
  gap: 11px;
  padding-inline: 5px;
  color: #ffffff;
  text-decoration: none;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -.056em;
}
.mark { display: block; width: 34px; height: 34px; flex: none; border-radius: 8px; }
nav { display: grid; gap: 5px; }
nav button {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #cccccc;
  background: transparent;
  text-align: left;
  white-space: nowrap;
  font-size: .875rem;
  font-weight: 620;
}
nav button::before {
  content: "";
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
nav button[data-view="capture"]::before { border-radius: 50%; }
nav button[data-view="people"]::before { border-radius: 50% 50% 3px 3px; }
nav button[data-view="reports"]::before { border-width: 0 2px 2px; border-radius: 1px; }
nav button[data-view="archive"]::before { border-radius: 1px; border-top-width: 3px; }
nav button[data-view="settings"]::before { rotate: 45deg; border-radius: 2px; }
nav button:hover { background: #242424; color: #fff; }
nav button[aria-current="page"] { color: var(--highlight); background: #333333; border-color: #777777; }
.bar :focus-visible { outline-color: var(--highlight); }
.masthead-footer { display: grid; gap: 12px; margin-top: auto; }
.local {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #444444;
  padding: 14px 3px 0;
  color: #dddddd;
  font-size: .75rem;
}
.local::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #bbbbbb; }
.sign-out {
  width: fit-content;
  min-height: 40px;
  padding: 6px 11px;
  border: 1px solid #666666;
  border-radius: 9px;
  background: transparent;
  color: #ffffff;
  font-size: .8125rem;
}
.sign-out:hover { background: var(--hover); }

main.shell { width: min(1240px, 100%); min-width: 0; margin: 0 auto; padding: 44px clamp(22px, 4vw, 58px) 55px; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .105em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(32px, 4.2vw, 56px); font-weight: 760; line-height: 1.02; letter-spacing: -.062em; }
h2 { margin-bottom: 0; font-size: 1.18rem; font-weight: 720; line-height: 1.2; letter-spacing: -.035em; }
p { color: var(--muted); line-height: 1.55; }
label { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 660; }
input, select, textarea {
  min-height: 44px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 9px 12px;
  background: var(--panel);
  color: var(--ink);
}
input:disabled, select:disabled { opacity: .7; }
input[type="checkbox"] { min-height: 0; width: 1.125rem; height: 1.125rem; accent-color: var(--accent); }
textarea { display: block; width: 100%; resize: vertical; }
.person-select { width: min(260px, 100%); flex-shrink: 0; }
.person-select select { width: 100%; background: var(--panel); }

.capture-grid, .people-grid { display: grid; gap: 18px; align-items: stretch; }
.capture-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); }
.people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.clock-card, .month-card, .pane { padding: clamp(18px, 2.6vw, 28px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 20px; }
.clock-card {
  display: flex;
  flex-direction: column;
  color-scheme: dark;
  color: #ffffff;
  border-color: #333333;
  background: var(--surface);
}
.clock-card :focus-visible { outline-color: var(--highlight); }
.clock-card h2 { color: #ffffff; }
.clock-display {
  min-height: 118px;
  margin-bottom: 20px;
  padding: 18px clamp(12px, 2.3vw, 22px);
  border: 1px solid #666666;
  border-radius: 17px;
  background: var(--panel);
}
.count { color: #ffffff; font-size: clamp(2.35rem, 5.15vw, 4.4rem); font-weight: 700; line-height: 1; letter-spacing: -.085em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-card p { color: #dddddd; margin: 10px 0 0; }
.clock-card .clock-greeting { margin: 2px 0 10px; color: #eeeeee; font-size: .875rem; font-weight: 630; }
.clock-card select { color: #ffffff; background: var(--panel); border-color: var(--line-strong); }
.clock-card .actions { margin-top: auto; }
.clock-card .primary { min-height: 48px; padding-inline: 18px; }
.clock-card .clock-round:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  border-radius: 50%;
  flex: 0 0 64px;
}
#clock-switch {
  background-image: url("./cost-center-switch.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 26px 26px;
  background-blend-mode: multiply;
}
#switch-cost-selection { width: 100%; }
.clock-action-icon { display: block; width: 24px; height: 24px; background: currentColor; pointer-events: none; }
#clock-main[data-action="start"] .clock-action-icon,
#clock-main[data-action="resume"] .clock-action-icon { clip-path: polygon(17% 0, 100% 50%, 17% 100%); }
#clock-main[data-action="stop"] .clock-action-icon { width: 22px; height: 22px; border-radius: 3px; }

.clock-card .secondary { color: #ffffff; border-color: #666666; background: #282828; }
.clock-card .secondary:hover:not(:disabled) { background: #363636; }
.clock-card .quiet { color: #eeeeee; }
.state, .badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; white-space: nowrap; font-size: .75rem; font-weight: 670; }
.state { color: #eeeeee; border: 1px solid #777777; background: #2a2a2a; }
.state::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.state[data-status="running"] { color: var(--highlight); }
.state[data-status="paused"] { color: #dddddd; }
.badge { color: var(--accent); background: var(--subtle); }

.month-total { margin: 20px 0 3px; font-size: clamp(1.7rem, 3.3vw, 2.5rem); line-height: 1; font-weight: 760; letter-spacing: -.065em; font-variant-numeric: tabular-nums; }
.month-card p { margin-bottom: 0; font-size: .875rem; }
.dashboard-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; }
.dashboard-controls label { display: flex; flex-direction: column; min-width: 0; margin: 0; gap: 6px; }
.dashboard-controls input, .dashboard-controls select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 46px;
  margin: 0;
  font-size: 16px;
}
.dashboard-controls input::-webkit-date-and-time-value { min-width: 0; text-align: left; }
#dashboard-date-field { grid-column: 1 / -1; }
#dashboard-empty { margin-top: 17px; }
.dashboard-axis, .dashboard-bars li { display: grid; grid-template-columns: 5.85rem minmax(0, 1fr) 3.75rem; gap: 8px; align-items: center; }
#dashboard-ticks { grid-column: 2; display: flex; justify-content: space-between; gap: 2px; white-space: nowrap; }
.dashboard-axis { margin-top: 17px; color: var(--muted); font-size: .6875rem; font-variant-numeric: tabular-nums; }
.dashboard-bars { display: grid; gap: 5px; margin: 5px 0 0; padding: 0; list-style: none; }
.dashboard-bars li { min-height: 23px; font-size: .8125rem; }
.dashboard-bars small { color: var(--muted); }
.dashboard-track { display: block; height: 9px; border-radius: 999px; overflow: hidden; background: #292929; }
.dashboard-track > span { display: block; height: 100%; border-radius: inherit; background: #fff; }
.dashboard-value { color: var(--accent); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.target-progress { margin-top: 17px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.target-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.target-heading h3 { margin: 0; font-size: .875rem; }
.target-heading strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.target-progress progress { display: block; width: 100%; height: 9px; margin: 9px 0 7px; accent-color: #fff; }
#target-detail, #monthly-target-help { color: var(--muted); font-size: .8125rem; }
#monthly-target-help { margin: 8px 0 0; }

.actions, .report-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.primary, .secondary, .quiet, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 680;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.primary { color: #000; background: var(--accent); }
.primary:hover:not(:disabled) { background: #ddd; }
.secondary { color: var(--accent); border-color: var(--line-strong); background: var(--panel); }
.secondary:hover:not(:disabled) { background: var(--hover); }
.quiet { color: var(--accent); background: transparent; }
.quiet:hover:not(:disabled) { text-decoration: underline; }
.danger { color: var(--error-text); background: var(--panel); border-color: var(--line-strong); }
.danger:hover:not(:disabled) { background: var(--hover); }

.ledger { margin-top: 18px; }
.ledger-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px clamp(18px, 2.6vw, 28px); }
.ledger-head p, .pane > p, .dialog-head + p { margin: 6px 0 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
th, td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.ledger th:first-child, .ledger td:first-child { padding-left: clamp(18px, 2.6vw, 28px); }
.ledger th:last-child, .ledger td:last-child { padding-right: clamp(18px, 2.6vw, 28px); }
thead th { color: #ddd; background: var(--subtle); font-size: .8125rem; white-space: nowrap; }
tbody tr:hover { background: var(--subtle); }
td:first-child, td:nth-child(3), td:nth-child(4) { white-space: nowrap; }
td small { display: block; color: var(--muted); }
td .quiet { min-height: 32px; padding: 0 7px; }
details ul { margin: 6px 0 0; padding-left: 16px; }
td details summary { color: #ddd; }
.empty { margin: 0; padding: 18px clamp(18px, 2.6vw, 28px); border-top: 1px solid var(--line); }
.report-controls { align-items: end; margin-bottom: 17px; }
#settings .table-wrap, #reports .table-wrap { margin-top: 15px; border: 1px solid var(--line); border-radius: 12px; }
#settings thead th, #reports thead th { border-top: 0; }

.pane form { margin-top: 17px; }
.pane input[type="file"] { width: 100%; margin-bottom: 12px; }
input::file-selector-button { margin-inline-end: 8px; padding: 4px 7px; border: 0; border-radius: 6px; color: var(--accent); background: var(--subtle); font: inherit; }
.people-list { margin-bottom: 0; padding: 0; list-style: none; }
.people-list li, .history details { padding-block: 12px; border-top: 1px solid var(--line); }
.people-list li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; overflow-wrap: anywhere; }
.people-list span { color: var(--muted); }
.history { margin-top: 16px; }
.history details p { margin: 7px 0 0; overflow-wrap: anywhere; }
.activity-select { display: block; width: 100%; max-width: 310px; margin-bottom: 14px; }
.person-create, .settings-block, .backup-panel { margin-bottom: 16px; }
.person-create form, .settings-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.person-create form > div, .settings-form > div { flex: 1 1 190px; min-width: 0; }
.settings-form > div { max-width: 380px; }
.person-create input, .settings-form input, .settings-form select { width: 100%; }
.settings-form + .settings-form { padding-top: 15px; border-top: 1px solid var(--line); }
.backup-panel form { display: grid; max-width: 400px; justify-items: start; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-block: 12px; }
.checkbox-label input { flex: none; }
.account-panel { margin-top: 16px; }
.account-panel .ledger-head { padding: 0; }
.auth-card { max-width: 480px; margin: auto; }
.auth-card input, #account-form > input, #account-form select { display: block; width: 100%; margin-bottom: 14px; }
.auth-card h1 { font-size: 2rem; }
#account-form .dialog-head { margin-bottom: 17px; }
#account-form select[multiple] { min-height: 108px; }

.feedback { padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--subtle); color: var(--ink); }
.feedback.error, .error { padding: 9px 12px; border-radius: 10px; color: var(--error-text); background: var(--subtle); border: 1px solid var(--line-strong); }
dialog { width: min(660px, calc(100% - 28px)); max-height: calc(100% - 32px); padding: clamp(17px, 3vw, 26px); border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--panel); box-shadow: 0 16px 65px #11111152; }
dialog::backdrop { background: #111111b8; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.dialog-actions { justify-content: end; margin-top: 14px; }
.input-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-bottom: 12px; }
.time-field { min-width: 0; }
.time-field input, .time-field select { width: 100%; }
.time-field select { margin-top: 5px; }
.pause-row { margin: 0 0 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
#reason-label { margin-top: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (min-width: 951px) {
  body { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); align-items: start; }
  .bar { position: sticky; top: 0; border-bottom: 0; border-right: 1px solid var(--line); height: 100vh; height: 100dvh; overflow-y: auto; }
}
@media (max-width: 950px) {
  .masthead { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 13px clamp(14px, 4vw, 28px) 9px; gap: 9px 12px; }
  .brand { padding-inline: 0; }
  nav { grid-row: 2; grid-column: 1 / -1; display: flex; gap: 5px; flex-wrap: wrap; }
  nav button { width: auto; gap: 7px; padding: 7px 10px; }
  .masthead-footer { grid-row: 1; grid-column: 2; display: flex; align-items: center; gap: 8px; margin: 0; }
  .local { max-width: 155px; padding: 0; border-top: 0; }
  main.shell { padding-top: 28px; }
}
@media (max-width: 670px) {
  .dashboard-controls { grid-template-columns: minmax(0, 1fr); }
  .capture-grid, .people-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .heading { align-items: start; flex-wrap: wrap; gap: 15px; margin-bottom: 19px; }
  .ledger { margin-top: 13px; }
  .person-select { width: 100%; }
  main.shell { padding: 23px 15px 34px; }
  .clock-card .primary { min-width: min(100%, 185px); }
}
@media (max-width: 440px) {
  .masthead { padding-inline: 12px; column-gap: 7px; }
  .brand { gap: 7px; font-size: 21px; }
  .mark { width: 32px; height: 32px; }
  .local { max-width: 101px; gap: 5px; font-size: .68rem; }
  .sign-out { padding-inline: 6px; font-size: .75rem; }
  nav { gap: 3px; }
  nav button { min-height: 42px; padding-inline: 6px; font-size: .75rem; }
  nav button::before { display: none; }
  .input-pair { grid-template-columns: minmax(0, 1fr); }
}

#report-cost-filter { max-width: min(100%, 300px); }
#report-cost-center { width: 100%; }
#report-table td:first-child { min-width: 8rem; white-space: normal; overflow-wrap: anywhere; }

.month-picker { min-width: 0; }
.month-picker > span { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 660; }
.month-picker-fields { display: grid; grid-template-columns: minmax(0, 1fr) 5.7rem; gap: 8px; min-width: 0; }
.month-picker-fields input, .month-picker-fields select { width: 100%; min-width: 0; max-width: 100%; margin: 0; height: 46px; font-size: 16px; }
.target-progress progress::-webkit-progress-bar { background: #292929; border-radius: 999px; }
.target-progress progress::-webkit-progress-value { background: #fff; border-radius: 999px; }
.target-progress progress::-moz-progress-bar { background: #fff; border-radius: 999px; }

.management-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.management-tabs button[aria-pressed="true"] { background: var(--accent); color: #000; }
.management-panel .report-controls { margin-bottom: 0; }
.management-panel .report-controls :is(input, select) { width: 100%; max-width: 100%; }
.management-panel .report-controls input::-webkit-date-and-time-value { min-width: 0; }
.management-panel .report-controls > div { min-width: 0; flex: 1 1 180px; max-width: 340px; }

#manage-activities { margin-top: 16px; }
#ledger-table td:nth-last-child(2) { white-space: nowrap; }
#ledger-table td:last-child .quiet { white-space: nowrap; }


#report-customer, #report-cost-center { max-width: 100%; }
#report-customer-filter, #report-cost-filter { min-width: 0; }
.cost-center-customer-edit { flex-basis: 100%; min-width: 0; }
.cost-center-customer-edit summary { width: fit-content; cursor: pointer; }
.cost-center-customer-edit .settings-form { margin-top: 10px; }
#cost-center-list small { display: block; color: var(--muted); }
