:root {
  color-scheme: light;
  --ink: #172b3a;
  --muted: #627484;
  --line: #dce5eb;
  --surface: #ffffff;
  --page: #f2f6f9;
  --brand: #174b70;
  --brand-dark: #12304a;
  --brand-soft: #eaf3f8;
  --danger: #a82f3a;
  --danger-soft: #fff0f0;
  --shadow: 0 12px 32px rgba(23, 43, 58, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.page {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 28px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 17px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 29px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(18, 48, 74, .18);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--brand);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(1.65rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.subtitle { margin-bottom: 0; color: var(--muted); }

.panel {
  margin-bottom: 22px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 { margin-bottom: 5px; font-size: 1.15rem; }
.section-heading p { margin-bottom: 0; color: var(--muted); font-size: .92rem; }

.badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .75rem;
  font-weight: 750;
}
.badge-muted { background: #f0f3f5; color: #536574; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

table {
  width: 100%;
  min-width: 850px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}
th:last-child, td:last-child { border-right: 0; }
thead th {
  padding-top: 12px;
  padding-bottom: 12px;
  background: #f5f8fa;
  color: #526879;
  font-size: .78rem;
  font-weight: 750;
  text-align: center;
}
thead th:first-child, tbody td:first-child, tfoot th:first-child { text-align: center; }
tbody tr:last-child td { border-bottom: 1px solid var(--line); }
tbody tr:nth-child(even) { background: #fbfcfd; }
tbody tr:focus-within { background: #f1f8fc; }
.row-number { color: #7b8c98; font-size: .78rem; }
.sum-col { background: #f2f7fa; font-weight: 750; }

.time-input {
  width: 100%;
  min-width: 72px;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.time-input:hover { border-color: #c7d7e2; background: #fff; }
.time-input:focus { border-color: #3c86b2; background: #fff; box-shadow: 0 0 0 3px rgba(60, 134, 178, .14); }
.time-input.invalid { border-color: #d65b63; background: var(--danger-soft); color: #8d1e28; }
.time-input[aria-invalid="true"] { border-color: #d65b63; background: var(--danger-soft); }
td.error-cell { position: relative; }
td.error-cell::after {
  content: attr(data-error);
  position: absolute;
  z-index: 2;
  left: 4px;
  top: calc(100% - 1px);
  padding: 4px 7px;
  border-radius: 5px;
  background: #8d1e28;
  color: #fff;
  font-size: .72rem;
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
}
tfoot th, tfoot td {
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 0;
  background: #eaf2f7;
  font-weight: 800;
}
tfoot th { text-align: left; }
tfoot .sum-col { background: #dceaf2; }

.decimal-panel { background: #fcfdfe; }
.decimal-panel thead th { background: #f0f4f6; }
.decimal-panel tbody td { background: #fafcfd; color: #315267; }
.decimal-panel tfoot th, .decimal-panel tfoot td { background: #e8f0f4; color: #23465c; }
.decimal-value { display: inline-block; min-width: 54px; }

.hint {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: .82rem;
}
code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef3f6;
  color: #23465c;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .9em;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
#save-status { color: var(--muted); font-size: .84rem; }
.button {
  border: 0;
  border-radius: 9px;
  padding: 11px 15px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.button:active { transform: translateY(1px); }
.button-danger { background: var(--danger); color: white; }
.button-danger:hover { background: #87232d; }
.button-secondary { background: #edf2f5; color: var(--ink); }
.button-secondary:hover { background: #dfe8ed; }
.privacy-note { margin: 12px 0 0; color: #71818d; font-size: .78rem; }

.confirm-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.confirm-dialog::backdrop { background: rgba(14, 31, 43, .42); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin-bottom: 8px; font-size: 1.2rem; }
.confirm-dialog p { margin-bottom: 20px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

@media (max-width: 700px) {
  .page { width: min(100% - 22px, 1500px); padding-top: 22px; }
  .hero { align-items: flex-start; margin-bottom: 20px; }
  .brand-mark { width: 46px; height: 46px; flex-basis: 46px; border-radius: 14px; }
  .panel { padding: 15px; border-radius: 14px; }
  .section-heading { gap: 10px; }
  .section-heading p { max-width: 300px; }
  .badge { font-size: .68rem; padding: 5px 8px; }
  .page-footer { align-items: stretch; flex-direction: column; }
  .button { width: 100%; }
  .dialog-actions .button { width: auto; }
}
