:root {
  --bg: #f3f7f8;
  --surface: #ffffff;
  --ink: #062f4f;
  --muted: #657789;
  --line: #d7e3e8;
  --brand: #13b8a6;
  --brand-dark: #06375c;
  --brand-mid: #0c7892;
  --accent: #24c7b7;
  --danger: #b42318;
  --ok: #0f8f66;
  --shadow: 0 18px 45px rgba(6, 47, 79, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  color: #f8fbfc;
  background: #062f4f;
}

.brand-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.brand-logo-card {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.brand-logo-card img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-copy {
  padding: 0 2px;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand-block p,
.sidebar-foot p {
  margin: 4px 0 0;
  color: #bfd1dd;
  font-size: 13px;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 6px 10px;
  color: #dbe5ee;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: rgba(19, 184, 166, 0.17);
  border-color: rgba(36, 199, 183, 0.28);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #dffefa;
  background: rgba(19, 184, 166, 0.2);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(19, 184, 166, 0.12);
}

.mini-score {
  margin-top: 8px;
  font-weight: 800;
  font-size: 36px;
}

.mini-score small {
  color: #bfd1dd;
  font-size: 16px;
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.topbar h2 {
  margin: 3px 0 0;
  font-size: 28px;
  letter-spacing: 0;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 8px;
  padding: 4px 9px;
  border: 1px solid #bfe8e2;
  border-radius: 8px;
  color: var(--brand-dark);
  background: #f1fffc;
  font-size: 12px;
  font-weight: 850;
}

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

.location-switcher {
  min-width: 210px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.location-switcher select {
  margin-top: 5px;
  min-height: 40px;
  text-transform: none;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid,
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

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

.score-panel {
  display: flex;
  gap: 24px;
  align-items: center;
}

.score-panel h3,
.panel h3 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.score-ring {
  position: relative;
  width: 150px;
  height: 150px;
  flex: 0 0 150px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-progress {
  fill: none;
  stroke-width: 12;
}

.ring-bg {
  stroke: #e6edf3;
}

.ring-progress {
  stroke: var(--brand);
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.25s ease;
}

.score-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.score-center span {
  font-size: 42px;
  font-weight: 850;
}

.score-center small {
  color: var(--muted);
}

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

.primary-button,
.ghost-button,
.text-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-weight: 750;
}

.primary-button {
  color: white;
  background: var(--brand-dark);
}

.primary-button:hover {
  background: #092a45;
}

.ghost-button {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.text-button {
  color: var(--brand-mid);
  background: transparent;
}

.table-link {
  min-height: 0;
  padding: 0;
  text-align: left;
}

.task-list,
.checklist,
.history-list {
  display: grid;
  gap: 10px;
}

.task-item,
.check-item,
.history-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.task-toggle,
.check-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: transparent;
}

.task-item.done .task-toggle,
.check-item.done .check-toggle {
  color: white;
  background: var(--brand);
  border-color: var(--brand);
}

.task-item h4,
.check-item h4,
.history-item h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.task-item p,
.check-item p,
.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.points {
  font-weight: 850;
  color: var(--brand-mid);
}

.metric-row,
.counter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric-row.compact {
  margin-top: 12px;
}

.metric-row div,
.counter-card {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  text-align: left;
}

.metric-row strong,
.counter-card strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}

.metric-row span,
.counter-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.counter-card {
  cursor: pointer;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.badge {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.badge.earned {
  border-color: rgba(21, 128, 61, 0.35);
  background: #ecfdf3;
}

.badge strong {
  display: block;
}

.badge span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.compliance-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #bfe8e2;
  border-radius: 8px;
  background: #f1fffc;
}

.compliance-card.inline {
  margin-top: 12px;
}

.compliance-card.blocked {
  border-color: #f2b8b5;
  background: #fff5f5;
}

.compliance-card.warning {
  border-color: #f7dc92;
  background: #fffbeb;
}

.compliance-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

label,
.wide-label {
  display: grid;
  gap: 7px;
  color: #324255;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

.wide-label {
  margin-top: 12px;
}

.variant-grid,
.photo-grid,
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.variant-card,
.photo-card,
.platform-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.variant-card textarea,
.platform-card textarea {
  min-height: 190px;
  margin: 12px 0;
}

.platform-card {
  display: grid;
  gap: 14px;
}

.platform-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.platform-card-header h3 {
  margin-top: 3px;
}

.platform-card select {
  min-width: 160px;
}

.instruction-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.instruction-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.instruction-block ol,
.instruction-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.instruction-block li + li {
  margin-top: 5px;
}

.posted-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f1fffc;
}

.posted-row p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.variant-actions,
.playbook-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.review-link-box {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  overflow-wrap: anywhere;
}

.review-link-box a {
  color: var(--brand-mid);
  font-weight: 800;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 8px;
  color: #05324f;
  background: #d8f8f3;
  font-weight: 800;
  font-size: 12px;
}

.status-pill.warn {
  background: #fef3c7;
}

.status-pill.risk {
  color: white;
  background: var(--danger);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  color: white;
  background: #15202b;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 47, 79, 0.74);
}

.onboarding-overlay.active {
  display: flex;
}

.onboarding-panel {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

.onboarding-logo {
  width: min(360px, 100%);
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.onboarding-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.onboarding-copy {
  max-width: 720px;
  margin-bottom: 18px;
}

.onboarding-copy h2 {
  margin: 5px 0 8px;
  font-size: 30px;
  letter-spacing: 0;
}

.onboarding-copy p {
  margin: 0;
  color: var(--muted);
}

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

.onboarding-wide {
  grid-column: 1 / -1;
}

.onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

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

  .sidebar {
    position: static;
    padding: 16px;
  }

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

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .nav-icon {
    display: none;
  }

  .sidebar-foot {
    display: none;
  }

  .dashboard-grid,
  .two-col,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 560px) {
  .main {
    padding: 14px;
  }

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

  .panel,
  .score-panel {
    padding: 15px;
  }

  .task-item,
  .check-item,
  .history-item {
    grid-template-columns: 38px 1fr;
  }

  .points {
    grid-column: 2;
  }

  .metric-row,
  .counter-grid {
    grid-template-columns: 1fr;
  }
}
