:root {
  color-scheme: light;
  --page: #f5f7f2;
  --surface: #ffffff;
  --surface-alt: #eef3f0;
  --ink: #17211d;
  --muted: #66736d;
  --line: #d7dfda;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --blue: #2f80ed;
  --danger: #b42318;
  --warning: #b7791f;
  --shadow: 0 14px 35px rgb(23 33 29 / 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

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

button,
input {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.top-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-button {
  min-height: 36px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.nav-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 28px;
  font-weight: 750;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

.status-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.approval-view,
.settings-view {
  width: min(680px, calc(100% - 24px));
  margin: 28px auto 30px;
}

.work-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-view {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.work-panel {
  min-width: 0;
  overflow: hidden;
  padding: 0;
}

.hidden {
  display: none;
}

.panel-heading,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-muted {
  background: var(--surface-alt);
  color: var(--muted);
}

.badge-ok {
  background: #dff3e8;
  color: #14532d;
}

.badge-warn {
  background: #fff3d6;
  color: #6f4d12;
}

.metadata-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.metadata-list div {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 750;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

button.secondary:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: #b8c5be;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.count-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.count-control input {
  width: 84px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.summary-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  min-height: 60px;
}

.totals-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-metric,
.total-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 11px;
  font-weight: 750;
}

.summary-metric span,
.total-currency {
  color: var(--muted);
  font-weight: 650;
}

.summary-metric strong,
.total-pill strong {
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  background: #fbfcfa;
}

td {
  font-size: 14px;
}

.numeric {
  text-align: right;
}

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

.approval-output {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
}

progress {
  width: 100%;
  height: 12px;
  accent-color: var(--blue);
}

pre {
  min-height: 68px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101815;
  color: #e8f2ee;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.error {
  color: var(--danger);
}

.warning {
  color: var(--warning);
}

@media (max-width: 820px) {
  .app-header {
    flex-wrap: wrap;
  }

  .top-nav {
    width: 100%;
    margin-left: 0;
  }

  .top-nav button {
    flex: 1;
  }

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

  .toolbar-actions {
    align-items: stretch;
  }

  .toolbar-actions button,
  .count-control {
    flex: 1 1 150px;
  }

  th,
  td {
    padding: 11px 12px;
  }
}
