/* Mygtukas Dashboard — palette aligned with Mygtukas/theme.css (--pyv-*) */

:root {
  color-scheme: light;
  --font: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Surfaces */
  --bg: #f7f7f7;
  --bg-accent: none;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f2f2f2;
  --surface-muted: #f7f7f7;

  /* Borders */
  --border: #c8c8c8;
  --border-strong: #cccccc;

  /* Text */
  --text-primary: #111111;
  --text-secondary: #666666;
  --text-muted: #a3a3a3;

  /* Primary actions (Mygtukas send / choice-active) */
  --accent: #111111;
  --accent-hover: #333333;
  --accent-soft: #e8e8e8;
  --accent-fg: #ffffff;
  --focus-border: #111111;
  --focus-ring: transparent;

  /* Buttons */
  --btn-primary-bg: #111111;
  --btn-primary-fg: #ffffff;
  --btn-primary-hover-bg: #333333;
  --btn-secondary-bg: #f7f7f7;
  --btn-secondary-fg: #333333;
  --btn-secondary-border: #cccccc;
  --badge-bg: #ececec;
  --badge-fg: #666666;
  --toggle-track: #ececec;
  --toggle-track-on: #111111;
  --toggle-knob: #ffffff;

  /* Status */
  --online: #22c55e;
  --online-bg: rgba(34, 197, 94, 0.12);
  --offline: #888888;
  --offline-bg: #f0f0f0;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --modal-scrim: rgba(255, 255, 255, 0.72);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 14px;

  --sidebar-w: 240px;
  --topbar-h: 56px;
  --content-max: 1280px;

  /* Typography — aligned with Mygtukas/theme.css */
  --type-title-size: 14px;
  --type-title-weight: 600;
  --type-body-size: 13px;
  --type-body-weight: 400;
  --type-body-lh: 1.55;
  --type-hint-size: 12px;
  --type-hint-weight: 400;
  --type-hint-lh: 1.45;
  --btn-label-size: 12px;
  --btn-label-weight: 700;
  --btn-label-tracking: 0.05em;
  --control-h: 44px;
  --control-h-compact: 36px;

  /* Charts — neutral + Mygtukas accent blue */
  --chart-grid: rgba(0, 0, 0, 0.06);
  --chart-1: #111111;
  --chart-2: #007acc;
  --chart-3: #666666;
  --chart-4: #333333;
  --chart-5: #a3a3a3;

  /* 2026 refresh accents */
  --accent-blue: #007acc;
  --accent-blue-soft: rgba(0, 122, 204, 0.12);
  --bg-glow: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 122, 204, 0.08), transparent 70%);
  --sidebar-w: 240px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #252528;
  --bg-accent: none;
  --sidebar-bg: #2d2d30;
  --surface: #2d2d30;
  --surface-hover: #3a3a3e;
  --surface-muted: #252528;

  --border: #505053;
  --border-strong: #505053;

  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b5;
  --text-muted: #787880;

  --accent: #e0e0e5;
  --accent-hover: #ffffff;
  --accent-soft: #454549;
  --accent-fg: #1a1a1e;
  --focus-border: #ffffff;
  --focus-ring: transparent;

  --btn-primary-bg: #ffffff;
  --btn-primary-fg: #111111;
  --btn-primary-hover-bg: #f0f0f2;
  --btn-secondary-bg: #3a3a3e;
  --btn-secondary-fg: #e0e0e5;
  --btn-secondary-border: #505053;
  --badge-bg: #404044;
  --badge-fg: #b0b0b5;
  --toggle-track: #404044;
  --toggle-track-on: #ffffff;
  --toggle-knob: #111111;

  --online: #4ade80;
  --online-bg: rgba(74, 222, 128, 0.14);
  --offline: #909095;
  --offline-bg: #353538;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --modal-scrim: rgba(0, 0, 0, 0.72);

  --chart-grid: rgba(255, 255, 255, 0.08);
  --chart-1: #e8e8e8;
  --chart-2: #6cb6ff;
  --chart-3: #b0b0b5;
  --chart-4: #787880;
  --chart-5: #505053;

  --accent-blue: #6cb6ff;
  --accent-blue-soft: rgba(108, 182, 255, 0.16);
  --bg-glow: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(108, 182, 255, 0.1), transparent 70%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  color: var(--text-primary);
}

/* ── App shell ── */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__nav {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.brand-row .health-pill {
  flex-shrink: 0;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-sidebar {
  width: 100%;
  justify-content: center;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--type-hint-size);
  font-weight: var(--type-title-weight);
  transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.sidebar__link.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: var(--type-title-weight);
}

.sidebar__icon {
  font-size: 15px;
  opacity: 0.85;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
}

.topbar__left {
  flex: 1;
  min-width: 0;
}

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

.main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* AUTO DETECT needs the full content width (not 1280px cap) */
.main:has(.ad-page) {
  max-width: none;
}

.view.hidden {
  display: none !important;
}

/* ── Brand ── */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  min-width: 0;
  flex: 1;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: var(--type-title-weight);
  font-size: var(--type-title-size);
  letter-spacing: 0;
}

.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #111111, #333333);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .brand__mark {
  background: linear-gradient(135deg, #e8e8e8, #ffffff);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text-primary);
}

.breadcrumb__current {
  color: var(--text-primary);
  font-weight: var(--type-title-weight);
}

/* ── Page head ── */

.page-head {
  margin-bottom: 16px;
}

.page-head__title {
  margin: 0;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  letter-spacing: 0;
  line-height: 1.3;
}

.page-head__sub {
  margin: 6px 0 0;
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  color: var(--text-muted);
}

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

/* ── Stats ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  align-items: start;
}

.stats-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 77px;
}

.stat-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.stat-tile--link {
  cursor: pointer;
}

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

.stat-tile--link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stat-tile__label {
  margin: 0;
  font-size: var(--type-hint-size);
  font-weight: var(--type-hint-weight);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
}

.stat-tile__value {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: var(--type-title-weight);
  letter-spacing: 0;
  line-height: 1.2;
}

.stat-tile__value--sm {
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  line-height: var(--type-hint-lh);
}

/* ── Panel ── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.panel__toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel__title {
  margin: 0;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
}

.panel__count {
  font-size: var(--type-hint-size);
  font-weight: var(--type-title-weight);
  color: var(--text-muted);
  background: var(--surface-muted);
  padding: 2px 8px;
  border-radius: 999px;
}

.search-field {
  flex: 1;
  max-width: 280px;
  min-width: 160px;
}

.search-field__input {
  width: 100%;
  min-height: var(--control-h);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px 0 32px;
  font-family: var(--font);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  background: var(--surface-muted) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23666666' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3 3'/%3E%3C/svg%3E") 10px center no-repeat;
  color: var(--text-primary);
}

.search-field__input:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

/* ── Instance cards ── */

.instances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  padding: 16px;
  align-items: start;
}

.instance-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.instance-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 84px;
}

.instance-card .state-switch-block {
  flex-shrink: 0;
  width: 148px;
  max-width: 148px;
}

.instance-card .state-switch__hint {
  min-height: 2.9em;
}

.instance-card__field {
  margin-bottom: 10px;
}

.instance-card__field--site {
  margin-bottom: 14px;
}

.instance-card__label {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.instance-card__title {
  margin: 0;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  line-height: 1.3;
  letter-spacing: 0;
}

.instance-card__site {
  margin: 0;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-card__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.instance-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.instance-card__title a {
  color: inherit;
  text-decoration: none;
}

.instance-card__title a:hover {
  color: var(--text-primary);
}

.instance-card__site a {
  color: var(--text-secondary);
  text-decoration: none;
}

.metric-chip {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  text-align: center;
}

.metric-chip__val {
  display: block;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  letter-spacing: 0;
  line-height: 1.2;
}

.metric-chip__lbl {
  display: block;
  margin-top: 4px;
  font-size: var(--type-hint-size);
  font-weight: var(--btn-label-weight);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--btn-label-tracking);
}

.instance-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.instance-card__meta {
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
  white-space: nowrap;
}

.instance-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.instance-card__actions .btn {
  min-height: var(--control-h-compact);
  padding: 0 14px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.instance-card__actions .btn-secondary {
  background: var(--btn-secondary-bg);
  border-color: var(--btn-secondary-border);
  color: var(--btn-secondary-fg);
}

.instance-card__actions .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.instance-card__actions .btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--danger);
}

.instance-card__actions .btn-danger:hover {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

/* ── Cards (detail) ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

/* Settings form sticky live preview needs a non-clipping ancestor. */
.card--allow-sticky {
  overflow: visible;
}

.card__head {
  padding: 16px 18px 0;
}

.card__head--border {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.card__title {
  margin: 0;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  line-height: 1.3;
}

.card__subtitle {
  margin: 4px 0 0;
  font-size: var(--type-hint-size);
  font-weight: var(--type-hint-weight);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
}

.card__body {
  padding: 16px 18px 18px;
}

/* ── Instance detail ── */

.instance-header {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 20px 24px;
  margin-bottom: 16px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.instance-header__identity {
  min-width: 0;
}

.instance-header__title {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: var(--type-title-weight);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.instance-header__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.instance-header__meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.instance-header__meta-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.instance-header__meta-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.instance-header__meta-empty {
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  color: var(--text-muted);
  font-style: italic;
}

.instance-header__id {
  display: block;
  margin: 0;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.instance-header__site-link {
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.instance-header__site-link:hover {
  text-decoration: underline;
}

.instance-header__tags {
  margin-top: 12px;
}

.instance-header__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.instance-header__panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.instance-header__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.instance-header__panel--connection {
  gap: 6px;
}

.instance-header__panel--connection .instance-header__status {
  align-self: flex-start;
  margin-top: 2px;
}

.instance-header__panel-title {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.instance-header__panel-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  flex: 1;
}

.instance-header__panel-meta {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

.instance-header__panel--embed {
  justify-content: flex-start;
}

.instance-header__copy-btn {
  appearance: none;
  align-self: flex-start;
  margin: 4px 0 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.instance-header__copy-btn:hover,
.instance-header__copy-btn:focus-visible {
  background: var(--online);
  color: #000000;
  border-color: var(--online);
  outline: none;
}

.instance-header__copy-btn.is-copied {
  background: var(--online);
  color: #000000;
  border-color: var(--online);
}

.instance-header .state-switch-block--header {
  align-items: flex-start;
  max-width: none;
  gap: 8px;
  flex: 1;
}

.instance-header .state-switch-block--header .state-switch__label,
.instance-header .state-switch-block--header .state-switch__hint {
  text-align: left;
}

.instance-header .state-switch-block--header .state-switch__label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.instance-header .state-switch-block--header .state-switch__hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.sticky-toolbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.segmented__btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: var(--btn-label-size);
  font-weight: var(--btn-label-weight);
  letter-spacing: var(--btn-label-tracking);
  line-height: normal;
  font-kerning: none;
  font-variant-ligatures: none;
  text-transform: uppercase;
  padding: 0 14px;
  min-height: var(--control-h-compact);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.segmented__btn:hover {
  color: var(--text-primary);
}

.segmented__btn.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-xs);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

.span-12 { grid-column: span 12; }
.span-6 { grid-column: span 6; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ── Tables ── */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

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

.data-table th {
  font-size: var(--type-hint-size);
  font-weight: var(--btn-label-weight);
  text-transform: uppercase;
  letter-spacing: var(--btn-label-tracking);
  color: var(--text-secondary);
  background: var(--surface-muted);
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.table-panel {
  max-height: 360px;
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Users tab: room for expandable generation history under each row. */
.table-panel--users {
  max-height: min(70vh, 720px);
}

/* Keep Hide buy / Disable actions on one row without wrapping awkwardly. */
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.table-panel--user-gens {
  max-height: 320px;
  margin-top: 8px;
}

.user-gens-row > td {
  background: var(--surface-hover);
  padding: 12px 14px 16px;
  border-top: none;
  vertical-align: top;
}

.user-gens-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-gens-summary {
  margin: 0;
  font-size: var(--type-body-size);
  color: var(--text-muted);
}

.user-gens-loading,
.user-gens-empty {
  margin: 0;
  padding: 8px 0;
  color: var(--text-muted);
}

.user-gens-when {
  display: block;
  font-weight: 600;
}

.user-gens-when-abs {
  display: block;
  font-size: 0.85em;
  color: var(--text-muted);
}

.user-gens-page a {
  color: var(--accent);
  text-decoration: none;
}

.user-gens-page a:hover {
  text-decoration: underline;
}

.chart-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  text-align: center;
  padding: 20px;
}

.chart-wrap {
  position: relative;
  height: 240px;
}

.chart-wrap--short {
  height: 200px;
}

.chart-card {
  min-height: 280px;
}

/* ── Status & tags ── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--type-hint-size);
  font-weight: var(--btn-label-weight);
  letter-spacing: var(--btn-label-tracking);
  text-transform: uppercase;
  line-height: normal;
}

.status-pill.online {
  background: var(--online-bg);
  color: var(--online);
}

.status-pill.offline {
  background: var(--offline-bg);
  color: var(--offline);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.tag-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: var(--type-hint-size);
  font-weight: var(--type-title-weight);
  color: var(--badge-fg);
  background: var(--badge-bg);
}

.tag-pill--sm {
  font-size: 11px;
}

.health-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: var(--type-title-weight);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.health-pill.is-ok {
  color: var(--online);
  background: var(--online-bg);
  border-color: transparent;
}

.health-pill.is-bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}

/* ── Buttons ── */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 0 16px;
  min-height: var(--control-h);
  font-family: var(--font);
  font-size: var(--btn-label-size);
  font-weight: var(--btn-label-weight);
  letter-spacing: var(--btn-label-tracking);
  line-height: normal;
  font-kerning: none;
  font-variant-ligatures: none;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

a.btn,
a.btn:hover,
a.btn:focus,
a.btn:active {
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-hover);
}

.btn-primary {
  background: var(--btn-primary-bg);
  border-color: transparent;
  color: var(--btn-primary-fg);
}

.btn-primary:hover {
  background: var(--btn-primary-hover-bg);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.btn-small {
  min-height: var(--control-h-compact);
  padding: 0 12px;
  font-size: var(--btn-label-size);
}

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.btn__plus {
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.icon {
  width: 18px;
  height: 18px;
}

[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun {
  display: none;
}

.toggle {
  position: relative;
  width: 40px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: var(--toggle-track);
  cursor: pointer;
}

.toggle.on {
  background: var(--toggle-track-on);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--toggle-knob);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease;
}

.toggle.on::after {
  transform: translateX(16px);
}

.state-switch-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: 220px;
}

.state-switch-block--header {
  align-items: flex-start;
  max-width: none;
}

.state-switch-block--header .state-switch__label,
.state-switch-block--header .state-switch__hint {
  text-align: left;
}

.state-switch__label {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: right;
}

.state-switch__hint {
  margin: 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: right;
}

.state-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-muted);
}

.state-switch__btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 12px;
  min-height: 28px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.state-switch__btn + .state-switch__btn {
  border-left: 1px solid var(--border);
}

.state-switch__btn--on.is-active {
  background: var(--online);
  color: #ffffff;
}

.state-switch__btn--off.is-active {
  background: var(--danger);
  color: #ffffff;
}

.state-switch__btn:not(.is-active):hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ── Settings & models ── */

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-form--pro {
  gap: 16px;
}

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

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

.settings-section-title {
  margin: 20px 0 8px;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  color: var(--text-primary);
}

.settings-hint {
  margin: 0 0 10px;
  font-size: var(--type-hint-size);
  font-weight: var(--type-hint-weight);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
}

.settings-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

/* Sticky live preview needs overflow visible so position:sticky can pin to the viewport. */
.settings-card--sticky-preview {
  overflow: visible;
}

.settings-card__head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.settings-card--sticky-preview .settings-card__body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--surface);
}

.settings-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.settings-card__subtitle {
  margin: 4px 0 0;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
}

.settings-card__body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-card__subheading {
  margin: 18px 0 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.settings-card__subheading:first-child {
  margin-top: 0;
}

/* Divided blocks inside Floating button / similar cards */
.settings-block {
  margin-top: 4px;
  padding-top: 18px;
}

.settings-block--first {
  margin-top: 12px;
  padding-top: 16px;
}

.settings-block__rule {
  height: 1px;
  margin: 0 0 14px;
  background: var(--border);
  opacity: 0.95;
}

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

.settings-block__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.button-preview {
  margin: 12px 0 4px;
  position: sticky;
  /* Sit below topbar + instance tab toolbar while scrolling button settings. */
  top: calc(var(--topbar-h) + 64px);
  z-index: 35;
  padding: 10px 0 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.button-preview__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.04), transparent 45%),
    linear-gradient(160deg, #12141a 0%, #1b1f2a 55%, #10131a 100%);
}

.button-preview__btn {
  appearance: none;
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  font-family: inherit;
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}

.button-preview__btn[data-shape="circle"] {
  aspect-ratio: 1 / 1;
}

.button-preview__hint {
  margin: 8px 0 0;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
}

.settings-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 8px;
}

.settings-form__footer-hint {
  margin: 0;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.model-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  overflow: hidden;
}

.model-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.model-card__title {
  margin: 0;
  min-width: 0;
  flex: 1;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-card__time {
  flex-shrink: 0;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
  white-space: nowrap;
}

.model-card__theme {
  margin: 0;
  flex: 1;
  min-height: 0;
  font-size: var(--type-hint-size);
  font-weight: var(--type-hint-weight);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.model-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  color: var(--text-secondary);
}

.vehicle-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

/* Models tab — allowed vehicles allowlist */

.allowed-vehicles-panel .card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.allowed-vehicles-bar__count {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.allowed-vehicles-bar__panel-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.allowed-vehicles-bar__panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.vehicles-status-filter {
  display: inline-flex;
  align-items: stretch;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  gap: 2px;
}

.vehicles-status-filter__btn {
  margin: 0;
  padding: 6px 10px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.vehicles-status-filter__btn:hover {
  color: var(--text-primary);
}

.vehicles-status-filter__btn.is-active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.vehicles-status-filter__btn[data-vehicles-filter="online"].is-active {
  color: var(--online);
}

.vehicles-status-filter__btn[data-vehicles-filter="offline"].is-active {
  color: var(--danger);
}

.vehicles-filter-empty {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.allowed-vehicles-bar__scan {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.allowed-vehicles-bar__scan:disabled {
  opacity: 0.65;
  cursor: wait;
}

.allowed-vehicles-bar__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.allowed-vehicles-bar__all:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--text-primary);
}

.allowed-vehicles-bar__all input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.vehicle-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

.vehicle-chip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.vehicle-chip.is-filtered-out,
.vehicle-chip[hidden] {
  display: none !important;
}

.vehicle-chip.is-on {
  border-color: var(--online);
  background: color-mix(in srgb, var(--online-bg) 55%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--online) 20%, transparent);
}

.vehicle-chip__media-wrap {
  position: relative;
}

.vehicle-chip__media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  margin: 0;
  overflow: hidden;
  border-radius: calc(var(--radius-md) - 2px);
  background: color-mix(in srgb, var(--border) 40%, var(--surface));
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.vehicle-chip__media:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-muted, var(--surface)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, var(--border));
}

.vehicle-chip__media:focus-within {
  outline: 2px solid var(--online);
  outline-offset: 1px;
}

.vehicle-chip__media-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.vehicle-chip__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vehicle-chip__placeholder {
  display: block;
  width: 22px;
  height: 14px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--text-secondary) 20%, transparent);
}

.vehicle-chip__media-hint {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.vehicle-chip.has-photo .vehicle-chip__media:hover .vehicle-chip__img {
  opacity: 0.72;
}

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

.vehicle-chip__name {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-chip__category {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.vehicle-chip__category-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
}

.vehicle-chip__category select {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.14));
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
  font-size: 12px;
}

.vehicle-chip__category select:focus-visible {
  outline: 2px solid var(--accent, #3dd68c);
  outline-offset: 1px;
}

.vehicle-chip__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.vehicle-chip__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.vehicle-chip__toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.vehicle-chip__switch {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--danger);
  transition: background 0.15s;
  flex-shrink: 0;
}

.vehicle-chip__switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s;
}

.vehicle-chip__toggle input:checked + .vehicle-chip__switch {
  background: var(--online);
}

.vehicle-chip__toggle input:checked + .vehicle-chip__switch::after {
  transform: translateX(12px);
}

.vehicle-chip__toggle input:focus-visible + .vehicle-chip__switch {
  outline: 2px solid var(--online);
  outline-offset: 2px;
}

.vehicle-chip__toggle-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--danger);
  min-width: 1.6em;
}

.vehicle-chip.is-on .vehicle-chip__toggle-label {
  color: var(--online);
}

.vehicle-chip__photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  margin: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vehicle-chip__photo-remove:hover {
  color: var(--danger, #b42318);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.page-url-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-block {
  width: 100%;
  min-height: 100px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--surface-muted);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

.copy-row {
  display: flex;
  gap: 10px;
}

.copy-row .code-block {
  flex: 1;
}

/* ── Modal ── */

.modal {
  border: none;
  padding: 0;
  width: min(400px, calc(100vw - 32px));
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.modal::backdrop {
  background: var(--modal-scrim);
  backdrop-filter: blur(4px);
}

.modal__body {
  padding: 20px;
}

.modal__head h3 {
  margin: 0;
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  line-height: 1.3;
}

.modal__hint {
  margin: 6px 0 0;
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  color: var(--text-muted);
}

.field {
  display: block;
  margin-top: 14px;
}

.field--inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.field--inline .field__label {
  margin-bottom: 0;
  white-space: nowrap;
}

.field__input--sm {
  width: auto;
  min-width: 108px;
  min-height: var(--control-h-compact);
  padding: 0 10px;
  font-size: var(--btn-label-size);
  font-weight: var(--btn-label-weight);
  letter-spacing: var(--btn-label-tracking);
  text-transform: uppercase;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--type-hint-size);
  font-weight: var(--type-title-weight);
  line-height: var(--type-hint-lh);
  color: var(--text-secondary);
}

.field__optional {
  font-weight: 500;
  color: var(--text-muted);
}

.field__input,
.field__textarea {
  width: 100%;
  min-height: var(--control-h);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-family: var(--font);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  background: var(--surface-muted);
  color: var(--text-primary);
}

.field__input:focus,
.field__textarea:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.field__textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Confirm / delete — slightly wider for multi-line warnings. */
.modal--confirm {
  width: min(440px, calc(100vw - 32px));
}

.modal--confirm .modal__detail {
  margin: 8px 0 0;
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-lh);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}

.modal--confirm .modal__warning {
  margin: 12px 0 0;
  font-size: var(--type-body-size);
  font-weight: 600;
  line-height: var(--type-body-lh);
  color: var(--danger);
}

.modal--confirm .btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.login-error {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: var(--type-hint-size);
  line-height: var(--type-hint-lh);
  color: var(--danger);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  color: var(--text-muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: var(--type-hint-size);
  font-weight: var(--btn-label-weight);
  letter-spacing: var(--btn-label-tracking);
  text-transform: uppercase;
  line-height: var(--type-hint-lh);
  color: var(--text-muted);
}

/* ── Responsive ── */

@media (max-width: 1100px) {
  .stats-grid,
  .detail-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .span-6 {
    grid-column: span 12;
  }

  .instance-header {
    grid-template-columns: 1fr;
  }

  .instance-header__controls {
    grid-template-columns: 1fr;
  }

  .allowed-vehicles-bar__panel-head {
    justify-content: flex-start;
  }

  .vehicle-chip-grid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .stats-grid--compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .instance-header__meta {
    grid-template-columns: 1fr;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

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

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

  .settings-grid .span-12 {
    grid-column: span 1;
  }

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

@media (max-width: 480px) {
  .stats-grid--compact,
  .detail-stats {
    grid-template-columns: 1fr;
  }

  .instance-card__metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── 2026 refresh: navigation, stats, command palette ── */

.sidebar__section {
  margin: 16px 0 6px;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar__section:first-child {
  margin-top: 0;
}

.sidebar__foot {
  margin-top: auto;
  padding-top: 12px;
}

.sidebar__search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: var(--type-hint-size);
  font-weight: var(--type-title-weight);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.sidebar__search:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text-primary);
}

.sidebar__search-kbd {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.page-head__subtitle {
  margin: 6px 0 0;
  max-width: 560px;
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  color: var(--text-secondary);
}

.stat-tile__hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

.stat-tile--skeleton {
  pointer-events: none;
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--surface-hover) 50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton--line {
  height: 12px;
  margin-bottom: 10px;
}

.skeleton--sm {
  width: 45%;
}

.skeleton--lg {
  width: 70%;
  height: 22px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.empty-state-box {
  grid-column: 1 / -1;
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-muted);
}

.empty-state-box__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.empty-state-box__body {
  margin: 8px auto 16px;
  max-width: 420px;
  color: var(--text-secondary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
}

.detail-list {
  display: grid;
  gap: 0;
}

.detail-list__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.detail-list__row:last-child {
  border-bottom: none;
}

.detail-list__row dt {
  margin: 0;
  font-size: var(--type-hint-size);
  font-weight: 600;
  color: var(--text-muted);
}

.detail-list__row dd {
  margin: 0;
  font-size: var(--type-body-size);
  color: var(--text-primary);
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: var(--type-body-size);
  animation: toast-in 0.22s ease;
}

.toast--success {
  border-color: var(--online);
  background: var(--online-bg);
}

.toast--info {
  border-color: var(--accent-blue);
  background: var(--accent-blue-soft);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal--command {
  width: min(560px, calc(100vw - 32px));
}

.command-palette__input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-family: var(--font);
  font-size: 15px;
  background: var(--surface-muted);
  color: var(--text-primary);
}

.command-palette__input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.command-results {
  margin-top: 10px;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.command-item:hover,
.command-item.is-active {
  background: var(--accent-blue-soft);
}

.command-item__label {
  font-size: var(--type-body-size);
  font-weight: 600;
}

.command-item__hint {
  font-size: var(--type-hint-size);
  color: var(--text-muted);
  white-space: nowrap;
}

.command-empty,
.command-palette__hint {
  margin: 8px 0 0;
  font-size: var(--type-hint-size);
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Explore tab — draft locally, publish with Save Explore */
.explore-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-height: 420px;
}

.explore-main__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.explore-main__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.explore-main__count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.explore-hero {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.explore-hero__preview {
  position: relative;
  min-height: 180px;
  border-radius: 10px;
  overflow: hidden;
  background: #111114;
}

.explore-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 180px;
}

.explore-hero__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  padding: 12px;
  text-align: center;
}

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

.explore-hero__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.explore-hero__hint {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.explore-hero__fields textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.explore-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.explore-hero__stroke {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 2px;
}

.explore-hero__stroke input {
  width: 16px;
  height: 16px;
}

.explore-hero__stroke-width input {
  max-width: 96px;
}

.explore-hero__stroke-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.explore-hero__stroke-color-row input[type="color"] {
  width: 42px;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
}

.explore-hero__stroke-color-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 720px) {
  .explore-hero {
    grid-template-columns: 1fr;
  }
}


.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.explore-empty {
  margin: 48px 0;
  text-align: center;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.explore-photo {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  min-height: 160px;
}

.explore-photo--draft {
  border-style: dashed;
  border-color: #8a8a96;
}

.explore-photo__badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c5c66;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 3px 8px;
}

.explore-photo__link {
  display: block;
  background: #ececef;
  min-height: 160px;
  align-self: stretch;
}

.explore-photo__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
}

.explore-photo__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  min-width: 0;
}

.explore-photo__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.explore-photo__field input,
.explore-photo__field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 0.85rem;
}

.explore-photo__filename {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explore-photo__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

@media (max-width: 560px) {
  .explore-photo {
    grid-template-columns: 1fr;
  }

  .explore-photo__link {
    min-height: 180px;
    aspect-ratio: 16 / 10;
  }
}

.topbar__menu {
  display: none;
}

@media (max-width: 768px) {
  .topbar__menu {
    display: inline-flex;
  }

  .sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 120;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-md);
  }

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

  .sidebar.is-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: -1;
  }
}

/* ── WRAPLOOK STUDIO (Models page) ── */
.studio {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.studio__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .studio__grid {
    grid-template-columns: 1fr;
  }
}

.studio-create {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.studio-step {
  padding: 1.2rem 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-md) + 2px);
  background: var(--surface, var(--surface-muted));
}

.studio-step__head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.studio-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong, var(--border));
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.studio-step__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.studio-step__sub {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted, #9a9a9e);
}

.studio-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

@media (max-width: 820px) {
  .studio-fields {
    grid-template-columns: 1fr;
  }
}

/* Match dashboard settings fields — no extra top margin inside the step grid. */
.studio-field.field {
  margin-top: 0;
  min-width: 0;
}

.studio-field .field__input {
  box-sizing: border-box;
  appearance: none;
}

.studio-field select.field__input {
  cursor: pointer;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a9a9e' d='M1.1 1.1 6 6l4.9-4.9L12 2.2 6 8.2 0 2.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
}

.studio-drops {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

@media (max-width: 820px) {
  .studio-drops {
    grid-template-columns: 1fr;
  }
}

.studio-drop-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1.5px dashed var(--border-strong, #666);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-muted) 70%, transparent);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.studio-drop-card.is-filled:not(.is-busy) {
  border-style: solid;
  border-color: color-mix(in srgb, #22c55e 55%, var(--border));
}

.studio-drop-card.is-dragover {
  border-color: var(--text-primary);
  background: var(--surface-hover);
}

.studio-drop-card.is-busy {
  border-style: solid;
  border-color: color-mix(in srgb, #34d399 45%, var(--border));
  background: var(--surface-muted);
  /* Stay in the Template column — do not stretch across Files row */
  grid-column: auto;
  min-width: 0;
  max-width: 100%;
}

.studio-drop-card .studio-drop {
  border: 0;
  background: transparent;
  min-height: 9.5rem;
  flex: 1;
}

.studio-drop-card.is-busy .studio-drop {
  min-height: 0;
}

.studio-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 9.5rem;
  padding: 1.15rem 0.9rem;
  border: 1.5px dashed var(--border-strong, #666);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-muted) 70%, transparent);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.studio-drop:hover,
.studio-drop:focus-within,
.studio-drop.is-dragover {
  border-color: var(--text-primary);
  background: var(--surface-hover);
}

.studio-drop.is-filled {
  border-style: solid;
  border-color: color-mix(in srgb, #22c55e 55%, var(--border));
}

/* Locked while editing an existing model (name + template). */
.field__input.is-locked,
.studio-drop.is-locked,
.studio-drop-card.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
}

.studio-drop-card.is-locked {
  border-style: solid;
}

.studio-drop__icon {
  display: inline-flex;
  color: var(--text-muted, #9a9a9e);
  margin-bottom: 0.15rem;
}

.studio-drop__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.studio-drop__hint {
  font-size: 0.78rem;
  color: var(--text-muted, #9a9a9e);
}

.studio-drop__meta {
  margin-top: 0.35rem;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-muted, #9a9a9e);
  word-break: break-word;
}

/* Local file queue — selected in browser, not yet on the server */
.studio-drop__files {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: left;
}

.studio-drop__file {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, #22c55e 12%, var(--surface));
  font-size: 0.72rem;
  line-height: 1.3;
}

.studio-drop__file-mark {
  flex-shrink: 0;
  color: #22c55e;
  font-weight: 700;
}

.studio-drop__file-name {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-all;
  color: var(--text-primary);
}

.studio-drop__file-size {
  flex-shrink: 0;
  color: var(--text-muted, #9a9a9e);
  font-variant-numeric: tabular-nums;
}

/* Job progress — compact inside drop cards. */
.studio-job {
  display: none;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 0.8rem 0.95rem;
  text-align: left;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}

.studio-drop-card.is-busy .studio-job {
  display: flex;
}

.studio-drop-card.is-busy > .studio-drop {
  display: none;
}

.studio-job__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.studio-job__title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.studio-job__count {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #9a9a9e);
}

.studio-job__meta {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-secondary, #b0b0b5);
  word-break: break-word;
}

.studio-job__track {
  height: 0.3rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.studio-job__bar {
  display: block;
  height: 100%;
  width: 6%;
  max-width: 100%;
  border-radius: inherit;
  background: #34d399;
  transition: width 0.35s ease;
}

.studio-drop-card.is-busy:has(.studio-job__item.is-error) .studio-job__bar,
.studio-job:has(.is-error) .studio-job__bar {
  background: #f87171;
}

.studio-job__steps {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.studio-job__item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--text-muted, #9a9a9e);
}

.studio-job__item.is-done {
  color: #34d399;
}

.studio-job__item.is-active {
  color: var(--text-primary);
  font-weight: 600;
}

.studio-job__item.is-error {
  color: #f87171;
  font-weight: 600;
}

.studio-job__mark {
  flex-shrink: 0;
  width: 0.85rem;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.35;
}

.studio-job__item.is-active .studio-job__mark {
  animation: studio-job-pulse 1s ease-in-out infinite;
}

.studio-job__text {
  min-width: 0;
  word-break: break-word;
}

.studio-job__live {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-secondary, #b0b0b5);
  word-break: break-word;
}

@keyframes studio-job-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.studio-export {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 1rem;
  align-items: stretch;
}

@media (max-width: 820px) {
  .studio-export {
    grid-template-columns: 1fr;
  }
}

.studio-summary {
  padding: 0.15rem 0.25rem;
  min-width: 0;
}

.studio-summary__title {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted, #9a9a9e);
}

.studio-summary__list {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1.25rem;
}

@media (max-width: 640px) {
  .studio-summary__list {
    grid-template-columns: 1fr;
  }
}

.studio-summary__list > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.studio-summary__list dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted, #9a9a9e);
}

.studio-summary__list dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #e8e8e8);
  word-break: break-word;
}

.studio-ready {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 12rem;
  padding: 1.35rem 1.1rem;
  border: 1.5px dashed var(--border-strong, #666);
  border-radius: var(--radius-md);
  text-align: center;
  background: color-mix(in srgb, var(--surface-muted) 65%, transparent);
}

.studio-ready__icon {
  color: var(--text-muted, #9a9a9e);
  margin-bottom: 0.2rem;
}

.studio-ready__label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.studio-ready__hint {
  margin: 0 0 0.65rem;
  max-width: 16rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted, #9a9a9e);
}

.studio-ready__btn {
  width: 100%;
  max-width: none;
  min-height: 2.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Recent models sidebar — clear rows, always-visible actions */
.studio-side {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0.85rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-md) + 2px);
  background: var(--surface, var(--surface-muted));
  min-height: min(70vh, 42rem);
  max-height: calc(100vh - 6rem);
}

.studio-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.25rem 0.15rem;
}

.studio-side__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.studio-side__list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.1rem 0.15rem 0.25rem;
}

.studio-side__refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  flex-shrink: 0;
}

.studio-model {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.8rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.studio-model:hover {
  border-color: color-mix(in srgb, var(--text-primary) 22%, var(--border));
}

/* Selected from Recent Models — loads Details / Files / Export */
.studio-model.is-selected {
  border-color: color-mix(in srgb, #34d399 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, #34d399 35%, transparent);
  background: color-mix(in srgb, #34d399 8%, var(--surface-muted));
}

.studio-model__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.studio-model__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.studio-model.is-online .studio-model__badge {
  color: #34d399;
}

.studio-model.is-offline .studio-model__badge {
  color: #94a3b8;
}

.studio-model__port {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #9a9a9e);
}

.studio-model__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  /* Allow 2 lines so names fit; only then ellipsis */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.studio-model__id {
  margin: 0;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  color: var(--text-muted, #9a9a9e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-model__category {
  display: inline-flex;
  align-self: flex-start;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary, #f0f0f0);
  background: rgba(61, 214, 140, 0.18);
  border: 1px solid rgba(61, 214, 140, 0.35);
}

.studio-model__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.studio-model__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 1.9rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.studio-model__btn--start:hover {
  background: #22c55e;
  border-color: #22c55e;
  color: #ffffff;
}

.studio-model__btn--stop:hover,
.studio-model__btn--delete:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

/* Banner when editing an existing model from the sidebar */
.studio-edit-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid color-mix(in srgb, #34d399 40%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, #34d399 10%, var(--surface-muted));
}

.studio-edit-banner.is-visible {
  display: flex;
}

.studio-edit-banner__text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.studio-edit-banner__text strong {
  font-weight: 700;
}

/* Files already present on the server for the selected model */
.studio-server-files {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.studio-server-files[hidden] {
  display: none;
}

.studio-server-files__title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.studio-server-files__hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.studio-server-files__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 11rem;
  overflow: auto;
}

.studio-server-files__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.2rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.studio-server-files__item:last-child {
  border-bottom: none;
}

.studio-server-files__name {
  word-break: break-all;
  color: var(--text-primary);
}

.studio-server-files__kind {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.studio-side__new {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
}

.model-status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

/* Studio page uses more of the viewport width */
.view:has(.studio) {
  max-width: none;
}
.main:has(.studio) {
  max-width: min(1600px, 100%);
}
.cm-progress {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.cm-progress[data-phase="working"] {
  border-color: color-mix(in srgb, #34d399 40%, var(--border));
}
.cm-progress[data-phase="ready"] {
  border-color: color-mix(in srgb, #34d399 70%, var(--border));
}
.cm-progress[data-phase="error"] {
  border-color: color-mix(in srgb, #f87171 70%, var(--border));
}
.cm-progress__head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.cm-progress__title {
  flex: 1;
  font-size: 0.92rem;
}
.cm-progress__elapsed {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--text-muted, #9a9a9e);
}
.cm-progress__detail {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-muted, #9a9a9e);
}
.cm-progress__job {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  opacity: 0.65;
  word-break: break-all;
}
.cm-progress__spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid color-mix(in srgb, #34d399 35%, transparent);
  border-top-color: #34d399;
  border-radius: 50%;
  flex-shrink: 0;
}
.cm-progress[data-phase="working"] .cm-progress__spinner {
  animation: cm-spin 0.8s linear infinite;
}
.cm-progress[data-phase="ready"] .cm-progress__spinner,
.cm-progress[data-phase="error"] .cm-progress__spinner,
.cm-progress[data-phase="idle"] .cm-progress__spinner {
  animation: none;
  border-color: currentColor;
  border-top-color: currentColor;
  opacity: 0.45;
}
.cm-progress[data-phase="error"] .cm-progress__title {
  color: #f87171;
}
.cm-progress[data-phase="ready"] .cm-progress__title {
  color: #34d399;
}
@keyframes cm-spin {
  to { transform: rotate(360deg); }
}

/* ---- AUTO DETECT page -------------------------------------------------- */
.ad-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: none;
  /* Fill the main content viewport under the topbar */
  min-height: calc(100vh - var(--topbar-h, 56px) - 72px);
}

.ad-card.studio-step {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

/* Left: small Design + Template stacked. Right: large Preview. */
.ad-drops {
  display: grid;
  grid-template-columns: minmax(12rem, 16.5rem) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: stretch;
  flex: 1;
  min-height: clamp(22rem, 52vh, 40rem);
}

.ad-uploads {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  height: 100%;
}

.ad-upload-card {
  flex: 1;
  min-height: 0;
}

.ad-upload-card .studio-drop {
  min-height: 100%;
  height: 100%;
  padding: 0.9rem 0.75rem;
  gap: 0.3rem;
  box-sizing: border-box;
}

.ad-upload-card .studio-drop__icon svg {
  width: 18px;
  height: 18px;
}

.ad-upload-card .studio-drop__title {
  font-size: 0.78rem;
}

.ad-upload-card .studio-drop__hint,
.ad-upload-card .studio-drop__meta {
  font-size: 0.72rem;
}

.ad-preview-card {
  border-style: solid;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100%;
  height: 100%;
  min-width: 0;
}

.ad-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  min-height: 100%;
  padding: 2rem 1.5rem;
  text-align: center;
  box-sizing: border-box;
}

.ad-preview-empty .studio-drop__icon svg {
  width: 28px;
  height: 28px;
}

.ad-preview-ready {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100%;
  height: 100%;
  padding: 0.85rem;
  gap: 0.75rem;
  box-sizing: border-box;
}

/* display:flex above overrides the HTML hidden attribute without this */
.ad-preview-empty[hidden],
.ad-preview-ready[hidden] {
  display: none !important;
}

.ad-preview {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 16rem;
  max-height: none;
  height: 100%;
  object-fit: contain;
  border-radius: calc(var(--radius-md) - 2px);
  background: #ffffff;
}

.ad-preview-download {
  align-self: flex-end;
  justify-content: center;
  min-height: var(--control-h-compact, 36px);
  flex-shrink: 0;
  min-width: 8.5rem;
}

.ad-preview-card.is-busy .ad-preview-empty .studio-drop__meta {
  color: var(--text-secondary, #c4c4c8);
}

.ad-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) auto;
  gap: 1rem 1.25rem;
  align-items: end;
  margin-top: 1.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.ad-controls__field {
  margin-top: 0;
  min-width: 0;
}

.ad-controls__field .field__input {
  width: 100%;
  min-height: var(--control-h, 40px);
  box-sizing: border-box;
}

.ad-controls__action {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 9.5rem;
}

/* Invisible label keeps Confirm baseline-aligned with Detector/Mode inputs */
.ad-controls__action-spacer {
  visibility: hidden;
  user-select: none;
}

.ad-controls__btn {
  min-height: var(--control-h, 40px);
  width: 100%;
  justify-content: center;
}

.ad-status {
  margin: 1rem 0 0;
  min-height: 1.25rem;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-muted, #9a9a9e);
  flex-shrink: 0;
}

.ad-status[data-tone="working"] {
  color: var(--text-secondary, #c4c4c8);
}

.ad-status[data-tone="ready"] {
  color: #34d399;
}

.ad-status[data-tone="error"] {
  color: #f87171;
}

@media (max-width: 900px) {
  .ad-page {
    min-height: 0;
  }

  .ad-drops {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .ad-uploads {
    flex-direction: row;
    height: auto;
  }

  .ad-upload-card .studio-drop {
    min-height: 8.5rem;
    height: auto;
  }

  .ad-preview-card,
  .ad-preview-empty,
  .ad-preview-ready {
    min-height: 18rem;
    height: auto;
  }

  .ad-controls {
    grid-template-columns: 1fr;
  }

  .ad-controls__action {
    min-width: 0;
    width: 100%;
  }

  .ad-controls__action-spacer {
    display: none;
  }

  .ad-preview {
    min-height: 16rem;
    max-height: 55vh;
  }

  .ad-preview-download {
    align-self: stretch;
    min-width: 0;
  }
}

/* Instance Broadcast tab - dedicated layout (do not use missing span-7/span-5). */
.broadcast-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 16px;
  align-items: start;
}

.broadcast-layout__compose,
.broadcast-layout__preview,
.broadcast-layout__history {
  min-width: 0;
  width: 100%;
}

.broadcast-layout__history {
  grid-column: 1 / -1;
}

.broadcast-presence {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-secondary, #555);
}

.broadcast-presence__muted {
  color: var(--text-muted, #888);
  font-weight: 400;
}

.broadcast-composer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.broadcast-composer > .field:first-child {
  margin-top: 0;
}

.broadcast-composer .field {
  width: 100%;
  min-width: 0;
}

.broadcast-composer .field__input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.broadcast-composer__body {
  min-height: 96px;
  resize: vertical;
}

.broadcast-composer__image-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.broadcast-composer__image-row .field--grow {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
}

.broadcast-composer__preview-img {
  border: 1px solid var(--border, #ddd);
  border-radius: 8px;
  overflow: hidden;
  max-height: 200px;
  width: 100%;
}

.broadcast-composer__preview-img img,
.broadcast-composer__preview-img video {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: #111;
}

.broadcast-composer__media-hint {
  margin: -4px 0 0;
  font-size: 12px;
  color: var(--text-muted, #888);
}

.broadcast-preview__media img,
.broadcast-preview__media video,
.broadcast-preview__video {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #111;
}

.broadcast-composer__actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.broadcast-actions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.broadcast-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 120px auto;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.broadcast-action-row .field__input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.broadcast-composer__actions-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary, #666);
}

.broadcast-composer__ttl {
  gap: 12px;
}

.broadcast-composer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  margin-top: 0;
  border-top: 1px solid var(--border, #e5e5e5);
}

.broadcast-preview {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface-muted, #f5f5f5);
  border-radius: 12px;
  min-height: 220px;
}

.broadcast-preview__card {
  width: 100%;
  max-width: 320px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border, #d8d8d8);
  border-radius: 12px;
  background: #fff;
  color: #111;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* Matches Mygtukas .pyv-admin-announce__head (#1a1a1c full-bleed bar). */
.broadcast-preview__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  height: 48px;
  padding: 0 14px;
  box-sizing: border-box;
  background: #1a1a1c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.broadcast-preview__icon {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #f2f2f4;
}

.broadcast-preview__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.broadcast-preview__media {
  width: 100%;
}

.broadcast-preview__media img,
.broadcast-preview__media video,
.broadcast-preview__video {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #111;
}

.broadcast-preview__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.broadcast-preview__body[hidden] {
  display: none !important;
}

.broadcast-preview__title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f2f2f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.broadcast-preview__heading {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #111;
  word-break: break-word;
}

.broadcast-preview__heading[hidden] {
  display: none !important;
}

.broadcast-preview__text {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: #555;
  white-space: pre-wrap;
  word-break: break-word;
}

.broadcast-preview__text[hidden] {
  display: none !important;
}

.broadcast-preview__footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: #1a1a1c;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.broadcast-preview__footer[hidden] {
  display: none !important;
}

.broadcast-preview__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-sizing: border-box;
}

.broadcast-preview__btn--primary {
  background: #e8e8ec;
  color: #1a1a1c;
}

.broadcast-preview__btn--secondary {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #f2f2f4;
  background: transparent;
}

.broadcast-preview__btn--ghost,
.broadcast-preview__btn--incomplete {
  opacity: 0.55;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  color: #f2f2f4;
  background: transparent;
}

.broadcast-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.broadcast-status--draft {
  background: #f0f0f0;
  color: #555;
}

.broadcast-status--published {
  background: #e8f5e9;
  color: #1b5e20;
}

.broadcast-status--archived {
  background: #eee;
  color: #777;
}

.broadcast-history__actions {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .broadcast-layout {
    grid-template-columns: 1fr;
  }

  .broadcast-layout__preview {
    order: -1;
  }
}

@media (max-width: 860px) {
  .broadcast-action-row {
    grid-template-columns: 1fr;
  }

  .broadcast-composer__image-row {
    flex-direction: column;
    align-items: stretch;
  }

  .broadcast-composer__footer {
    flex-direction: column-reverse;
  }

  .broadcast-composer__footer .btn {
    width: 100%;
  }
}
