/* Shared design tokens for cloud, executors and the standalone authorization page. */
:root {
  --ink: #172033;
  --text: #344054;
  --muted: #5f6b7c;
  --line: #e3e8ef;
  --line-strong: #d2dae5;
  --canvas: #f4f6f8;
  --paper: #ffffff;
  --blue: #2f6bff;
  --blue-strong: #2056d7;
  --blue-soft: #edf3ff;
  --blue-hover: #1949b3;
  --blue-border: #c5d6ff;
  --surface-muted: #f8fafc;
  --surface-hover: #eef2f7;
  --filter-height: 36px;
  --account-control-height: 40px;
  --touch-height: 44px;
  --radius-small: 4px;
  --radius-panel: 12px;
  --radius-pill: 999px;
  --control-radius: 7px;
  --control-shadow: 0 1px 2px #16213908;
  --panel-shadow: 0 2px 6px #1720330a;
  --popover-shadow: 0 8px 28px #17203326;
  --dialog-shadow: 0 22px 76px #17203338;
  --drawer-shadow: 6px 0 24px #17203321;
  --small-label: 11px;
  --type-caption: 12px;
  --type-ui: 13px;
  --type-body: 14px;
  --type-subheading: 16px;
  --progress-track: #e4e9f1;
  --progress-local: #637791;
  --green: #198754;
  --success-text: #14694c;
  --success-fill: #e8f7ef;
  --warning-text: #825714;
  --warning-fill: #fff5df;
  --error-text: #9a3749;
  --error-fill: #fceef0;
  --amber: #a66a00;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
}

/* Lists use the same filter surfaces even when a desktop field wraps its input and icon. */
#main :is([role="search"], .tk-filters, .aur-filterbar, .ff-field, .df-field)
  :is(select, input[type="search"], input[type="date"]):not(:where(.ws-search *, .au-search *)),
#main :is(.ws-search, .au-search) {
  box-sizing: border-box;
  height: var(--filter-height);
  min-height: var(--filter-height);
  padding-block: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  box-shadow: var(--control-shadow);
  background-color: var(--paper);
  color: var(--text);
  font-family: inherit;
  font-size: var(--type-ui);
  font-weight: 500;
  line-height: 1.4;
}
#main :is(.ws-search, .au-search) input[type="search"] {
  height: 100%;
  min-height: 0;
  padding-block: 0;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: inherit;
  font: inherit;
}
#main :is([role="search"], .tk-filters, .aur-filterbar, .ff-field, .df-field)
  :is(select, input[type="search"], input[type="date"]):not(:where(.ws-search *, .au-search *)):focus-visible,
#main :is(.ws-search, .au-search):focus-within {
  border-color: var(--blue-strong);
  outline: 2px solid var(--blue-strong);
  outline-offset: 2px;
}
#main :is(.scene-catalog-tab, .mj-stages label, .ad-views label, .res-tab, .op-choices label) > span,
#main .dr-tabs a {
  min-height: var(--filter-height);
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--text);
  font-size: var(--type-ui);
  font-weight: 600;
  line-height: 1.4;
}
#main :is(.scene-catalog-tab, .mj-stages label, .ad-views label, .res-tab, .op-choices label):hover > span,
#main .dr-tabs a:hover {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue-strong);
}
#main :is(.scene-catalog-tab, .mj-stages label, .ad-views label, .res-tab, .op-choices label) input:checked + span,
#main .dr-tabs a[aria-current] {
  border-color: var(--blue-strong);
  background: var(--blue-strong);
  color: var(--paper);
}
#main .dr-tabs {
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-block: 6px;
}
#main .dr-tabs a[aria-current] .dr-tab-count { background: #ffffff30; color: var(--paper); }

@media (max-width: 700px) {
  :root {
    --filter-height: var(--touch-height);
    --account-control-height: var(--touch-height);
  }
}

body {
  background: var(--canvas);
  color: var(--text);
}

.shell {
  display: block;
  min-height: 100vh;
  background: var(--canvas);
}

.shell > .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 3;
  width: 204px;
  height: 100vh;
  padding: 22px 12px 16px;
  background: var(--paper);
  color: var(--text);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  gap: 10px;
  padding: 0 8px 30px;
  color: var(--ink);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-small);
  background: var(--blue);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand b {
  font-size: 17px;
  letter-spacing: 0;
}

.brand small {
  color: #8590a0;
  font-size: 9px;
  letter-spacing: .08em;
}

.nav-group {
  margin: 0 0 23px;
}

.nav-group h2 {
  padding: 0 14px 9px;
  color: #8a95a5;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
}

.nav-link {
  min-height: 42px;
  margin: 3px 0;
  padding: 10px 14px;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  color: #4b596d;
  font-size: var(--type-ui);
  font-weight: 550;
}

.nav-link svg {
  width: 16px;
  height: 16px;
}

.nav-link.selected {
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-weight: 650;
}

.nav-link:hover:not(.selected) {
  background: #f5f7fa;
  color: var(--ink);
}

.shell > .sidebar .side-end {
  border-top: 1px solid var(--line);
  padding: 14px 10px 0;
  color: #7d8899;
  font-size: var(--small-label);
}

.side-end i,
.pulse {
  width: 7px;
  height: 7px;
  background: var(--green);
}

.shell-main {
  min-height: 100vh;
  margin-left: 204px;
}

.shell-main > .topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 72px;
  padding: 0 30px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.crumbs {
  gap: 8px;
  color: #7a8697;
  font-size: var(--type-caption);
}

.crumbs b {
  color: var(--ink);
  font-weight: 650;
}

.switcher {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #f6f8fb;
}

.switcher a {
  padding: 5px 10px;
  border-radius: var(--radius-small);
  color: #687588;
  font-size: var(--small-label);
}

.switcher a.current {
  color: var(--blue-strong);
  background: var(--paper);
  box-shadow: var(--control-shadow);
}

#main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 30px 52px;
}

.page-head {
  min-height: 52px;
  margin: 0 0 22px;
}

.page-head-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.scope-picker {
  display: grid;
  gap: 4px;
  min-width: 166px;
}

.scope-picker > span {
  color: #7a8697;
  font-size: var(--small-label);
  font-weight: 650;
}

.scope-picker select {
  min-width: 166px;
}

h1 {
  color: var(--ink);
  font-size: 28px;
  letter-spacing: -.035em;
  font-weight: 700;
}

.page-head p {
  margin-top: 5px;
  color: #718096;
  font-size: var(--type-ui);
}

h2 {
  color: var(--ink);
  font-size: var(--type-subheading);
  letter-spacing: -.02em;
}

.stats {
  gap: 12px;
  margin-bottom: 16px;
}

.stat,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--paper);
  box-shadow: var(--control-shadow);
}

.stat {
  padding: 15px 17px 13px;
}

.stat-label {
  color: #687588;
  font-size: var(--type-caption);
}

.stat strong {
  color: var(--ink);
  font-size: 29px;
  line-height: 1.35;
}

.stat small {
  color: #8a95a5;
  font-size: var(--small-label);
}

.panel-head {
  min-height: 58px;
  padding: 14px 17px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.panel-head > div > small {
  margin-top: 3px;
}

.feature-line {
  flex-wrap: wrap;
}

.feature-line small {
  color: #7a8697;
  font-size: var(--small-label);
}

.panel-pad {
  padding: 14px 17px;
}

.feature-title {
  padding: 15px 17px 13px;
}

.feature-title h2 {
  font-size: 19px;
}

.featured .signal {
  margin: 0 14px 14px;
}

.signal {
  padding: 17px 18px 15px;
  border-radius: var(--control-radius);
  background: #1f4b9c;
}

.number {
  font-size: 43px;
}

.segments {
  gap: 2px;
}

.segments i {
  height: 7px;
  background: #4469ae;
}

.segments i.filled {
  background: #a7c4ff;
}

.device-row,
.account-item {
  padding: 12px 17px;
  border-bottom-color: var(--line);
}

.device-row:hover,
.account-item:hover {
  background: #f7f9fc;
}

.session-title {
  display: inline-block;
  margin-bottom: 2px;
}

.live-id,
.session-id {
  display: inline-block;
  margin-right: 8px;
  color: #7b8798;
  font-family: var(--mono);
  font-size: var(--small-label);
}

.session-id {
  margin-right: 0;
  color: #a0a9b7;
}

.account-cell b,
.account-cell small {
  display: block;
}

.account-cell small {
  margin-top: 2px;
  color: #8994a3;
  font-size: 10px;
}

.device-icon {
  width: 31px;
  height: 31px;
  border-radius: var(--control-radius);
  background: var(--blue-soft);
  color: var(--blue-strong);
}

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

.table-scroll-hint {
  display: none;
}

th {
  padding: 10px 14px;
  background: #f8fafc;
  color: #7a8697;
  font-size: var(--small-label);
  font-weight: 650;
}

td {
  padding: 11px 14px;
  border-top-color: var(--line);
  color: var(--text);
  font-size: var(--type-caption);
}

.title-link,
.name {
  color: var(--ink);
  font-weight: 650;
}

.title-link:hover,
.name:hover {
  color: var(--blue-strong);
}

.filters {
  grid-template-columns: minmax(240px, 1.8fr) repeat(3, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px 17px 2px;
  border-bottom: 1px solid var(--line);
}

.job-filters {
  grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(118px, 1fr));
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 17px;
  color: #687588;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  font-size: var(--small-label);
}

.filter-summary b {
  color: var(--ink);
  font-weight: 700;
}

.filter-summary-scope {
  padding: 3px 8px;
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-weight: 650;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 36px;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: var(--radius-panel);
  background: var(--blue-soft);
  color: var(--blue-strong);
}

.empty-state h2 {
  margin-bottom: 5px;
}

.empty-state p {
  max-width: 360px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: var(--type-caption);
}

.field {
  gap: 4px;
  margin-bottom: 11px;
}

.field > span,
legend {
  color: #7a8697;
  font-size: var(--small-label);
  font-weight: 650;
}

input:not([type='checkbox']),
select {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--paper);
  font-size: var(--type-caption);
}

input:not([type='checkbox']):focus,
select:focus {
  border-color: #8faef5;
  box-shadow: 0 0 0 3px #2f6bff18;
  outline: 0;
}

.badge {
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  font-size: 10px;
}

.badge.green {
  color: var(--success-text);
  background: var(--success-fill);
}

.badge.blue,
.badge.active {
  color: var(--blue-strong);
  background: var(--blue-soft);
}

.badge.red {
  color: var(--error-text);
  background: var(--error-fill);
}

.badge.amber {
  color: var(--warning-text);
  background: var(--warning-fill);
}

.notice {
  color: #4c6384;
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
}

.tabs {
  gap: 20px;
  margin-bottom: 18px;
}

.tabs a {
  padding: 8px 2px 10px;
  font-size: var(--type-caption);
}

.tabs a.selected {
  color: var(--blue-strong);
  border-color: var(--blue);
}

.btn {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  color: var(--text);
  background: var(--paper);
  font-size: var(--type-caption);
}

.btn:hover {
  color: var(--blue-strong);
  border-color: #a8bff4;
  background: #f5f8ff;
}

.btn.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.btn.primary:hover {
  color: #fff;
  background: var(--blue-strong);
}

.btn.quiet {
  color: var(--blue-strong);
}

.btn.quiet:hover {
  background: var(--blue-soft);
}

@media (max-width: 1080px) {
  .shell-main > .topbar {
    padding: 0 22px;
  }

  #main {
    padding-left: 22px;
    padding-right: 22px;
  }

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

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

  .page-head-tools {
    align-items: stretch;
  }
}

@media (max-width: 800px) {
  .shell-main {
    margin-left: 0;
  }

  .shell > .sidebar {
    top: 56px;
    bottom: 0;
    width: 228px;
    height: auto;
    box-shadow: var(--drawer-shadow);
  }

  .shell-main > .topbar {
    height: 56px;
    padding: 0 15px;
  }

  #main {
    padding: 22px 15px 40px;
  }

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

  .table-scroll-hint {
    display: block;
    padding: 7px 14px;
    color: #7a8697;
    background: #fbfcfe;
    border-bottom: 1px solid var(--line);
    font-size: 10px;
    text-align: right;
  }
}

/* Archive browsing */
.shell .workspace-account {
  display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px 4px 14px;
  border: 1px solid #ccd5df; border-radius: var(--radius-pill); background: white; color: #445068;
}
.workspace-account > span { font-size: var(--type-ui); font-weight: 600; white-space: nowrap; }
.workspace-account select { min-width: 150px; border: 0; background-color: #f3f5fa; font-weight: 650; }
.workspace-account svg { width: 17px; height: 17px; }
.page-head p:empty { display: none; }
.archive-counts { display: grid; grid-template-columns: repeat(4,1fr); padding: 18px 0; margin-bottom: 22px; background: white; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.archive-counts > div { padding: 0 24px; border-inline-start: 1px solid var(--line); }
.archive-counts > div:first-child { border: 0; }
.archive-counts span { display: block; font-size: var(--type-ui); color: var(--muted); margin-bottom: 4px; }
.archive-counts strong { font-size: 28px; color: var(--ink); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.archive-counts small { color: var(--muted); margin-left: 6px; }
.archive-feature { display: grid; grid-template-columns: 38% 1fr; border-radius: var(--radius-panel); overflow: hidden; background: #fff; border: 1px solid var(--line); }
.archive-cover,.replay-cover { position: relative; overflow: hidden; background: #e3e3df; }
.scene-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.scene-cover-placeholder { display: grid; align-content: center; justify-items: center; gap: 2px; overflow: hidden; container-type: inline-size; background: #eef1f5; color: #667488; }
.scene-cover-placeholder > small { font-size: 10px; font-weight: 500; line-height: 1.2; text-align: center; }
@container (max-width: 60px) {
  .scene-cover-placeholder > small { display: none; }
}
.archive-cover .scene-photo { position: absolute; inset: 0; }
.archive-detail { padding: clamp(19px, 2vw, 32px); }
.feature-status { display: flex; align-items: center; gap: 7px; font-size: var(--type-ui); color: #465575; }
.feature-status .badge { margin-left: auto; }
.archive-detail h2 { margin: 14px 0 5px; font-size: clamp(21px,2vw,30px); }
.archive-detail p { margin: 0; font-size: var(--type-ui); color: var(--muted); }
.save-meter { display: flex; justify-content: space-between; margin: 20px 0 6px; font-size: var(--type-ui); }
.save-meter b { font-variant-numeric: tabular-nums; color: #324b8b; }
.archive-detail progress { width: 100%; height: 7px; display: block; appearance: none; border: 0; border-radius: var(--radius-pill); overflow: hidden; background: var(--progress-track); }
.archive-detail progress::-webkit-progress-bar { background: var(--progress-track); }
.archive-detail progress::-webkit-progress-value { background: var(--blue-strong); border-radius: var(--radius-pill); }
.archive-detail progress::-moz-progress-bar { background: var(--blue-strong); }
.feature-actions { margin-top: 16px; }
.replay-section { margin-top: 26px; }
.replay-section header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.replay-section h2 { font-size: 19px; }
.replay-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(285px,100%),1fr)); gap: 16px; }
.replay-card { display: block; color: var(--ink); border: 1px solid var(--line); background: white; border-radius: var(--radius-panel); overflow: hidden; text-decoration: none; }
.replay-card:hover, .replay-card:focus-visible { border-color: var(--blue); }
.replay-cover { height: clamp(110px,10vw,172px); }
.replay-play { position: absolute; left: 12px; bottom: 10px; display: grid; place-items: center; border-radius: 100%; height: 32px; width: 32px; background: #19232ace; color: white; }
.replay-record { position: absolute; left: 12px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: var(--control-radius); background: #19232ace; color: white; font-size: var(--type-caption); }
.replay-record svg, .replay-play svg { width: 15px; height: 15px; }
.replay-caption { display: grid; gap: 5px; padding: 13px 16px 16px; }
.replay-caption small, .result-count, .filter-context { color: var(--muted); font-size: var(--type-ui); }
.replay-caption strong { font-size: var(--type-subheading); }
.result-count, .filter-context { padding: 12px 18px; }
.scene-item { display: inline-flex; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; }
.scene-item:hover b { color: var(--blue-strong); }
.scene-item .scene-photo { width: 78px; height: 48px; border-radius: var(--radius-small); flex: none; }
.scene-filters { grid-template-columns: 2fr 1fr 1fr; }
.job-filters { grid-template-columns: 2fr repeat(3,1fr); }
@media (max-width: 800px) {
  .job-filters, .scene-filters { grid-template-columns: 1fr 1fr; }
  .scene-filters .field:first-child { grid-column: 1/-1; }
}
@media (max-width: 620px) {
  .workspace-account select { min-width: 130px; }
  .archive-counts { grid-template-columns: repeat(2,1fr); gap: 14px 0; }
  .archive-counts > div { padding: 0 14px; }
  .archive-counts > div:nth-child(3) { border: 0; }
  .archive-feature { grid-template-columns: 1fr; }
  .archive-cover { height: 135px; }
  .replay-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .replay-cover { height: 92px; }
  .replay-caption { padding: 10px; }
  .replay-caption strong { font-size: var(--type-body); }
}
@media (min-width: 1100px) {
  .replay-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .replay-cover { height: clamp(135px,12vw,205px); }
  .shell #main { max-width: 1700px; padding-inline: clamp(28px,3vw,64px); }
}
.archive-counts strong, .archive-counts small { display: inline; }
@media (max-width: 620px) {
  .shell .page-head:has(.workspace-account) { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .page-head:has(.workspace-account) .actions, .workspace-account { width: 100%; }
  .workspace-account select { flex: 1; }
  .library-list .table-scroll-hint { display: none; }
  .library-list table, .library-list tbody { display: block; min-width: 0; width: 100%; }
  .library-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .library-list tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 12px 15px; border-top: 1px solid var(--line); }
  .library-list tbody td { padding: 0; border: 0; white-space: normal; }
  .library-list tbody td:first-child { grid-column: 1/-1; }
  .library-list tbody td:nth-child(2) { display: flex; align-items: center; gap: 6px; }
  .library-list tbody td:nth-child(2) small { margin: 0; }
  .library-list tbody td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: var(--type-caption); }
  .library-list tbody td:nth-child(3) small { display: inline; margin-left: 6px; }
  .library-list tbody td:nth-child(4) { grid-column: 2; grid-row: 2; justify-self: end; }
  .library-list tbody td:last-child { grid-column: 2; grid-row: 3; justify-self: end; }
}

/* Shared list controls retain the count and size selector on a single page. */
.desk-pager .dp-pages[hidden], .cloud-drawer-close, .cloud-scrim { display: none; }
.shell .brand small, .shell .nav-group h2, .shell .crumbs, .shell .side-end { color: #536477; }
.route-empty { margin: 24px auto; max-width: 780px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-panel); }
.route-empty h1 { font-size: 22px; }
.route-empty p { margin: 12px 0 18px; }
.token-change-preview:not([hidden]) { margin: 12px 0; padding: 12px 14px; color: var(--text); background: var(--blue-soft); border-radius: var(--control-radius); }
.token-change-preview ul { margin: 8px 0; padding-left: 18px; }
@media (max-width: 800px) {
  .shell.menu-open > .sidebar { top: 0; max-height: 100dvh; height: 100dvh; z-index: 12; }
  .cloud-scrim { display: block; position: fixed; inset: 0; z-index: 10; background: #17203350; border: 0; }
  .cloud-drawer-close { display: grid; align-self: flex-end; place-items: center; width: 32px; height: 32px; background: var(--paper); color: var(--text); border: 1px solid var(--line); border-radius: var(--control-radius); }
  .cloud-drawer-close svg { width: 16px; height: 16px; }
}
