:root {
  --ink: #16201f;
  --muted: #6d7773;
  --line: #dde5df;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-soft: #d8f3ee;
  --coral: #d94f45;
  --coral-soft: #ffe3de;
  --amber: #bd7b12;
  --amber-soft: #fff0cc;
  --blue: #2767ad;
  --blue-soft: #e2eefb;
  --green: #287a46;
  --green-soft: #e3f5e8;
  --shadow: 0 18px 45px rgba(22, 32, 31, 0.09);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.06), transparent 40%),
    var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand-row,
.child-pill,
.nav-item,
.device-row,
.metric-card,
.panel-head,
.topbar,
.topbar-actions,
.search-box,
.action-row,
.notification-card,
.detail-row {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark,
.metric-icon,
.notification-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark {
  background: #e5fff6;
  color: #0f766e;
}

.brand-mark i,
.metric-icon i,
.nav-item i,
.child-pill i,
.device-row i,
.icon-button i,
.primary-action i,
.secondary-action i,
.ghost-action i,
.search-box i,
.notification-icon i {
  width: 20px;
  height: 20px;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-caption {
  color: #a8bbb5;
  font-size: 13px;
  margin-top: 2px;
}

.nav-stack,
.family-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.child-pill {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cfe0dc;
  min-height: 44px;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover,
.child-pill.active,
.child-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.section-label,
.eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--muted);
}

.sidebar .section-label {
  color: #8eaaa3;
  margin: 0 0 6px 6px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.avatar-all {
  background: #e5fff6;
  color: #0f766e;
}

.avatar-a {
  background: #ffe3de;
  color: #a3342c;
}

.avatar-n {
  background: #e2eefb;
  color: #22558e;
}

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

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
  margin-top: 6px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar-copy {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-box {
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  min-height: 44px;
  min-width: 240px;
}

.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  color: var(--ink);
}

.primary-action,
.secondary-action,
.ghost-action,
.icon-button {
  border-radius: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-action {
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.22);
}

.secondary-action {
  background: var(--ink);
  color: #ffffff;
}

.ghost-action,
.icon-button {
  background: #f6f5ef;
  color: var(--ink);
  border-color: var(--line);
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  gap: 12px;
  min-height: 82px;
  box-shadow: 0 10px 25px rgba(22, 32, 31, 0.05);
}

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

.metric-card strong {
  font-size: 26px;
  line-height: 1;
}

.metric-icon {
  background: var(--coral-soft);
  color: var(--coral);
}

.metric-icon.safe {
  background: var(--green-soft);
  color: var(--green);
}

.metric-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.metric-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(290px, 0.8fr) minmax(300px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.alerts-panel {
  grid-row: span 3;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.segmented {
  background: #f1f1ea;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  padding: 3px;
}

.filter-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.filter-btn.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(22, 32, 31, 0.08);
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-item {
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  text-align: left;
  width: 100%;
  color: inherit;
}

.alert-item:hover,
.alert-item.active {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.12);
}

.risk-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.risk-icon.urgent {
  background: var(--coral-soft);
  color: var(--coral);
}

.risk-icon.watch {
  background: var(--amber-soft);
  color: var(--amber);
}

.risk-icon.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.risk-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.risk-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.severity {
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
  align-self: start;
  white-space: nowrap;
}

.severity-urgent {
  background: var(--coral-soft);
  color: #9f281f;
}

.severity-watch {
  background: var(--amber-soft);
  color: #8a5708;
}

.severity-reviewed {
  background: var(--green-soft);
  color: var(--green);
}

.live-dot {
  color: var(--green);
  font-weight: 800;
  font-size: 13px;
}

.live-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
  margin-right: 6px;
}

.phone-frame {
  width: min(100%, 260px);
  margin: 0 auto;
  border: 8px solid #182220;
  border-radius: 34px;
  background: #eef4ef;
  min-height: 480px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 20px 42px rgba(22, 32, 31, 0.22);
}

.phone-status {
  display: flex;
  justify-content: space-between;
  padding: 16px 16px 8px;
  font-size: 12px;
  font-weight: 800;
}

.phone-app {
  padding: 10px;
  display: grid;
  gap: 12px;
}

.notification-card {
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(22, 32, 31, 0.08);
  border-radius: 8px;
  padding: 12px;
}

.notification-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.notification-icon {
  width: 36px;
  height: 36px;
  background: var(--coral-soft);
  color: var(--coral);
}

.phone-summary {
  background: #112522;
  color: #eef8f4;
  border-radius: 8px;
  padding: 14px;
}

.phone-summary span {
  color: #9bb6af;
  font-size: 12px;
}

.phone-summary strong {
  display: block;
  margin-top: 4px;
}

.mini-bars,
.trend-bars {
  display: flex;
  align-items: end;
  gap: 7px;
}

.mini-bars {
  height: 74px;
  margin-top: 16px;
}

.mini-bars span,
.trend-bars span {
  flex: 1;
  border-radius: 6px 6px 0 0;
  background: #58d2be;
  min-height: 12px;
}

.detail-body {
  display: grid;
  gap: 10px;
}

.detail-row {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
  gap: 12px;
}

.detail-row span,
.evidence-box span {
  color: var(--muted);
  font-size: 13px;
}

.detail-row strong {
  text-align: right;
}

.evidence-box {
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 8px;
  padding: 12px;
}

.evidence-box p,
.summary-copy {
  color: #33413d;
  line-height: 1.6;
  margin-top: 6px;
}

.action-row {
  gap: 8px;
  flex-wrap: wrap;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.summary-chips span {
  border-radius: 6px;
  background: #f0f3ed;
  color: #40504b;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
}

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

.device-row {
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.device-row i {
  color: var(--teal);
  flex: 0 0 auto;
}

.device-row div {
  min-width: 0;
  flex: 1;
}

.device-row strong,
.device-row span {
  display: block;
}

.device-row span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.device-row b {
  color: var(--green);
  font-size: 12px;
}

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

.rule-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.rule-toggle input {
  accent-color: var(--teal);
}

.trend-bars {
  height: 180px;
  padding-top: 14px;
  border-bottom: 1px solid var(--line);
}

.trend-bars span {
  position: relative;
  background: linear-gradient(180deg, #d94f45, #bd7b12 48%, #0f766e);
  min-width: 18px;
}

.trend-bars b {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
}

.strategy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.wide-panel {
  grid-column: span 2;
}

.compact-action {
  min-height: 38px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pipeline-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  min-height: 142px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.pipeline-step::after {
  content: "";
  position: absolute;
  inset: auto 14px 12px 14px;
  height: 4px;
  border-radius: 99px;
  background: #e8ede8;
}

.pipeline-step.active::after {
  background: linear-gradient(90deg, var(--teal), #58d2be);
}

.pipeline-step i {
  width: 24px;
  height: 24px;
  color: var(--teal);
}

.pipeline-step strong,
.pipeline-step span {
  display: block;
}

.pipeline-step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.classifier-output {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.classifier-output div,
.market-grid div,
.sprint-board div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf5;
  padding: 12px;
}

.classifier-output span,
.market-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}

.classifier-output strong,
.market-grid strong {
  display: block;
}

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

.integration-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.integration-row i {
  color: var(--blue);
  width: 22px;
  height: 22px;
}

.integration-row.ready i {
  color: var(--green);
}

.integration-row strong,
.integration-row span {
  display: block;
}

.integration-row span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.integration-row b {
  color: var(--teal);
  font-size: 12px;
}

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

.playbook-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  counter-increment: playbook;
}

.playbook-list li::before {
  content: counter(playbook);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.playbook-list strong,
.playbook-list span {
  display: block;
  grid-column: 2;
}

.playbook-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 2px;
}

.sprint-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sprint-board span {
  color: var(--teal);
  font-weight: 900;
  font-size: 12px;
}

.sprint-board strong {
  display: block;
  margin-top: 8px;
}

.sprint-board p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 6px;
}

.roadmap-panel {
  grid-column: span 2;
}

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #102522;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 18px 40px rgba(16, 37, 34, 0.28);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: 180ms ease;
  font-weight: 800;
  max-width: 320px;
}

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

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

  .brand-row {
    justify-content: center;
  }

  .brand-row > div:not(.brand-mark),
  .nav-item span,
  .child-pill span:not(.avatar),
  .sidebar .section-label {
    display: none;
  }

  .sidebar {
    padding: 20px 12px;
    align-items: center;
  }

  .nav-item,
  .child-pill {
    justify-content: center;
    padding: 0;
  }

  .work-grid {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 0.8fr);
  }

  .strategy-grid {
    grid-template-columns: minmax(0, 1fr) minmax(290px, 0.8fr);
  }

  .wide-panel,
  .roadmap-panel {
    grid-column: span 2;
  }

  .pipeline,
  .sprint-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phone-panel {
    grid-row: span 2;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    height: auto;
    position: static;
    flex-direction: row;
    justify-content: space-between;
    overflow-x: auto;
    gap: 16px;
  }

  .brand-row > div:not(.brand-mark),
  .nav-item span {
    display: block;
  }

  .nav-stack,
  .family-list {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .child-pill span:not(.avatar),
  .sidebar .section-label {
    display: none;
  }

  .nav-item {
    width: auto;
    padding: 0 12px;
  }

  .dashboard {
    padding: 18px;
  }

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

  .topbar-actions,
  .search-box,
  .primary-action {
    width: 100%;
  }

  .metric-grid,
  .work-grid,
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .wide-panel,
  .roadmap-panel {
    grid-column: auto;
  }

  .pipeline,
  .classifier-output,
  .sprint-board {
    grid-template-columns: 1fr;
  }

  .alerts-panel {
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 26px;
  }

  .dashboard {
    padding: 14px;
  }

  .sidebar {
    padding: 12px;
  }

  .brand-row > div:not(.brand-mark),
  .nav-stack {
    display: none;
  }

  .panel,
  .metric-card {
    padding: 14px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .filter-btn {
    flex: 1;
  }

  .alert-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .alert-item .severity {
    grid-column: 2;
    justify-self: start;
  }

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

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

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}
