:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --panel: #fff;
  --ink: #14263b;
  --muted: #64748b;
  --border: #e0e7ee;
  --accent: #087e78;
  --accent-light: #e5f5f1;
  --bad: #b64040;
  --warn: #946514;
  --shadow: 0 6px 24px #24374b05;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.65 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}
a {
  color: var(--accent);
  text-decoration: none;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  outline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #55b9b1;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
.skip-link {
  position: fixed;
  top: -80px;
  left: 240px;
  padding: 12px;
  background: #fff;
  z-index: 10;
}
.skip-link:focus {
  top: 8px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 224px;
  padding: 32px 18px;
  background: #111f30;
  color: #c5d2df;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 12px 35px;
  color: #f8fafc;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.5px;
}
.brand-mark {
  width: 35px;
  height: 39px;
  border: 1px solid #59b9af;
  background: #1e454d;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #c9fff2;
  font-size: 25px;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: #8a9eaf;
  font-weight: 500;
}
.workspace-label {
  font-size: 11px;
  color: #8396a8;
  padding: 0 16px 14px;
  letter-spacing: 1px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-item {
  padding: 12px 16px;
  border-radius: 9px;
  color: #acbecf;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
}
.nav-item:hover {
  background: #1b2e43;
  color: #fff;
}
.nav-item.active {
  background: #213b49;
  color: #bcf4e5;
  box-shadow: inset 3px 0 #68cbb8;
}
.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 20px;
  line-height: 1;
}
.sidebar-note {
  margin-top: auto;
  padding: 28px 16px 0;
  font-size: 10px;
  letter-spacing: 2px;
  color: #8caaa9;
}
.sidebar-note p {
  font-size: 12px;
  letter-spacing: 0;
  color: #718a9b;
  line-height: 1.8;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #81c3b1;
  margin-right: 8px;
}
.workspace {
  margin-left: 224px;
}
.topbar {
  min-height: 77px;
  padding: 18px 38px;
  border-bottom: 1px solid var(--border);
  background: #ffffffbd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar > div,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 17px;
}
.mode-pill {
  background: #eaf0f5;
  border: 1px solid #dce5ed;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.connection {
  font-size: 12px;
  color: var(--muted);
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  white-space: nowrap;
}
.button:hover {
  border-color: #adc5ce;
  background: #f8fbfc;
}
.button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.button.small {
  padding: 4px 9px;
  font-size: 12px;
}
.button.link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding-left: 0;
}
main {
  padding: 35px 38px 28px;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 137px);
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 26px;
}
.eyebrow {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  margin: 0 0 5px;
}
h1 {
  font-size: 28px;
  line-height: 1.35;
  letter-spacing: -0.7px;
  margin: 0 0 7px;
  font-weight: 650;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.updated {
  font-size: 11px;
  color: #7b899b;
  text-align: right;
  flex-shrink: 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 23px;
}
.metric {
  padding: 21px 23px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.metric-label {
  color: var(--muted);
  font-size: 12px;
}
.metric-value {
  font-size: 32px;
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: -1px;
}
.metric-note {
  font-size: 11px;
  color: #8995a6;
}
.metric.good .metric-value {
  color: var(--accent);
}
.metric.danger .metric-value {
  color: var(--bad);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-header {
  padding: 19px 23px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
h2 {
  font-size: 16px;
  letter-spacing: -0.2px;
  line-height: 1.5;
  margin: 0;
  font-weight: 650;
}
.panel-body {
  padding: 21px 23px;
}
.panel-header p {
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0 0;
}
.grid-two {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
}
.grid-two > .panel {
  min-width: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.mono {
  font:
    12px/1.6 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  overflow-wrap: anywhere;
}
.break {
  overflow-wrap: anywhere;
}
.banner {
  border: 1px solid #e9d9a8;
  border-left: 3px solid #b68937;
  border-radius: 8px;
  background: #fffbef;
  padding: 12px 17px;
  margin: 0 0 20px;
  color: #79551e;
  font-size: 13px;
}
.banner.good {
  background: #eff9f6;
  border-color: #c5e3d9;
  color: #296557;
}
.banner.error {
  background: #fff4f3;
  border-color: #ecc8c4;
  color: #913e37;
}
.banner p {
  margin: 4px 0 0;
}
.empty-state {
  text-align: center;
  padding: 45px 24px;
  color: var(--muted);
}
.empty-state strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 7px;
}
.empty-state p {
  max-width: 560px;
  margin: 7px auto 0;
  font-size: 13px;
}
.empty-icon {
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: 13px;
  color: #91b5b7;
}
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
th {
  font-weight: 500;
  color: #7c8c9e;
  background: #f9fbfc;
  font-size: 11px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 17px 22px;
  border-bottom: 1px solid #ecf0f4;
  font-size: 12px;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #fbfdfd;
}
td .subtext {
  display: block;
  font-size: 10px;
  color: #8a97a7;
  margin-top: 2px;
}
.row-title {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
}
.row-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  text-align: left;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  border-radius: 5px;
  padding: 3px 8px;
  font-weight: 500;
  white-space: nowrap;
  background: #eef2f6;
  color: #63758b;
}
.badge.good {
  background: #eaf6f1;
  color: #20765e;
}
.badge.bad {
  background: #fbebea;
  color: #b24c43;
}
.badge.wait {
  background: #fff5df;
  color: #996c22;
}
.badge.neutral {
  background: #edf1f7;
  color: #60748c;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
}
.toolbar-group {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
select,
input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
input[type="search"] {
  width: 250px;
  max-width: 100%;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 23px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.pagination-actions {
  display: flex;
  gap: 8px;
}
.fact-list {
  margin: 0;
}
.fact-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid #edf1f5;
}
.fact-row:last-child {
  border-bottom: 0;
}
.fact-row dt {
  color: var(--muted);
  font-size: 12px;
}
.fact-row dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.detail-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 19px;
}
.detail-heading h2 {
  font-size: 19px;
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 21px 27px;
  border-left: 1px solid #dbe7e5;
  margin-left: 5px;
}
.timeline li:before {
  content: "";
  position: absolute;
  left: -4px;
  top: 6px;
  width: 7px;
  height: 7px;
  background: #76a99e;
  border-radius: 50%;
}
.timeline li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.timeline time {
  display: block;
  font-size: 11px;
  color: #8a97a7;
}
.timeline strong {
  font-size: 12px;
  font-weight: 550;
}
.timeline p {
  font-size: 12px;
  color: var(--muted);
  margin: 3px 0 0;
}
.steps {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.step {
  padding: 7px 10px;
  border-radius: 7px;
  background: #f1f5f7;
  color: #7a8b9e;
  font-size: 12px;
}
.step.done {
  background: #eaf7f1;
  color: #24725c;
}
.step.current {
  background: #fff3d9;
  color: #8b6822;
}
.technical {
  margin: 18px 0 0;
  border-top: 1px solid var(--border);
  padding-top: 15px;
}
.technical summary {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.technical pre {
  font:
    11px/1.6 ui-monospace,
    Consolas,
    monospace;
  background: #f5f7fa;
  padding: 15px;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 440px;
  overflow: auto;
}
.help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}
.help-list li {
  padding: 5px 0;
}
.command {
  font-size: 12px;
  background: #f2f5f8;
  border-radius: 6px;
  padding: 10px 13px;
  overflow-wrap: anywhere;
  margin: 12px 0 0;
}
.inline-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 15px;
}
footer {
  padding: 17px 38px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: #8291a2;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
footer span {
  color: #8997a6;
}
@media (min-width: 1600px) {
  .metrics {
    gap: 22px;
  }
  .metric {
    padding: 25px 28px;
  }
  main {
    padding-top: 45px;
  }
}
@media (max-width: 1100px) {
  .sidebar {
    width: 190px;
    padding: 28px 12px;
  }
  .workspace {
    margin-left: 190px;
  }
  .brand {
    font-size: 19px;
    padding-left: 8px;
  }
  .topbar {
    padding: 17px 25px;
  }
  main {
    padding: 27px 25px;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 18px 16px;
  }
  .grid-two {
    grid-template-columns: 1fr;
  }
  td,
  th {
    padding-left: 15px;
    padding-right: 15px;
  }
  footer {
    padding: 16px 25px;
  }
  .connection {
    max-width: 200px;
  }
  .metric-value {
    font-size: 29px;
  }
}
@media (max-width: 720px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 17px 17px 10px;
  }
  .brand {
    padding: 0 0 16px;
    font-size: 19px;
  }
  .brand small {
    display: inline;
    margin-left: 10px;
    letter-spacing: 1px;
  }
  .brand-mark {
    width: 28px;
    height: 31px;
    font-size: 20px;
  }
  .workspace-label,
  .sidebar-note {
    display: none;
  }
  .sidebar nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 3px;
  }
  .nav-item {
    padding: 9px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .nav-icon {
    display: none;
  }
  .nav-item.active {
    box-shadow: inset 0 -2px #68cbb8;
  }
  .workspace {
    margin-left: 0;
  }
  .topbar {
    padding: 13px 17px;
    min-height: 62px;
    gap: 8px;
  }
  .topbar > div {
    gap: 8px;
  }
  .connection {
    font-size: 10px;
    max-width: 135px;
  }
  .topbar-actions .button {
    padding: 5px 9px;
    font-size: 11px;
  }
  .mode-pill {
    font-size: 10px;
    padding: 3px 6px;
  }
  main {
    padding: 25px 17px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .updated {
    font-size: 10px;
    max-width: 90px;
  }
  h1 {
    font-size: 24px;
  }
  .subtitle {
    font-size: 12px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric {
    padding: 16px;
  }
  .metric-value {
    font-size: 29px;
  }
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  input[type="search"] {
    width: 180px;
  }
  .panel-header,
  .panel-body {
    padding: 17px;
  }
  .fact-row {
    grid-template-columns: 1fr 1.5fr;
  }
  .pagination {
    padding: 12px 16px;
  }
  footer {
    padding: 16px 17px;
    flex-direction: column;
  }
  .detail-heading h2 {
    font-size: 16px;
  }
  .skip-link {
    left: 10px;
  }
}

/* Account and device onboarding uses the same small shell in both locations. */
#account-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.account-label { font-size: .82rem; overflow-wrap: anywhere; }
.scope-label { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.5rem; color: var(--muted); }
select, .onboarding input { font: inherit; color: inherit; background: transparent; border: 1px solid #536575; border-radius: .6rem; padding: .6rem; max-width: 100%; }
.onboarding { padding: 1.5rem; max-width: 850px; }
.onboarding p { line-height: 1.7; }
.onboarding label { display: grid; gap: .5rem; margin: 1.2rem 0; max-width: 25rem; }
.onboarding .button { margin: .4rem .6rem .4rem 0; }
.onboarding-step, .device-row { padding: 1rem; margin: 1rem 0; border: 1px solid #536575; border-radius: .7rem; }
.device-row { display: flex; flex-direction: column; gap: .6rem; overflow-wrap: anywhere; }
.pair-code { display: block; font-size: 1.8rem; letter-spacing: .15em; margin: 1rem 0; }
@media(max-width: 760px) { .topbar, .topbar-actions { flex-wrap: wrap; } .scope-label { align-items: start; flex-direction: column; } }

.landing { max-width: 950px; margin: 6vh auto; padding: 1.5rem; }
.landing .brand { margin-bottom: 2rem; }
.landing li { padding: .4rem 0; line-height: 1.6; }

/* Project member views share the existing console hierarchy and palette. */
.project-page { min-width: 0; }
.project-panel { padding: 22px 24px; }
.project-panel > h2 { margin-bottom: 8px; }
.project-panel > p:first-of-type { margin-top: 4px; }
.project-panel .project-panel { box-shadow: none; margin-top: 18px; }
.project-form { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.project-form .form-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 190px; color: var(--muted); font-size: 12px; }
.project-form .form-field input, .project-form .form-field select, .project-form textarea { width: 100%; border-color: var(--border); background: #fff; }
.project-form textarea { min-width: 280px; padding: 12px; font: 12px/1.6 ui-monospace, monospace; resize: vertical; border-radius: 7px; color: var(--ink); }
.project-check { display: flex; align-items: start; gap: 9px; color: var(--ink); font-size: 13px; margin: 10px 0; }
.project-check input { margin-top: 5px; accent-color: var(--accent); }
.project-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 4px; }
.button.danger { color: var(--bad); border-color: #e5c7c4; }
.button.danger:hover { background: #fff4f3; }
.project-facets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project-facets .project-panel { margin: 0; min-width: 0; padding: 16px; }
.project-facets table { white-space: normal; }
.project-panel td { white-space: normal; overflow-wrap: anywhere; }
.project-selection { background: var(--accent-light); padding: 12px 16px; border-radius: 8px; color: var(--accent); }
.project-consent { padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #f8fbfc; white-space: pre-wrap; }
.project-form[data-project-editor="campaign"] { align-items: stretch; flex-direction: column; }
.project-form[data-project-editor="campaign"] .form-field { flex-basis: auto; max-width: 450px; }
.project-panel > .button { margin: 4px 8px 4px 0; }
@media (max-width: 760px) {
  .project-panel { padding: 17px; }
  .project-facets { grid-template-columns: 1fr; }
  .project-form { align-items: stretch; }
  .project-form .form-field { flex-basis: 100%; }
  .project-form textarea { min-width: 0; }
  .project-panel .metric-value { font-size: 27px; }
}

.collection-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); list-style: none; padding: 0; gap: 10px; margin: 20px 0; }
.collection-stages li { display: flex; flex-direction: column; gap: 7px; padding: 14px; background: #f8fbfc; border: 1px solid var(--border); border-radius: 8px; }
.collection-stages strong { font-size: 13px; }
.collection-stages span { color: var(--muted); font-size: 12px; }
.collection-advanced { margin: 24px 0; }
.collection-advanced > summary { cursor: pointer; padding: 16px; color: var(--muted); border: 1px solid var(--border); border-radius: 8px; }
.collection-advanced[open] > summary { margin-bottom: 18px; }
.collection-binding, .collection-settings { width: 100%; }
.collection-settings .form-field:last-of-type { flex-basis: 100%; }
.collection-settings textarea { font: inherit; }

/* Task navigation: a small main menu, details stay with their task. */
.secondary-nav { margin-top: 2rem; border-top: 1px solid var(--border, #dce3e9); padding-top: 1rem; }
.task-tabs { display:flex; gap:.6rem; flex-wrap:wrap; margin:0 0 1.2rem; }
.task-tab { padding:.5rem .85rem; border-radius:.5rem; color:inherit; text-decoration:none; }
.task-tab.active { background:#e2ede9; color:#174d3d; font-weight:700; }
[hidden] { display:none !important; }
.primary-task { border-left:4px solid #28705b; }

/* Dataset workspaces keep the library first and long reports out of the main list. */
.dataset-tabs { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 24px; border-bottom:1px solid var(--border, #dce5ed); padding-bottom:16px; }
.dataset-workspace .project-panel { margin-bottom:20px; }
.dataset-workspace details { margin-top:16px; }
.dataset-workspace summary { cursor:pointer; font-weight:600; padding:10px 0; }
.dataset-workspace .subtext { display:block; }
.dataset-workspace table td { vertical-align:top; }
.dataset-workspace .project-form { margin-bottom:20px; }
.dataset-workspace .project-form > details { flex-basis:100%; width:100%; }

.dataset-tabs .dataset-secondary { font-size:.875rem; padding:.5rem .75rem; align-self:center; }
.dataset-tabs .dataset-secondary:not(.primary) { background:transparent; border-color:transparent; color:var(--muted); }
.dataset-tabs [data-action="dataset-tab-previews"] { margin-left:auto; }
