:root {
  color-scheme: light;
  /* Palette derived from the legacy InScreen app — azure blue + cool greys, the
     colors long-time users recognize. Accent deepened from the legacy sky blue
     so white button text clears WCAG AA. */
  --bg: #eef2f6;
  --chrome: #f5f8fb;
  --panel: #ffffff;
  --panel-2: #f3f7fb;
  --panel-3: #e9eef5;
  --ink: #2b3036;
  --muted: #687079;
  /* --subtle/--ok/--blue darkened to clear WCAG AA (4.5:1) for the small/600-weight text they back —
     badge-ok/info, --subtle informative text, and accent pills were measured at 2.6–4.2:1 (audit). */
  --subtle: #7d8590;
  --line: #dce3ea;
  --line-strong: #c4ccd5;
  --accent: #2479bd;
  --accent-hover: #1d6aa8;
  --accent-soft: #e9f2fb;
  --accent-2: #b23b3b;
  --blue: #1f6aa8;
  --ok: #3f7024;
  --warn: #936216;
  --danger: #b4282d;
  --info: var(--blue);
  /* Reserved for elements that genuinely float above content (menus, dialogs, popovers). */
  --shadow: 0 1px 2px rgba(19, 20, 24, 0.05), 0 8px 24px rgba(19, 20, 24, 0.08);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Radius scale — every step is multiplied by --rad-mult, which is bumped
     to 1.3 when corner-shape: squircle is supported (squircles read smaller). */
  --rad-mult: 1;
  --radius-xs: calc(4px * var(--rad-mult));
  --radius-sm: calc(6px * var(--rad-mult));
  --radius-8: calc(8px * var(--rad-mult));
  --radius-md: calc(10px * var(--rad-mult));
  --radius-12: calc(12px * var(--rad-mult));
  --radius-lg: calc(16px * var(--rad-mult));
  --radius-xl: calc(20px * var(--rad-mult));
  --radius-pill: 999px; /* pills & circles — never scaled, never squircled */

  /* Typography scale */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 14px;
  --text-lg: 18px;
  --text-xl: 24px;
}

/* Progressive enhancement: superellipse ("squircle") corners where supported.
   Squircles read visually smaller than circular-arc corners, so radii are
   scaled up via --rad-mult. Genuine pills/circles are kept perfectly round. */
@supports (corner-shape: squircle) {
  :root {
    --rad-mult: 1.3;
  }

  *,
  *::before,
  *::after {
    corner-shape: squircle;
  }

  .quota-bar,
  .forecast-band,
  .pill,
  .badge,
  .account-avatar {
    corner-shape: round;
  }
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font:
    14px / 1.48 "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  margin: 0;
}

body:has(.app-shell) {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

input,
textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: var(--ink);
  min-height: 40px;
  /* min-width 0: width:100% alone doesn't let datetime-local shrink below its ~200px intrinsic
     editor minimum, so a narrow grid track overflows the panel instead of clipping the input
     (tripped the dashboard-matrix no-horizontal-overflow gate; worse with wider Linux CI fonts). */
  min-width: 0;
  padding: 8px 12px;
  width: 100%;
}

input:focus-visible,
textarea:focus-visible,
.select-trigger:focus-visible,
.button:focus-visible,
.tab:focus-visible {
  outline: 2px solid rgba(36, 121, 189, 0.4);
  outline-offset: 2px;
}

label,
.select-field {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 750;
  gap: 6px;
  /* Grid-item minimum: without this the trigger's selected-value text (nowrap span below) sets the
     field's min-content and the whole field pokes out of narrow columns instead of ellipsizing. */
  min-width: 0;
}

/* ── ui/Field error slot (U5): the wrapper class marks the nested control invalid
   (aria-invalid mirrors it from the component) and .field-error carries the message. */
.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border-color: var(--accent-2);
}

.field-error {
  color: var(--accent-2);
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0;
}

/* Base UI Select.Value span — the trigger's first flex child. min-width:0 lets it shrink (long
   selected labels wrap inside the trigger) instead of propagating the text's intrinsic width up the
   grid chain and out of narrow columns (dashboard-matrix no-horizontal-overflow gate). NO nowrap
   here: unconstrained triggers (inline-form rows) must keep wrapping, not grow to one long line. */
.select-trigger > span:first-child {
  min-width: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0;
}

h1 {
  font:
    650 clamp(30px, 5vw, 50px) / 1.05 "SF Pro Display",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  letter-spacing: -0.035em;
}

h2 {
  font:
    620 20px / 1.18 "SF Pro Display",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 14px;
}

.shell {
  margin: 0 auto;
  max-width: 1360px;
  min-height: 100vh;
  padding: 24px;
}

.app-shell {
  background: var(--bg);
  min-height: 100vh;
  padding: 20px;
}

.product-shell {
  background: var(--panel);
  border: 1px solid rgba(17, 18, 23, 0.08);
  border-radius: var(--radius-xl);
  box-shadow:
    0 1px 3px rgba(19, 20, 24, 0.04),
    0 16px 40px rgba(19, 20, 24, 0.06);
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  height: calc(100vh - 40px);
  min-height: 720px;
  overflow: hidden;
}

.sidebar {
  background: var(--chrome);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  overflow-y: auto;
  padding: 18px;
}

.workspace-switcher {
  align-items: center;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 12px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  min-height: 72px;
  padding: 10px;
}

.workspace-mark {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  color: var(--ink);
  display: flex;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  letter-spacing: -0.04em;
  width: 44px;
}

.workspace-name {
  font-size: 15px;
  font-weight: 720;
  line-height: 1.15;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-meta {
  color: var(--subtle);
  font-size: 12px;
  margin: 2px 0 0;
}

.spotlight-trigger,
.searchbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  color: var(--subtle);
  cursor: pointer;
  display: flex;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
}

.spotlight-trigger span,
.searchbar span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

kbd {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: var(--muted);
  font:
    600 12px / 1 "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  min-width: 26px;
  padding: 5px 7px;
  text-align: center;
}

.content-shell {
  background: #fbfbfa;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* The drawer summoner — visible only under the 900px breakpoint. Doubled class beats the
   generic .button display that is declared later in the file. */
.button.nav-toggle {
  display: none;
}

.content-topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 104px;
  padding: 20px 24px;
}

.content-topbar h1 {
  font-size: clamp(28px, 3vw, 38px);
}

.content-topbar .muted {
  margin: 6px 0 0;
}

.content-shell > .tab-panel {
  overflow-y: auto;
  padding: 18px 24px 24px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-splash {
  background: var(--bg);
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.app-splash-content {
  align-items: center;
  display: grid;
  gap: var(--space-4);
  justify-items: center;
}

.app-splash-content strong {
  color: var(--ink);
  font:
    650 28px / 1 "SF Pro Display",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  letter-spacing: -0.035em;
}

.app-splash-spinner {
  animation: app-splash-spin 0.9s linear infinite;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-pill);
  border-top-color: var(--accent);
  height: 20px;
  width: 20px;
}

@keyframes app-splash-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-splash-spinner {
    animation: none;
  }
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  box-shadow: var(--shadow);
  display: grid;
  gap: 28px;
  grid-template-columns: 1.1fr 0.9fr;
  margin: 14vh auto 0;
  max-width: 820px;
  padding: 34px;
}

.login-recovery {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  padding-top: 14px;
}

.login-recovery summary {
  cursor: pointer;
  font-weight: 750;
}

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

.top-actions,
.row-actions,
.panel-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-actions {
  align-items: center;
  justify-content: flex-end;
  min-width: min(620px, 52vw);
}

.searchbar {
  flex: 1;
  max-width: 430px;
  min-width: 260px;
}

.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-8);
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  gap: 7px;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button.sm {
  min-height: 32px;
  padding: 0 10px;
}

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

.button.ghost:hover:not(:disabled) {
  background: var(--panel-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.button.danger {
  background: #fff8f8;
  border-color: #e6cad0;
  color: var(--accent-2);
}

.button.danger:hover:not(:disabled) {
  background: #fff0f2;
  border-color: #dcaeb8;
}

.button:disabled,
.select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

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

.muted,
.label,
.row-meta {
  color: var(--muted);
}

.error,
.error-banner {
  color: var(--accent-2);
}

.error-banner {
  align-items: center;
  background: #fff4f5;
  border: 1px solid #e6cad0;
  border-radius: var(--radius-8);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-weight: 750;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.error-banner > span {
  min-width: 0;
}

.live-updates-banner {
  align-items: center;
  background: #fff8e8;
  border: 1px solid #e4d29d;
  border-radius: var(--radius-8);
  color: #6d5214;
  display: flex;
  gap: 8px;
  font-weight: 650;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.live-updates-banner svg {
  flex: 0 0 auto;
}

.stack,
.list-stack,
.event-list {
  display: grid;
  gap: 10px;
}

.status-strip {
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  display: grid;
  gap: 1px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
  overflow: hidden;
}

.status-strip > div {
  background: var(--panel);
  display: grid;
  gap: 3px;
  min-height: 82px;
  padding: 14px 16px;
}

.metric-block {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.metric-icon {
  color: var(--accent);
}

.metric {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.metric-list {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 4px 8px;
}

.metric-list > span {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-width: 0;
}

.metric-list > span:not(:first-child)::before {
  color: var(--line-strong);
  content: "·";
}

.tabs-list {
  background: transparent;
  border: 0;
  border-radius: 0;
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
}

.nav-group {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 14px;
}

.nav-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.nav-group-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 6px;
}

.tab {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-12);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-weight: 650;
  gap: 10px;
  justify-content: flex-start;
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  width: 100%;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
}

.tab[data-selected] {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.tab-panel {
  outline: none;
}

.sidebar-account {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}

.sidebar-account > .account-trigger {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-grid {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.dashboard-grid > .panel {
  height: 100%;
}

.dashboard-hero {
  align-items: end;
  background: linear-gradient(135deg, rgba(36, 121, 189, 0.08), transparent 38%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  gap: 16px;
  grid-column: 1 / -1;
  justify-content: space-between;
  min-height: 150px;
  padding: 22px;
}

.dashboard-hero h2 {
  font-size: clamp(28px, 3.4vw, 42px);
}

.dashboard-hero .muted {
  max-width: 640px;
}

.hero-actions,
.overview-columns,
.spotlight-results {
  display: grid;
  gap: 10px;
}

.hero-actions {
  grid-template-columns: auto auto;
}

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

.overview-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.overview-list h3 {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.action-row,
.spotlight-result {
  appearance: none;
  color: inherit;
  cursor: pointer;
  display: grid;
  font: inherit;
  text-align: left;
  width: 100%;
}

.action-row:hover,
.spotlight-result:hover {
  background: var(--panel-2);
}

.work-grid {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.85fr);
}

.access-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}

.account-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

/* Account page: the session user-agent is string-truncated in the view (full value sits on the
   title tooltip); this is the CSS backstop so a narrow panel column still can't be stretched. */
.session-agent {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-actions {
  justify-content: flex-end;
  margin-bottom: 10px;
}

.loading-row {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 18px 0;
}

.composition-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.adops-grid {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 0.9fr);
}

.saas-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1.1fr);
}

.analytics-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr) minmax(0, 0.9fr);
}

.span-2 {
  grid-column: span 2;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  min-width: 0;
  padding: 14px;
}

/* Device-scoped emergency messaging shares the composition grid, but the red top rule makes the
   incident surface distinguishable from the adjacent screen-level Zásah controls at a glance. */
.emergency-alert-panel {
  border-top: 3px solid var(--danger);
}

.emergency-alert-panel .panel-icon {
  background: #fff4f5;
  border-color: #e6cad0;
  color: var(--danger);
}

.emergency-alert-form textarea {
  min-height: 88px;
  resize: vertical;
}

.emergency-character-count {
  margin: -6px 0 0;
  text-align: right;
}

.emergency-target-picker {
  border: 0;
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.emergency-target-picker legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 6px;
  padding: 0;
}

.emergency-target-options {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px;
}

.emergency-alert-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.emergency-alert-section-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.emergency-alert-message {
  margin: 0;
}

.panel-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-icon {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(36, 121, 189, 0.18);
  border-radius: var(--radius-sm);
  color: var(--accent);
  display: flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.history-grid,
.date-grid {
  display: grid;
  gap: 12px;
  /* minmax(0,…), not bare 1fr: bare 1fr = minmax(auto,1fr), so a long unwrappable row-meta line
     ("smyčka · Europe/Prague") sets the column's MINIMUM to its intrinsic text width and the panel
     overflows horizontally. Linux CI fonts render Czech wider than macOS — this tripped the
     dashboard-matrix no-horizontal-overflow gate on the runner only (27px over at 1280px). */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.upload-form,
.pair-form,
.invite-form {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

/* Field(s) + button rows: flex-wrap so 2- or 3-element groups reflow instead of
   colliding when the surrounding panel column is narrow. */
.inline-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form > label,
.inline-form > .select-field,
.inline-form > input {
  flex: 1 1 130px;
  min-width: 0;
}

.inline-form > .button {
  flex: 0 0 auto;
}

.invite-form {
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
  margin-bottom: 14px;
}

.adops-form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 14px;
}

.upload-workbench {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  gap: 10px;
  padding: 12px;
}

/* The drawer's two tabs are both mounted (so a half-filled form survives a tab switch) and the
   inactive one carries [hidden]. `display: grid` above outranks the UA stylesheet's hidden rule,
   so it has to be restated here — without this both tabs render stacked. */
.upload-workbench[hidden] {
  display: none;
}

.upload-quick-create {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.upload-quick-create .inline-form {
  margin: 0;
}

.multi-upload-form {
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}

.multi-upload-form > .button,
.multi-upload-form > .check-row {
  align-self: end;
}

.queue-summary {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
}

.queue-summary span,
.upload-queue-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
}

.queue-summary span {
  padding: 5px 8px;
}

.upload-queue {
  display: grid;
  gap: 8px;
}

.upload-queue-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px) minmax(260px, 360px) auto;
  padding: 9px 10px;
}

.upload-queue-role .select-field {
  margin: 0;
}

.upload-queue-role .select-field > span {
  font-size: 11px;
}

.upload-queue-role .select-trigger {
  min-height: 34px;
  padding-block: 6px;
}

.upload-queue-meta {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(120px, 1fr) 72px 64px;
}

.upload-queue-meta label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 700;
  gap: 3px;
}

.upload-queue-meta input {
  min-height: 34px;
  padding-block: 6px;
}

.upload-queue-row.state-ready {
  border-color: rgba(22, 131, 61, 0.32);
}

.upload-queue-row.state-error {
  border-color: rgba(147, 98, 22, 0.38);
}

.media-maintenance-actions {
  align-items: center;
}

/* ── ui/FileDrop ────────────────────────────────────────────────
   Custom dropzone family (inline / detailed / multi) + progress bar. */
.filedrop {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.filedrop-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.filedrop-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.filedrop-zone {
  background: var(--panel);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-12);
  transition:
    border-color 140ms ease,
    background-color 140ms ease;
}

.filedrop-zone.is-dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.filedrop-zone.is-disabled {
  opacity: 0.55;
}

.filedrop-zone-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  padding: 22px 16px;
  text-align: center;
  width: 100%;
}

.filedrop-zone-button:disabled {
  cursor: not-allowed;
}

.filedrop-zone-button > svg {
  color: var(--accent);
}

.filedrop-inline .filedrop-zone-button {
  flex-direction: row;
  gap: 9px;
  justify-content: flex-start;
  padding: 10px 12px;
  text-align: left;
}

.filedrop-zone-text {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.filedrop-zone-hint {
  font-size: 12px;
}

.filedrop-slots {
  display: grid;
  gap: 8px;
}

.filedrop-slot {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 10px;
}

.filedrop-detailed .filedrop-slot {
  align-items: start;
}

.filedrop-slot.state-ready {
  border-color: rgba(22, 131, 61, 0.32);
}

.filedrop-slot.state-error {
  border-color: rgba(180, 40, 45, 0.4);
}

.filedrop-thumb {
  align-items: center;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: var(--subtle);
  display: flex;
  flex: none;
  height: 40px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 40px;
}

/* Play badge over a video poster; fades out on hover while the clip plays. */
.filedrop-thumb-play {
  align-items: center;
  background: rgba(17, 18, 23, 0.28);
  color: #fff;
  display: flex;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  transition: opacity 120ms ease;
}

.filedrop-thumb:hover .filedrop-thumb-play {
  opacity: 0;
}

.filedrop-detailed .filedrop-thumb {
  height: 72px;
  width: 96px;
}

.filedrop-thumb-media {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.filedrop-slot-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filedrop-slot-title {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filedrop-slot-meta {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.filedrop-slot-fields {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.filedrop-slot-extra {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.filedrop-slot-actions {
  align-self: start;
  display: flex;
  gap: 4px;
}

.upload-progress {
  background: var(--panel-3);
  border-radius: var(--radius-pill);
  height: 6px;
  overflow: hidden;
  width: 100%;
}

.upload-progress-fill {
  background: var(--accent);
  border-radius: inherit;
  height: 100%;
  transition: width 120ms ease;
}

.rule-stack {
  margin-bottom: 12px;
}

.mini-kpis {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
}

.approval-controls,
.billing-strip,
.checkout-controls,
.quota-grid,
.toggle-grid {
  display: grid;
  gap: 10px;
}

.checkout-controls {
  margin: 14px 0;
}

.approval-controls {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 14px 0;
}

/* select + button + price card: flex-wrap so the strip reflows instead of
   overflowing into the neighbouring panel column when billing sits in a
   narrow saas-grid track. */
.billing-strip {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  margin: 14px 0;
}

.billing-strip > .select-field {
  flex: 1 1 200px;
  min-width: 0;
}

.billing-strip > .pricing-card {
  flex: 1 1 180px;
  min-width: 0;
}

.billing-strip > .button {
  flex: 0 0 auto;
}

.quota-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.quota-row,
.pricing-card,
.toggle-row,
.token-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  padding: 10px 12px;
}

.quota-row {
  background: var(--panel);
  display: grid;
  gap: 8px;
}

.quota-row > div:first-child {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.quota-bar {
  background: var(--panel-3);
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}

.quota-bar span {
  background: var(--accent);
  display: block;
  height: 100%;
}

.fullness-bar {
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  width: 100%;
}

.fullness-bar span {
  display: block;
  height: 100%;
  transition: width 120ms ease;
}

.fullness-bar.is-under span {
  background: #d97706;
}

.fullness-bar.is-balanced span {
  background: #16a34a;
}

.fullness-bar.is-over span {
  background: #dc2626;
}

.pricing-card {
  background: var(--panel-2);
  display: grid;
  gap: 3px;
}

.pricing-stack,
.forecast-list,
.analytics-columns,
.programmatic-columns,
.integration-columns,
.trust-columns,
.valuation-form {
  display: grid;
  gap: 10px;
}

.pricing-stack {
  margin-bottom: 12px;
}

.valuation-form {
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0;
  padding-top: 12px;
}

.price-facts-list {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

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

.programmatic-columns {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  margin-top: 14px;
}

.trust-columns {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  margin-top: 14px;
}

.integration-columns {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  margin-top: 4px;
}

.scope-grid,
.token-reveal {
  display: grid;
  gap: 8px;
}

.scope-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.auction-history {
  margin-top: 12px;
}

.access-review-list {
  margin-top: 12px;
}

.review-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  gap: 6px;
  padding: 10px;
}

.forecast-list {
  margin-bottom: 12px;
}

.forecast-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  gap: 10px;
  grid-template-columns: 86px minmax(120px, 1fr) auto;
  min-height: 42px;
  padding: 8px 10px;
}

.forecast-band {
  background: var(--panel-3);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  justify-self: stretch;
  padding: 5px 8px;
  text-align: center;
}

.toggle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.toggle-row {
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.token-box {
  background: #f0f2f7;
  color: #202436;
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.csv-box {
  min-height: 150px;
  resize: vertical;
  width: 100%;
}

.event-row,
.review-queue-row,
.media-card,
.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  padding: 10px;
}

.event-row,
.review-queue-row,
.media-card {
  background: var(--panel);
}

.event-row,
.review-queue-row {
  align-items: center;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.event-row .button,
.event-row .row-actions {
  justify-self: start;
}

.event-row:hover,
.review-queue-row:hover,
.media-card:hover {
  border-color: var(--line-strong);
}

.row-title {
  font-weight: 650;
  min-width: 0;
  overflow-wrap: anywhere;
}

.row-meta {
  font-size: 12px;
}

.section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inspector-drilldown {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inspector-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.inspector-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 4px;
  min-height: 74px;
  min-width: 0;
  padding: 10px;
  text-align: left;
}

.inspector-row:hover,
.inspector-row.selected {
  border-color: var(--line-strong);
}

.inspector-row.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.inspector-detail {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  padding-top: 14px;
}

.inspector-detail h3 {
  font-size: 18px;
  margin: 0;
}

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

.detail-grid {
  margin: 0;
}

.detail-grid div {
  border-bottom: 1px solid var(--line);
  min-width: 0;
  padding-bottom: 8px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid dd {
  font-size: 13px;
  font-weight: 650;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.inspector-reason {
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  margin: 0;
  overflow-wrap: anywhere;
  padding: 10px;
}

.inspector-context {
  align-items: start;
}

.checkout-url {
  overflow-wrap: anywhere;
}

.media-grid,
.fleet-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-top: 14px;
}

.zone-grid,
.fleet-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 14px;
}

.fleet-controls {
  align-items: end;
  margin-bottom: 14px;
}

.zone-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.command-actions {
  grid-column: 1 / -1;
}

.layout-preview {
  aspect-ratio: 16 / 9;
  background: #151720;
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  min-height: 220px;
  overflow: hidden;
  position: relative;
}

.layout-zone {
  align-items: center;
  background: rgba(244, 245, 248, 0.12);
  border: 1px solid rgba(244, 245, 248, 0.46);
  color: #f7f8fb;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  position: absolute;
  text-align: center;
}

.media-card {
  display: grid;
  gap: 12px;
  grid-template-columns: 90px 1fr;
}

.thumb {
  align-items: center;
  aspect-ratio: 1;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.thumb img,
.thumb video {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.hover-video-preview {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  position: relative;
  width: 100%;
}

.hover-video-preview-video {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.pill {
  background: var(--accent-soft);
  border: 1px solid rgba(36, 121, 189, 0.2);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  padding: 4px 8px;
  white-space: nowrap;
}

.pill.health-critical {
  background: rgba(214, 80, 80, 0.12);
  border-color: rgba(214, 80, 80, 0.28);
  color: #9b2828;
}

.pill.health-warning {
  background: rgba(181, 126, 29, 0.12);
  border-color: rgba(181, 126, 29, 0.28);
  color: #805a14;
}

.pill.health-info {
  background: rgba(42, 118, 104, 0.11);
  border-color: rgba(42, 118, 104, 0.24);
  color: #1e6659;
}

.state-ready,
.state-playing,
.state-paired,
.state-active,
.state-accepted,
.state-pending.online {
  color: var(--ok);
  font-weight: 850;
}

.state-error,
.state-offline,
.state-revoked,
.state-expired,
.state-superseded {
  color: var(--accent-2);
  font-weight: 850;
}

.state-quarantined {
  color: #805a14;
  font-weight: 850;
}

.state-pending,
.state-booting,
.state-idle {
  color: var(--warn);
  font-weight: 850;
}

.empty {
  border-style: dashed;
  color: var(--muted);
  background: var(--panel-2);
}

/* DataTable emptyAction (U5): the CTA sits under the empty label in the same cell. */
.empty-action {
  margin-top: var(--space-3);
}

.check-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.check-row input {
  min-height: auto;
  width: auto;
}

.select-trigger {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  gap: 8px;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 12px;
  width: 100%;
}

/* ── stacking order ──────────────────────────────────────────
   40  sticky page chrome
   50  modal backdrop
   51  drawer panel        60  dialog popup
   80  select / menu popups — MUST outrank both, or a picker opened inside a dialog or drawer
       renders behind it and its options can't be clicked (2026-07-31: exactly this happened when
       the Média upload workbench moved into a drawer)
   100 toasts — always the last word
   ──────────────────────────────────────────────────────────── */

.select-positioner {
  z-index: 80;
}

.select-popup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  box-shadow: var(--shadow);
  min-width: 220px;
  padding: 5px;
}

.select-item {
  align-items: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  font-weight: 600;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 8px;
}

.select-item[data-highlighted] {
  background: var(--accent-soft);
}

.dialog-backdrop {
  background: rgba(17, 18, 23, 0.38);
  inset: 0;
  position: fixed;
  z-index: 50;
}

.dialog-popup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  left: 50%;
  max-width: min(900px, calc(100vw - 32px));
  padding: 18px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 820px;
  z-index: 60;
}

.dialog-title {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.schedule-timed-spot-dialog {
  width: min(520px, calc(100vw - 32px));
}

.membership-role-dialog {
  width: min(480px, calc(100vw - 32px));
}

.retention-policy-dialog {
  width: min(520px, calc(100vw - 32px));
}

.retention-policies-table {
  overflow-x: auto;
}

.retention-policies-table .data-table {
  min-width: 760px;
}

/* The members card shares a grid row with the outbox card, so the table scrolls
   sideways inside its own card instead of bleeding over the neighbour. */
.team-members-table {
  overflow-x: auto;
}

.team-members-table .data-table {
  min-width: 640px;
}

.timed-spots-head {
  align-items: end;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
}

.timed-spots-head h3 {
  font-size: 16px;
}

.timed-spots-list .event-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.timed-spots-list .row-title,
.timed-spots-list .row-meta {
  grid-column: 1;
}

.timed-spots-list .badge,
.timed-spots-list .row-actions {
  grid-column: 2;
  justify-self: end;
}

.spotlight-popup {
  gap: 10px;
  top: 11vh;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px));
}

.spotlight-input-wrap {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 0 12px;
}

.spotlight-input-wrap input {
  background: transparent;
  border: 0;
  min-height: 48px;
  outline: none;
  padding: 0;
}

.spotlight-results {
  max-height: min(460px, 56vh);
  overflow: auto;
}

.spotlight-result {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  gap: 10px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  min-height: 54px;
  padding: 9px;
}

.spotlight-result > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.preview-stage {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: #151720;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.preview-stage img,
.preview-stage video {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.compact {
  gap: 4px;
}

/* ── Responsive shell (2026-07-31, critique §3.5).
   Breakpoints: ≤1100px icon rail · ≤900px off-canvas drawer · short screens compact the rail.
   The old ≤1020px rules turned the sidebar into a horizontally scrolling strip that hid the
   active tab and pushed ~1050px of chrome above the content — exactly the layout this replaces.
   Content-GRID collapses stay in the 1020px block below; the shell has its own blocks. */

/* Icon rail: between 901 and 1100px the sidebar keeps its vertical shape but drops to icons.
   Labels return inside the ≤900px drawer (that block re-expands them — order matters). */
@media (max-width: 1100px) {
  .product-shell {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
  }

  .workspace-switcher {
    grid-template-columns: 44px;
    min-height: 0;
    padding: 6px;
  }

  .workspace-switcher > :not(.workspace-mark),
  .spotlight-trigger > :not(svg),
  .nav-group-label,
  .tab > span {
    display: none;
  }

  .spotlight-trigger,
  .tab {
    justify-content: center;
    width: 44px;
  }

  .sidebar-account {
    flex-direction: column;
  }

  .sidebar-account .account-id {
    display: none;
  }
}

@media (max-width: 1020px) {
  body:has(.app-shell) {
    overflow: auto;
  }

  .shell {
    padding: 18px;
  }

  .app-shell {
    padding: 10px;
  }

  .upload-queue-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .content-topbar,
  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    min-width: 0;
  }

  .searchbar {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .hero-actions,
  .page-actions {
    grid-template-columns: 1fr;
  }

  .login-panel,
  .work-grid,
  .access-grid,
  .account-grid,
  .inspector-drilldown,
  .status-strip,
  .dashboard-grid,
  .overview-columns,
  .approval-controls,
  .analytics-columns,
  .billing-strip,
  .programmatic-columns,
  .trust-columns,
  .valuation-form,
  .history-grid,
  .date-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .inline-form,
  .invite-form,
  .upload-form,
  .pair-form {
    grid-template-columns: 1fr;
  }

  .media-card,
  .forecast-row {
    grid-template-columns: 1fr;
  }
}

/* Off-canvas drawer: below 900px the sidebar leaves the grid entirely and slides over the
   content when summoned by the topbar hamburger. Labels re-expand — inside a drawer there is
   room for them, and an icon-only drawer would be pointless. */
@media (max-width: 900px) {
  .product-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    align-items: stretch;
    bottom: 0;
    box-shadow: var(--shadow);
    gap: 18px;
    left: 0;
    padding: 18px;
    position: fixed;
    top: 0;
    transform: translateX(-105%);
    transition: transform 160ms ease;
    width: min(320px, 86vw);
    z-index: 90;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    background: rgba(19, 20, 24, 0.4);
    inset: 0;
    position: fixed;
    z-index: 89;
  }

  .button.nav-toggle {
    display: inline-flex;
  }

  .workspace-switcher {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 72px;
    padding: 10px;
  }

  .workspace-switcher > :not(.workspace-mark),
  .spotlight-trigger > :not(svg),
  .tab > span {
    display: revert;
  }

  .nav-group-label {
    display: block;
  }

  .spotlight-trigger,
  .tab {
    justify-content: flex-start;
    width: 100%;
  }

  .sidebar-account {
    flex-direction: row;
  }

  .sidebar-account .account-id {
    display: revert;
  }

  .content-shell {
    overflow: visible;
  }

  .content-shell > .tab-panel {
    overflow: visible;
    padding: 14px;
  }
}

/* Short laptop screens: the rail held 915px of content in a 718px viewport (critique §3.5) —
   compact the chrome instead of scrolling the navigation. */
@media (max-height: 820px) and (min-width: 901px) {
  .sidebar {
    gap: 8px;
    padding: 10px 14px;
  }

  .workspace-switcher {
    min-height: 48px;
    padding: 6px;
  }

  .spotlight-trigger {
    min-height: 34px;
    padding: 6px 10px;
  }

  .tabs-list {
    gap: 2px;
  }

  .tab {
    min-height: 30px;
    padding: 4px 10px;
  }

  .nav-group {
    padding-top: 6px;
  }

  .nav-group-label {
    margin-bottom: 2px;
  }
}

/* ── Small phones (U5 mobile pass). The 1020px block above already stacks the shell,
   sidebar and the wide grids; this adds the phone-specific finishing touches. */
@media (max-width: 720px) {
  /* Tables keep their column layout and scroll sideways inside the panel instead of
     squishing cells into unreadable wraps. */
  .panel {
    overflow-x: auto;
  }

  .data-table {
    min-width: 560px;
  }

  .dialog-popup {
    max-width: calc(100vw - 32px);
  }

  /* Detail-view grids (entity detail main+aside, settings/context splits) collapse to
     one column; the 960px .detail-layout rule already covers the main split. */
  .detail-main,
  .detail-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-actions,
  .hero-actions,
  .page-actions {
    flex-wrap: wrap;
  }

  /* The ⌘K hint is meaningless on a touch keyboard. */
  .searchbar kbd,
  .spotlight-trigger kbd {
    display: none;
  }
}

/* ── ui/Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  /* Hug content even when placed directly in a grid/flex-column (which would
     otherwise blockify + stretch the badge to the full track width). */
  justify-self: start;
  align-self: start;
  width: fit-content;
}

.badge-neutral {
  background: var(--panel-3);
  border-color: var(--line);
  color: var(--muted);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-ok {
  background: #e6f4ea;
  color: var(--ok);
}

.badge-warn {
  background: #fbf1e0;
  color: var(--warn);
}

.badge-danger {
  background: #fbe7e8;
  color: var(--danger);
}

.badge-info {
  background: #e8eefb;
  color: var(--info);
}

/* ── ui/Card ────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* ── Workspace switcher (interactive trigger) ───────────────── */
.workspace-switcher.interactive {
  cursor: pointer;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
}

.workspace-switcher.interactive:hover {
  border-color: var(--line-strong);
}

.workspace-switcher.interactive:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Base UI Menu (workspace switcher, account, …) ──────────── */
.menu-positioner {
  z-index: 80;
}

.menu-popup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  min-width: 240px;
  padding: var(--space-1);
}

.workspace-menu {
  min-width: 260px;
}

.menu-item {
  align-items: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  gap: var(--space-3);
  min-height: 40px;
  padding: var(--space-2);
}

.menu-item[data-highlighted] {
  background: var(--accent-soft);
}

.menu-item.active {
  background: var(--panel-2);
}

.menu-item-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.menu-item-title {
  font-size: var(--text-md);
  font-weight: 650;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-item-meta {
  color: var(--subtle);
  font-size: var(--text-xs);
  margin-top: 2px;
}

.workspace-mark.small {
  border-radius: var(--radius-8);
  font-size: var(--text-sm);
  height: 32px;
  width: 32px;
}

/* ── Account menu (bottom of sidebar) ───────────────────────── */
.account-trigger {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: inherit;
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: var(--space-2);
  padding: var(--space-2);
  text-align: left;
  width: 100%;
}

.account-trigger:hover {
  background: var(--panel-2);
  border-color: var(--line);
}

.account-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.account-avatar {
  align-items: center;
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  color: var(--accent);
  display: flex;
  flex: none;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.account-id {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Settings entry (gear) next to the account menu — same ghost treatment as .account-trigger. */
.settings-trigger {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: none;
  justify-content: center;
  padding: var(--space-2);
}

.settings-trigger:hover {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink);
}

.settings-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-trigger[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── ui/DataTable ───────────────────────────────────────────── */
.data-table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-8);
  width: 100%;
}

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

.data-table thead th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
}

.data-table thead th:first-child {
  border-top-left-radius: var(--radius-8);
}

.data-table thead th:last-child {
  border-top-right-radius: var(--radius-8);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-8);
}

.data-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-8);
}

.data-table-sort {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 6px;
  letter-spacing: inherit;
  padding: 0;
  text-transform: inherit;
}

.data-table-sort:hover {
  color: var(--ink);
}

.data-table-sort .sort-indicator {
  font-size: 9px;
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table tbody tr.clickable:hover td {
  background: var(--panel-2);
}

.data-table tbody tr.clickable:focus-visible {
  outline: 2px solid rgba(36, 121, 189, 0.4);
  outline-offset: -2px;
}

.data-table td.empty {
  background: transparent;
  border: 0;
  text-align: center;
}

/* Bulk selection column (DataTable `selectable`) + the bulk action bar above lists. */
.data-table .select-cell {
  text-align: center;
  width: 36px;
}

.data-table .select-cell input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.bulk-bar {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: flex;
  /* The fleet bulk bar carries two labeled selects next to its buttons — wrap instead of
     overflowing at narrow widths, and align the select labels with the buttons beside them. */
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
}

.bulk-bar .select-field {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  margin: 0;
}

.bulk-bar .bulk-count {
  font-weight: 650;
}

/* HTML5 row drag-and-drop (playlist items/campaigns, campaign spots): the dragged row fades,
   the drop target gets an accent top edge. The Nahoru/Dolů buttons stay the fallback path. */
.data-table tbody tr.dragging,
.event-row.dragging {
  opacity: 0.5;
}

.data-table tbody tr.drop-target td {
  box-shadow: inset 0 2px 0 var(--accent);
}

.event-row.drop-target {
  border-color: var(--accent);
  box-shadow: inset 0 2px 0 var(--accent);
}

.data-table tbody tr[draggable="true"],
.event-row[draggable="true"] {
  cursor: grab;
}

/* Media library card bulk selection. */
.media-card .media-select {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  grid-column: 1 / -1;
}

.media-card .media-select input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

/* ── panels/clients (AdOps sub-navigation + list toolbar) ────── */
.subnav {
  display: flex;
  gap: var(--space-2);
  grid-column: 1 / -1;
  margin-bottom: var(--space-3);
}

.subnav-link {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
}

.subnav-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.subnav-link.active {
  background: var(--accent-soft);
  border-color: rgba(36, 121, 189, 0.2);
  color: var(--accent);
}

/* ── panels/settings (Nastavení shell: left sub-nav + section content) ── */
.settings-layout {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 180px minmax(0, 1fr);
}

.settings-subnav {
  align-items: stretch;
  flex-direction: column;
  /* .subnav carries grid-column: 1 / -1 for AdOps; here the nav IS the left grid column. */
  grid-column: auto;
  margin-bottom: 0;
}

.settings-subnav .subnav-link {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.settings-content {
  min-width: 0;
}

.clients-toolbar {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.clients-toolbar input {
  flex: 1;
}

.clients-toolbar .canvases-archive-toggle {
  flex: none;
  white-space: nowrap;
}

.clients-toolbar .canvases-archive-toggle input {
  flex: none;
}

.client-spots-table {
  overflow-x: auto;
}

.spot-row-actions {
  flex-wrap: nowrap;
  min-width: max-content;
}

.edit-spot-dialog {
  width: min(480px, calc(100vw - 32px));
}

.spot-client-filter {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

.spot-client-filter span {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.spot-client-filter select {
  min-width: 220px;
}

.media-library-toolbar {
  flex-wrap: wrap;
}

.media-library-toolbar > input {
  min-width: 220px;
}

.media-library-sort {
  flex: 0 0 180px;
}

.media-library-sort .select-field {
  width: 100%;
}

/* ── campaigns/CampaignDetailView ───────────────────────────── */
.row-title-link {
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  padding: 0;
  text-align: left;
}

.row-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.spot-thumb {
  flex: none;
  height: 40px;
  width: 40px;
}

.asset-pick-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  max-height: 280px;
  overflow: auto;
}

.asset-pick-row {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  text-align: left;
}

.asset-pick-row:last-child {
  border-bottom: 0;
}

.asset-pick-row:hover {
  background: var(--panel-3);
}

.asset-pick-row.selected,
.asset-pick-row[aria-pressed="true"] {
  background: var(--accent-soft);
}

/* ── campaigns/CampaignsListView ────────────────────────────── */
.campaigns-list {
  align-content: start;
  display: grid;
  gap: var(--space-3);
}

.campaigns-secondary > summary {
  cursor: pointer;
  font-weight: 650;
}

.campaigns-secondary > summary::marker {
  color: var(--muted);
}

.campaigns-secondary[open] > summary {
  margin-bottom: var(--space-3);
}

.campaigns-secondary-body {
  display: grid;
  gap: var(--space-3);
}

.pick-group {
  display: grid;
  gap: var(--space-2);
}

.pick-label {
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ── ui/ConfirmDialog ───────────────────────────────────────── */
.confirm-dialog {
  max-width: min(440px, calc(100vw - 32px));
  width: 440px;
}

.dialog-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ── ui/Toast ───────────────────────────────────────────────── */
.toast-stack {
  bottom: var(--space-5);
  display: grid;
  gap: var(--space-2);
  position: fixed;
  right: var(--space-5);
  width: min(360px, calc(100vw - 32px));
  z-index: 100;
}

.toast {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  box-shadow: var(--shadow);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  padding: 10px 12px;
}

.toast-success {
  background: #e6f4ea;
  color: var(--ok);
}

.toast-error {
  background: #fbe7e8;
  color: var(--danger);
}

.toast-dismiss {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  flex: none;
  font: inherit;
  line-height: 1;
  padding: 2px 4px;
}

/* ── ui/EntityHeader ────────────────────────────────────────── */
.entity-header {
  display: grid;
  gap: var(--space-2);
}

.breadcrumb-list {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb-item {
  align-items: center;
  display: flex;
  gap: 6px;
}

.breadcrumb-separator {
  color: var(--subtle);
}

.breadcrumb-link {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.breadcrumb-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumb-current {
  color: var(--ink);
  font-weight: 600;
}

.entity-header-row {
  align-items: flex-start;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

.entity-header-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.entity-header-title h1 {
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  margin: 0;
}

.entity-header-actions {
  display: flex;
  gap: var(--space-2);
}

/* ── ui/DetailLayout ────────────────────────────────────────── */
.detail-layout {
  align-items: start;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr) 320px;
}

.detail-layout.no-aside {
  grid-template-columns: minmax(0, 1fr);
}

.detail-main,
.detail-aside {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

/* ── media/MediaAssetDetailView ─────────────────────────────── */
.media-detail,
.device-detail {
  display: grid;
  gap: var(--space-4);
}

.media-detail-preview {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: #151720;
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: #f7f8fb;
  display: flex;
  justify-content: center;
  min-height: 280px;
  overflow: hidden;
}

.media-detail-preview img,
.media-detail-preview video {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.media-preview-meta {
  margin-top: var(--space-3);
}

.media-usage-groups {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.media-usage-group {
  min-width: 0;
}

.media-usage-group h3 {
  font-size: var(--text-sm);
  margin: 0 0 var(--space-2);
}

.media-detail-facts {
  display: grid;
  gap: 0;
  margin: 0;
}

.media-detail-facts > div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: var(--space-2);
  grid-template-columns: minmax(0, 90px) minmax(0, 1fr);
  padding: var(--space-2) 0;
}

.media-detail-facts > div:last-child {
  border-bottom: 0;
}

.media-detail-facts dt {
  color: var(--muted);
  font-size: var(--text-xs);
}

.media-detail-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.media-detail-facts .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--text-xs);
}

@media (max-width: 720px) {
  .media-usage-groups {
    grid-template-columns: minmax(0, 1fr);
  }

  .media-detail-preview {
    min-height: 200px;
  }
}

@media (max-width: 960px) {
  .detail-layout,
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Collapsed settings shell: the left sub-nav turns back into a horizontal pill row. */
  .settings-subnav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ── panels/monitor (U8 operator live view) ─────────────────── */
.monitor-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin-top: 14px;
}

.monitor-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.monitor-card {
  align-content: start;
  display: grid;
  gap: var(--space-3);
}

/* Loud signalling for problem cards: a thick colored left bar the operator can't miss
   on an all-day wall. */
.monitor-card-alert {
  border-left: 4px solid var(--danger);
}

.monitor-card-warn {
  border-left: 4px solid var(--warn);
}

.monitor-card-head {
  align-items: flex-start;
  display: flex;
  gap: var(--space-2);
}

.monitor-card-title {
  flex: 1;
  min-width: 0;
}

.monitor-dot {
  border-radius: var(--radius-pill);
  flex: none;
  height: 10px;
  margin-top: 5px;
  width: 10px;
}

.monitor-dot-ok {
  background: var(--ok);
}

.monitor-dot-warn {
  background: var(--warn);
}

.monitor-dot-danger {
  background: var(--danger);
}

.monitor-now {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 64px minmax(0, 1fr);
  padding: var(--space-2);
}

.monitor-now-label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.monitor-thumb {
  width: 64px;
}

.monitor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.monitor-alerts,
.monitor-alert-group {
  display: grid;
  gap: var(--space-2);
}

.monitor-alert-group {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  padding: var(--space-2);
}

.monitor-alert-group-head,
.device-screenshot-meta,
.alert-actions,
.alert-group-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
}

.alert-actions {
  justify-content: flex-end;
}

.alert-owner {
  color: var(--muted);
  font-size: var(--text-xs);
}

.alert-acknowledged {
  filter: saturate(0.45);
  opacity: 0.72;
}

.device-screenshot {
  display: grid;
  gap: var(--space-2);
}

.device-screenshot-frame {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: var(--panel-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-8);
  color: var(--muted);
  display: flex;
  font-size: var(--text-sm);
  justify-content: center;
  overflow: hidden;
  text-align: center;
}

.device-screenshot-frame img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.monitor-deviceless {
  margin-top: 14px;
}

.monitor-deviceless .event-row {
  opacity: 0.75;
}

/* ── ui/NotificationBell ────────────────────────────────────── */
.notification-bell {
  position: relative;
}

.notification-bell-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
  position: relative;
}

.notification-bell-button:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
}

.notification-bell-badge {
  align-items: center;
  background: var(--danger);
  border-radius: var(--radius-pill);
  color: #fff;
  display: inline-flex;
  font-size: var(--text-xs);
  font-weight: 700;
  justify-content: center;
  min-height: 18px;
  min-width: 18px;
  padding: 0 5px;
  position: absolute;
  right: -6px;
  top: -6px;
}

.notification-positioner {
  z-index: 80;
}

.notification-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  max-width: calc(100vw - 24px);
  padding: var(--space-2);
  width: 380px;
}

.notification-panel-head {
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-1) var(--space-2);
}

.notification-item {
  background: transparent;
  border-radius: var(--radius-8);
  display: grid;
  gap: 2px;
  padding: var(--space-2);
  width: 100%;
}

.notification-item-main {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 2px;
  padding: 0;
  text-align: left;
  width: 100%;
}

.notification-item .alert-actions {
  margin-top: var(--space-1);
}

.notification-item:hover {
  background: var(--panel-2);
}

.notification-more {
  color: var(--muted);
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-2);
}

/* ── screens/ScheduleWeek (U9a) ─────────────────────────────── */
.schedule-week {
  display: grid;
  gap: var(--space-2);
}

.schedule-week-tz {
  color: var(--muted);
  font-size: var(--text-xs);
}

.schedule-week-grid {
  align-items: center;
  column-gap: 1px;
  display: grid;
  grid-template-columns: 2rem repeat(24, minmax(0, 1fr));
  row-gap: 2px;
}

.schedule-week-hour-label {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.schedule-week-day-label {
  color: var(--muted);
  font-size: var(--text-xs);
}

.schedule-week-cell {
  background: var(--panel-3);
  border-radius: 2px;
  display: block;
  height: 14px;
}

.schedule-week-cell.filled {
  background: var(--accent);
}

.schedule-week-cell.filled-campaign {
  background: #e8a13c;
}

/* Both source kinds overlap the cell — split the fill diagonally. */
.schedule-week-cell.filled.filled-campaign {
  background: linear-gradient(135deg, var(--accent) 50%, #e8a13c 50%);
}

/* Editable canvas (2026-07-31): the grid is a drag surface, cells preview the drag range. */
.schedule-week-grid.editable {
  cursor: crosshair;
  user-select: none;
}

.schedule-week-grid.editable .schedule-week-cell:hover {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.schedule-week-cell.drag-preview {
  background: var(--accent-soft);
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}

.schedule-week-cell.filled.drag-preview {
  background: var(--accent-hover);
}

.schedule-week-legend {
  color: var(--muted);
  display: flex;
  font-size: var(--text-xs);
  gap: var(--space-3);
}

.schedule-week-swatch {
  border-radius: 2px;
  display: inline-block;
  height: 10px;
  margin-right: var(--space-1);
  width: 10px;
}

.schedule-week-swatch.assignment {
  background: var(--accent);
}

.schedule-week-swatch.campaign {
  background: #e8a13c;
}

.schedule-week-note {
  margin: 0;
}

/* ── campaigns/AvailabilityGridCard ─────────────────────────── */
.availability-grid-panel,
.availability-grid {
  display: grid;
  gap: var(--space-2);
}

.availability-grid-controls {
  align-items: end;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
}

.availability-grid-week-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.availability-grid-week-label {
  font-variant-numeric: tabular-nums;
  min-width: 7rem;
  text-align: center;
}

.availability-grid-timezone {
  color: var(--muted);
  font-size: var(--text-xs);
}

.availability-grid-canvas {
  align-items: center;
  border: 0;
  column-gap: 1px;
  display: grid;
  grid-template-columns: 2rem repeat(24, minmax(0, 1fr));
  margin: 0;
  min-width: 0;
  padding: 0;
  row-gap: 2px;
}

.availability-grid-hour-label {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  text-align: center;
}

.availability-grid-day-label {
  color: var(--muted);
  font-size: var(--text-xs);
}

.availability-grid-cell,
.availability-grid-swatch {
  border-radius: 2px;
  display: block;
}

.availability-grid-cell {
  cursor: help;
  height: 16px;
}

.availability-grid-cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.availability-grid-cell.is-empty,
.availability-grid-swatch.is-empty {
  background: repeating-linear-gradient(
    135deg,
    var(--panel-3),
    var(--panel-3) 3px,
    var(--panel-2) 3px,
    var(--panel-2) 6px
  );
}

/* Keep the capacity-card palette: under 95 % is amber, 95–100 % green, over 100 % red. */
.availability-grid-cell.is-free,
.availability-grid-swatch.is-free {
  background: #d97706;
}

.availability-grid-cell.is-tight,
.availability-grid-swatch.is-tight {
  background: rgba(22, 163, 74, 0.62);
}

.availability-grid-cell.is-full,
.availability-grid-swatch.is-full {
  background: #16a34a;
}

.availability-grid-cell.is-over,
.availability-grid-swatch.is-over {
  background: #dc2626;
}

.availability-grid-legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  gap: var(--space-3);
}

.availability-grid-legend > span {
  align-items: center;
  display: inline-flex;
  gap: var(--space-1);
}

.availability-grid-swatch {
  height: 10px;
  width: 10px;
}

@media (max-width: 720px) {
  .availability-grid-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .availability-grid-week-nav {
    justify-content: flex-start;
  }
}

/* ── media-fit hints (U9a) ──────────────────────────────────── */
.fit-hint {
  cursor: help;
  display: inline-flex;
  margin-left: var(--space-1);
  vertical-align: middle;
}

/* ── grouped alerts (2026-07-30 UX pass) ────────────────────── */
/* One row per fault KIND with a count, expanding to the affected screens. Styled like an
   .event-row so a group reads as one item in the list it lives in. */
.alert-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  padding: 10px;
}

.alert-group:hover {
  border-color: var(--line-strong);
}

.alert-group > summary {
  align-items: baseline;
  cursor: pointer;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  list-style: none;
}

.alert-group > summary::-webkit-details-marker {
  display: none;
}

.alert-group > summary::before {
  color: var(--muted);
  content: "▸";
  font-size: var(--text-xs);
  margin-right: var(--space-1);
}

.alert-group[open] > summary::before {
  content: "▾";
}

.alert-group[open] > .event-list {
  margin-top: var(--space-3);
}

.alert-group-actions {
  margin-top: var(--space-2);
}

.drawer-alerts {
  display: grid;
  gap: var(--space-2);
}

.drawer-alerts h3 {
  font-size: var(--text-sm);
  margin: 0;
}

/* ── technical-details disclosure (2026-07-30 UX pass) ───────── */
/* Diagnostics that used to sit inline on every card: hashes, probe state, pipeline messages.
   Collapsed by default — visible on demand, invisible during normal work. */
.tech-details > summary {
  color: var(--subtle);
  cursor: pointer;
  list-style: none;
  margin-top: var(--space-2);
  width: fit-content;
}

.tech-details > summary::-webkit-details-marker {
  display: none;
}

.tech-details > summary::before {
  content: "▸ ";
}

.tech-details[open] > summary::before {
  content: "▾ ";
}

/* ── side drawer (2026-07-30 UX pass) ───────────────────────── */
/* Right-edge sheet for actions that used to live inline on a page: the Média upload workbench is
   the first. Full-height on desktop, full-width sheet on narrow viewports. */
.drawer-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  bottom: 0;
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-4);
  align-content: start;
  max-width: 100%;
  overflow-y: auto;
  padding: var(--space-5);
  position: fixed;
  right: 0;
  top: 0;
  width: min(640px, 100vw);
  z-index: 51;
}

.drawer-head {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
}

@media (max-width: 720px) {
  .drawer-panel {
    padding: var(--space-4);
    width: 100vw;
  }
}

/* Upload-queue pill: keeps an in-flight (or failed, or reload-restored) upload queue visible on the
   Média page while the drawer that owns it is closed. */
.upload-queue-pill {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--blue);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 650;
  justify-self: start;
  padding: 6px 12px;
  width: fit-content;
}

.upload-queue-pill:hover {
  border-color: var(--line-strong);
}

/* ── charts (2026-08-02, P2-1) ─────────────────────────────── */
.chart-frame {
  position: relative;
}

.chart-frame svg {
  display: block;
  width: 100%;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-crosshair {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.chart-tick {
  fill: var(--muted);
  font-size: 10px;
}

/* End dots and hover dots carry a 2px surface ring so they stay legible over lines. */
.chart-dot {
  stroke: var(--panel);
  stroke-width: 2;
}

.chart-legend {
  color: var(--muted);
  display: flex;
  font-size: var(--text-xs);
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.chart-key {
  border-radius: 2px;
  display: inline-block;
  height: 3px;
  vertical-align: middle;
  width: 14px;
}

.chart-tooltip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
  padding: 6px 10px;
  pointer-events: none;
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 5;
}

.chart-tooltip-date {
  color: var(--muted);
  font-size: var(--text-xs);
}

.chart-tooltip-row {
  align-items: center;
  display: flex;
  gap: 6px;
}

.hbar-list {
  display: grid;
  gap: 6px;
}

.hbar-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr) auto;
}

.hbar-row:hover .hbar-fill {
  background: var(--accent-hover);
}

.hbar-name {
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-track {
  background: var(--panel-3);
  border-radius: var(--radius-xs);
  display: block;
  height: 14px;
}

/* Rounded DATA end, square baseline. */
.hbar-fill {
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  display: block;
  height: 100%;
}

.hbar-value {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.meter {
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  display: block;
  height: 8px;
  overflow: hidden;
}

.meter-fill {
  background: var(--accent);
  border-radius: var(--radius-pill);
  display: block;
  height: 100%;
}

.availability-row {
  display: grid;
  gap: 4px;
  padding: 6px 0;
}

/* ── platform-admin surface (P2-3): the saas tab for platform owners ────────
   Deliberately loud: a violet band no tenant page uses, so a demo screen-share
   is never one mis-click away from looking like customer UI. */
.admin-surface .content-topbar {
  background: linear-gradient(180deg, #f3eefe, transparent);
  border-bottom: 2px solid #7c5cd6;
}

.admin-banner {
  align-items: center;
  background: #f3eefe;
  border: 1px solid #c9b8f0;
  border-radius: var(--radius-8);
  color: #4b3d86;
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
}

.admin-banner svg {
  flex: none;
}
