:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #18201c;
  --muted: #64706a;
  --line: #d8dfda;
  --green: #16784f;
  --red: #b33a3a;
  --blue: #2368a2;
  --gold: #a47519;
  --ink-soft: #28342e;
  --shadow: 0 10px 28px rgba(21, 31, 26, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  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,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--ink-soft);
  border-radius: 6px;
  background: var(--ink-soft);
  color: #fff;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 245, 0.94);
  backdrop-filter: blur(12px);
}

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

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

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

h1 {
  font-size: 18px;
  line-height: 1.1;
}

h2 {
  font-size: 15px;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.home-link:hover {
  border-color: var(--ink-soft);
}

.mode-banner {
  display: grid;
  gap: 2px;
  justify-items: end;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
}

.mode-banner strong {
  color: var(--green);
  font-size: 13px;
  text-transform: uppercase;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.shell {
  padding: 18px;
}

.demo-disclosure {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid #d9b253;
  border-radius: 8px;
  background: #fff8e6;
  color: #4a3410;
  padding: 11px 14px;
}

.demo-disclosure strong {
  flex: 0 0 auto;
  text-transform: uppercase;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

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

.metric {
  padding: 12px 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 21px;
}

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

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

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

.panel {
  padding: 14px;
}

.panel.tight {
  display: grid;
  gap: 12px;
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
  min-height: 36px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hidden {
  display: none;
}

.chart-panel {
  min-height: 332px;
}

canvas {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(#ffffff, #fbfcfb);
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 999px;
}

.swatch.pnl {
  background: var(--green);
}

.swatch.risk {
  background: var(--blue);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  background: #f8faf8;
}

tr:last-child td {
  border-bottom: 0;
}

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

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

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.item-title {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.item-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.pill.pending {
  background: var(--gold);
}

.pill.good {
  background: var(--green);
}

.pill.bad {
  background: var(--red);
}

.pill.neutral {
  background: var(--blue);
}

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

.row-actions button {
  min-height: 30px;
  padding: 0 9px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(420px, calc(100vw - 32px));
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(140%);
  transition: transform 160ms ease;
}

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

@media (max-width: 980px) {
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    padding: 12px;
    flex-wrap: wrap;
  }

  .mode-banner {
    justify-items: start;
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .demo-disclosure {
    align-items: flex-start;
    flex-direction: column;
  }

  .shell {
    padding: 10px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

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