:root {
  --teal: #58c6b3;
  --teal-dark: #3ab4a0;
  --navy: #2b2e39;
  --navy-2: #242733;
  --blue: #3d63ea;
  --sky: #2f80ed;
  --green: #34a853;
  --amber: #f2aa3a;
  --orange: #e87722;
  --red: #e05252;
  --purple: #7c5cff;
  --cyan: #2898bd;
  --pink: #d9488f;
  --text: #0f172a;
  --muted: #75849a;
  --border: #e5e9f0;
  --panel: #f4f7fb;
  --white: #ffffff;
  --shadow: 0 14px 32px rgba(23, 43, 77, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--panel);
  font-family: Inter, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 400;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  font-synthesis-weight: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 12px 14px;
  color: #dce9f7;
  background: #2b2e39;
}

.brand {
  display: flex;
  align-items: center;
  padding: 0 0 2px;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 236px;
  height: auto;
  object-fit: contain;
}

.product-name {
  padding: 2px 12px 8px;
}

.product-name > span {
  display: block;
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.product-name > span span {
  color: var(--teal);
}

.product-name small {
  display: block;
  margin-top: 7px;
  color: #c4d4e4;
  font-size: 12px;
  font-weight: 400;
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  padding: 0 0 6px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  color: #dbe7f4;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(88, 198, 179, 0.22);
  box-shadow: inset 3px 0 0 var(--teal);
}

.nav-icon {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  font-size: 12px;
}

.nav-badge,
.pill {
  display: inline-grid;
  min-width: 24px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: #ffffff;
  background: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.profile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 8px 0;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.profile strong,
.profile span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile strong {
  color: #ffffff;
  font-size: 13px;
}

.profile span {
  color: #a9bad0;
  font-size: 11px;
}

.workspace {
  min-width: 0;
  background: var(--panel);
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  background: #ffffff;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  font-size: 23px;
  font-weight: 700;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.search-box {
  width: min(470px, 42vw);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  background: #ffffff;
  font-weight: 800;
}

.danger-dot {
  position: relative;
}

.danger-dot::after {
  content: "12";
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  color: #ffffff;
  background: var(--red);
  font-size: 9px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.status-row strong {
  color: var(--text);
  margin-right: 10px;
}

.view-root {
  max-width: 1700px;
  padding: 24px 32px 32px;
}

.grid {
  display: grid;
  gap: 20px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.card,
.table-panel,
.hero-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.035);
}

.card {
  padding: 20px;
}

.kpi-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  gap: 12px;
}

.kpi-card h3,
.panel-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 8px;
  font-size: 25px;
  font-weight: 700;
}

.trend {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.trend.up {
  color: var(--green);
}

.kpi-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 800;
}

.tone-red { color: var(--red); }
.tone-amber { color: var(--amber); }
.tone-green { color: var(--green); }
.tone-blue { color: var(--blue); }
.tone-purple { color: var(--purple); }
.tone-orange { color: var(--orange); }
.tone-cyan { color: var(--cyan); }
.bg-red { background: #fee2e2; }
.bg-amber { background: #ffedd5; }
.bg-green { background: #dcfce7; }
.bg-blue { background: #dbeafe; }
.bg-purple { background: #ede9fe; }
.bg-orange { background: #ffedd5; }
.bg-cyan { background: #dff6fb; }

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.dashboard-main,
.right-rail {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  grid-template-columns: 1.25fr 1fr;
  margin-top: 16px;
}

.three-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.panel-header p {
  color: var(--muted);
  font-size: 13px;
}

.link-button {
  border: 0;
  color: #1359be;
  background: transparent;
  font-weight: 800;
}

.row-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.map-and-risk {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  align-items: center;
}

.world-map {
  position: relative;
  min-height: 245px;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 22% 33%, #e1e7ef 0 10%, transparent 10.5%),
    radial-gradient(ellipse at 43% 29%, #e1e7ef 0 14%, transparent 14.5%),
    radial-gradient(ellipse at 68% 38%, #e1e7ef 0 18%, transparent 18.5%),
    radial-gradient(ellipse at 53% 67%, #e1e7ef 0 7%, transparent 7.5%),
    radial-gradient(ellipse at 78% 71%, #e1e7ef 0 8%, transparent 8.5%),
    linear-gradient(180deg, #fbfcfe, #f4f7fb);
}

.risk-pin {
  position: absolute;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 5px 16px rgba(23, 43, 77, 0.16);
  transform: translate(-50%, -50%);
}

.risk-pin b {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}

.risk-pin.critical { background: #b86b6b; }
.risk-pin.high { background: #c79056; }
.risk-pin.medium { background: #c8a64f; }
.risk-pin.low { background: #6fa98f; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--dot);
}

.rank-list,
.feed-list,
.recommendation-list,
.agent-list,
.metric-stack {
  display: grid;
  gap: 10px;
}

.rank-row,
.feed-item,
.recommendation,
.agent-row,
.metric-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #edf1f6;
  padding: 10px 0;
}

.rank-row:last-child,
.feed-item:last-child,
.recommendation:last-child,
.agent-row:last-child,
.metric-row:last-child {
  border-bottom: 0;
}

.rank-row button,
.data-table button {
  border: 0;
  color: #1359be;
  background: transparent;
  font-weight: 800;
}

.score {
  font-weight: 900;
}

.score.critical { color: var(--red); }
.score.high { color: #f97316; }
.score.medium { color: #ca8a04; }
.score.low { color: var(--green); }

.donut-wrap {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut {
  --segments: conic-gradient(var(--red) 0 11%, #f97316 11% 33%, #facc15 33% 69%, var(--green) 69% 92%, var(--blue) 92% 100%);
  width: 210px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--segments);
}

.donut-center {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  text-align: center;
  font-weight: 800;
}

.donut-center span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.donut-center strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
}

.breakdown {
  display: grid;
  gap: 12px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
}

.feed-flag {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.item-title {
  font-weight: 800;
}

.item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-grid;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--tag-color, var(--text));
  background: var(--tag-bg, var(--panel));
  font-size: 11px;
  font-weight: 700;
}

.tag-red { --tag-bg: #fee2e2; --tag-color: #b91c1c; }
.tag-amber { --tag-bg: #fff7df; --tag-color: #a15f00; }
.tag-green { --tag-bg: #e5f8eb; --tag-color: #1f7a3b; }
.tag-blue { --tag-bg: #e6edff; --tag-color: #264fc8; }
.tag-purple { --tag-bg: #efebff; --tag-color: #5d43cc; }

.recommendation-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.recommendation {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  border: 0;
  border-right: 1px solid var(--border);
  padding: 10px 16px;
}

.recommendation:last-child {
  border-right: 0;
}

.rec-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 900;
}

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

.list-shell {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.command-bar,
.list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment,
.filter-select,
.primary-button,
.secondary-button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 11px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.segment.active,
.primary-button {
  border-color: var(--teal);
  color: #ffffff;
  background: var(--teal-dark);
}

.secondary-button {
  color: #1359be;
}

.table-panel {
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

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

.data-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

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

.data-table tr:hover {
  background: #f8fbff;
}

.data-table select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 7px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}

.click-row {
  cursor: pointer;
}

.row-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  margin-right: 9px;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.record-count {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-card {
  min-height: 210px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 22px;
  background:
    linear-gradient(120deg, #ffffff 0 58%, rgba(0, 183, 168, 0.08)),
    #ffffff;
}

.hero-panel h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.hero-panel p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

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

.mini-metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

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

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

.reference-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.engine-hero {
  grid-template-columns: minmax(0, 1fr) 280px;
}

.engine-summary {
  min-height: 100%;
  display: grid;
  align-content: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: #f8fbff;
}

.engine-summary strong {
  font-size: 18px;
}

.engine-summary p,
.score-card p,
.capability-card p,
.source-note span {
  color: var(--muted);
  line-height: 1.5;
}

.score-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.score-card {
  display: grid;
  gap: 12px;
}

.score-number {
  font-size: 34px;
  font-weight: 800;
}

.score-number.critical { color: #b86b6b; }
.score-number.high { color: #c79056; }
.score-number.medium { color: #c8a64f; }

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

.capability-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.capability-card {
  min-height: 150px;
}

.source-note {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.timeline {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 12px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 2px var(--dot);
}

.progress-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.progress-bar span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--bar, var(--teal));
}

.agent-row {
  grid-template-columns: 42px minmax(0, 1fr) 96px;
}

.agent-state {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: var(--accent, var(--blue));
}

.accent-red { --accent: var(--red); }
.accent-amber { --accent: var(--amber); }
.accent-green { --accent: var(--green); }
.accent-blue { --accent: var(--blue); }
.accent-purple { --accent: var(--purple); }
.accent-orange { --accent: var(--orange); }

.assistant-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 20px;
}

.assistant-card,
.assistant-chat {
  display: grid;
  gap: 12px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chips button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: #294a72;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
}

.chat-log {
  display: grid;
  gap: 10px;
}

.chat {
  max-width: 82%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.45;
}

.chat.agent {
  background: #f8fbff;
}

.chat.user {
  justify-self: end;
  color: #ffffff;
  background: var(--blue);
}

.ask-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 4px;
}

.ask-box input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
  font-size: 12px;
}

.mini-table td:first-child {
  color: var(--muted);
  font-weight: 700;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(8, 23, 43, 0.28);
}

.drawer {
  position: fixed;
  z-index: 11;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.drawer-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding: 22px;
  background: #ffffff;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.drawer-body {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.drawer-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.drawer-section h3 {
  margin-bottom: 10px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

  .dashboard-grid,
  .dashboard-layout,
  .three-grid,
  .two-grid,
  .recommendation-grid,
  .hero-panel,
  .engine-hero,
  .score-grid,
  .indicator-grid,
  .capability-grid,
  .assistant-workspace,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .recommendation {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

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

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

  .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .map-and-risk,
  .donut-wrap,
  .hero-metrics,
  .indicator-grid {
    grid-template-columns: 1fr;
  }

  .view-root {
    padding: 16px;
  }

  .data-table {
    min-width: 760px;
  }

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

@media (max-width: 560px) {
  .nav-list,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 16px;
  }
}
