:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #142028;
  --muted: #62717c;
  --line: #dce3e8;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #b42318;
  --warning: #a15c07;
  --ok: #087443;
  --shadow: 0 12px 28px rgba(23, 34, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #101820;
  color: #edf5f4;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #21a99a;
  color: #06100f;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.side-note span {
  color: #aebbc1;
  font-size: 12px;
}

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

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d8e4e1;
  padding: 12px 14px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.side-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.side-note strong {
  display: block;
  margin-top: 4px;
  text-transform: capitalize;
}

.main {
  padding: 28px;
  min-width: 0;
}

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

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

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

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

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

.button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 800;
  min-height: 40px;
}

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

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics,
.product-grid,
.two-column,
.admin-grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.product-grid,
.two-column,
.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 28px;
}

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

.section-head p,
.muted {
  color: var(--muted);
}

.panel,
.product-card {
  padding: 18px;
  margin-bottom: 16px;
}

.product-card {
  display: grid;
  gap: 14px;
}

.product-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e7f5f2;
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quote-grid div {
  background: #f4f7f8;
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.quote-grid span,
.address-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.quote-grid strong,
.address-row strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.address-row {
  background: #f4f7f8;
  border-radius: 8px;
  padding: 10px;
}

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

.kv-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

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

.kv-list span {
  color: var(--muted);
}

.kv-list strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.output {
  min-height: 220px;
  white-space: pre-wrap;
  overflow: auto;
  padding: 14px;
  background: #101820;
  color: #dff5ee;
  border-radius: 8px;
}

.table {
  overflow: auto;
}

.row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.8fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row.header {
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
}

.row.compact-row {
  grid-template-columns: 150px 1fr 1.2fr;
}

.status-approved,
.status-settled,
.risk-low {
  color: var(--ok);
  font-weight: 900;
}

.status-pending,
.risk-medium {
  color: var(--warning);
  font-weight: 900;
}

.status-suspended,
.status-refunded,
.risk-high {
  color: var(--danger);
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 13px 15px;
  border-radius: 8px;
  background: #101820;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .metrics,
  .product-grid,
  .two-column,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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