:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #657287;
  --line: #d9e0ea;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --accent: #176b5b;
  --accent-strong: #105246;
  --danger: #a12b2b;
  --warning: #8a5b16;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  color: #fff;
  background: var(--accent);
}

button.primary:hover {
  background: var(--accent-strong);
}

button.ghost {
  color: var(--accent);
  background: #fff;
}

button.danger {
  color: var(--danger);
  border-color: #d8a9a9;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px max(16px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1,
.section-head h2 {
  margin: 3px 0 0;
}

.topbar h1 {
  font-size: 28px;
}

.top-actions,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-panel,
.editor-panel,
.list-panel,
.summary-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px;
}

.status-label {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.status-detail {
  margin: 7px 0 0;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.summary-grid article {
  padding: 18px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.summary-grid small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.editor-panel,
.list-panel {
  padding: 18px;
  margin-top: 14px;
}

.entry-form {
  display: grid;
  grid-template-columns: 140px 160px 130px 130px minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
}

.message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--warning);
  font-weight: 650;
}

.month-filter,
.sort-filter {
  width: 170px;
}

.sort-filter {
  width: 190px;
}

.table-wrap {
  overflow: auto;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #eef3f7;
  font-size: 13px;
}

td.actions-cell {
  display: flex;
  gap: 8px;
}

.small-button {
  padding: 7px 9px;
  font-size: 13px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .topbar,
  .status-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .entry-form {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .status-panel button,
  .entry-form button {
    width: 100%;
  }
}
