:root {
  color-scheme: light;
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #5e584f;
  --line: #ddd4c6;
  --green: #0e5c45;
  --green-soft: #e5f3ee;
  --blue: #1d3f66;
  --danger: #8a2e2e;
  --danger-soft: #f8e8e4;
  --shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
  font-family: "Segoe UI", "Liberation Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: white;
  padding: 0.4rem 0.7rem;
}

.skip:focus {
  top: 0.6rem;
}

.top,
main,
.foot,
.storage-note {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  padding: 1.6rem 0 0.2rem;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 650;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.15rem;
}

.eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 700;
}

.host,
.section-note,
.hint,
.form-note,
.kpi-note,
.foot,
.storage-note {
  color: var(--muted);
}

.host {
  margin: 0;
  text-align: right;
  font-size: 0.92rem;
}

.host span {
  color: var(--ink);
  font-weight: 650;
}

main {
  display: grid;
  gap: 1rem;
  padding: 1rem 0 1.4rem;
  min-width: 0;
}

main > * {
  min-width: 0;
}

.panel,
.kpi,
.empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.empty {
  border-style: dashed;
  padding: 1.35rem 1.3rem 1.45rem;
}

.empty h2 {
  font-size: 1.7rem;
}

.empty p:last-child {
  margin: 0.45rem 0 0;
  max-width: 38rem;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.kpi {
  padding: 0.85rem 0.95rem 0.95rem;
}

.kpi-value {
  margin: 0.15rem 0 0;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.kpi-note,
.hint,
.form-note,
.section-note {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.panel {
  padding: 1rem 1rem 1.05rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.section-head .section-note {
  margin: 0;
}

.fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

input,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}

input[readonly] {
  background: #f7f3ea;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

button {
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

.primary {
  background: var(--ink);
  color: #f7f3ea;
  border: 1px solid var(--ink);
}

.secondary,
.danger,
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger {
  color: var(--danger);
  border-color: #e4c9c4;
  background: var(--danger-soft);
}

.status,
.form-error {
  margin: 0.7rem 0 0;
}

.status:empty,
.form-error:empty {
  display: none;
}

.status {
  color: var(--green);
  font-weight: 650;
}

.form-error {
  color: var(--danger);
  font-weight: 650;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

.legend {
  display: flex;
  gap: 1rem;
  margin: 0.8rem 0 0.4rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.swatch.spend {
  background: var(--green);
}

.swatch.revenue {
  background: var(--blue);
}

.chart-scroll,
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.chart-scroll {
  margin-top: 0.3rem;
}

#trend-text {
  margin: 0.45rem 0 0;
  max-width: 46rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 118rem;
  margin-top: 0.7rem;
}

th,
td {
  padding: 0.6rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

thead th {
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  font-weight: 700;
}

tbody th,
tfoot th {
  font-weight: 650;
}

.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr.is-editing {
  background: var(--green-soft);
}

tbody tr:last-child td,
tfoot td,
tfoot th {
  border-bottom: 0;
}

tfoot th,
tfoot td {
  font-weight: 650;
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  background: var(--green-soft);
  color: var(--green);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1rem;
}

.ghost {
  padding: 0.25rem 0.7rem;
}

.foot,
.storage-note {
  padding-bottom: 0.4rem;
}

.storage-note:empty {
  display: none;
}

.storage-note {
  padding-bottom: 2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible,
input:focus-visible,
.skip:focus {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

html[data-entries="some"] #empty {
  display: none;
}

html[data-entries="0"] .needs-entries {
  display: none;
}

#report {
  display: contents;
}

.fields.narrow {
  grid-template-columns: repeat(2, minmax(0, 16rem));
}

.staff-list {
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

.staff-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.one-time {
  margin: 0.8rem 0 0;
  padding: 0.7rem 0.8rem;
  background: var(--green-soft);
  border-radius: 10px;
  max-width: 36rem;
}

.top {
  align-items: center;
}

@media (max-width: 800px) {
  .top,
  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .host {
    text-align: left;
  }

  .kpis,
  .fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .kpis,
  .fields,
  .fields.narrow {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.7rem;
  }
}
