/* Iris Control — Apollo visual language.
 * Light utilities are tokens below; html.dark remaps them (no second palette).
 * The sidebar and filled brand buttons keep the same colors in both themes. */

:root {
  color-scheme: light;

  /* Brand */
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-bright: #3b82f6;
  --primary: var(--brand);
  --on-brand: #ffffff;

  /* Surfaces */
  --canvas: #ffffff; /* bg-white */
  --canvas-subtle: #f9fafb; /* bg-gray-50 */
  --surface-muted: #f3f4f6; /* bg-gray-100 */
  --hover-subtle: #f9fafb; /* hover:bg-gray-50 */
  --hover: #f3f4f6; /* hover:bg-gray-100 */
  --input-bg: #ffffff;

  /* Text */
  --text: #111827; /* gray-900 */
  --text-strong: #1f2937; /* gray-800 */
  --text-body: #374151; /* gray-700 */
  --text-secondary: #4b5563; /* gray-600 */
  --text-muted: #6b7280; /* gray-500 */
  --text-faint: #9ca3af; /* gray-400: icons and markers only */
  --placeholder: #9ca3af;
  --link: #2563eb;
  --link-hover: #1e40af;

  /* Lines */
  --border: #e5e7eb; /* gray-200 */
  --border-strong: #d1d5db; /* gray-300 */
  --focus: #3b82f6;

  /* Selection and pressed toggles */
  --selected-bg: #eff6ff; /* blue-50 */
  --pressed-bg: #eff6ff;
  --pressed-border: #93c5fd;
  --pressed-text: #1d4ed8;

  /* Feedback text */
  --danger-text: #dc2626;
  --success-text: #047857;

  /* Status pills: tinted background, darker text of the same hue */
  --pill-neutral-bg: #f3f4f6;
  --pill-neutral-text: #374151;
  --pill-info-bg: #dbeafe;
  --pill-info-text: #1d4ed8;
  --pill-success-bg: #d1fae5;
  --pill-success-text: #047857;
  --pill-warning-bg: #fef3c7;
  --pill-warning-text: #b45309;
  --pill-danger-bg: #fee2e2;
  --pill-danger-text: #b91c1c;

  /* Banners */
  --banner-success-bg: #ecfdf5;
  --banner-success-border: #d1fae5;
  --banner-success-text: #065f46;
  --banner-warning-bg: #fffbeb;
  --banner-warning-border: #fcd34d;
  --banner-warning-text: #78350f;
  --banner-warning-icon: #b45309;
  --banner-danger-bg: #fef2f2;
  --banner-danger-border: #fca5a5;
  --banner-danger-text: #991b1b;
  --banner-info-bg: #eff6ff;
  --banner-info-border: #bfdbfe;
  --banner-info-text: #1e40af;

  /* Danger button */
  --danger-btn-border: #fca5a5;
  --danger-btn-text: #b91c1c;
  --danger-btn-hover: #fee2e2;

  /* Inline code */
  --code-bg: #f1f5f9;
  --code-text: #0f172a;

  /* Kiosk link-state dots */
  --dot-online: #16a34a;
  --dot-cached: #d97706;
  --dot-offline: #94a3b8;

  /* Chrome that does not change with the theme */
  --sidebar-bg: #111827;
  --sidebar-hairline: #374151;
  --sidebar-text: #d1d5db;
  --sidebar-hover: #1f2937;
  --sidebar-label: #9ca3af;

  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --sidebar-width: 256px;
  --topbar-height: 56px;
}

html.dark {
  color-scheme: dark;

  --canvas: #111827;
  --canvas-subtle: #1f2937;
  --surface-muted: #1f2937;
  --hover-subtle: #1f2937;
  --hover: #374151;
  --input-bg: #111827;

  --text: #f3f4f6;
  --text-strong: #e5e7eb;
  --text-body: #d1d5db;
  --text-secondary: #9ca3af;
  --text-muted: #9ca3af;
  --placeholder: #6b7280;
  --link: #60a5fa;
  --link-hover: #93c5fd;

  --border: #374151;
  --border-strong: #4b5563;

  --selected-bg: rgb(59 130 246 / 0.24);
  --pressed-bg: #1f2937;
  --pressed-border: #2563eb;
  --pressed-text: #60a5fa;

  --danger-text: #f87171;
  --success-text: #34d399;

  --pill-neutral-bg: #1f2937;
  --pill-neutral-text: #d1d5db;
  --pill-info-bg: rgb(30 58 138 / 0.55);
  --pill-info-text: #93c5fd;
  --pill-success-bg: rgb(6 78 59 / 0.55);
  --pill-success-text: #6ee7b7;
  --pill-warning-bg: rgb(120 53 15 / 0.55);
  --pill-warning-text: #fcd34d;
  --pill-danger-bg: rgb(127 29 29 / 0.55);
  --pill-danger-text: #fca5a5;

  --banner-success-bg: rgb(6 78 59 / 0.35);
  --banner-success-border: #065f46;
  --banner-success-text: #a7f3d0;
  --banner-warning-bg: rgb(120 53 15 / 0.35);
  --banner-warning-border: #92400e;
  --banner-warning-text: #fde68a;
  --banner-warning-icon: #fbbf24;
  --banner-danger-bg: rgb(127 29 29 / 0.35);
  --banner-danger-border: #991b1b;
  --banner-danger-text: #fecaca;
  --banner-info-bg: #1f2937;
  --banner-info-border: #374151;
  --banner-info-text: #93c5fd;

  --danger-btn-border: #991b1b;
  --danger-btn-text: #f87171;
  --danger-btn-hover: rgb(127 29 29 / 0.35);

  --code-bg: #1f2937;
  --code-text: #e5e7eb;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  background: var(--canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  color: var(--text);
}

h2 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  color: var(--text);
}

/* Section labels are uppercase, not headings. */
h3,
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

code {
  padding: 0.125em 0.35em;
  border-radius: 0.25em;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.icon {
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
}

.hidden {
  display: none !important;
}

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

:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus);
}

/* ---------- Shell ---------- */

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding-left: env(safe-area-inset-left);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-hairline);
  color: var(--sidebar-text);
  transition: width 200ms ease, transform 200ms ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-hairline);
  flex: 0 0 auto;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  color: #ffffff;
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.wordmark:hover {
  color: #ffffff;
}

.wordmark-mini {
  display: none;
  color: #60a5fa;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 150ms, color 150ms;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item[aria-current="page"] {
  background: var(--brand);
  color: #ffffff;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 4px;
  padding: 0 12px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-label);
  white-space: nowrap;
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgb(0 0 0 / 0.5);
}

.column {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 200ms ease;
}

html.sidebar-collapsed {
  --sidebar-width: 64px;
}

html.sidebar-collapsed .wordmark-full,
html.sidebar-collapsed .nav-item span,
html.sidebar-collapsed .nav-label span,
html.sidebar-collapsed .nav-label .icon {
  display: none;
}

html.sidebar-collapsed .wordmark-mini {
  display: inline;
}

html.sidebar-collapsed .sidebar-head {
  justify-content: center;
  padding: 0;
}

html.sidebar-collapsed .sidebar-nav {
  padding: 12px 10px;
}

html.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 8px;
}

html.sidebar-collapsed .nav-label {
  margin: 12px 4px 4px;
  padding: 0;
  height: 0;
  border-top: 1px solid var(--sidebar-hairline);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--topbar-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}

.topbar-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  container-type: inline-size;
  container-name: main;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

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

.page-head h1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.count-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--brand-bright);
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 640px) {
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .main {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (min-width: 768px) {
  .main {
    padding: 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 1023px) {
  .topbar-meta {
    visibility: hidden;
  }
}

/* Below 768px the sidebar is an off-canvas drawer, never a collapsed rail. */
@media (max-width: 767px) {
  html.sidebar-collapsed {
    --sidebar-width: 256px;
  }

  html.sidebar-collapsed .wordmark-full,
  html.sidebar-collapsed .nav-item span,
  html.sidebar-collapsed .nav-label span,
  html.sidebar-collapsed .nav-label .icon {
    display: revert;
  }

  html.sidebar-collapsed .wordmark-mini {
    display: none;
  }

  html.sidebar-collapsed .sidebar-head {
    justify-content: flex-start;
    padding: 0 16px;
  }

  html.sidebar-collapsed .sidebar-nav {
    padding: 12px;
  }

  html.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    padding: 8px 12px;
  }

  html.sidebar-collapsed .nav-label {
    margin: 16px 0 4px;
    padding: 0 12px;
    height: auto;
    border-top: 0;
  }

  .sidebar {
    transform: translateX(-100%);
  }

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

  html.sidebar-open .sidebar-scrim {
    display: block;
  }

  .column {
    margin-left: 0;
  }
}

/* ---------- Buttons ---------- */

button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}

button:hover,
a.button:hover {
  background: var(--brand-hover);
  color: var(--on-brand);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:disabled:hover {
  background: var(--brand);
}

button.secondary {
  padding: 6px 10px;
  background: var(--canvas);
  border-color: var(--border);
  color: var(--text-secondary);
}

button.secondary:hover {
  background: var(--hover-subtle);
  color: var(--text-secondary);
}

button.secondary:disabled:hover {
  background: var(--canvas);
}

/* Pressed / toggled state is a blue wash, not a gray fill. */
button.secondary.is-pressed,
button.secondary[aria-pressed="true"] {
  background: var(--pressed-bg);
  border-color: var(--pressed-border);
  color: var(--pressed-text);
}

button.danger {
  padding: 6px 10px;
  background: transparent;
  border-color: var(--danger-btn-border);
  color: var(--danger-btn-text);
}

button.danger:hover {
  background: var(--danger-btn-hover);
  color: var(--danger-btn-text);
}

button.danger:disabled:hover {
  background: transparent;
}

button.icon-btn {
  padding: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
}

button.icon-btn:hover {
  background: var(--hover);
  color: var(--text-secondary);
}

button.icon-btn:disabled:hover {
  background: transparent;
}

button.icon-btn.sm {
  padding: 6px;
}

button.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-weight: 400;
}

button.text-btn:hover {
  background: none;
  color: var(--text-body);
}

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

/* ---------- Forms ---------- */

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text-body);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
}

select {
  padding-right: 32px;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus);
}

input:disabled,
select:disabled {
  opacity: 0.5;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--brand);
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.status {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

.status:empty {
  display: none;
}

.status.ok {
  color: var(--success-text);
}

.status.err {
  color: var(--danger-text);
}

/* ---------- Cards, pills, banners ---------- */

.card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.card > h2 + .hint,
.card > h2 + p {
  margin-top: 4px;
}

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

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-text);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill-info,
.badge {
  background: var(--pill-info-bg);
  color: var(--pill-info-text);
}

.pill-success {
  background: var(--pill-success-bg);
  color: var(--pill-success-text);
}

.pill-warning {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-text);
}

.pill-danger {
  background: var(--pill-danger-bg);
  color: var(--pill-danger-text);
}

.alert,
.token-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--banner-info-border);
  border-radius: 8px;
  background: var(--banner-info-bg);
  color: var(--banner-info-text);
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.token-box code,
.alert code {
  display: block;
  margin-top: 4px;
  padding: 8px 12px;
  font-size: 13px;
  user-select: all;
}

.alert-success {
  background: var(--banner-success-bg);
  border-color: var(--banner-success-border);
  color: var(--banner-success-text);
}

.alert-warn {
  background: var(--banner-warning-bg);
  border-color: var(--banner-warning-border);
  color: var(--banner-warning-text);
}

.alert-warn .icon {
  color: var(--banner-warning-icon);
}

.alert-danger {
  background: var(--banner-danger-bg);
  border-color: var(--banner-danger-border);
  color: var(--banner-danger-text);
}

.empty-state {
  padding: 40px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

/* ---------- Menus and avatar ---------- */

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  width: 160px;
  margin-top: 4px;
  padding: 4px 0;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.menu.wide {
  width: 208px;
}

.menu-head {
  display: flex;
  flex-direction: column;
  padding: 6px 12px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.menu-head strong {
  font-weight: 500;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-head span {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

button.menu-item {
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-body);
  font-weight: 400;
}

button.menu-item:hover {
  background: var(--hover-subtle);
  color: var(--text-body);
}

button.menu-item[aria-checked="true"] {
  color: var(--link);
  font-weight: 500;
}

button.avatar-btn {
  gap: 4px;
  padding: 2px 6px 2px 2px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-faint);
}

button.avatar-btn:hover {
  background: var(--hover);
  color: var(--text-faint);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

/* ---------- Kiosks workspace ---------- */

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

.device-pane {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 45px;
  padding: 8px 12px;
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
}

.list-head.is-bulk {
  background: var(--banner-info-bg);
  border-bottom-color: var(--banner-info-border);
}

.select-all {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.list-head.is-bulk .select-all {
  color: var(--banner-info-text);
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.device-list {
  max-height: 45vh;
  overflow-y: auto;
}

.device-list > .hint {
  padding: 12px;
  font-size: 14px;
  line-height: 20px;
}

button.device {
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}

button.device:hover {
  background: var(--hover-subtle);
  color: var(--text);
}

button.device.active,
button.device.active:hover {
  background: var(--selected-bg);
}

.device-copy {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.device-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-strong);
}

.device-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
}

.device-id {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-text);
  font-size: 12px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.dot {
  flex: 0 0 auto;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--dot-offline);
}

.dot.online {
  background: var(--dot-online);
}

.dot.cached {
  background: var(--dot-cached);
}

.dot.offline {
  background: var(--dot-offline);
}

button.group-head {
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--canvas-subtle);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

button.group-head:hover {
  background: var(--hover);
  color: var(--text-body);
}

.group-head .icon {
  color: var(--text-faint);
}

.group-head .group-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  letter-spacing: normal;
}

.group-block > .hint {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.link-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  margin-top: -1px;
}

.link-legend span:not(.dot) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stage {
  min-width: 0;
  container-type: inline-size;
  container-name: stage;
}

@container main (min-width: 760px) {
  .workspace {
    grid-template-columns: 288px minmax(0, 1fr);
  }

  .device-pane {
    position: sticky;
    top: calc(var(--topbar-height) + 16px);
    max-height: calc(100vh - var(--topbar-height) - 40px);
  }

  .device-list {
    flex: 1;
    max-height: none;
  }
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.editor-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@container stage (min-width: 720px) {
  .editor-hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 1fr);
  }
}

.preview-card,
.identity-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000000;
  border-radius: 8px;
}

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

.preview-frame .hint {
  position: absolute;
  padding: 0 16px;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  color: #9ca3af;
}

.preview-frame.live::after {
  content: "LIVE";
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.identity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.identity-head .hint {
  flex: 1;
  min-width: 10rem;
}

.name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem;
  gap: 12px;
  align-items: end;
}

.id-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.kiosk-versions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.version-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.version-item .section-label {
  font-size: 11px;
}

.kiosk-versions .btn-row {
  margin-left: auto;
}

.editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.settings-block + .settings-block {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.section-head,
.wifi-head,
.playlist-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-panel > .section-head:not(:first-child),
.editor-panel > .wifi-head:not(:first-child),
.editor-panel > h3:not(:first-child) {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.editor-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.editor-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--canvas);
  border-top: 1px solid var(--border);
}

.empty-stage {
  margin-top: 0;
}

.danger-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.kiosk-image {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--canvas-subtle);
}

.kiosk-image .actions {
  margin-top: 4px;
}

.kiosk-image .sha {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.kiosk-log-box summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
}

.kiosk-log-box[open] summary {
  margin-bottom: 8px;
}

.kiosk-log-box .hint {
  margin-bottom: 8px;
}

/* Code block: same dark slate in both themes. */
.kiosk-logs {
  max-height: 16rem;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: 8px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.875em;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Rows with an icon-action gutter */

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

.playlist-rows {
  position: relative;
}

.playlist-item {
  position: relative;
  background: var(--canvas);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.playlist-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 5rem auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.playlist-item:first-child .playlist-row:first-child {
  border-top: 1px solid var(--border);
}

/* The name is a button that opens the item editor. */
.playlist-row button.playlist-name {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  margin: -4px;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-strong);
  font-weight: 400;
  text-align: left;
}

.playlist-row button.playlist-name:hover {
  background: var(--hover-subtle);
  color: var(--text-strong);
}

.playlist-row button.playlist-name:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus);
}

/* Thumbnail: a tiny copy of the TV with this item's own layout. */
.playlist-thumb {
  position: relative;
  flex: none;
  height: 32px;
  max-width: 57px;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px var(--border);
}

.playlist-thumb-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgb(0 0 0 / 0.62);
  color: #fff;
}

.layout-bg,
.layout-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.layout-blur,
.layout-el {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

.layout-blur {
  object-fit: cover;
  transform: scale(1.1);
}

.playlist-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Type tile: photo, video, website at a glance. */
.playlist-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-text);
}

.playlist-icon.kind-image {
  background: var(--pill-success-bg);
  color: var(--pill-success-text);
}

.playlist-icon.kind-video {
  background: var(--pill-info-bg);
  color: var(--pill-info-text);
}

.playlist-icon.kind-web {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-text);
}

.playlist-icon.kind-youtube {
  background: var(--pill-danger-bg);
  color: var(--pill-danger-text);
}

/* Drag to reorder */
.playlist-row button.playlist-grip {
  cursor: grab;
  touch-action: none;
  color: var(--text-secondary);
}

.playlist-item.is-dragging {
  position: fixed;
  z-index: 60;
  margin: 0;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: none;
  scale: 1;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 160ms ease, scale 160ms ease;
}

.playlist-item.is-dragging.is-lifted {
  box-shadow: var(--shadow-xl);
  scale: 1.02;
}

.playlist-item.is-dragging .playlist-row {
  padding-left: 4px;
  padding-right: 4px;
}

.playlist-item.is-dragging .playlist-grip {
  cursor: grabbing;
}

.playlist-placeholder {
  box-sizing: border-box;
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--surface-muted);
}

body.playlist-dragging,
body.playlist-dragging * {
  cursor: grabbing !important;
  user-select: none;
  -webkit-user-select: none;
}

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

.playlist-web-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

/* Compact transition picker between playlist rows */

.playlist-transition {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.playlist-transition select.transition-select {
  width: auto;
  min-width: 9rem;
  max-width: 50%;
  padding: 2px 24px 2px 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
}

.playlist-transition .hint {
  font-size: 12px;
}

.playlist-row .duration {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.file-btn {
  position: relative;
  flex-direction: row;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms;
}

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

.file-btn:focus-within {
  box-shadow: 0 0 0 2px var(--focus);
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

.upload-name {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-body);
}

.upload-pct {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.upload-bar {
  height: 6px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--surface-muted);
}

.upload-bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--brand);
}

.upload-item.err .upload-bar > span {
  background: #dc2626;
}

.upload-item.err .upload-pct {
  color: var(--danger-text);
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem 7.5rem minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-row:first-child {
  border-top: 1px solid var(--border);
}

.sch-days {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.day-bit {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-text);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  cursor: pointer;
}

.day-bit input {
  width: 14px;
  height: 14px;
}

.day-bit:has(input:checked) {
  background: var(--pill-info-bg);
  color: var(--pill-info-text);
}

@container stage (max-width: 560px) {
  .schedule-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  .schedule-row .sch-name,
  .schedule-row .sch-template {
    grid-column: 1 / 3;
  }

  /* Narrow editor: name on its own line, controls underneath, nothing hidden. */
  .playlist-row {
    grid-template-columns: auto minmax(0, 1fr) 4.5rem auto auto auto;
    grid-template-areas:
      "grip name name name name name"
      "grip . dur unit edit remove";
    row-gap: 6px;
  }

  .playlist-row .playlist-grip {
    grid-area: grip;
  }

  .playlist-row button.playlist-name {
    grid-area: name;
  }

  .playlist-row .duration {
    grid-area: dur;
  }

  .playlist-row .duration-unit {
    grid-area: unit;
  }

  .playlist-row .playlist-edit {
    grid-area: edit;
  }

  .playlist-row .playlist-remove {
    grid-area: remove;
  }

  .playlist-actions {
    width: 100%;
  }

  .playlist-actions > .file-btn,
  .playlist-actions > button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .name-row {
    grid-template-columns: minmax(0, 1fr) 6rem;
  }
}

/* ---------- Users ---------- */






.user-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.user-title strong {
  margin-right: 2px;
  font-weight: 500;
  color: var(--text-strong);
}


/* ---------- Sign in ---------- */

body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: var(--canvas-subtle);
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 24rem;
  padding: 32px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.auth-brand img {
  width: 32px;
  height: 32px;
}

.auth-card h1 {
  font-weight: 700;
}

.auth-card .auth-lede {
  margin-top: -8px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted);
}

.auth-card button[type="submit"] {
  width: 100%;
  padding-top: 8px;
  padding-bottom: 8px;
  border-radius: 4px;
}

.auth-card .text-btn {
  align-self: center;
}

.totp-qr {
  display: block;
  width: 196px;
  height: 196px;
  align-self: center;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.totp-secret {
  display: block;
  padding: 8px 12px;
  text-align: center;
  letter-spacing: 0.1em;
  font-size: 13px;
  user-select: all;
}

input.otp-input {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Small screens ---------- */

@media (max-width: 639px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px;
  }

  button:not(.device):not(.group-head):not(.menu-item):not(.avatar-btn),
  a.button,
  .file-btn {
    min-height: 40px;
  }

  button.icon-btn {
    min-width: 40px;
  }

  .auth-card {
    padding: 24px;
  }

  .sm-hide {
    display: none;
  }
}

/* ---------- Playlist item editor ---------- */

dialog.item-editor {
  width: min(1040px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--canvas);
  color: var(--text-body);
  box-shadow: var(--shadow-xl);
}

dialog.item-editor::backdrop {
  background: rgb(15 23 42 / 0.55);
}

.item-editor-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
  margin: 0;
}

.item-editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
}

.item-editor-titles {
  flex: 1;
  min-width: 0;
}

.item-editor-titles h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-editor-titles p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 24px;
  padding: 20px;
  overflow: auto;
}

.item-editor-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.item-editor-foot .spacer {
  flex: 1;
}

/* The little TV */
.tv {
  min-width: 0;
}

.tv-frame {
  margin: 0 auto;
  padding: 10px;
  border-radius: 12px;
  background: #0b0d12;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-lg);
}

.tv-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 2px;
  background: #000;
  cursor: crosshair;
  touch-action: none;
}

.tv-screen.is-web {
  cursor: default;
  touch-action: auto;
}

.tv-screen iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  background: #fff;
  transform-origin: 0 0;
  pointer-events: none;
}

.tv-focus {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.55), inset 0 0 0 1px rgb(0 0 0 / 0.55);
  pointer-events: none;
  transition: left 120ms ease, top 120ms ease;
}

.tv-focus::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: #fff;
}

.tv-screen.is-aiming .tv-focus {
  transition: none;
}

.tv-stand {
  width: 22%;
  height: 10px;
  margin: 0 auto;
  border-radius: 0 0 8px 8px;
  background: var(--border-strong);
}

.tv-caption {
  margin: 8px 0 0;
  text-align: center;
}

/* Controls */
.item-editor-controls {
  min-width: 0;
}

.ie-group {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.ie-group legend,
.ie-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 6px;
  padding: 0;
  color: var(--text-body);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  flex-direction: row;
}

.ie-group output {
  color: var(--text-secondary);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.ie-group .hint {
  margin: 6px 0 0;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.segmented label {
  position: relative;
  flex-direction: row;
  gap: 0;
}

.segmented input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: block;
  padding: 6px 12px;
  border-right: 1px solid var(--border);
  background: var(--canvas);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 150ms, color 150ms;
}

.segmented label:last-child span {
  border-right: 0;
}

.segmented label:hover span {
  background: var(--hover-subtle);
}

.segmented input:checked + span {
  background: var(--pressed-bg);
  color: var(--pressed-text);
}

.segmented input:focus-visible + span {
  box-shadow: inset 0 0 0 2px var(--focus);
}

.segmented label.is-disabled span {
  opacity: 0.45;
}

.segmented input:disabled {
  cursor: not-allowed;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#ie-zoom,
#ie-webzoom {
  flex: 1;
  min-width: 0;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--brand);
}

button.sm-btn {
  padding: 4px 10px;
  font-size: 13px;
  line-height: 18px;
}

.focus-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.focus-row .hint {
  margin: 0;
}

.focus-grid {
  display: grid;
  flex: none;
  grid-template-columns: repeat(3, 22px);
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.focus-grid button.focus-dot {
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-muted);
}

.focus-grid button.focus-dot::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.focus-grid button.focus-dot:hover {
  background: var(--hover-subtle);
}

.focus-grid button.focus-dot.is-on {
  border-color: var(--brand);
  background: var(--brand);
}

.focus-grid button.focus-dot.is-on::after {
  background: #fff;
}

.bg-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

#ie-bg-color {
  flex: none;
  width: 44px;
  height: 32px;
  padding: 2px;
  cursor: pointer;
}

.bg-color-row .hint {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.ie-timing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 767px) {
  dialog.item-editor {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .item-editor-form {
    height: 100%;
    max-height: 100dvh;
  }

  .item-editor-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .item-editor-foot {
    padding: 12px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .column,
  .playlist-item,
  .playlist-item.is-dragging,
  .tv-focus,
  .segmented span {
    transition: none;
  }
}

.card > form {
  margin-top: 16px;
}

.form-stack.narrow {
  max-width: 32rem;
}

.kiosk-versions .btn-row {
  flex-basis: 100%;
  margin-left: 0;
}

/* ---------- Accounts ---------- */

/* Customers never see employee controls. The server enforces this; this only tidies the UI. */
.role-customer .employee-only {
  display: none !important;
}

.kiosk-picks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
}

.kiosk-picks legend {
  padding: 0 4px;
  font-size: 13px;
  color: var(--text-strong);
}

.kiosk-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}

.kiosk-pick-list .hint {
  grid-column: 1 / -1;
  margin: 0;
}

dialog.item-editor.password-dialog {
  width: min(400px, calc(100vw - 32px));
  height: auto;
  padding: 20px;
}

/* Accounts: same list + editor workspace as Kiosks. */
.account-filter {
  justify-content: flex-start;
  gap: 4px;
  padding: 6px;
}

button.account-tab {
  flex: 1 1 0;
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

button.account-tab:hover {
  background: var(--hover);
  color: var(--text-body);
}

button.account-tab.is-pressed {
  background: var(--canvas);
  color: var(--text-strong);
  box-shadow: 0 0 0 1px var(--border);
}

button.account-tab span {
  margin-left: 4px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

div.account-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--canvas-subtle);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.label-note {
  font-weight: 400;
  color: var(--text-muted);
}

.access-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

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

.access-link select {
  width: auto;
}

.access-row #toggle-enabled {
  margin-left: auto;
}
