:root {
  color-scheme: light;
  --ink: #18232d;
  --ink-soft: #34424e;
  --muted: #687580;
  --line: #d9e0e5;
  --line-strong: #c4cdd4;
  --surface: #ffffff;
  --surface-soft: #f4f7f8;
  --page: #edf1f3;
  --accent: #087b70;
  --accent-dark: #05645c;
  --accent-soft: #e4f4f1;
  --blue: #2166a5;
  --blue-soft: #e8f1fa;
  --warning: #a15c00;
  --warning-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --success: #147a46;
  --success-soft: #e9f6ef;
  --shadow: 0 1px 2px rgba(24, 35, 45, .05);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--page); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { touch-action: manipulation; }

.hidden { display: none !important; }

.app-header {
  min-height: 76px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background: #18232d;
  border-bottom: 3px solid var(--accent);
}

.brand, .header-actions, .toolbar-actions, .button-row, .copy-field, .example-header {
  display: flex;
  align-items: center;
}

.brand { gap: 13px; min-width: 0; }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 680; }
.brand p { margin: 3px 0 0; color: #aebbc5; font-size: 12px; }

.brand-mark {
  width: 39px;
  height: 39px;
  position: relative;
  flex: 0 0 auto;
  border: 1px solid #55717b;
  background: #243640;
}
.brand-mark span, .brand-mark i, .brand-mark b {
  position: absolute;
  display: block;
  height: 3px;
  left: 7px;
  background: #7cd8ca;
}
.brand-mark span { top: 10px; width: 24px; }
.brand-mark i { top: 18px; width: 17px; }
.brand-mark b { top: 26px; width: 10px; }
.brand-mark::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
}

.header-actions { gap: 18px; }
.capture-endpoint {
  color: #dbe5ea;
  text-decoration: none;
  font: 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.endpoint-dot, .health-badge > span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #6ce0a4;
}
.health-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #40515c;
  color: #dce6eb;
  background: #22313b;
  font-size: 12px;
}
.health-badge.checking > span { background: #f0bb62; }
.health-badge.offline > span { background: #f27a70; }

.mode-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.mode-nav-inner { max-width: 1540px; margin: 0 auto; padding: 0 28px; display: flex; gap: 4px; }
.mode-tab {
  min-width: 205px;
  height: 68px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.mode-tab:hover { background: var(--surface-soft); }
.mode-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); background: #f7fbfa; }
.mode-tab strong, .mode-tab small { display: block; }
.mode-tab strong { font-size: 14px; }
.mode-tab small { margin-top: 1px; font-size: 11px; color: var(--muted); }
.tab-icon { width: 27px; font-size: 21px; text-align: center; color: var(--accent); }

.workspace {
  max-width: 1540px;
  margin: 0 auto;
  padding: 20px 28px 40px;
  display: grid;
  grid-template-columns: minmax(310px, 370px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.setup-column, .content-column { min-width: 0; display: grid; gap: 16px; }

.panel {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.panel-heading {
  margin-bottom: 17px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.panel-heading.compact { margin-bottom: 13px; }
.panel-heading h2, .drawer-header h2 { margin: 1px 0 0; font-size: 17px; line-height: 1.35; }
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.status-chip.guest { color: var(--blue); background: var(--blue-soft); }
.status-chip.running { color: var(--success); background: var(--success-soft); }
.status-chip.completed { color: var(--blue); background: var(--blue-soft); }
.status-chip.stopped, .status-chip.stalled { color: var(--warning); background: var(--warning-soft); }
.status-chip.neutral { color: var(--muted); background: var(--surface-soft); }

.field-label, .field-group legend {
  display: block;
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}
.field-label span, .field-group legend span { color: var(--muted); font-weight: 400; }
.field-group { margin: 17px 0 0; padding: 0; border: 0; }

input, textarea, select {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  outline: 0;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 123, 112, .11); }
input::placeholder { color: #9aa4ac; }

.platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.platform-option {
  min-width: 0;
  height: 46px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.platform-option:hover { border-color: #9eb0b7; background: #fafcfc; }
.platform-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.platform-option input { width: 15px; height: 15px; min-height: 0; margin: 0; accent-color: var(--accent); }
.platform-option .platform-name { min-width: 0; flex: 1; font-size: 12px; font-weight: 650; }
.platform-option .quantity { display: none; align-items: center; gap: 2px; }
.platform-option.selected .quantity { display: flex; }
.quantity button {
  width: 22px;
  height: 24px;
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  cursor: pointer;
}
.quantity output { width: 16px; text-align: center; font-size: 12px; font-weight: 700; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.segmented button {
  min-width: 0;
  min-height: 34px;
  padding: 5px 6px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { color: #fff; background: var(--ink-soft); }
.segmented.small { width: auto; grid-template-columns: repeat(3, auto); }
.segmented.small button { min-width: 72px; }

.field-help { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.privacy-note {
  margin-top: 17px;
  padding: 10px 11px;
  display: flex;
  gap: 9px;
  color: #53626d;
  background: var(--surface-soft);
  border-left: 3px solid #78909c;
  font-size: 11px;
}
.privacy-note > span { color: var(--accent); }
.privacy-note p { margin: 0; }
.privacy-note strong { display: block; margin-bottom: 1px; color: var(--ink-soft); }

.button, .icon-button {
  min-height: 35px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 620;
}
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.quiet, .icon-button { color: var(--ink-soft); background: #fff; border-color: var(--line-strong); }
.button.quiet:hover, .icon-button:hover { background: var(--surface-soft); }
.button.wide { width: 100%; min-height: 42px; margin-top: 17px; }
.button:disabled, .icon-button:disabled { opacity: .43; cursor: not-allowed; }
.button-row { margin-top: 10px; gap: 7px; }
.icon-button { min-width: 35px; padding: 6px 9px; font-size: 16px; }
.icon-button.labeled { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.icon-button.labeled span { font-size: 16px; }
.danger-text { color: var(--danger) !important; }
.toolbar-actions { gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.form-message { min-height: 0; margin: 8px 0 0; color: var(--muted); font-size: 11px; white-space: pre-wrap; }
.form-message.error { color: var(--danger); }
.form-message.success { color: var(--success); }

.password-field { position: relative; }
.password-field input { padding-right: 43px; }
.password-field .icon-button { position: absolute; top: 2px; right: 2px; min-height: 35px; border: 0; }

.guide-panel { background: #f9fbfb; }
.steps { margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 7px 0; }
.steps li > span { width: 25px; height: 25px; display: grid; place-items: center; color: var(--accent-dark); background: var(--accent-soft); border-radius: 50%; font-size: 11px; font-weight: 750; }
.steps strong { font-size: 12px; }
.steps p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
summary { color: var(--ink-soft); font-size: 12px; font-weight: 650; cursor: pointer; }
details p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.credential-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px; }
.credential-item { min-width: 0; padding: 10px 12px; background: var(--surface-soft); border: 1px solid var(--line); }
.credential-item.span-2 { grid-column: 1 / -1; }
.credential-item label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.credential-item strong, .credential-item code { font-size: 12px; }
.copy-field { min-width: 0; gap: 8px; justify-content: space-between; }
.copy-field code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-field button { flex: 0 0 auto; padding: 2px 7px; border: 0; color: var(--accent-dark); background: transparent; cursor: pointer; font-size: 11px; }
.warning-line { margin: 10px 0 0; color: var(--warning); font-size: 11px; }

.example-header { margin-top: 19px; justify-content: space-between; gap: 14px; }
.example-header h3 { margin: 1px 0 0; font-size: 14px; }
.code-block { position: relative; margin-top: 9px; color: #e9f0f4; background: #202d36; border: 1px solid #101a20; }
.code-block pre { min-height: 90px; margin: 0; padding: 14px 90px 14px 14px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 11px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.code-copy { position: absolute; top: 8px; right: 8px; padding: 5px 8px; color: #d9e5ea; background: #30424e; border: 1px solid #50636e; border-radius: 3px; cursor: pointer; font-size: 10px; }
.example-note { margin: 6px 0 0; color: var(--muted); font-size: 10px; }

.summary-strip { margin: -2px 0 13px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: var(--surface-soft); }
.summary-strip > div { padding: 9px 12px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span, .summary-strip strong { display: block; }
.summary-strip span { color: var(--muted); font-size: 10px; }
.summary-strip strong { margin-top: 1px; font-size: 17px; }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafbfb; font-size: 10px; font-weight: 700; white-space: nowrap; }
td { font-size: 12px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fbfb; }
tbody tr.selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.cell-title { display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.cell-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hash { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.progress { width: 110px; }
.progress-track { height: 5px; margin-bottom: 4px; overflow: hidden; background: #e1e7ea; border-radius: 3px; }
.progress-track i { display: block; height: 100%; background: var(--accent); }
.progress-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.empty-state { min-height: 170px; display: grid; place-items: center; padding: 25px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); background: #fbfcfc; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink-soft); font-size: 13px; }
.empty-state span { display: block; font-size: 11px; }

.sync-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.event-console { height: 260px; overflow: auto; padding: 11px 13px; color: #b9c8d1; background: #19242c; border: 1px solid #111a20; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.console-empty { min-height: 100%; display: grid; place-items: center; color: #758996; text-align: center; }
.event-line { display: grid; grid-template-columns: 76px 110px minmax(0, 1fr); gap: 10px; padding: 4px 0; border-bottom: 1px solid #273640; }
.event-line time { color: #758996; }
.event-line strong { color: #7fd7ca; font-weight: 600; }
.event-line.error strong { color: #ff9389; }

.drawer { position: fixed; inset: 0; z-index: 30; visibility: hidden; pointer-events: none; }
.drawer.open { visibility: visible; pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(14, 24, 30, .38); opacity: 0; transition: opacity .16s ease; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; width: min(560px, 92vw); height: 100%; display: flex; flex-direction: column; background: #fff; box-shadow: -12px 0 30px rgba(20, 31, 38, .16); transform: translateX(100%); transition: transform .18s ease; }
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-header { min-height: 73px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer-content { padding: 18px; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item { min-width: 0; padding: 9px 10px; background: var(--surface-soft); border: 1px solid var(--line); }
.detail-item.full { grid-column: 1 / -1; }
.detail-item label { display: block; color: var(--muted); font-size: 10px; }
.detail-item strong, .detail-item code { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 11px; }
.detail-section { margin-top: 18px; }
.detail-section h3 { margin: 0 0 7px; font-size: 13px; }
.json-view { margin: 0; padding: 11px; max-height: 330px; overflow: auto; color: #d6e2e8; background: #202d36; white-space: pre-wrap; word-break: break-word; font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 220px; max-width: 360px; padding: 10px 12px; color: #fff; background: #24343e; border-left: 4px solid #66cfbf; box-shadow: 0 8px 20px rgba(20, 31, 38, .2); font-size: 12px; }
.toast.error { border-left-color: #ef746a; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 320px minmax(0, 1fr); padding-left: 18px; padding-right: 18px; }
  .platform-grid { grid-template-columns: 1fr; }
  .event-line { grid-template-columns: 70px 90px minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .app-header { min-height: 68px; padding: 12px 15px; }
  .brand p, .capture-endpoint { display: none; }
  .brand h1 { font-size: 17px; }
  .mode-nav-inner { padding: 0; }
  .mode-tab { min-width: 0; flex: 1; justify-content: center; height: 62px; padding: 8px; }
  .mode-tab small { display: none; }
  .workspace { display: block; padding: 12px 10px 30px; }
  .setup-column, .content-column { display: contents; }
  .panel { margin-bottom: 11px; padding: 14px; }
  .auth-panel { order: 0; }
  .task-builder { order: 1; }
  .connection-panel { order: 2; }
  .tasks-panel { order: 3; }
  .samples-panel { order: 4; }
  .sync-panel { order: 5; }
  .events-panel { order: 6; }
  .guide-panel { order: 7; }
  .platform-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credential-grid, .sync-grid { grid-template-columns: 1fr; }
  .credential-item.span-2 { grid-column: auto; }
  .example-header { align-items: flex-start; flex-direction: column; }
  .segmented.small { width: 100%; grid-template-columns: repeat(3, 1fr); }
  .panel-heading { align-items: flex-start; }
  .tasks-panel .panel-heading, .samples-panel .panel-heading { display: block; }
  .tasks-panel .toolbar-actions, .samples-panel .toolbar-actions { margin-top: 10px; justify-content: flex-start; }
  .summary-strip strong { font-size: 15px; }
  .event-line { grid-template-columns: 62px minmax(0, 1fr); gap: 7px; }
  .event-line span { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .health-badge strong { display: none; }
  .health-badge { min-width: 30px; padding: 5px 7px; }
  .health-badge > span { margin: 0; }
  .platform-grid { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: repeat(2, 1fr); }
  .segmented button:nth-child(2) { border-right: 0; }
  .segmented button:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .summary-strip > div { padding: 8px; }
  .summary-strip span { min-height: 30px; }
}

/* Persistent collector workspace */
.collector-shell { max-width: 1540px; margin: 0 auto; padding: 20px 28px 44px; }
.identity-bar {
  min-height: 74px;
  padding: 13px 17px;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
}
.identity-title { display: flex; align-items: center; gap: 10px; }
.identity-title h2 { margin: 1px 0 0; font-size: 15px; }
.identity-icon { width: 31px; height: 31px; display: grid; place-items: center; color: #fff; background: var(--ink-soft); font: 700 15px ui-monospace, monospace; }
.identity-token { min-width: 0; display: flex; align-items: center; }
.identity-token code { min-width: 0; height: 39px; padding: 9px 11px; flex: 1; overflow: hidden; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line-strong); text-overflow: ellipsis; white-space: nowrap; font: 12px/20px ui-monospace, monospace; }
.identity-token .icon-button, .identity-token .button { margin-left: 6px; }
.identity-meta { display: grid; justify-items: end; gap: 2px; color: var(--muted); font-size: 10px; }
.identity-meta > span { white-space: nowrap; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #28a466; }
.text-button { padding: 2px 0; border: 0; color: var(--accent-dark); background: transparent; cursor: pointer; font-size: 11px; font-weight: 650; }

.collector-layout { margin-top: 17px; display: grid; grid-template-columns: minmax(330px, 390px) minmax(0, 1fr); gap: 17px; align-items: start; }
.instruction-column, .library-column { min-width: 0; display: grid; gap: 15px; }
.section-copy { margin: -4px 0 16px; color: var(--muted); font-size: 11px; }
.platform-tabs { margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 5px; }
.platform-tabs button { min-height: 30px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: #fff; cursor: pointer; font-size: 11px; }
.platform-tabs button.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.instruction-options { display: grid; gap: 12px; }
.segmented.small.two { grid-template-columns: repeat(2, 1fr); }
.segmented.small.two button { min-width: 0; }
.instruction-code pre { min-height: 150px; max-height: 300px; }
.instruction-note { min-height: 38px; margin-top: 8px; padding: 8px 10px; color: #566771; background: var(--surface-soft); border-left: 3px solid var(--blue); font-size: 10px; }
.compact-steps { margin: 15px 0 0; padding: 13px 0 0; border-top: 1px solid var(--line); list-style: none; }
.compact-steps li { padding: 4px 0; display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; }
.compact-steps li > span { width: 20px; height: 20px; display: grid; place-items: center; color: var(--accent-dark); background: var(--accent-soft); border-radius: 50%; font-size: 10px; font-weight: 750; }
.compact-steps p { margin: 0; color: var(--muted); font-size: 10px; }
.compact-steps strong { color: var(--ink-soft); }
.endpoint-copy { min-height: 40px; padding: 7px 8px 7px 10px; border: 1px solid var(--line-strong); background: var(--surface-soft); }
.endpoint-copy code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.archive-list { display: grid; gap: 5px; }
.archive-item { width: 100%; padding: 8px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-soft); background: #fff; cursor: pointer; text-align: left; }
.archive-item:hover, .archive-item.active { border-color: var(--accent); background: var(--accent-soft); }
.archive-item strong { display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.archive-item small { display: block; color: var(--muted); font-size: 9px; }
.archive-item span { min-width: 23px; height: 20px; display: grid; place-items: center; color: var(--muted); background: var(--surface-soft); border-radius: 10px; font-size: 9px; }
.archive-empty { padding: 16px 8px; color: var(--muted); border: 1px dashed var(--line); text-align: center; font-size: 10px; }

.metrics-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.metrics-strip > div { min-width: 0; min-height: 84px; padding: 13px 15px; border-right: 1px solid var(--line); }
.metrics-strip > div:last-child { border-right: 0; }
.metrics-strip span, .metrics-strip strong, .metrics-strip small { display: block; }
.metrics-strip span { color: var(--muted); font-size: 10px; font-weight: 650; }
.metrics-strip strong { margin-top: 2px; overflow: hidden; font-size: 22px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.metrics-strip small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.library-heading { margin-bottom: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.library-heading h2 { margin: 1px 0 0; font-size: 17px; }
.library-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.filter-bar { padding: 10px; display: grid; grid-template-columns: repeat(4, minmax(105px, 1fr)); gap: 7px; background: var(--surface-soft); border: 1px solid var(--line); }
.filter-bar input, .filter-bar select { min-width: 0; min-height: 34px; padding: 6px 8px; font-size: 10px; }
.filter-bar .text-button { justify-self: start; }
.selection-bar { margin-top: 9px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; color: var(--accent-dark); background: var(--accent-soft); font-size: 11px; }
.fingerprint-table { margin-top: 10px; min-height: 300px; }
.fingerprint-table tbody tr { cursor: pointer; }
.fingerprint-table tbody tr.checked { background: #eff8f6; }
.fingerprint-table input[type="checkbox"] { width: 15px; height: 15px; min-height: 0; accent-color: var(--accent); }
.dimension-stack strong, .dimension-stack small { display: block; }
.dimension-stack strong { font-size: 11px; }
.dimension-stack small { color: var(--muted); font-size: 9px; }
.sync-mark { color: var(--success); font-size: 9px; }

.modal { position: fixed; inset: 0; z-index: 40; visibility: hidden; pointer-events: none; }
.modal.open { visibility: visible; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(14, 24, 30, .42); opacity: 0; transition: opacity .14s ease; }
.modal.open .modal-backdrop { opacity: 1; }
.modal-panel { position: relative; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 30px); margin: 8vh auto 0; overflow: auto; background: #fff; box-shadow: 0 18px 45px rgba(20, 31, 38, .22); transform: translateY(10px); transition: transform .14s ease; }
.modal.open .modal-panel { transform: translateY(0); }
.modal-panel.small-modal { width: min(430px, calc(100vw - 24px)); }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 7px; background: var(--surface-soft); border-top: 1px solid var(--line); }
.field-label.spaced { margin-top: 14px; }
.sync-summary { margin-bottom: 15px; padding: 10px 11px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.sync-summary p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.privacy-inline { margin: 10px 0 0; color: var(--muted); font-size: 10px; }

@media (max-width: 1100px) {
  .collector-shell { padding-left: 18px; padding-right: 18px; }
  .collector-layout { grid-template-columns: 330px minmax(0, 1fr); }
  .filter-bar { grid-template-columns: repeat(3, minmax(100px, 1fr)); }
  .identity-bar { grid-template-columns: auto 1fr; }
  .identity-meta { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 14px; }
}

@media (max-width: 820px) {
  .collector-shell { padding: 12px 10px 30px; }
  .identity-bar { display: block; padding: 12px; }
  .identity-token { margin-top: 10px; }
  .identity-meta { margin-top: 7px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
  .collector-layout { display: flex; flex-direction: column; }
  .instruction-column, .library-column { width: 100%; display: contents; }
  .metrics-strip { order: 1; width: 100%; }
  .fingerprint-library { order: 2; width: 100%; }
  .instruction-panel { order: 3; width: 100%; }
  .endpoint-panel { order: 4; width: 100%; }
  .archive-panel { order: 5; width: 100%; }
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .metrics-strip > div:nth-child(2) { border-right: 0; }
  .metrics-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .library-heading { display: block; }
  .library-actions { margin-top: 10px; justify-content: flex-start; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .identity-token { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .identity-token code { grid-column: 1 / -1; width: 100%; }
  .identity-token .icon-button, .identity-token .button { margin: 0; }
  .identity-token .button { width: 100%; }
  .metrics-strip strong { font-size: 18px; }
  .filter-bar { grid-template-columns: 1fr; }
  .library-actions .button, .library-actions .icon-button { flex: 1; }
  .segmented.small { grid-template-columns: 1fr; }
  .segmented.small button { border-right: 0; border-bottom: 1px solid var(--line); }
  .segmented.small button:last-child { border-bottom: 0; }
}
