:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --panel: #ffffff;
  --panel-soft: #eef4f5;
  --ink: #172026;
  --muted: #617077;
  --line: #d7e0de;
  --accent: #116466;
  --accent-strong: #0b4f55;
  --warning: #b75619;
  --critical: #b3263a;
  --high: #7b4c12;
  --watch: #2f6b45;
  --low: #56616b;
  --blue: #2764ad;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(245, 247, 243, 0.96)),
    repeating-linear-gradient(90deg, rgba(17, 100, 102, 0.07) 0 1px, transparent 1px 78px),
    repeating-linear-gradient(0deg, rgba(39, 100, 173, 0.06) 0 1px, transparent 1px 78px),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

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

.side-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(17, 100, 102, 0.35);
  border-radius: var(--radius);
  background: #e9f1ef;
  overflow: hidden;
}

.brand-mark span {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 50%;
  inset: var(--ring);
  opacity: var(--opacity);
}

.brand-mark span:nth-child(1) { --ring: 8px; --opacity: 0.95; }
.brand-mark span:nth-child(2) { --ring: 15px; --opacity: 0.65; }
.brand-mark span:nth-child(3) { --ring: 22px; --opacity: 0.9; background: var(--accent); }

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

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

h1 {
  margin-bottom: 0;
  font-size: 1.4rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2vw, 2.15rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.control-block {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

label,
.label-row {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

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

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

.chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.chip.is-active {
  border-color: rgba(17, 100, 102, 0.5);
  background: #d9ece8;
  color: var(--accent-strong);
}

select,
input[type="time"] {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

.reminder-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.reminder-time {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.reminder-time button,
.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 800;
}

.reminder-time button,
.primary-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: #fff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent-strong);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #adb8bc;
}

.status-dot.is-on {
  background: var(--watch);
}

.reminder-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

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

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

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

.metric-tile {
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(23, 32, 38, 0.06);
}

.metric-tile span,
.metric-tile small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.metric-tile strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 2rem;
  line-height: 1;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.55fr);
  gap: 16px;
  margin-bottom: 16px;
  min-width: 0;
}

.radar-panel,
.focus-panel,
.signal-column,
.watchlist-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(23, 32, 38, 0.06);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.section-heading > div {
  min-width: 0;
}

.section-heading select {
  max-width: 150px;
}

.radar-map {
  position: relative;
  min-height: 360px;
  margin: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(23, 32, 38, 0.15) 50%, transparent 50.3%),
    linear-gradient(0deg, transparent 49.7%, rgba(23, 32, 38, 0.15) 50%, transparent 50.3%),
    linear-gradient(135deg, rgba(17, 100, 102, 0.08), rgba(39, 100, 173, 0.08));
  overflow: hidden;
}

.radar-map::before,
.radar-map::after {
  position: absolute;
  color: rgba(23, 32, 38, 0.52);
  font-size: 0.75rem;
  font-weight: 800;
}

.radar-map::before {
  content: "Higher edge impact";
  top: 12px;
  left: 14px;
}

.radar-map::after {
  content: "More feasible";
  right: 14px;
  bottom: 12px;
}

.radar-point {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 0.72rem;
  font-weight: 900;
}

.radar-point.is-critical { background: var(--critical); }
.radar-point.is-high { background: var(--high); }
.radar-point.is-watch { background: var(--watch); }
.radar-point.is-low { background: var(--low); }

.focus-panel {
  min-height: 360px;
}

.icon-link {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent-strong);
  text-decoration: none;
}

.focus-score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.focus-score span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.focus-score strong {
  font-size: 3rem;
  line-height: 1;
}

#focusSummary {
  padding: 14px 18px 4px;
  color: var(--muted);
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 18px;
}

.tag-row span,
.signal-meta span,
.watch-actions span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e9f1ef;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  min-width: 0;
}

.signal-list,
.watchlist {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.signal-card,
.watch-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.signal-button {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 14px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.signal-card.is-selected {
  border-color: rgba(17, 100, 102, 0.65);
  box-shadow: 0 0 0 3px rgba(17, 100, 102, 0.12);
}

.signal-main {
  min-width: 0;
}

.signal-headline {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 7px;
}

.signal-headline h4,
.watch-top h4 {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.impact-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--low);
  flex: 0 0 auto;
}

.impact-badge.is-critical { background: var(--critical); }
.impact-badge.is-high { background: var(--high); }
.impact-badge.is-watch { background: var(--watch); }

.signal-card p,
.watch-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.signal-meta,
.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.score-pill {
  display: grid;
  place-items: center;
  align-self: center;
  min-width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.watch-card {
  padding: 14px;
}

.watch-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.watch-top span {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
}

.result-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

  .side-panel {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .brand-lockup {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .control-block {
    margin-bottom: 0;
  }

  .workbench,
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard,
  .side-panel {
    padding: 16px;
  }

  .side-panel,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }

  .metrics-grid {
    gap: 10px;
  }

  .metric-tile {
    min-height: 92px;
  }

  .radar-map {
    min-height: 300px;
  }

  .focus-score strong {
    font-size: 2.4rem;
  }
}
