:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #687384;
  --line: #d8dee7;
  --panel: #ffffff;
  --soft: #f4f7fa;
  --navy: #17324d;
  --blue: #2f6f9f;
  --teal: #238779;
  --gold: #c59228;
  --red: #b6473f;
  --amber: #bd7f22;
  --green: #2f8651;
  --shadow: 0 16px 50px rgba(23, 32, 42, 0.1);
  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;
  background: var(--soft);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.7rem 0.95rem;
}

button:hover {
  filter: brightness(1.05);
}

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 1.4rem clamp(1rem, 4vw, 3rem);
  position: sticky;
  top: 0;
  z-index: 4;
}

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

.topbar h1 {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1;
}

.eyebrow,
.label {
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 0.6rem;
}

.icon-button {
  align-items: center;
  aspect-ratio: 1;
  display: inline-flex;
  justify-content: center;
  padding: 0;
  width: 2.55rem;
}

.ghost-button {
  background: #eef3f7;
  color: var(--navy);
}

main {
  padding: 1.2rem clamp(1rem, 4vw, 3rem) 3rem;
}

.summary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1.2rem;
}

.metric-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04);
  padding: 1rem;
}

.metric-tile strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1.1;
  margin: 0.35rem 0;
}

.metric-tile small,
.panel-header p,
.note,
.tracking-note,
.owner-card p,
.gap {
  color: var(--muted);
}

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

.sidebar,
.content-stack,
#goalDialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  position: sticky;
  top: 6rem;
}

.control-block {
  display: grid;
  gap: 0.4rem;
}

label {
  color: var(--ink);
  display: grid;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 0.4rem;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 2.65rem;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

.content-stack {
  overflow: hidden;
}

.tabs {
  background: #eef3f7;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem;
}

.tab {
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 10px rgba(23, 32, 42, 0.08);
}

.view {
  display: none;
  padding: 1rem;
}

.view.active {
  display: block;
}

.panel-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1.25rem;
}

.count-pill,
.area-chip,
.status-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
}

.count-pill,
.area-chip {
  background: #eaf3f5;
  color: var(--blue);
}

.goal-list,
.kpi-list {
  display: grid;
  gap: 0.9rem;
}

.goal-card,
.kpi-card,
.owner-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.goal-card-main,
.owner-head,
.card-actions {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.goal-card h3 {
  font-size: 1.03rem;
  line-height: 1.25;
  margin-top: 0.6rem;
}

.status-pill.risk,
.dot.risk {
  background: #f8e4e0;
  color: var(--red);
}

.status-pill.watch,
.dot.watch {
  background: #fff0d8;
  color: var(--amber);
}

.status-pill.unknown,
.dot.unknown {
  background: #eceff3;
  color: #5d6572;
}

.status-pill.good,
.dot.good {
  background: #def3ea;
  color: var(--teal);
}

.status-pill.great,
.dot.great {
  background: #e1f2e5;
  color: var(--green);
}

.goal-meta {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1rem 0;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0.2rem 0 0;
}

.progress-row {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) 3rem;
  margin: 0.75rem 0;
}

.progress-track {
  background: #edf1f5;
  border-radius: 999px;
  height: 0.65rem;
  overflow: hidden;
}

.progress-track span {
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teal));
  display: block;
  height: 100%;
}

.note {
  line-height: 1.45;
}

.tracking-note {
  border-left: 3px solid var(--blue);
  margin-top: 0.75rem;
  padding-left: 0.75rem;
}

.card-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
}

.owner-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.owner-head strong {
  background: var(--navy);
  border-radius: 999px;
  color: #fff;
  min-width: 2.1rem;
  padding: 0.3rem 0.55rem;
  text-align: center;
}

.owner-score {
  align-items: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: 96px minmax(0, 1fr);
  margin-top: 1rem;
}

.radial {
  --score: 0;
  align-items: center;
  aspect-ratio: 1;
  background: conic-gradient(var(--teal) calc(var(--score) * 1%), #e9eef3 0);
  border-radius: 50%;
  display: flex;
  justify-content: center;
}

.radial span {
  align-items: center;
  background: #fff;
  border-radius: 50%;
  display: flex;
  font-weight: 900;
  height: 72%;
  justify-content: center;
  width: 72%;
}

.owner-score ul {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dot {
  border-radius: 50%;
  display: inline-block;
  height: 0.65rem;
  margin-right: 0.45rem;
  vertical-align: middle;
  width: 0.65rem;
}

.kpi-card {
  display: grid;
  gap: 0.45rem;
}

#goalDialog {
  max-width: min(720px, calc(100vw - 2rem));
  padding: 0;
  width: 720px;
}

#goalDialog::backdrop {
  background: rgba(23, 32, 42, 0.42);
}

#goalForm {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
}

.dialog-header {
  align-items: start;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-header h3 {
  font-size: 1.25rem;
  margin-top: 0.35rem;
}

.form-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

menu {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

@media (max-width: 980px) {
  .summary-grid,
  .dashboard-layout,
  .goal-meta,
  .owner-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sidebar {
    position: static;
  }

  .dashboard-layout {
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .topbar,
  .panel-header,
  .goal-card-main,
  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .dashboard-layout,
  .goal-meta,
  .owner-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    white-space: nowrap;
  }
}
