/* Layout */
body {
  display: flex;
  overflow: hidden;
}











/* Settings tab bar. Account / Subscription / Members / Admin — the account-shaped screens that
   used to be four separate sidebar entries. Scrolls horizontally rather than wrapping so a
   narrow window keeps them on one line. */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.settings-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

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

.settings-tab.active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent-ink);
}

/* A delegated tab (Subscription / Members / Admin) is a full view that renders its own page
   header, so inside a tab the title appears twice — once from the Settings shell and again
   from the view. Hide the child's heading, not the header itself: Admin and Members put their
   action buttons in there, and removing the element would take those with it. */
#settingsTabBody .page-header h1,
#settingsTabBody .page-header .subtitle {
  display: none;
}

#settingsTabBody .page-header {
  margin-bottom: 8px;
}





































/* Workspace members page (Phase 2 user-mgmt, slice 2A read-only). Three
   sections render via JS: direct members, via_org access, pending invites.
   Row layout mirrors the sidebar user card's avatar pattern for visual
   continuity. via_org rows are opacity-reduced and invite rows use the
   input-bg shade so the three states are distinguishable at a glance. */
.members-list { display: flex; flex-direction: column; gap: 4px; }
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-card);
}
.member-row--via-org { opacity: 0.75; }
.member-row--invited { background: var(--bg-input); }
.member-avatar {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--accent-on);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.member-avatar--muted { background: var(--text-muted); }
.member-meta { flex: 1; min-width: 0; }
.member-name {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-email {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-role {
  flex-shrink: 0; font-size: 12px; color: var(--text-secondary);
  padding: 4px 8px; background: var(--bg-input);
  border-radius: 4px; min-width: 60px; text-align: center;
}
.member-detail {
  flex-shrink: 0; font-size: 11px; color: var(--text-muted);
  min-width: 110px; text-align: right;
}
.member-via-org { font-style: italic; }
.member-badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 6px; background: var(--bg-input); color: var(--text-muted);
  border-radius: 3px; font-weight: 600;
}

/* Slice 2B - mutation affordances. .member-actions is the cell that holds
   per-row admin buttons (remove on direct-member rows, cancel on invited
   rows). via_org rows omit the cell entirely. The role select replaces the
   .member-role div for admins on direct-member rows. */
.member-role-select {
  flex-shrink: 0; font-size: 12px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; min-width: 90px; cursor: pointer;
}
.member-role-select:hover { border-color: var(--accent-ink); }
.member-actions {
  flex-shrink: 0; display: flex; align-items: center; gap: 4px;
  margin-left: 4px;
}
.member-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 6px;
  color: var(--text-muted); cursor: pointer;
  border-radius: 4px; transition: all var(--transition);
}
.member-action-btn:hover { background: var(--bg-hover); }
.member-action-btn--danger:hover { color: var(--danger); }


























.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); }
/* Grey, matching .row-state.provisioning and the row stripe. A screen waiting to be paired is
   mid-setup, not a fault — amber here made every fresh install look like an alert, and the same
   word wore three different colours across three files. */
.status-dot.provisioning { background: var(--text-muted); animation: pulse 2s infinite; }
/* v4 liveness (server-derived): healthy=green, degraded=amber+pulse (reconnecting), offline=red (above) */
.status-dot.healthy { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.degraded { background: var(--warning); box-shadow: 0 0 6px var(--warning); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Media compression in progress on a content card. Reuses the `pulse` above rather than adding
   a second animation, and stays muted on purpose — the asset is playable throughout, so this is
   a note, not a warning. */
.processing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pulse 2s infinite;
}

/* Wraps the (optional) banners strip and main content so they stack
   vertically as a single flex column, independent from the fixed sidebar.
   Without this wrapper, #banners and .content would be direct siblings in
   the (row-direction) body flexbox, turning the banner into a narrow flex
   item next to the content instead of a full-width strip above it, and
   shifting the whole dashboard layout out of alignment with the sidebar. */
/*
 * O RECUO SAIU DAQUI, e a falha que ele causou está descrita duas telas abaixo, escrita antes
 * de acontecer: "um dia a barra encolhe e o conteúdo não acompanha, deixando uma faixa vazia
 * que ninguém entende".
 *
 * Foi exatamente isso. `margin-left: var(--sidebar-width)` existia porque a antiga `.sidebar`
 * era `position: fixed` — fora do fluxo, ocupando zero, e o conteúdo tinha de abrir espaço por
 * conta própria. O <loop-sidebar> está NO fluxo: ele já ocupa os 232px. Somando o recuo, a
 * medida era contada duas vezes e sobravam 232px de nada entre a barra e o conteúdo.
 *
 * Agora a largura existe num lugar só, dentro do componente, e `flex: 1` absorve o que sobrar
 * — inclusive quando ele recolhe para 72px, sem ninguém precisar avisar ninguém.
 */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  /*
   * ⚠️ 100vh on a phone is the height WITHOUT the browser's toolbars, which are in fact on screen.
   * The shell was therefore taller than the visible area, and with `body { overflow: hidden }`
   * the last part of every page sat behind the address bar with no way to reach it — the single
   * cause of "I cannot scroll to the bottom on mobile".
   *
   * dvh tracks the toolbars as they appear and retract. The 100vh line is kept immediately above
   * as the fallback for a browser that does not support it.
   */
  height: 100vh;
  height: 100dvh;
  min-width: 0;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px;
  /*
   * The home indicator on a modern iPhone overlaps the bottom of the page. env() is 0 everywhere
   * that has no such inset, so this costs nothing on a desktop or an Android box.
   */
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  /* Dark, not white — see --accent-on in variables.css for the contrast maths. */
  color: var(--accent-on);
  font-weight: 600;
}

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

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

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

/*
 * A destructive action that is NOT the point of the screen.
 *
 * .btn-danger is a filled surface and reads as an invitation; eleven of them across a grid of
 * system templates competed with the primary action on every card. This says the same thing in a
 * quieter voice — the colour still marks it destructive, the weight no longer suggests it is what
 * you came for. It only turns solid on hover, where the intent is already deliberate.
 */
.btn-quiet {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-quiet:hover {
  background: var(--danger-dim);
  border-color: var(--danger);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: all var(--transition);
}

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

/* Device Grid */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.device-card:hover {
  border-color: var(--accent-ink);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* #238: a rotated display shown as its viewer sees it. The stage is the panel's face; the frame is
   its framebuffer, turned back by the mount (js/lib/device-frame.js sizes and rotates it from the
   players' shared rule). The frame is centred on its offset parent, so a stage without
   `position: relative` would centre it on the page — hence both halves live here together. */
.display-stage {
  position: relative;
  overflow: hidden;
}

.display-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.device-card-preview {
  aspect-ratio: 16/9;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.device-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.device-card-preview .no-preview {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
}

.device-card-preview .no-preview svg {
  opacity: 0.3;
}

.device-card-status {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
/* Device cards render the reused liveness pill (.device-status-badge from device-detail), which brings
   its own bg/padding/shape — so neutralize the dark wrapper for those. Wall cards keep the dark pill
   above for their "NxN wall" label (they share .device-card-status but have no .is-liveness). */
.device-card-status.is-liveness {
  background: none;
  backdrop-filter: none;
  padding: 0;
  border-radius: 0;
}
/* Lift the list pill off the screenshot so it stays legible over any image. */
.device-card-status.is-liveness .device-status-badge {
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.device-card-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  background: rgba(0,0,0,0.6);
  border-radius: 4px;
  padding: 3px 5px;
  display: flex;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.device-card:hover .device-card-select,
.device-card.selected .device-card-select { opacity: 1; }
.device-card-select input { cursor: pointer; margin: 0; }
.device-card.selected { outline: 2px solid var(--accent-ink); outline-offset: -2px; }

/* Wall editor — free-form pan/zoom canvas */
.wall-viewport {
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  background:
    linear-gradient(rgba(15,23,42,0.06) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(15,23,42,0.06) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--bg-primary);
}
.wall-viewport.panning { cursor: grabbing; }
/* Inner canvas: a 0×0 anchor whose CSS transform supplies pan + zoom.
   All rect children are absolutely positioned in canvas-data coordinates
   and inherit the parent transform. transform-origin is the canvas's
   top-left so pan offsets map cleanly to data → screen pixels. */
.wall-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  /* Disable transition so panning doesn't lag behind the cursor */
}
.wall-zoom-readout {
  position: absolute;
  bottom: 8px;
  right: 12px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.wall-screen {
  position: absolute;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 2px solid var(--accent-ink);
  border-radius: 4px;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  touch-action: none;
  overflow: hidden;
}
.wall-screen-overlap {
  position: absolute;
  background: rgba(96,165,250,0.35);
  pointer-events: none;
  display: none;
  z-index: 1;
}
.wall-screen-label {
  position: absolute;
  top: 4px;
  left: 6px;
  right: 24px;
  pointer-events: none;
  z-index: 2;
}
.wall-screen-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wall-screen-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.wall-screen-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.wall-screen-remove:hover { background: var(--danger); }

.wall-player {
  position: absolute;
  background: rgba(96,165,250,0.18);
  border: 2px dashed var(--info);
  border-radius: 4px;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  touch-action: none;
  z-index: 5;
  box-shadow: 0 0 0 9999px transparent; /* keeps stacking explicit */
}
.wall-player-label {
  position: absolute;
  top: 4px;
  left: 6px;
  pointer-events: none;
  color: var(--info);
  font-size: 11px;
  letter-spacing: 1px;
}

/* Selected rect highlight (works for both screens and the player) */
.wall-screen.selected,
.wall-player.selected {
  outline: 3px solid var(--warning);
  outline-offset: 1px;
  z-index: 6;
}

/* Fine-position panel inputs */
.wall-pos-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 6px 8px;
  align-items: center;
  font-size: 12px;
}
.wall-pos-grid label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wall-pos-grid input {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.wall-pos-grid input:focus { outline: 1px solid var(--accent-ink); outline-offset: 0; border-color: var(--accent-ink); }

/* Eight resize handles, used by both screens and the player */
.wall-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border: 1px solid var(--info);
  border-radius: 2px;
  z-index: 4;
}
.wall-player .wall-handle { border-color: var(--info); }
.wall-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.wall-handle-n  { top: -5px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.wall-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.wall-handle-e  { top: 50%; right: -5px; transform: translateY(-50%); cursor: e-resize; }
.wall-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.wall-handle-s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.wall-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.wall-handle-w  { top: 50%; left: -5px; transform: translateY(-50%); cursor: w-resize; }

/* Wall editor — legacy cells (kept for migration; new editor uses wall-canvas) */
.wall-cell {
  position: relative;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
  user-select: none;
}
.wall-cell.occupied {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 2px solid var(--accent-ink);
  cursor: grab;
}
.wall-cell.occupied:active { cursor: grabbing; }
.wall-cell.drag-over {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.25) inset;
}
.wall-cell-name { font-weight: 500; padding: 0 6px; text-align: center; }
.wall-cell-pos {
  position: absolute;
  bottom: 4px;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.wall-cell-remove {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 20px; height: 20px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.wall-cell-remove:hover { background: var(--danger); }

.wall-card .wall-card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
}
.wall-card-grid {
  display: grid;
  gap: 4px;
  width: 65%;
  aspect-ratio: 16/9;
  padding: 8px;
}
.wall-card-cell {
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--border-light);
  border-radius: 2px;
}
.wall-card-cell.filled {
  background: var(--accent);
  border-color: var(--accent-dim);
}

.device-card-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 10px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff;
  font-size: 11px;
  pointer-events: none;
}
.device-card-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.device-card-progress-label .dcp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.device-card-progress-label .dcp-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.device-card-progress-track {
  height: 3px;
  background: rgba(15, 23, 42, 0.2);
  border-radius: 2px;
  overflow: hidden;
}
.device-card-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.9s linear;
}
.device-card-progress-fill.indeterminate {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 50% 100%;
  animation: dcp-indeterminate 1.4s linear infinite;
}
@keyframes dcp-indeterminate {
  0% { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}

.device-card-body {
  padding: 14px 16px;
}

.device-card-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

.device-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.device-card-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Device Detail */
.device-detail {
  max-width: 1200px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 13px;
  transition: color var(--transition);
}

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

.device-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.device-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.device-header-left h1 {
  font-size: 22px;
}

.device-status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.device-status-badge.online { background: var(--success-dim); color: var(--success); }
.device-status-badge.offline { background: var(--danger-dim); color: var(--danger); }
.device-status-badge.provisioning { background: var(--bg-hover); color: var(--text-secondary); }
/* v4 liveness (server-derived): healthy=green, degraded=amber (reconnecting), offline reuses .offline above */
.device-status-badge.healthy { background: var(--success-dim); color: var(--success); }
.device-status-badge.degraded { background: var(--warning-dim); color: var(--warning); }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent-ink); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Screenshot Preview */
.screenshot-container {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
  margin-bottom: 20px;
}

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

.screenshot-container .no-screenshot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
}

/* Remote Control */
.remote-container {
  display: flex;
  gap: 20px;
}

.remote-screen {
  flex: 1;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}

.remote-screen canvas {
  width: 100%;
  display: block;
}

.remote-controls {
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* Playlist */
.playlist-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.playlist-item:hover {
  border-color: var(--border-light);
}

.playlist-item-thumb {
  width: 80px;
  height: 45px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-primary);
  flex-shrink: 0;
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
}

.playlist-item-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.playlist-item-actions {
  display: flex;
  gap: 4px;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.info-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.info-card-value {
  font-size: 20px;
  font-weight: 600;
}

.info-card-value.small {
  font-size: 14px;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition);
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }

/* Content Library */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.content-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}

.content-item:hover {
  border-color: var(--border-light);
}

.content-item-preview {
  aspect-ratio: 16/9;
  background: var(--bg-primary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.content-item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.content-item-preview .video-icon {
  color: var(--text-muted);
}

.content-item-body {
  padding: 10px 12px;
}

.content-item-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.content-item-size {
  font-size: 11px;
  color: var(--text-muted);
}

.content-item-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 10px;
  gap: 4px;
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 24px;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.upload-area svg {
  margin: 0 auto 12px;
  color: var(--text-muted);
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 14px;
}

.upload-area .upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: 90vw;
  box-shadow: var(--shadow);
  /* Cap to the viewport and lay out as a column so a tall form (e.g. the directory-board
     widget with many entries) scrolls inside .modal-body while the header/footer stay
     pinned — otherwise the modal grows past the screen and Save becomes unreachable. */
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  /* Scroll region between the pinned header and footer. min-height:0 lets the flex item
     shrink below its content so overflow-y actually engages inside the column. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Form Elements */
/*
 * Two columns of fields that collapse to one when there is no room. Used by the integration forms,
 * where a host and a port belong side by side and a From address does not.
 *
 * A field opts out of the pairing with grid-column: 1/-1 inline, which is how the forms that came
 * before it already asked for a full-width row.
 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--accent-ink);
}

.pairing-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 8px;
  font-family: 'Courier New', monospace;
}

.pairing-input:focus {
  outline: none;
  border-color: var(--accent-ink);
}

/* Toast */
/*
 * A STRIP ACROSS THE TOP OF THE CONTENT — for the small number of facts that must follow the
 * reader from page to page.
 *
 * There were three of these and each was styled inline, in its own way, with its own literals:
 * background:var(--warning,#f59e0b) with color:#1a1200, background:var(--danger,#dc2626) with
 * color:#fff. Three near-identical strips that could drift apart and two colour fallbacks that no
 * theme change could reach.
 *
 * INK IS --text-primary, NOT THE STATUS COLOUR. The obvious version — amber text on an amber
 * tint — measures 4.42:1 and misses the bar, and this is a strip whose entire job is to be read.
 * So the severity is carried by the tint and the rule beneath it, which are decoration and only
 * have to clear 3:1, while the words are carried by the ink that always passes.
 */
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  border-bottom: 1px solid;
}
.banner a { color: inherit; text-decoration: underline; font-weight: 700; }
.banner .btn { flex: 0 0 auto; }

.banner-warning { background: var(--warning-dim); border-bottom-color: var(--warning); }
.banner-danger  { background: var(--danger-dim);  border-bottom-color: var(--danger); }
.banner-info    { background: var(--info-dim);    border-bottom-color: var(--info); }

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 280px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
/* An INFO toast used the brand green, right beside a SUCCESS toast in green: two states,
   one colour, and the reader has to open the message to tell which is which. */
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}














/*
 * Faixa do filtro vindo da URL.
 *
 * Ela existe para responder uma pergunta que a lista sozinha nao responde: "a frota encolheu
 * ou eu estou olhando um recorte?". Por isso ela e larga, fica ACIMA da lista e carrega
 * sempre a saida -- um recorte sem porta de saida vira um beco.
 */
.filtro-faixa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-ink);
}
.filtro-faixa-texto {
  font-size: 13px;
  color: var(--text-primary);
}
.filtro-faixa-limpar {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.filtro-faixa-limpar:hover,
.filtro-faixa-limpar:focus-visible {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto;
}

/* Settings */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

/* Assign Modal */
.assign-content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.assign-content-item {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.assign-content-item:hover {
  border-color: var(--accent-ink);
}

.assign-content-item.selected {
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 1px var(--accent);
}

.assign-content-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.assign-content-item-name {
  padding: 6px 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Upload progress */
.upload-progress {
  margin-top: 16px;
}

.upload-progress-bar {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Help tooltips */

/* A help tip must be reachable without a mouse. :hover alone made every one of these
   invisible on a tablet or phone — which is a large share of the people administering a
   signage install — and unreachable by keyboard. Tapping toggles .is-open; focus shows it too. */
/* The visible marker is 18px, which is fine to look at and far too small to hit with a thumb —
   about half the ~44px touch guideline. Now that tapping a tip is how touch users read it at
   all, extend the HIT AREA with a transparent inset overlay rather than inflating the circle,
   so the target is comfortable without the marker dominating a heading. */

/* Table wrapper: enables horizontal scroll when table min-width exceeds viewport */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile hamburger toggle */
/*
 * The mobile top bar: a solid strip the content scrolls behind, rather than a floating button it
 * scrolls around. Also carries the current page name, because the real page header scrolls out of
 * view on a phone and takes with it the only sign of where you are.
 */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  align-items: center;
  gap: 12px;
  /* Below the notch on a landscape iPhone; 0 everywhere else. */
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}
.mobile-topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-menu-btn {
  display: none;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
  .mobile-menu-btn { display: flex; }
  
  
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 140;
  }
  .sidebar-backdrop.open { display: block; }
  
  .main-wrapper { margin-left: 0; }
  /*
   * Clear the bar, and the notch above it. The old 68px was a guess that only helped the FIRST
   * element — everything after it scrolled under a transparent button. Now the bar is opaque, so
   * this is simply the room it occupies.
   */
  .content {
    padding: 16px;
    padding-top: calc(61px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .device-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .info-grid { grid-template-columns: 1fr; }
  .remote-container { flex-direction: column; }
  .remote-controls { width: 100%; flex-direction: row; flex-wrap: wrap; }
  /* max-height + scrolling body are now on the base .modal (pinned header/footer); just widen. */
  .modal { width: 95vw; }
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
  }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .playlist-item { flex-wrap: wrap; }

  /* Dashboard stats stack to single column */
  .dash-stats-row { flex-direction: column; }
  .dash-stats-row .info-card { flex: none; }

  /* Content-library 3-up toolbar stacks vertically */
  .content-toolbar { flex-direction: column; }
  .content-toolbar > div[style*="width:320px"] { width: auto !important; }

  /* Schedule controls: allow wrap and widen select to full row */
  .schedule-controls { gap: 8px; }
  .schedule-controls > select { flex: 1 1 100%; }
  .schedule-controls > button,
  .schedule-controls > span { flex: 0 1 auto; }

  /* Tap targets: minimum 44px height for interactive elements */
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; padding: 8px 12px; }
  .btn-icon { min-width: 40px; min-height: 40px; }

  /* Form inputs: 16px font to prevent iOS focus zoom; 44px tap target */
  .input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }
  .pairing-input { font-size: 24px; letter-spacing: 6px; }

  /* Modals: adjust padding at 95vw so content doesn't touch edges */
  .modal-header,
  .modal-footer { padding: 14px 16px; }
  .modal-body { padding: 16px; }

  /* Toast container: full-width bar instead of 280px fixed to right */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast { min-width: 0; width: 100%; }

  /*
   * THE SCREEN NAME WAS NOT TRUNCATED — it was collapsed to nothing.
   *
   * .device-list-wrap .list-table is table-layout:fixed, and every column carries a fixed width
   * EXCEPT the name: the fixed columns now total far less than they did, because three of them
   * 390px phone the one column with no width gets what is left, and there is nothing left. The
   * first header a reader saw was PLAYLIST, and the screen's own name had zero pixels.
   *
   * So on a phone the two columns that answer questions you are not asking there — what is
   * playing this second, and the Wi-Fi signal in dBm — are gone from the product entirely now, so
   * the sum is fixed at the source. What a phone drops on top of that is the layout name; the name
   * and the lists fit comfortably in what remains, and the desktop is untouched.
   */
  .device-list-wrap .list-table { table-layout: auto; }
  /*
   * The layout NAME is what a phone can spare. The lists cannot go: "which playlist is on this
   * screen" is the question the row exists to answer, and unlike the layout there is no other
   * place on this page to read it.
   */
  .device-list-wrap .list-table .col-layout { display: none; }
  /*
   * The state as a WORD, under the name. The dot beside it is a 9px target carrying a title and an
   * aria-label — fine with a mouse, thin on a phone — and colour alone is exactly what a
   * colour-blind reader and a screen reader do not get.
   */
  .state-inline { display: block; }
  /* A wider stripe to carry the state at a glance, now that no column repeats it. */
  .device-row > td:first-child,
  .device-list-wrap .list-table thead th:first-child { border-left-width: 5px; }
  .device-list-wrap .list-table .col-playlist { width: auto; }
  .device-list-wrap .list-table .num { width: auto; }

  /*
   * Momentum scrolling on the wrappers the other lists already have. Arquivos and Playlists set
   * .list-table-wrap from JS (grid.className) rather than in the markup, which is easy to miss
   * when reading the template — they were never missing a wrapper, only this.
   */
  .list-table-wrap { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  .content-grid { grid-template-columns: 1fr; }
  .assign-content-grid { grid-template-columns: 1fr 1fr; }
}

/* ── list tables ───────────────────────────────────────────────────────────
   The shared layout behind Conteúdo, Playlists and Telas. A card grid is a
   browser; these pages are management surfaces, where the questions are
   "which of these is expiring", "which screens are down" and "delete these
   eleven" — all of them columns you scan, none of them answered by a wall of
   thumbnails. */
.list-table-wrap { width: 100%; overflow-x: auto; }
.list-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.list-table thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.list-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.list-table tbody tr:hover { background: var(--bg-hover); }
.list-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-table .actions { text-align: right; white-space: nowrap; width: 1%; }
/* The checkbox column is exactly as wide as a checkbox, so the name starts in
   the same place whether or not the row is selected. */
/* Type-to-find picker inside the batch toolbar ("add the selected files to a list").
   Absolutely positioned so opening it cannot push the toolbar or the table below it around. */
.bulk-picker { position: relative; display: inline-block; }
.bulk-picker-results {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  min-width: 260px; max-height: 260px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius, 8px); box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.bulk-picker-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 12px; background: none; border: 0; cursor: pointer;
  text-align: left; color: var(--text-primary); font-size: 13px;
}
.bulk-picker-item:hover, .bulk-picker-item:focus-within { background: var(--bg-hover); }
.bulk-picker-item input[type="checkbox"] { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; cursor: pointer; }
/* The name takes the slack so the item count stays pinned right and never wraps under it. */
.bulk-picker-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Sticky so the confirm button stays reachable once the list scrolls. */
.bulk-picker-foot {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end;
  padding: 8px 12px; border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.bulk-picker-meta { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); }
.bulk-picker-empty { padding: 10px 12px; font-size: 12px; color: var(--text-muted); }

/* O cabecalho que separa Grupos de Telas no seletor de envio. Sem ele as duas listas viram uma
   so, e marcar um "grupo" achando que e uma tela poe a midia em quatro paredes de uma vez. */
.bulk-picker-head {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.list-table .bulk-cell { width: 1%; padding-right: 0; }
.list-table .bulk-cell input { width: 16px; height: 16px; margin: 0; cursor: pointer; }

.list-row.is-dim { opacity: .55; }
/* A stripe rather than a badge for a row-level problem: it reads down the whole
   list at a glance and costs no column. */
.list-row.is-down td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

.list-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-thumb {
  flex: 0 0 auto; width: 44px; height: 30px; border-radius: 4px; overflow: hidden;
  background: var(--bg-secondary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
}
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-thumb-fallback { font-size: 13px; }
.list-name-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-name-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.list-sub { font-size: 11px; color: var(--text-muted); }
.list-sub.is-danger { color: var(--danger); font-weight: 600; }

/* Chips for "which screens run this playlist" and similar many-to-one columns. */
.list-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.list-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-input); color: var(--text-secondary); white-space: nowrap;
}
.list-chip.is-down { background: var(--danger-dim); color: var(--danger); }

.list-table .btn-icon {
  background: none; border: none; cursor: pointer; padding: 5px;
  border-radius: 4px; color: var(--text-muted);
}
.list-table .btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.list-table .btn-icon.is-danger:hover { color: var(--danger); }

/* The file name is the handle for "change this file". The thumbnail beside it opens the preview
   instead — different questions, so different targets, and the name says which one it is. */
/* The scheduling clock beside a filename. Three states, drawn rather than typed so the colour is
   ours: the unicode clock characters render as full-colour emoji and would look identical in all
   three. Sized to the cap height of the name next to it so the row does not grow a pixel. */
.sched-clock { flex: 0 0 auto; width: 14px; height: 14px; line-height: 0; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.sched-clock svg { width: 100%; height: 100%; display: block; }
.sched-clock.is-active  { color: var(--success); }
.sched-clock.is-expired { color: var(--danger); }
/* Scheduled but not on air: deliberately quiet. It is the state that needs no attention, and a
   third saturated colour beside the red and the green would compete with both. */
.sched-clock.is-pending { color: var(--text-muted); }

/* The name and its clock share a line; the sub-labels stay stacked underneath. */
.list-name-main-row { display: flex; align-items: center; min-width: 0; }

.list-name-main.is-clickable { cursor: pointer; }
.list-name-main.is-clickable:hover { text-decoration: underline; color: var(--accent-ink); }

/* [hidden] is a user-agent rule and loses to any author rule that sets display — which .btn and
   .form-group both do. Without this, hiding a field by attribute changes nothing on screen. */
[hidden] { display: none !important; }

/* Tool rows in the playlist's Ferramentas tab: a name and a line, not a form. The fields only
   matter once the tool is chosen, so choosing comes first. */
.tool-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-align: left;
  color: var(--text-primary); transition: border-color var(--transition);
}
.tool-row:hover { border-color: var(--accent-ink); }
.tool-icon { flex: 0 0 auto; color: var(--accent-ink); display: flex; }
.tool-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tool-title { font-size: 13px; font-weight: 600; }
.tool-desc { font-size: 11px; color: var(--text-muted); }
.tool-chevron { flex: 0 0 auto; color: var(--text-muted); }

/* ---- Fleet list ---------------------------------------------------------------------------
 * The screens page renders as a table like the content library and playlists. The progress bar
 * survives from the card, where it floated over a thumbnail; in a row it is ordinary flow
 * content, so the absolute positioning and the dark scrim it needed there are undone. */
.device-list-wrap { width: 100%; }
.device-row { cursor: pointer; }
.device-row[draggable="true"] { cursor: grab; }
.device-row .col-playlist, .list-table thead .col-playlist { white-space: nowrap; }
.device-row .col-layout, .list-table thead .col-layout { color: var(--text-muted); white-space: nowrap; }
.device-list-wrap .list-table .col-layout { width: 20%; }


/*
 * A ZONE WITH NOTHING IN IT — amber, never red.
 *
 * Red is "it stopped working". This is "it is working and nobody finished setting it up", and the
 * difference decides what the reader does next: a site visit, or thirty seconds in the panel.
 */

.zone-warn {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid var(--warning);
  white-space: nowrap;
}
.col-playlist .list-chip + .zone-warn,
.col-playlist .zone-warn + .zone-warn { margin-left: 4px; }
.list-muted { color: var(--text-muted); }
.device-row .device-card-progress {
  position: static;
  padding: 0;
  background: none;
  color: inherit;
  font-size: 11px;
}
.device-row .device-card-progress-label { margin-bottom: 3px; text-shadow: none; }
.device-row .device-card-progress-track { background: var(--bg-input); }
.pairing-code-inline {
  margin-left: 8px;
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--warning);
}

/* The state pill sits IN its column. .device-card-status, which the card used, is absolutely
 * positioned — a cell carrying it lands in the corner of the page. */

/* Each group renders its own table, so without fixed widths every group sizes its columns to its
 * own contents and the page reads as a stack of misaligned grids. Fixed makes the fleet scan as
 * one list broken by headings, which is what it is. */
.device-list-wrap .list-table { table-layout: fixed; }
.device-list-wrap .list-table .bulk-cell { width: 42px; }
.device-list-wrap .list-table .col-playlist { width: 170px; }
.device-list-wrap .list-table .num { width: 150px; }
.device-list-wrap .list-table td, .device-list-wrap .list-table th { overflow: hidden; text-overflow: ellipsis; }

/* ---- The band above every list ------------------------------------------------------------
 * Telas, Conteúdo and Playlists each invented their own arrangement of the same four zones, so
 * switching tabs moved the search box, moved the toggle, and started the table at a different
 * height every time. One band: search first, filters beside it, toggles and secondary buttons
 * pushed to the far end. A page with nothing to filter still renders the band, so the table
 * begins at the same height on all three. */
.list-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
  min-height: 38px;
}
.list-toolbar-search { max-width: 280px; width: 100%; }
.list-toolbar-count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
/* Everything after this sits at the far end: toggles, then secondary actions. */
.list-toolbar-end { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.list-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

/* One row height across the three lists. Content rows ran taller because of the thumbnail and
 * Telas taller still because of the owner line underneath the name; the cell contents now fit
 * the row rather than the row growing to fit them. */
.list-table tbody tr { height: 58px; }

/* An empty container must take no room. The folder breadcrumb and the subfolder grid are both
 * empty for any account that never created a folder, and their margins alone pushed the content
 * table well below where the same table starts on Playlists. */
#folderBreadcrumb:empty, #folderGrid:empty { display: none !important; }

/* A chip carries a NAME; the dot beside it carries the state. Filling the whole pill red made
 * three offline screens read as three errors, when the fact being reported is just where the
 * playlist runs. */
.list-chip { display: inline-flex; align-items: center; gap: 5px; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--text-muted); }
.chip-dot.is-up { background: var(--success); }
.chip-dot.is-down { background: var(--danger); }

/* Playing-now is the widest column; narrower now that it says "—" when idle rather than
 * standing empty. */

/* With table-layout:fixed the generic .actions { width: 1% } wins and the column collapses to
 * ~13px, clipping the icons under overflow:hidden. Auto-layout treats 1% as "as narrow as the
 * content allows"; fixed layout takes it literally. */
.device-list-wrap .list-table .actions { width: 88px; }

/* .list-name-link and .list-tag were written into the playlist row and never styled, so the name
 * had no affordance and "rascunho" ran on as loose text beside it. Now that the row icon is gone
 * and the name is the only way in, the affordance is the whole navigation. */
.list-name-link { color: inherit; text-decoration: none; display: inline-flex; min-width: 0; max-width: 100%; }
.list-name-link:hover .list-name-main { text-decoration: underline; color: var(--accent-ink); }
.list-tag {
  margin-left: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-muted);
  white-space: nowrap;
}
.list-tag.is-draft { color: var(--warning); background: rgba(245,158,11,.14); }

/* ---- The state stripe ----------------------------------------------------------------------
 * At a fixed x down the left edge, so the fleet reads as one continuous line and a screen in
 * trouble breaks it. This is the whole point: no text to parse, no eye travel along a row.
 * The header carries a transparent stripe of the same width so the columns still line up. */
.device-list-wrap .list-table thead th:first-child { border-left: 3px solid transparent; }
.device-row > td:first-child { border-left: 3px solid transparent; }
/* The phone-only copy of the state. Hidden here; the media query below reveals it. */
.state-inline { display: none; margin-top: 2px; }
/* Green healthy, amber idle, red offline, blue waiting for content. `degraded` keeps the amber
   it always had: an older server still emits that name for the same state. */
.device-row[data-row-state="healthy"]     > td:first-child { border-left-color: var(--success); }
.device-row[data-row-state="idle"]        > td:first-child { border-left-color: var(--warning); }
.device-row[data-row-state="degraded"]    > td:first-child { border-left-color: var(--warning); }
.device-row[data-row-state="awaiting"]    > td:first-child { border-left-color: var(--info); }
.device-row[data-row-state="offline"]     > td:first-child { border-left-color: var(--danger); }
.device-row[data-row-state="provisioning"] > td:first-child { border-left-color: var(--text-muted); }

/* With the stripe carrying the state, a filled badge is a second and louder copy of the same
 * fact, competing with it. The column now earns its place by carrying the REASON, in text. */
.row-state { font-size: 12px; color: var(--text-secondary); }
.row-state.offline { color: var(--danger); }
.row-state.idle { color: var(--warning); }
.row-state.degraded { color: var(--warning); }
.row-state.awaiting { color: var(--info); }
.row-state.provisioning { color: var(--text-muted); }
/* Reported states a screen row never has: a list is published or it is a draft waiting to be. */
.row-state.online { color: var(--success); }
.row-state.published { color: var(--success); }
.row-state.draft { color: var(--warning); }

/* Wider, because it now says what, for how long and why — and it can afford to be: the
 * "Visto por último" column folded into it. */

/* The device page is one page. Sections replace tabs: after the cleanup each tab held two to four
 * rows, and clicking to reach three fields costs more than scrolling past them. The rule that
 * separates them does the work a tab bar used to. */
.device-section { padding: 20px 0; border-top: 1px solid var(--border); }
.device-section:first-of-type { padding-top: 4px; border-top: none; }
.device-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Reports ------------------------------------------------------------------------------ */
.rep-toolbar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 16px 0;
}
.rep-field { display: flex; flex-direction: column; gap: 4px; }
.rep-field > span { font-size: 12px; color: var(--text-secondary); }
.rep-field .input { padding: 6px 8px; font-size: 13px; min-width: 170px; }
.rep-toolbar-end { margin-left: auto; }

.rep-subject { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.rep-subject h2 { font-size: 18px; font-weight: 600; margin: 0; }

.rep-h { font-size: 15px; font-weight: 600; margin: 22px 0 10px; }
.rep-h:first-child { margin-top: 0; }
.rep-h4 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-secondary); }
.rep-note { font-size: 12px; color: var(--text-muted); margin: 8px 0 14px; }
.rep-muted { color: var(--text-muted); }

.rep-tiles {
  display: grid;
  /* auto-fit, so five tiles become one column on a phone instead of five unreadable slivers. */
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.rep-tile { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.rep-tile-v { font-size: 20px; font-weight: 600; }
.rep-tile-l { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Two panels side by side on a desktop, stacked on anything narrow — decided by the content's own
   width rather than by a breakpoint. */
.rep-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.rep-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.rep-list li { padding: 4px 0; border-bottom: 1px solid var(--border); }

/* Every wide thing scrolls inside its own box. Without this a long file name widens the page
   itself, and on a phone the whole layout scrolls sideways behind the fixed bar. */
.rep-scroll { overflow-x: auto; }
.rep-table { font-size: 13px; }
.rep-table td, .rep-table th { padding: 5px 8px; }

/* A row that opens that subject's own report. */
.rep-row { cursor: pointer; }
.rep-row:hover { background: var(--bg-hover); }

/* The grid: rows down the side, hours or days across the top. */
.rep-matrix { border-collapse: collapse; font-size: 12px; margin: 4px 0 18px; }
.rep-matrix th, .rep-matrix td {
  border: 1px solid var(--border);
  padding: 3px 6px;
  text-align: center;
  white-space: nowrap;
}
.rep-matrix thead th { font-weight: 600; color: var(--text-secondary); }
/* The row label stays put while the hours scroll under the finger. */
.rep-matrix .rep-matrix-head {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-primary);
  text-align: left;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rep-matrix .rep-matrix-total { font-weight: 600; }
.rep-matrix tfoot td, .rep-matrix tfoot th { font-weight: 600; background: var(--bg-secondary); }

/* Save sits at the foot of the page, because it saves everything above it — which it always
 * did, and which its old position in the middle of one block denied. */
.device-save-bar { padding: 18px 0 6px; border-top: 1px solid var(--border); }

/* The count of screens in trouble, on the nav. Zero is never rendered — a badge that is
 * always there stops being seen. */
