:root {
  color-scheme: light;
  --ink: #171511;
  --muted: #70685f;
  --soft: #a89c8e;
  --line: #eadfce;
  --page: #f8f2e8;
  --panel: #fffdf8;
  --panel-2: #fbf6ed;
  --beige: #f0e5d4;
  --black: #181612;
  --green: #2f7d4d;
  --orange: #be792f;
  --red: #b9493d;
  --shadow: 0 18px 44px rgba(40, 31, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 400;
  background: var(--page);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--black);
  color: var(--panel);
  font-weight: 700;
}

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

h1 {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 600;
}

h2 {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 500;
}

h3 {
  font-size: 18px;
  font-weight: 600;
}

p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.eyebrow,
.section-label {
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.notice,
.form-card,
.project-button,
.card,
.table-wrap,
.empty {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.notice {
  display: grid;
  gap: 5px;
  padding: 13px;
}

.notice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.project-list {
  display: grid;
  gap: 9px;
}

.project-button {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 13px;
  text-align: left;
  color: var(--ink);
}

.project-button.is-active {
  background: #25221b;
  color: var(--panel);
  border-color: #25221b;
}

.project-button span {
  color: var(--muted);
  font-size: 12px;
}

.project-button.is-active span {
  color: #d8cbb6;
}

.form-card {
  display: grid;
  gap: 11px;
  padding: 14px;
  margin-top: auto;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 4px rgba(21, 19, 15, 0.08);
}

.primary,
.secondary,
.ghost {
  min-height: 44px;
  border-radius: 10px;
  font-weight: 650;
}

.primary {
  border: 0;
  background: var(--black);
  color: var(--panel);
}

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

.ghost {
  min-height: 36px;
  padding: 0 11px;
  background: #fffdf8;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 18px;
  background: rgba(255, 253, 248, 0.86);
  border-bottom: 1px solid var(--line);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 28px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 650;
}

.tab.is-active {
  background: #25221b;
  border-color: #25221b;
  color: var(--panel);
}

.content {
  flex: 1;
  overflow: auto;
  padding: 22px 28px 32px;
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

.card {
  padding: 16px;
}

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

.metric {
  display: grid;
  gap: 8px;
}

.metric strong {
  font-size: 26px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e3f0e6;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
}

.status-pill.warn {
  background: #f7ead9;
  color: var(--orange);
}

.status-pill.danger {
  background: #f5dfda;
  color: var(--red);
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #25221b;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.form-grid .wide {
  grid-column: span 2;
}

.form-grid button {
  align-self: end;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

td strong {
  display: block;
}

td span {
  display: block;
  margin-top: 4px;
  color: var(--soft);
  font-size: 12px;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
}

.item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.empty {
  padding: 22px;
  text-align: center;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #edd0ca;
  border-radius: 12px;
  background: #fff7f5;
}

.danger-zone strong {
  font-weight: 650;
}

.danger-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #e4b0a8;
  border-radius: 10px;
  background: #fffdf8;
  color: var(--red);
  font-weight: 650;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .form-card {
    margin-top: 0;
  }

  .grid.cols-2,
  .grid.cols-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .danger-button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .sidebar {
    padding: 16px;
  }

  .topbar {
    display: grid;
    padding: 18px 16px 14px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }

  h2 {
    font-size: 24px;
  }

  .tabs {
    padding: 10px 16px;
  }

  .content {
    padding: 16px;
  }
}

@media print {
  .sidebar,
  .tabs,
  .topbar-actions,
  form {
    display: none;
  }

  .app-shell,
  .main {
    display: block;
  }

  .content {
    padding: 0;
  }
}
