:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --panel: #fffefa;
  --panel-2: #f7f8f4;
  --ink: #24231f;
  --muted: #686860;
  --line: rgba(48, 49, 44, .15);
  --line-strong: rgba(48, 49, 44, .24);
  --imagineer: #66799f;
  --fluxcell: #5f8d88;
  --sarrus: #7b9278;
  --shadow: 0 14px 32px rgba(49, 47, 40, .07), inset 0 1px 0 rgba(255, 255, 255, .72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eceee8 0%, var(--bg) 42%, #fbfbf8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(calc(100% - 32px), 1480px);
  margin: 0 auto;
  padding: 24px 0 44px;
}

.ledger-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

h1,
h2,
p,
dl {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.summary-line,
.updated-at,
.section-head span,
.analysis-grid span,
.category-line strong,
.muted,
.form-status {
  color: var(--muted);
}

.summary-line {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 680;
}

.updated-at {
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.analysis-panel,
.ledger-panel,
.gate-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, .92);
  box-shadow: var(--shadow);
}

.analysis-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 16px;
  padding: 12px;
  margin-bottom: 12px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.analysis-grid div {
  min-height: 82px;
  padding: 12px;
  background: var(--panel);
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: lowercase;
}

dd {
  margin: 7px 0 2px;
  font-size: 30px;
  line-height: 1;
  font-weight: 830;
}

.analysis-grid span,
.category-line strong {
  font-size: 12px;
  font-weight: 720;
}

.category-analysis {
  display: grid;
  gap: 9px;
  align-content: center;
}

.category-line {
  --accent: var(--imagineer);
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 160px;
  gap: 10px;
  align-items: center;
  min-height: 28px;
}

.category-line span {
  font-size: 13px;
  font-weight: 820;
}

.category-line.imagineer,
.entry-row.imagineer {
  --accent: var(--imagineer);
}

.category-line.fluxcell,
.entry-row.fluxcell {
  --accent: var(--fluxcell);
}

.category-line.sarrus,
.entry-row.sarrus {
  --accent: var(--sarrus);
}

.category-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(48, 49, 44, .08);
}

.category-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.ledger-panel {
  padding: 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.ledger-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

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

th:last-child,
td:last-child {
  border-right: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eff1ec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: lowercase;
}

th:nth-child(1),
td:nth-child(1) {
  width: 138px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 132px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 116px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 96px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 32%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 180px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 220px;
}

th:nth-child(8),
td:nth-child(8) {
  width: 96px;
}

select,
input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(37, 36, 33, .18);
  border-radius: 7px;
  background: #fffefa;
  color: var(--ink);
  padding: 7px 9px;
  outline: none;
}

.compose-row td {
  background: var(--panel-2);
}

.compose-row td:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.entry-row {
  --accent: var(--imagineer);
  background: var(--panel);
}

.entry-row td:first-child {
  border-left: 5px solid var(--accent);
  padding-left: 10px;
}

.entry-row strong {
  display: block;
  font-size: 13px;
}

.entry-row td > span,
.entry-row .muted {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.work-cell,
.artifact-cell,
.entry-row td {
  overflow-wrap: anywhere;
}

.category-pill {
  display: inline-block;
  margin-top: 0;
  color: var(--ink);
  font-weight: 820;
}

.action-cell {
  display: grid;
  gap: 6px;
  align-items: start;
}

button {
  min-height: 36px;
  border: 1px solid rgba(37, 36, 33, .16);
  border-radius: 7px;
  background: #24231f;
  color: #fffefa;
  padding: 7px 12px;
  font-weight: 820;
}

button:disabled {
  opacity: .58;
  cursor: default;
}

.entry-row button {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.form-status {
  min-height: 16px;
  font-size: 12px;
  font-weight: 760;
}

.empty-row td {
  padding: 18px;
  color: var(--muted);
  font-weight: 680;
  background: rgba(255, 254, 250, .74);
}

.locked {
  background: linear-gradient(180deg, #eceee8 0%, var(--bg) 100%);
}

.gate-shell {
  min-height: calc(100vh - 63px);
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.gate-panel {
  width: min(100%, 420px);
  padding: 24px;
}

.gate-panel h1 {
  font-size: 54px;
}

.gate-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 720;
}

.gate-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.remember-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.remember-line input {
  width: 18px;
  min-height: 18px;
}

@media (max-width: 980px) {
  .analysis-panel {
    grid-template-columns: 1fr;
  }

  .analysis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(calc(100% - 24px), 520px);
    padding-top: 20px;
  }

  .ledger-head,
  .section-head {
    display: grid;
    gap: 6px;
  }

  .updated-at {
    white-space: normal;
  }

  .analysis-grid {
    grid-template-columns: 1fr 1fr;
  }

  .category-line {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .category-line strong {
    grid-column: 2;
  }

  .table-scroll {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

  .ledger-table,
  .ledger-table thead,
  .ledger-table tbody,
  .ledger-table tr,
  .ledger-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .ledger-table thead {
    display: none;
  }

  .compose-row,
  .entry-row,
  .empty-row {
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }

  th,
  td,
  th:nth-child(n),
  td:nth-child(n) {
    width: 100%;
  }

  td {
    display: grid !important;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-right: 0;
    padding: 9px 10px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 820;
    text-transform: lowercase;
  }

  .entry-row td:first-child {
    border-left: 0;
    border-top: 5px solid var(--accent);
    padding-left: 10px;
  }

  .empty-row td {
    display: block !important;
  }

  .empty-row td::before {
    content: none;
  }

  .action-cell {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: 34px;
  }
}
