:root {
  --paper: #f7f4ee;
  --surface: #fffdf8;
  --ink: #17211c;
  --muted: #667169;
  --line: #d8d0c4;
  --sage: #497768;
  --blue: #385f8f;
  --amber: #bd7a24;
  --red: #a8473f;
  --green: #2f7b53;
  --shadow: 0 18px 44px rgba(48, 42, 31, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", Arial, sans-serif;
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #10201b;
  color: #f7f4ee;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-logo {
  width: min(210px, 100%);
  height: auto;
  display: block;
  object-fit: contain;
}

.brand p,
.sync-panel p {
  margin: 0;
  font-weight: 700;
  line-height: 1.15;
}

.brand span,
.sync-panel span {
  color: rgba(247, 244, 238, 0.68);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  color: rgba(247, 244, 238, 0.74);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 8px;
}

.nav-list a.active,
.nav-list a:hover {
  background: rgba(247, 244, 238, 0.1);
  color: #fffdf8;
}

.nav-list svg,
.panel-heading svg,
button svg {
  width: 18px;
  height: 18px;
}

.sync-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(247, 244, 238, 0.16);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--amber);
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 0.95;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.header-actions,
.panel-heading,
.revenue-layout,
.referral-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

button {
  border: 0;
  cursor: pointer;
}

.icon-button,
.primary-button,
.text-button,
.segmented button {
  min-height: 40px;
  border-radius: 8px;
}

.icon-button {
  width: 42px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-button.small {
  width: 36px;
  min-height: 36px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  background: var(--ink);
  color: #fffdf8;
}

.text-button {
  padding: 0 14px;
  background: #fffdf8;
  color: var(--ink);
  border: 1px solid var(--line);
}

.alert-strip {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-left: 5px solid var(--amber);
  background: #fff8e9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.alert-strip span {
  color: var(--muted);
  margin-left: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi strong {
  display: block;
  margin: 12px 0 5px;
  font-family: "Roboto Mono", monospace;
  font-size: 26px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
}

.kpi .trend {
  color: var(--green);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 18px;
  align-items: start;
}

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

.revenue-panel,
.workload-panel {
  grid-column: span 2;
}

.panel-heading {
  margin-bottom: 18px;
}

.segmented {
  padding: 4px;
  display: flex;
  background: #eee8dc;
  border-radius: 8px;
  gap: 2px;
}

.segmented button {
  padding: 0 10px;
  min-height: 30px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(48, 42, 31, 0.12);
}

.big-number span {
  display: block;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 600;
}

.big-number p {
  color: var(--muted);
  margin-bottom: 0;
}

.bar-chart {
  height: 220px;
  min-width: 340px;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 26px;
}

.bar {
  min-height: 18px;
  background: linear-gradient(180deg, var(--blue), var(--sage));
  border-radius: 6px 6px 0 0;
  position: relative;
}

.bar span {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
}

.pipeline-list,
.review-list,
.deadline-list,
.mini-list {
  display: grid;
  gap: 10px;
}

.pipeline-row,
.review-row,
.deadline-row,
.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.pipeline-row:first-child,
.review-row:first-child,
.deadline-row:first-child,
.mini-row:first-child {
  border-top: 0;
}

.row-title {
  margin-bottom: 3px;
  font-weight: 700;
}

.row-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.count,
.risk,
.target-pill {
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf1ee;
  white-space: nowrap;
}

.risk.high {
  background: #f8e8e4;
  color: var(--red);
}

.risk.medium {
  background: #fff0d6;
  color: #83520f;
}

.risk.low {
  background: #e8f3ed;
  color: var(--green);
}

.workload-table {
  display: grid;
  gap: 12px;
}

.workload-row {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) 70px 80px;
  gap: 12px;
  align-items: center;
}

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

.meter span {
  display: block;
  height: 100%;
  background: var(--sage);
}

.review-panel {
  border-top: 5px solid var(--amber);
}

.referral-panel {
  border-top: 5px solid var(--blue);
}

.referral-meter {
  margin-bottom: 14px;
}

.referral-meter span {
  font-family: "Roboto Mono", monospace;
  font-size: 44px;
  font-weight: 600;
}

.referral-meter p {
  color: var(--muted);
  margin-bottom: 0;
}

.ring {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 68%, #e7dfd1 68% 100%);
  display: grid;
  place-items: center;
}

.ring span {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
}

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

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

  .nav-list {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

  .revenue-panel,
  .workload-panel {
    grid-column: span 2;
  }
}

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

  .topbar,
  .alert-strip,
  .revenue-layout {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .nav-list,
  .dashboard-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .revenue-panel,
  .workload-panel {
    grid-column: span 1;
  }

  .bar-chart {
    min-width: 0;
    height: 180px;
  }

  .workload-row {
    grid-template-columns: 1fr;
    gap: 7px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
}
