:root {
  color-scheme: light;
  --ink: #232830;
  --muted: #52606e;
  --line: #dce1e8;
  --surface: #fff;
  --page: #eff1f5;
  --charcoal: #252930;
  --brand-red: #e74c3c;
  --accent: #165fc6;
  --accent-strong: #104d9f;
  --soft: #eaf2ff;
  --shadow: 0 1px 3px #2328300a, 0 9px 24px #23283008;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-strong); text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #669cf0;
  outline-offset: 3px;
}

.shell { width: min(72rem, calc(100% - 3rem)); margin-inline: auto; }
.top { background: var(--charcoal); border-bottom: 1px solid #3c424c; }
.top-inner { display: flex; align-items: center; gap: clamp(1rem, 4vw, 3rem); min-height: 4.25rem; }
.top-inner > form { margin-left: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  white-space: nowrap;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 550;
  letter-spacing: -.03em;
}
.brand strong { font-weight: 790; }
.brand-mark {
  position: relative;
  width: 2.125rem;
  height: 2.125rem;
  flex: 0 0 2.125rem;
  border-radius: 50%;
  background: var(--brand-red);
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; }
.brand-mark::before { inset: .53rem; border: 2px solid #fff; border-radius: 50%; }
.brand-mark::after { left: 50%; bottom: 50%; width: .3rem; height: .37rem; border-left: 2px solid #fff; border-bottom: 2px solid #fff; }
.top nav { display: flex; gap: .375rem; }
nav a, .quiet {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: .5rem .8rem;
  font-weight: 600;
  font-size: .875rem;
}
.quiet:hover { background: var(--page); color: var(--ink); }
.top nav a, .top .quiet { color: #dce1e8; }
.top nav a:hover, .top .quiet:hover { background: #373c45; color: #fff; }
.top nav a[aria-current="page"] { color: #fff; background: #373c45; box-shadow: inset 0 -2px var(--brand-red); }

.main { padding-block: 2.5rem 3.5rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.1; letter-spacing: -.053em; font-weight: 785; }
.intro { color: var(--muted); margin-top: .55rem; }
h1 { overflow-wrap: anywhere; }
.back-link { display: inline-block; margin-bottom: .75rem; font-size: .875rem; font-weight: 650; }
.back-link:hover { text-decoration: underline; }
.month-picker, .month-form { display: flex; align-items: center; gap: .25rem; }
.month-picker {
  padding: .25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  white-space: nowrap;
}
.month-step {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1.45rem;
  line-height: 1;
}
a.month-step:hover { background: var(--soft); color: var(--accent-strong); }
.month-step.unavailable { opacity: .35; }
.month-form input { width: 10.2rem; min-height: 2rem; padding: .2rem .35rem; border: 0; font-size: .9rem; }
.month-submit { padding: .3rem .4rem; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.metric, .panel {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.metric { min-width: 0; padding: 1.15rem 1.35rem; }
.metric p { color: var(--muted); font-weight: 640; font-size: .875rem; }
.metric strong {
  display: block;
  margin: .25rem 0;
  line-height: 1.16;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.metric small { color: var(--muted); font-size: .62em; }
.metric > span { color: var(--muted); font-size: .875rem; }
.metric.featured { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.metric.featured p, .metric.featured > span { color: #dce1e8; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); align-items: start; gap: 1.25rem; }
.panel { min-width: 0; padding: 1.35rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.15rem; }
.panel-heading p, .customer-note { color: var(--muted); font-size: .875rem; margin-top: .2rem; }
h2 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -.027em; }
h3 { font-size: 1rem; font-weight: 720; overflow-wrap: anywhere; }

.budget-row, .entry, .customer-details { border-top: 1px solid var(--line); padding-block: .95rem; }
.budget-row:last-child, .entry:last-child, .customer-details:last-child { padding-bottom: .15rem; }
.budget-top, .customer-details summary { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.customer-name { display: flex; min-width: 0; align-items: center; gap: .7rem; overflow-wrap: anywhere; }
.customer-name p { font-size: .875rem; color: var(--muted); }
.customer-link:hover h3 { text-decoration: underline; text-underline-offset: .15em; }
.monogram {
  display: grid;
  flex: 0 0 2.375rem;
  height: 2.375rem;
  place-items: center;
  background: var(--soft);
  color: var(--accent-strong);
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 760;
  white-space: nowrap;
}
.budget-track { display: grid; gap: .4rem; margin: .55rem 0 0 3.075rem; }
.budget-track p { font-size: .875rem; color: var(--muted); }
.budget-track strong { color: var(--ink); font-weight: 730; }
progress {
  appearance: none;
  width: 100%;
  height: .45rem;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #edf0f7;
  --progress: var(--accent);
}
progress.done { --progress: #087b5d; }
progress.over { --progress: #a75815; }
progress::-webkit-progress-bar { background: #edf0f7; border-radius: 20px; }
progress::-webkit-progress-value { background: var(--progress); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--progress); border-radius: 20px; }
.pill, .count {
  display: inline-block;
  padding: .25rem .6rem;
  color: #46546a;
  background: #eef1f5;
  border-radius: 25px;
  font-size: .8125rem;
  font-weight: 650;
  text-align: center;
}
.pill.open { background: var(--soft); color: var(--accent-strong); }
.pill.done { background: #e5f6ef; color: #08624c; }
.pill.over { background: #fff0db; color: #82420a; }

.stack { display: grid; gap: .9rem; }
label { display: grid; gap: .35rem; color: var(--ink); font-size: .875rem; font-weight: 650; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 2.7rem;
  padding: .55rem .65rem;
  border: 1px solid #ccd5e3;
  border-radius: 8px;
  background-color: white;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
}
input::placeholder { color: #5f6e84; opacity: 1; }
input[readonly] { background: var(--page); }
select {
  appearance: none;
  padding-right: 1.9rem;
  background:
    linear-gradient(45deg, transparent 50%, #526078 51%) right 15px center / 5px 5px no-repeat,
    linear-gradient(135deg, #526078 50%, transparent 51%) right 10px center / 5px 5px no-repeat,
    #fff;
}
.form-pair { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: .65rem; }
.field-hint { color: var(--muted); font-size: .8125rem; font-weight: 400; }
.form-pair + .field-hint { margin-top: -.6rem; }
.primary, .secondary, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 680;
  min-height: 2.6rem;
  padding: .45rem .75rem;
  font-size: .875rem;
  text-align: center;
}
.primary { color: #fff; background: var(--accent); border: 1px solid transparent; }
.primary:hover { background: var(--accent-strong); }
.secondary { color: var(--accent-strong); border: 1px solid var(--line); background: var(--surface); }
.secondary:hover { background: var(--soft); }
.danger { color: #982f42; border: 1px solid #efd0d7; background: #fff; }
.danger:hover { background: #fcf0f3; }

.activity { margin-top: 1.25rem; scroll-margin: 1rem; }
.empty { border: 1px dashed #ccd5e3; border-radius: 10px; padding: 1rem; color: var(--muted); font-size: .9375rem; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .2rem 1rem; align-items: start; }
.entry-meta { min-width: 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.entry-title { font-weight: 700; color: var(--ink); font-size: 1rem; }
.entry-duration { white-space: nowrap; font-variant-numeric: tabular-nums; }
summary { cursor: pointer; }
.entry-edit { display: contents; }
.entry-edit summary, .details-action { color: var(--accent-strong); font-size: .875rem; font-weight: 650; }
.entry-controls, .customer-edit-form { max-width: 30rem; margin-top: .75rem; padding: .9rem; border-radius: 10px; background: var(--page); }
.entry-controls { grid-column: 1 / -1; }
.entry-controls > form + form { margin-top: .75rem; }
.customer-details summary { list-style: none; }
.customer-details summary::-webkit-details-marker { display: none; }
.customer-note { display: block; }
.message { color: #08624c; background: #eaf7f2; border-radius: 8px; padding: .65rem .8rem; margin-bottom: 1rem; }
.message.error { color: #982f42; background: #fcf0f3; }
.stack .message { margin: 0; }

.login-wrap { min-height: 100dvh; display: grid; align-items: center; justify-items: center; padding: 1rem; }
.login-card { width: min(100%, 26rem); background: white; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); padding: 1.75rem; }
.login-brand { background: var(--charcoal); border-radius: 14px 14px 0 0; margin: -1.75rem -1.75rem 1.75rem; padding: .9rem 1.75rem; }
.login-card .intro { margin-bottom: 1.1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 52rem) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 34rem) {
  .shell { width: calc(100% - 1.5rem); }
  .main { padding-top: 1.7rem; }
  .top-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem .25rem; padding-block: .6rem; }
  .top .brand { font-size: .95rem; gap: .4rem; }
  .top nav { grid-column: 1 / -1; grid-row: 2; }
  .top .quiet { padding-inline: .45rem; }
  .metrics { gap: .5rem; }
  .metric { padding: .65rem; }
  .metric p, .metric > span { font-size: .8125rem; }
  .panel { padding: 1rem; }
}
@media (max-width: 23rem) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .metric { padding: .8rem; }
  .entry { grid-template-columns: minmax(0, 1fr) auto; }
  .entry-edit summary { grid-column: 1 / -1; }
}
