:root {
  color-scheme: light;
  --background: #f5f2eb;
  --surface: #ffffff;
  --surface-soft: #f9faf7;
  --text: #1f2726;
  --muted: #687370;
  --border: #d8ddd7;
  --accent: #216869;
  --accent-strong: #174f50;
  --warning: #9b5d18;
  --danger: #a63d40;
  --shadow: 0 18px 48px rgba(31, 39, 38, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.75rem, 2rem, 2.2rem);
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
}

.status {
  min-width: 128px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.status[data-state="ok"] {
  border-color: rgba(33, 104, 105, 0.28);
  color: var(--accent-strong);
}

.status[data-state="error"] {
  border-color: rgba(166, 61, 64, 0.28);
  color: var(--danger);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding-inline: 14px;
}

.ghost:hover {
  background: var(--surface-soft);
}

.login-panel {
  margin-bottom: 14px;
}

.login-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px;
  gap: 10px;
  align-items: end;
  padding: 14px;
}

.login-message {
  margin: 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 12px 14px 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 96px 128px;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(33, 104, 105, 0.15);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

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

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

.metric {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric strong {
  font-size: 1.6rem;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 13px 14px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.86rem;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

tbody tr:hover {
  background: #fbfcf7;
}

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

.amount {
  color: var(--accent-strong);
  font-weight: 800;
}

.side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 0.92rem;
}

.list li:last-child {
  border-bottom: 0;
}

.list strong {
  white-space: nowrap;
}

.empty {
  padding: 18px 14px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .toolbar,
  .metrics,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .top-actions,
  .status {
    text-align: left;
  }

  .top-actions,
  .login-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 14px;
  }

  .metric {
    min-height: 76px;
  }
}
