﻿/* Layout */
body {
  display: flex;
  overflow: hidden;
  background: var(--bg-primary);
}

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
}

/* Workspace switcher (Phase 3 MVP). Sits in sidebar-header below the logo.
   Three render modes via JS: dropdown (>1 ws), static text (1 ws),
   muted empty state (0 ws). */
.workspace-switcher { position: relative; margin-top: 12px; }
.workspace-switcher-button {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 13px; cursor: pointer; transition: all var(--transition);
}
.workspace-switcher-button:hover { border-color: var(--accent); }
.workspace-switcher-static {
  display: block; padding: 4px 2px;
  color: var(--text-primary); font-size: 13px; font-weight: 500;
}
.workspace-switcher-static::before {
  content: 'Workspace';
  display: block;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 2px;
}
.workspace-switcher-empty {
  display: block; padding: 8px 10px;
  color: var(--text-muted); font-size: 12px; font-style: italic;
}
/* #19: single-workspace view - name + always-visible manage icons (no dropdown). */
.workspace-switcher-single { display: flex; align-items: center; gap: 4px; }
.workspace-switcher-single .workspace-switcher-static { flex: 1; min-width: 0; }
.workspace-switcher-single .workspace-switcher-members,
.workspace-switcher-single .workspace-switcher-pencil { visibility: visible; align-self: end; }
.workspace-switcher-button .chev {
  flex-shrink: 0; margin-left: 8px; color: var(--text-muted);
  transition: transform var(--transition);
}
.workspace-switcher.open .chev { transform: rotate(180deg); }
.workspace-switcher-menu {
  display: none;
  /* Width: detach from the narrow sidebar-header (188px content width). The
     sidebar is z-indexed and the dropdown is free to extend beyond the
     sidebar into the main content area. min/max bounds keep it readable
     for normal-length names without sprawling on extreme cases. */
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 280px; max-width: 360px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  max-height: 360px; padding: 4px 0; overflow-y: auto; z-index: 100;
}
.workspace-switcher.open .workspace-switcher-menu { display: block; }
/* #16: sticky type-to-filter search header inside the (scrolling) menu. */
.workspace-switcher-search {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-card); padding: 8px;
  border-bottom: 1px solid var(--border);
}
.workspace-switcher-search input {
  width: 100%; box-sizing: border-box; padding: 6px 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 13px;
}
.workspace-switcher-search input:focus { outline: none; border-color: var(--accent); }
.workspace-switcher-noresults {
  padding: 12px; color: var(--text-muted); font-size: 13px; text-align: center;
}
.workspace-switcher-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary); font-size: 13px;
}
.workspace-switcher-item:last-child { border-bottom: none; }
.workspace-switcher-item:hover { background: var(--bg-input); }
/* keyboard-cursor highlight (arrow keys) - same surface as hover */
.workspace-switcher-item.highlighted { background: var(--bg-input); }
.workspace-switcher-item.current { font-weight: 600; }
.workspace-switcher-item .check {
  flex-shrink: 0; color: var(--accent); width: 14px;
}
.workspace-switcher-item .ws-meta { flex: 1; min-width: 0; }
.workspace-switcher-item .ws-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace-switcher-item .ws-org {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
  /* nowrap + ellipsis: long "Org Name . N devices" lines truncate cleanly
     instead of wrapping onto a second line that doubles row height. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.workspace-switcher-pencil {
  flex-shrink: 0; visibility: hidden;
  background: none; border: none; padding: 4px;
  color: var(--text-muted); cursor: pointer;
  border-radius: 4px; transition: all var(--transition);
}
.workspace-switcher-item:hover .workspace-switcher-pencil { visibility: visible; }
.workspace-switcher-pencil:hover { color: var(--accent); background: var(--bg-input); }
/* Members icon - same shape as the pencil; navigates to #/workspace/:id/members. */
.workspace-switcher-members {
  flex-shrink: 0; visibility: hidden;
  background: none; border: none; padding: 4px;
  color: var(--text-muted); cursor: pointer;
  border-radius: 4px; transition: all var(--transition);
}
.workspace-switcher-item:hover .workspace-switcher-members { visibility: visible; }
.workspace-switcher-members:hover { color: var(--accent); background: var(--bg-input); }

/* 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: white;
  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); }
.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-input); }
.member-action-btn--danger:hover { color: var(--danger); }

.nav-links {
  flex: 1;
  padding: 12px 8px;
  /* Scroll the nav when it's taller than the viewport (short screens, e.g.
     1366x768) so items below the fold (Settings) stay reachable. min-height:0
     is required for a flex child to shrink and scroll instead of overflowing. */
  overflow-y: auto;
  min-height: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.tdn-brand {
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}
.tdn-brand-mark {
    display: block;
    flex: 0 1 168px;
    height: 38px;
    max-width: 168px;
    min-width: 0;
    object-fit: contain;
    object-position: left center;
    border-radius: 2px;
    background: #fff;
}
.tdn-brand-name {
    display: none;
    color: #0d9fa4;
    flex: 0 1 auto;
    font-size: 17px;
    font-style: italic;
    font-weight: 800;
    letter-spacing: .12em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Teal-150 is an operations console, not a general-purpose signage suite. */
.nav-link[data-view="playlists"],
.nav-link[data-view="layouts"],
.nav-link[data-view="walls"],
.nav-link[data-view="reports"],
.nav-link[data-view="kiosk"],
.nav-link[data-view="activity"],
.nav-link[data-view="members"],
.nav-link[data-view="help"],
.nav-link[data-view="settings"],
#billingNavItem {
  display: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.version-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.version-badge {
  background: var(--warning);
  color: #000;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

.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); }
.status-dot.provisioning { background: var(--warning); 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; }
}

.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-primary);
  padding: 28px 32px 44px;
}

/* Displays workspace. Colors come from tokens / shell.css. */
.content:has(#groupedDevices) { background: var(--bg-primary); }
.content:has(#groupedDevices) .page-header { margin-bottom: 18px; }
.content:has(#groupedDevices) .page-header h1 { color: var(--text-primary); font-size: 26px; letter-spacing: -.02em; }
.content:has(#groupedDevices) .page-header .subtitle { color: var(--text-secondary); }
.content:has(#groupedDevices) #dashStats { gap: 14px !important; }
.content:has(#groupedDevices) #dashStats .info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-height: 86px; padding: 15px 18px; }
.content:has(#groupedDevices) #dashStats .info-card-label { color: var(--text-muted); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.content:has(#groupedDevices) #dashStats .info-card-value { color: var(--text-primary); font-size: 25px; margin-top: 7px; }
.content:has(#groupedDevices) #deviceSearch { border-color: var(--border-light); box-shadow: none; }
.content:has(#groupedDevices) #deviceFilter { background: #fff !important; border-color: var(--border-light); }
.content:has(#groupedDevices) .display-toolbar { align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 12px; display: flex; gap: 8px; margin-bottom: 18px; padding: 8px; }
.content:has(#groupedDevices) .display-search { flex: 1 1 240px; max-width: 440px; }
.content:has(#groupedDevices) .display-search .input { margin: 0; width: 100% !important; }
.content:has(#groupedDevices) .display-toolbar select.input { margin: 0; width: 190px; }
.content:has(#groupedDevices) .group-section, .content:has(#groupedDevices) .ungrouped-section, .content:has(#groupedDevices) .wall-section { background: transparent; border: 0; border-radius: 0; margin-bottom: 26px !important; padding: 0; }
.content:has(#groupedDevices) .group-section > div:first-child, .content:has(#groupedDevices) .ungrouped-section > div:first-child, .content:has(#groupedDevices) .wall-section > div:first-child { background: #fff !important; border: 1px solid var(--border); border-left: 3px solid var(--accent) !important; border-radius: 10px; margin: 0 0 10px !important; padding: 10px 12px !important; }
.content:has(#groupedDevices) .device-grid { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; }
.content:has(#groupedDevices) .device-card { box-shadow: var(--shadow-sm); }
.content:has(#groupedDevices) .device-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.content:has(#groupedDevices) .selection-toolbar { background: var(--accent-dim) !important; border-color: #b7e0e1 !important; border-radius: 10px !important; }
.selection-toolbar { align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px 12px; }
.dashboard-header-actions { display: flex; gap: 8px; }
.display-section-title { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.display-section-title strong { color: var(--text-primary); font-size: 14px; }
.display-section-title span { color: var(--text-muted); font-size: 12px; }

.kiosk-editor-layout {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 340px;
}
.kiosk-preview-column { min-width: 0; }
.kiosk-preview-header {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}
.kiosk-preview-header strong { color: var(--text-primary); font-size: 14px; }
.kiosk-preview-frame {
  aspect-ratio: 16 / 9;
  background: #10131d;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  min-height: 0;
  width: 100%;
}
.kiosk-settings-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 176px);
  min-width: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.kiosk-settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}
.kiosk-settings-section h4 {
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  margin: 0 0 14px;
  padding-bottom: 10px;
}
.kiosk-settings-section .form-group:last-child { margin-bottom: 0; }
.kiosk-settings-section input[type="color"] {
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  height: 36px !important;
  padding: 2px;
  width: 100%;
}
.kiosk-page-target {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.kiosk-page-target .input { flex: 1; min-width: 0; }
.kiosk-page-target .btn { flex: 0 0 auto; white-space: nowrap; }

/* Industrial display designer: calm, light, operator-first workspace. */
.industrial-designer-shell { max-width: 1680px; margin: -4px auto 0; color: var(--text-primary); }
.industrial-starter-shell { max-width: 1540px; margin: 28px auto; }
.industrial-starter-heading { border-bottom: 1px solid var(--border); padding-bottom: 24px; }
.industrial-starter-heading h1 { font-size: 30px; margin: 7px 0 8px; letter-spacing: -.02em; }
.industrial-starter-heading p { color: var(--text-secondary); font-size: 14px; margin: 0; }
.industrial-starter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.industrial-starter-label { color: var(--text-primary); font-size: 16px; font-weight: 600; margin-top: 28px; }
.industrial-starter-card { appearance: none; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); cursor: pointer; display: flex; flex-direction: column; overflow: hidden; padding: 0; text-align: left; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.industrial-starter-card:hover, .industrial-starter-card:focus-visible { border-color: var(--accent); box-shadow: 0 8px 24px rgba(23,43,77,.10); outline: none; transform: translateY(-2px); }
.industrial-starter-card.is-recommended { border-top: 3px solid var(--accent); }
.industrial-starter-preview { background: #172b4d; border: 10px solid #101b30; aspect-ratio: 16 / 9; min-height: 130px; padding: 12px; display: flex; gap: 8px; align-items: center; justify-content: center; position: relative; }
.industrial-starter-preview span { display: block; border: 1px solid #5ca8ef; background: rgba(92,168,239,.12); }
.industrial-preview-dashboard .starter-zone { height: 74px; flex: 1; }.industrial-preview-dashboard .starter-chart { border-bottom: 3px solid #4cc38a; }
.industrial-preview-storyboard { gap: 6px; }.starter-scene { height: 82px; flex: 1; border-radius: 4px; }
.industrial-preview-gantt { flex-direction: column; align-items: stretch; }.starter-gantt { height: 12px; width: 80%; background: #4cc38a !important; border: 0 !important; }.starter-gantt.short { width: 50%; }
.industrial-preview-animated { flex-direction: column; align-items: flex-start; }.starter-hero { width: 70%; height: 36px; }.starter-line { width: 45%; height: 8px; }
.industrial-preview-signboard { border-color: #f0c36b; }.starter-sign { width: 80%; height: 66px; border-color: #f0c36b !important; }
.industrial-starter-card-content { display: flex; flex-direction: column; gap: 7px; padding: 16px; }.industrial-starter-card-content strong { font-size: 15px; }.industrial-starter-card-content span { color: var(--text-secondary); font-size: 12px; line-height: 1.4; }.industrial-starter-card-content em { color: var(--text-secondary); font-size: 11px; font-style: normal; }.industrial-starter-use { background: var(--accent); border-radius: 4px; color: #fff !important; font-size: 13px !important; font-weight: 600; margin-top: 5px; padding: 10px 12px; text-align: center; }
.industrial-block-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }.industrial-block { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 4px; color: var(--text-primary); cursor: grab; font-size: 11px; padding: 9px 6px; }.industrial-block:hover { border-color: var(--accent); color: var(--accent); }.industrial-block span { display: block; font-size: 16px; margin-bottom: 4px; }.industrial-preview-frame:has(.is-drop-target) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,120,212,.15); }
.industrial-starter-foot { align-items: center; color: var(--text-secondary); display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; font-size: 13px; }
.industrial-designer-topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 18px; }
.industrial-designer-topbar h1 { font-size: 26px; letter-spacing: -.02em; margin: 5px 0 4px; }
.industrial-designer-topbar p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.industrial-breadcrumb { color: var(--text-muted); font-size: 11px; letter-spacing: .02em; }
.industrial-breadcrumb span { padding: 0 7px; color: var(--border-light); }
.industrial-top-actions { display: flex; align-items: center; gap: 8px; }
.industrial-save-state { color: var(--text-muted); font-size: 12px; margin-right: 8px; }
.industrial-designer-tabs { display: flex; gap: 4px; height: 42px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.industrial-designer-tab { appearance: none; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer; font: inherit; font-size: 13px; padding: 0 14px 11px; }
.industrial-designer-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.industrial-designer-tab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.industrial-mode-panel[hidden], .industrial-mapping-workspace[hidden], .industrial-preview-workspace[hidden] { display: none; }
.industrial-mapping-workspace, .industrial-preview-workspace { min-height: 560px; }
.industrial-workspace-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.industrial-workspace-heading h2 { margin: 5px 0 5px; font-size: 22px; }
.industrial-workspace-heading p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.industrial-mapping-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.industrial-mapping-table-head, .industrial-mapping-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 20px; align-items: center; }
.industrial-mapping-table-head { background: var(--bg-subtle); border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 13px 18px; text-transform: uppercase; }
.industrial-mapping-row { border-bottom: 1px solid var(--border); padding: 15px 18px; }
.industrial-mapping-row:last-child { border-bottom: 0; }
.industrial-mapping-row strong { display: block; font-size: 14px; }
.industrial-mapping-row span { color: var(--text-secondary); font-size: 13px; margin-top: 4px; display: block; }
.industrial-mapping-row label { margin: 0; }
.industrial-mapping-note { display: flex; gap: 8px; margin-top: 14px; color: var(--text-secondary); font-size: 13px; }
.industrial-animation-controls { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.industrial-animation-controls label + label { margin-top: 10px; }
.industrial-full-preview-frame { background: #e9eef4; border: 1px solid var(--border); border-radius: 6px; padding: clamp(12px, 3vw, 32px); }
.industrial-full-preview-frame .industrial-preview-frame { border: 0; box-shadow: none; padding: 0; }
.industrial-full-preview-frame .industrial-preview-frame > div { max-width: 1280px; margin: auto; }
.industrial-designer-grid { display: grid; grid-template-columns: minmax(250px, 285px) minmax(500px, 1fr) minmax(290px, 340px); gap: 18px; align-items: start; }
.industrial-builder-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 280px; gap: 14px; align-items: stretch; min-height: 690px; }
.industrial-builder-sidebar, .industrial-builder-inspector { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; min-width: 0; overflow-y: auto; }
.industrial-builder-sidebar .industrial-panel-section, .industrial-builder-inspector .industrial-panel-section { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.industrial-builder-canvas { min-width: 0; display: flex; flex-direction: column; }
.industrial-grapes-frame { align-items: center; background: #e9eef4; border: 1px solid var(--border); border-radius: 6px; display: flex; flex: 1; justify-content: center; min-height: 0; overflow: auto; padding: 18px; }
.industrial-grapes-frame > div { aspect-ratio: var(--screen-ratio, 16 / 9); background: #fff; height: min(100%, 720px); max-height: 100%; max-width: 100%; min-height: 0; width: min(100%, 1280px); box-shadow: 0 8px 26px rgba(23,43,77,.16); }
.industrial-grapes-frame[data-orientation="portrait"] > div { width: min(100%, calc(var(--screen-height, 1080px) * .5625)); }
.industrial-grapes-frame[data-orientation="square"] > div { width: min(100%, var(--screen-height, 1080px)); }
.industrial-grapes-frame .gjs-editor { height: 100%; }
.industrial-grapes-blocks { min-height: 100px; }
.industrial-grapes-blocks .gjs-blocks-c { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 0; }
.industrial-grapes-blocks .gjs-block { align-items: center; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 4px; box-shadow: none; color: var(--text-primary); display: flex; font-size: 11px; height: 44px; justify-content: flex-start; margin: 0; padding: 8px; width: 100%; }
.industrial-grapes-blocks .gjs-block:hover { border-color: var(--accent); color: var(--accent); }
.industrial-builder-layout .industrial-canvas-toolbar { background: var(--bg-card); border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 12px 14px; }
.industrial-builder-layout .industrial-canvas-toolbar + .industrial-grapes-frame { border-radius: 0 0 6px 6px; }
.industrial-builder-inspector .gjs-sm-sector { background: transparent; border: 0; }
.industrial-builder-layout .gjs-one-bg { background: var(--bg-card); }
.industrial-builder-layout .gjs-two-color, .industrial-builder-layout .gjs-three-bg { color: var(--text-primary); }
.industrial-builder-layout .gjs-pn-panels, .industrial-builder-layout .gjs-pn-views-container, .industrial-builder-layout .gjs-blocks-c { background: var(--bg-card); }
.industrial-builder-layout .gjs-block { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 5px; box-shadow: none; color: var(--text-primary); height: 48px; margin: 0; padding: 8px 10px; width: 100%; }
.industrial-builder-layout .gjs-block:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(23,43,77,.08); color: var(--accent); }
.industrial-builder-layout .gjs-block-label { font-size: 11px; }
.industrial-builder-layout .gjs-sm-sector-title, .industrial-builder-layout .gjs-clm-tags { background: var(--bg-subtle); border-color: var(--border); color: var(--text-primary); }
.industrial-builder-layout .gjs-field, .industrial-builder-layout .gjs-input-holder input, .industrial-builder-layout .gjs-field select { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }
.industrial-builder-layout .gjs-sm-sector { border-bottom: 1px solid var(--border); }
.industrial-builder-layout .gjs-cv-canvas { background: #dfe7ef; }
.industrial-builder-layout .gjs-frame { background: #fff; }
.industrial-builder-layout .gjs-layer, .industrial-builder-layout .gjs-layer-title { color: var(--text-primary); }
.industrial-builder-layout .gjs-cv-canvas__frames { background: transparent; }
.industrial-template-dashboard .industrial-display-table { display: none; }
.industrial-designer-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-sm); }
.industrial-panel-section { padding: 18px; border-bottom: 1px solid var(--border); }
.industrial-panel-section:last-child { border-bottom: 0; }
.industrial-panel-section label { display: block; color: var(--text-secondary); font-size: 11px; font-weight: 600; margin: 0 0 13px; }
.industrial-panel-section label .input { margin-top: 5px; width: 100%; }
.industrial-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.industrial-panel-heading h3 { font-size: 14px; margin: 3px 0 0; }
.industrial-panel-heading p { color: var(--text-muted); font-size: 11px; font-weight: 400; margin: 5px 0 0; line-height: 1.4; }
.industrial-section-kicker { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.industrial-help { color: var(--text-muted); font-weight: 400; }
.industrial-future-badge { background: var(--accent-dim); color: var(--accent); border-radius: 12px; font-size: 10px; font-weight: 700; padding: 4px 8px; white-space: nowrap; }
.industrial-panel-note { background: #f7f9fc; border-left: 3px solid var(--border-light); color: var(--text-muted); font-size: 11px; line-height: 1.45; margin: 2px 0 0; padding: 8px 9px; }
.industrial-check { align-items: center; display: flex !important; gap: 8px; font-weight: 500 !important; }
.industrial-check input { accent-color: var(--accent); }
.industrial-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.industrial-color-grid label { margin: 0; }
.industrial-color-grid input { border: 1px solid var(--border); border-radius: 4px; display: block; height: 28px; margin-top: 5px; padding: 2px; width: 100%; }
.industrial-designer-canvas { min-width: 0; }
.industrial-canvas-toolbar, .industrial-canvas-foot { align-items: center; color: var(--text-muted); display: flex; font-size: 11px; justify-content: space-between; padding: 0 2px 10px; }
.industrial-canvas-toolbar strong { color: var(--text-primary); font-size: 13px; margin-right: 10px; }
.industrial-preview-frame { background: #e9eef4; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); min-width: 0; padding: 22px; }
.industrial-preview-frame > div { aspect-ratio: 16 / 9; border-radius: 2px; box-shadow: 0 8px 26px rgba(23, 43, 77, .16); min-width: 0; overflow: hidden; }
.industrial-preview-frame > div > .industrial-display { height: 100%; width: 100%; }
.industrial-designer-shell[data-designer-mode="preview"] .industrial-full-preview-frame .industrial-preview-frame > div { aspect-ratio: 16 / 9; }
.industrial-display { height: 100%; overflow: hidden; }
.industrial-fields-panel { max-height: calc(100vh - 150px); overflow-y: auto; }
.industrial-row-editor { border: 1px solid var(--border); border-radius: 5px; margin-bottom: 10px; padding: 11px; }
.industrial-row-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,120,212,.12); }
.industrial-row-editor-head { align-items: center; color: var(--text-muted); display: flex; font-size: 11px; gap: 7px; margin-bottom: 10px; }
.industrial-row-editor-head strong { color: var(--text-secondary); flex: 1; font-size: 11px; }
.industrial-drag-handle { color: var(--border-light); font-size: 15px; letter-spacing: -3px; }
.industrial-icon-button { background: transparent; border: 0; color: var(--text-muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 2px; }
.industrial-icon-button:hover { color: var(--danger); }
.industrial-row-grid { display: grid; gap: 9px; grid-template-columns: 1fr 1fr; }
.industrial-row-grid label, .industrial-options { font-size: 10px; margin: 0; }
.industrial-row-grid .input, .industrial-options .input { font-size: 12px; margin-top: 4px; min-height: 34px; padding: 6px 8px; width: 100%; }
.industrial-row-wide { grid-column: 1 / -1; }
.industrial-options { display: block; margin-top: 9px !important; }
.industrial-options .input { display: block; }
@media (max-width: 1220px) { .industrial-designer-grid { grid-template-columns: 250px minmax(440px, 1fr); } .industrial-fields-panel { grid-column: 1 / -1; max-height: none; } }
@media (max-width: 1500px) { .industrial-starter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .industrial-starter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .industrial-designer-topbar { align-items: flex-start; flex-direction: column; } .industrial-top-actions { width: 100%; } .industrial-save-state { flex: 1; } .industrial-designer-grid { grid-template-columns: 1fr; } .industrial-designer-panel, .industrial-fields-panel { max-height: none; } .industrial-preview-frame { padding: 10px; } .industrial-mapping-table-head { display: none; } .industrial-mapping-row { grid-template-columns: 1fr; gap: 8px; } .industrial-workspace-heading { flex-direction: column; } .industrial-starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .industrial-builder-layout { grid-template-columns: 190px minmax(0, 1fr); } .industrial-builder-inspector { grid-column: 1 / -1; max-height: none; } }
@media (max-width: 700px) { .industrial-builder-layout { grid-template-columns: 1fr; min-height: 0; } .industrial-builder-sidebar, .industrial-builder-inspector { max-height: none; } .industrial-grapes-frame > div { min-height: 480px; } }
@media (max-width: 700px) { .industrial-starter-shell { margin: 16px auto; } .industrial-starter-grid { grid-template-columns: 1fr; } .industrial-starter-card { min-height: 118px; padding: 0; } }

/* Login-first white-label shell. */
.login-shell { align-items: center; background: radial-gradient(circle at 50% 0%, #fff 0, #f7f9fc 54%, #eef3f8 100%); display: flex; justify-content: center; min-height: 100vh; padding: 24px; width: 100%; }
.login-card { max-width: 410px; width: 100%; }
.login-brand { margin-bottom: 22px; text-align: center; }
.login-logo { display: block; height: 58px; margin: 0 auto 16px; max-width: 210px; object-fit: contain; }
.login-tdn-lockup { align-items: center; display: inline-flex; gap: 10px; margin-bottom: 10px; }
.login-tdn-lockup .login-logo { height: 48px; margin: 0; width: 74px; }
.login-tdn-lockup > span { color: #0d9fa4; font-size: 30px; font-weight: 800; letter-spacing: .14em; }
.login-logo-failed { display: none; }
.login-brand-name { color: var(--text-primary); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.login-brand-rule { background: var(--accent); height: 3px; margin: 13px auto 12px; width: 34px; }
.login-brand p { color: var(--text-secondary); font-size: 13px; margin: 0; }
.login-form-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 18px 44px rgba(36,50,56,.14); padding: 30px; }
.login-card-brand { margin: 0 auto 26px; text-align: center; }
.login-product-lockup,
.login-card-logo-lockup {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  font-family: var(--font);
  font-weight: 800;
}
.login-product-lockup { color: #fff; }
.login-card-logo-lockup { color: var(--text-primary); margin: 0 auto 22px; }
.login-adn-mark {
  align-items: baseline;
  display: inline-flex;
  flex: none;
  gap: 1px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1;
}
.login-adn-mark span:nth-child(1) { color: var(--brand-green); }
.login-adn-mark span:nth-child(2) { color: var(--brand-magenta); }
.login-adn-mark span:nth-child(3) { color: var(--brand-blue); }
.login-product-name { font-size: 15px; letter-spacing: -.01em; }
.login-card-logo-lockup .login-product-name { color: #032d60; }
.login-brand-image { display: block; max-height: 42px; max-width: 220px; object-fit: contain; }
.login-card-tdn-logo { display: block; height: 58px; max-width: 220px; margin: 0 auto 18px; object-fit: contain; }
.login-card-logo { display: block; height: auto; max-height: 72px; max-width: 100%; margin: 0 auto 24px; object-fit: contain; }
.login-card-divider { align-items: center; color: var(--text-primary); display: flex; font-family: var(--font); font-size: 22px; font-style: normal; font-weight: 650; gap: 12px; line-height: 1.2; letter-spacing: -.03em; }
.login-card-divider::before, .login-card-divider::after { background: var(--border); content: ''; flex: 1; height: 1px; }
.login-card-subtitle { color: var(--text-secondary); font-size: 13px; margin: 10px 0 0; }
.login-form-card .form-group { margin-bottom: 18px; }
.login-form-card .form-group label { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.login-form-card .input { background: #fff; border-color: var(--border-light); margin-top: 6px; width: 100%; }
.login-form-card .input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.login-submit { min-height: 42px; width: 100%; }
.login-powered { align-items: center; color: var(--text-muted); display: flex; font-size: 11px; gap: 6px; justify-content: center; margin: 18px 0 0; text-align: center; }
.login-powered img { height: 22px; max-width: 150px; object-fit: contain; }
.login-powered strong { color: var(--text-secondary); font-weight: 600; }

/* Activity log: semantic data grid for fast audit scanning. */
.activity-table-wrap { background: #fff; border: 1px solid #d9e2ec; border-radius: 6px; box-shadow: 0 2px 8px rgba(23,43,77,.05); overflow-x: auto; }
.activity-table { border-collapse: collapse; min-width: 820px; table-layout: fixed; width: 100%; }
.activity-table th { background: #f7f9fc; border-bottom: 1px solid #c8d4e3; color: #6b778c; font-size: 10px; font-weight: 700; letter-spacing: .07em; padding: 11px 14px; text-align: left; text-transform: uppercase; }
.activity-table th:first-child { width: 52px; }
.activity-table th:nth-child(2) { width: 18%; }
.activity-table th:nth-child(3) { width: 28%; }
.activity-table th:nth-child(4) { width: auto; }
.activity-table th:last-child { text-align: right; width: 150px; }
.activity-table td { border-bottom: 1px solid #e5ebf2; color: #172b4d; font-size: 13px; padding: 12px 14px; vertical-align: middle; }
.activity-table tbody tr:last-child td { border-bottom: 0; }
.activity-table tbody tr:hover { background: #f7fbff; }
.activity-table td small { color: #6b778c; display: block; font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-event-cell { padding-right: 0 !important; }
.activity-event-icon { align-items: center; background: #f1f5f9; border: 1px solid #d9e2ec; border-radius: 50%; color: #42526e; display: inline-flex; font-size: 13px; height: 30px; justify-content: center; width: 30px; }
.activity-actor-cell strong { font-weight: 600; }
.activity-action-text { display: block; font-weight: 500; }
.activity-details-cell { color: #42526e !important; max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-muted { color: #97a6ba; font-size: 12px; }
.activity-time-cell { color: #6b778c !important; font-size: 11px !important; text-align: right; white-space: nowrap; }
@media (max-width: 760px) {
  .activity-table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .activity-table { min-width: 0; }
  .activity-table thead { display: none; }
  .activity-table, .activity-table tbody, .activity-table tr, .activity-table td { display: block; width: 100%; }
  .activity-table tr { background: #fff; border: 1px solid #d9e2ec; border-radius: 6px; margin-bottom: 8px; padding: 10px 12px; }
  .activity-table td { border: 0; padding: 2px 0 2px 40px; }
  .activity-table .activity-event-cell { float: left; margin-left: 0; padding: 0 !important; width: 32px; }
  .activity-table .activity-event-icon { height: 28px; width: 28px; }
  .activity-table .activity-details-cell { max-width: none; white-space: normal; }
  .activity-table .activity-time-cell { text-align: left; }
}

/* Schedule planner: light work surface with subtle bands and readable work-item blocks. */
.content:has(#calendarScroll) { background: var(--bg-primary); }
.content:has(#calendarScroll) .page-header { margin-bottom: 20px; }
.content:has(#calendarScroll) .page-header h1 { color: var(--text-primary); font-size: 26px; letter-spacing: -.02em; }
.content:has(#calendarScroll) .schedule-controls { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.content:has(#calendarScroll) .schedule-controls .input { background: #fff !important; border-color: var(--border-light); }
.schedule-calendar-shell { background: #fff; box-shadow: 0 2px 8px rgba(23,43,77,.06); }
.schedule-calendar-shell #calendar { background: #fff; }
.schedule-corner { background: #f7f9fc; border-bottom: 1px solid #d9e2ec; height: 53px; position: sticky; top: 0; z-index: 6; }
.schedule-day-header { align-items: center; background: #fff; border-bottom: 1px solid #d9e2ec; border-left: 1px solid #d9e2ec; color: #42526e; display: flex; flex-direction: column; font-size: 11px; justify-content: center; line-height: 1.5; padding: 7px; position: sticky; text-align: center; top: 0; z-index: 6; }
.schedule-day-header.is-today { background: var(--accent-dim); color: var(--accent-hover); font-weight: 700; box-shadow: inset 0 -2px var(--accent); }
.schedule-time-label { background: #f7f9fc; border-bottom: 1px solid #e5ebf2; color: #6b778c; font-size: 10px; padding: 5px 8px; text-align: right; }
.schedule-time-cell { background: #fff; border-bottom: 1px solid #e5ebf2; border-left: 1px solid #e5ebf2; position: relative; }
.schedule-time-cell.is-working-hour { background: #fbfcfe; }
.schedule-calendar-shell [data-schedule-id] { box-shadow: 0 2px 5px rgba(23,43,77,.16); font-size: 11px !important; font-weight: 600; }

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  color: var(--text-primary);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.015em;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

/* Buttons */
.btn {
  align-items: center;
  border: 1px solid transparent;
  display: inline-flex;
  gap: 7px;
  height: var(--control-height);
  justify-content: center;
  line-height: 1;
  padding: 0 14px;
  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);
  color: white;
}

.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);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-icon {
  align-items: center;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  padding: 0;
  width: 32px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Shared Fluent-style control contract. All interactive surfaces use the same
   height, focus ring, border language, and disabled state. */
.btn:focus-visible, .btn-icon:focus-visible, .nav-link:focus-visible, .input:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  box-shadow: var(--focus-ring);
  outline: 0;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary, .btn:not(.btn-primary):not(.btn-danger) { background: #fff; border-color: var(--border-light); color: var(--text-primary); }
.btn-secondary:hover, .btn:not(.btn-primary):not(.btn-danger):hover { background: var(--bg-hover); border-color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a82e2e; border-color: #a82e2e; color: #fff; }
.btn:disabled, .btn-icon:disabled { cursor: not-allowed; opacity: .55; }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], input[type="time"], select, textarea {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  min-height: var(--control-height);
  padding: 0 10px;
}
.input:hover, input:hover, select:hover, textarea:hover { border-color: #adc0c6; }
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); outline: 0; }
.btn, .btn-icon, .nav-link, input, select, textarea { min-height: 36px; }
.btn-icon { min-height: 32px; }
.card, .info-card, .content-item, .device-card, .industrial-designer-panel, .activity-table-wrap { border-radius: 6px; }
.ui-icon { display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.nav-link > .ui-icon { color: currentColor; width: 18px; }
.help-guide-title { align-items: center; display: flex; font-size: 15px; gap: 9px; }
.help-guide-icon { align-items: center; background: var(--accent-dim); border-radius: 8px; color: var(--accent-hover); display: inline-flex; height: 32px; justify-content: center; width: 32px; }
.content-grid, .info-grid, .device-grid { align-items: stretch; }
.content-item, .device-card, .info-card { min-width: 0; }
.content-item-actions { align-items: center; display: flex; gap: 8px; min-height: 40px; }
.content-item-actions .btn { flex: 1 1 auto; min-width: 0; }
.sr-only { height: 1px; margin: -1px; overflow: hidden; position: absolute; width: 1px; clip: rect(0, 0, 0, 0); }

/* Device Grid */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

.device-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* #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: #edf2f7;
  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(23,43,77,.12);
}

/* Wall labels sit on a pale preview, so the generic dark overlay has poor contrast
   and competes with the preview itself. Use the same quiet surface language as the
   rest of the light workspace. */
.wall-card .device-card-status {
  background: rgba(255, 255, 255, .94);
  border: 1px solid #c8d4e3;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(23, 43, 77, .12);
  color: #42526e;
  padding: 4px 10px;
}
.wall-card .device-card-status svg { color: var(--accent); }

.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(--primary, #3B82F6); 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(255,255,255,0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255,255,255,0.04) 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: rgba(59,130,246,0.08);
  border: 2px solid var(--primary, #3B82F6);
  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, #fff);
  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, #ef4444); }

.wall-player {
  position: absolute;
  background: rgba(96,165,250,0.18);
  border: 2px dashed #60a5fa;
  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: #dbeafe;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  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 #facc15;
  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, #fff);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.wall-pos-grid input:focus { outline: 1px solid var(--primary); outline-offset: 0; border-color: var(--primary); }

/* Eight resize handles, used by both screens and the player */
.wall-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1px solid #1d4ed8;
  border-radius: 2px;
  z-index: 4;
}
.wall-player .wall-handle { border-color: #60a5fa; }
.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: rgba(59,130,246,0.15);
  border: 2px solid var(--primary, #3B82F6);
  cursor: grab;
}
.wall-cell.occupied:active { cursor: grabbing; }
.wall-cell.drag-over {
  border-color: var(--success, #10b981);
  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, #ef4444); }

.wall-card .wall-card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(59,130,246,0.1));
}
.wall-card-grid {
  display: grid;
  gap: 4px;
  width: 65%;
  aspect-ratio: 16/9;
  padding: 8px;
}
.wall-card-cell {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 2px;
}
.wall-card-cell.filled {
  background: rgba(139,92,246,0.5);
  border-color: rgba(139,92,246,0.9);
}

.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(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}
.device-card-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary, #3B82F6);
  transition: width 0.9s linear;
}
.device-card-progress-fill.indeterminate {
  background: linear-gradient(90deg, transparent, var(--primary, #3B82F6), 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: 12px 14px;
}

.device-card-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 7px;
}

.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: #fca5a5; }
.device-status-badge.provisioning { background: var(--warning-dim); color: var(--warning); }
/* 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); border-bottom-color: var(--accent); }

.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: 6px;
  box-shadow: 0 1px 2px rgba(23,43,77,.04);
  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);
  background: var(--accent-dim);
}

.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(23, 43, 77, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  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;
}
.device-card-content-row { align-items: center; border-top: 1px solid var(--border); display: flex; gap: 8px; margin-top: 10px; min-width: 0; padding-top: 9px; }
.device-card-content-label { color: var(--text-muted); flex: 0 0 auto; font-size: 11px; }
.device-card-content-value { color: var(--text-primary); font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-card-content-value.is-empty { color: var(--warning); }
.device-card-content-action { color: var(--accent); display: inline-block; font-size: 11px; font-weight: 600; margin-top: 8px; text-decoration: none; }
.device-card-content-action:hover { color: var(--accent-hover); text-decoration: underline; }

/* Content Library type scale: match page titles, body text, and metadata used
   by Displays and Activity instead of the legacy undersized card typography. */
.content:has(#contentGrid) .content-toolbar,
.content:has(#contentGrid) #contentSearch,
.content:has(#contentGrid) #contentTypeFilter,
.content:has(#contentGrid) #contentSort,
.content:has(#contentGrid) #contentResultCount,
.content:has(#contentGrid) #folderBreadcrumb,
.content:has(#contentGrid) #showExpiredToggle {
  font-family: inherit;
}
.content:has(#contentGrid) .content-item-name {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.content:has(#contentGrid) .content-item-size {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}
.content:has(#contentGrid) .content-item-body {
  padding: 12px 14px 8px;
}
.content:has(#contentGrid) .content-item-actions {
  padding: 2px 14px 12px;
}
.content:has(#contentGrid) .content-item-actions .btn {
  font-size: 12px;
}
.content:has(#contentGrid) .content-toolbar > div:not(.upload-area) {
  font-family: inherit;
}
.content:has(#contentGrid) .content-add-toolbar {
  align-items: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(360px, 1.35fr) minmax(250px, .8fr) minmax(250px, .8fr);
  margin-bottom: 20px;
}
.content:has(#contentGrid) .content-upload-panel {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  min-height: 250px;
  padding: 32px 24px;
}
.content:has(#contentGrid) .content-upload-panel p {
  margin: 0;
}
.content:has(#contentGrid) .content-upload-panel .upload-hint {
  margin-top: 5px;
}
.content-source-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
.content-source-title {
  align-items: center;
  color: var(--text-primary);
  display: flex;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
}
.content-source-title svg { color: var(--accent); }
.content-source-description {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  min-height: 34px;
}
.content-library-toolbar {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
}
.content-library-toolbar #contentSearch { max-width: 300px !important; }
.content-library-toolbar #contentResultCount { margin-left: 4px; }
.content-library-toolbar label { margin-left: auto !important; }
.content-breadcrumb {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 20px;
}

.modal-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.form-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Form Elements */
.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);
}

.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);
}

/* Toast */
.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); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 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-picker-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}

.assign-picker-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.assign-picker-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent);
}

.assign-picker-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  outline: 0;
}

.assign-folder-filter {
  flex: 0 0 210px;
  height: 38px;
}

.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[hidden] {
  display: none;
}

.assign-filter-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px 12px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
}

.assign-content-item:hover {
  border-color: var(--accent);
}

.assign-content-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.assign-content-item img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

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

.assign-widget-preview iframe {
  position: absolute;
  inset: 0;
  width: 1920px;
  height: 1080px;
  border: 0;
  transform: scale(0.1);
  transform-origin: top left;
  pointer-events: none;
  background: #111827;
}

.assign-widget-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: .04em;
  pointer-events: none;
  z-index: 0;
}

.assign-widget-preview iframe {
  z-index: 1;
}

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

.assign-item-folder {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
  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 */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #42526e;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  cursor: help;
  position: relative;
  margin: 0 0 2px 7px;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}

/* 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. */
.help-tip::before {
  content: '';
  position: absolute;
  inset: -13px;
  border-radius: 50%;
}

.help-tip:hover::after,
.help-tip:focus-visible::after,
.help-tip.is-open::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 10px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: normal;
  width: min(280px, calc(100vw - 32px));
  max-width: 280px;
  z-index: 1000;
  box-shadow: var(--shadow);
  margin: 0;
  line-height: 1.4;
  text-align: left;
}

/* Table wrapper: enables horizontal scroll when table min-width exceeds viewport */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile hamburger toggle */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  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-menu-btn { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 140;
  }
  .sidebar-backdrop.open { display: block; }
  .nav-link { min-height: 44px; padding: 10px 14px; }
  .content { margin-left: 0; padding: 16px; padding-top: 68px; }
  .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; }
  .content:has(#contentGrid) .content-add-toolbar { grid-template-columns: 1fr; }
  .content:has(#contentGrid) .content-upload-panel { min-height: 190px; }
  .content:has(#contentGrid) .content-library-toolbar { align-items: stretch; flex-direction: column; }
  .content:has(#contentGrid) .content-library-toolbar #contentSearch,
  .content:has(#contentGrid) .content-library-toolbar .input { max-width: none !important; width: 100% !important; }
  .content:has(#contentGrid) .content-library-toolbar label { margin-left: 0 !important; }
  .dashboard-header-actions { width: 100%; }
  .dashboard-header-actions .btn { flex: 1; }
  .content:has(#groupedDevices) .display-toolbar { align-items: stretch; flex-direction: column; }
  .content:has(#groupedDevices) .display-search,
  .content:has(#groupedDevices) .display-toolbar .input { max-width: none; width: 100% !important; }
  .kiosk-editor-layout { grid-template-columns: 1fr; }
  .kiosk-settings-column { max-height: none; overflow: visible; }
  .kiosk-preview-frame { min-height: 0; }

  /* 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%; }
}

@media (max-width: 480px) {
  .content-grid { grid-template-columns: 1fr; }
  .assign-picker-tools { align-items: stretch; flex-direction: column; }
  .assign-folder-filter { flex-basis: auto; width: 100%; }
  .assign-content-grid { grid-template-columns: 1fr 1fr; }
}
/* ============================================================
   Industrial Signage Designer â€“ Google Slides-style accurate canvas
   Include this after main.css, or paste into main.css
   ============================================================ */

.id-shell {
  max-width: 1760px;
  margin: 0 auto;
  color: var(--text-primary);
}

.id-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.id-topbar-left h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 2px 0 0;
}
.id-breadcrumb {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.id-breadcrumb span {
  padding: 0 6px;
  color: var(--border-light);
}
.id-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.id-save-state {
  color: var(--text-muted);
  font-size: 12px;
  margin-right: 4px;
}

/* Orientation segmented control (Landscape / Portrait / Square) */
.id-orient-group {
  display: inline-flex;
  background: #fff;
  border: 1px solid #c8d4e3;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(23,43,77,0.04);
}
.id-orient-btn {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid #e5ebf2;
  color: #5c6b7a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 14px;
  transition: background 0.12s, color 0.12s;
}
.id-orient-btn:last-child { border-right: 0; }
.id-orient-btn:hover { background: #f3f6fa; color: #172b4d; }
.id-orient-btn.is-active {
  background: #deecf9;
  color: #005a9e;
  font-weight: 600;
}
.id-orient-btn svg { flex-shrink: 0; opacity: 0.85; }

.id-tabs {
  display: flex;
  gap: 2px;
  height: 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.id-tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 0 16px 10px;
}
.id-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.id-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.id-panel[hidden] { display: none !important; }

.id-builder {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: stretch;
  min-height: calc(100vh - 220px);
}

.id-rail {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}
.id-rail-left, .id-rail-right { min-width: 0; }

.id-section {
  padding: 16px;
  border-bottom: 1px solid #e5ebf2;
}
.id-section:last-child { border-bottom: 0; }
.id-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.id-section-head h3 {
  font-size: 13px;
  margin: 2px 0 0;
  font-weight: 600;
}
.id-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
}
.id-section label {
  display: block;
  color: #5c6b7a;
  font-size: 11px;
  font-weight: 600;
  margin: 0 0 12px;
}
.id-section label .input,
.id-section label input,
.id-section label select {
  margin-top: 5px;
  width: 100%;
}
.id-color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.id-color-row label { margin-bottom: 10px; }
.id-color-row input[type="color"] {
  height: 34px;
  padding: 2px;
  cursor: pointer;
}
.id-checks {
  display: flex;
  gap: 16px;
  margin: 8px 0 14px;
}
.id-check {
  display: flex !important;
  align-items: center;
  gap: 6px;
  font-weight: 500 !important;
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
}
.id-check input { accent-color: var(--accent); margin: 0; }

.id-blocks { min-height: 80px; }
.id-blocks .gjs-blocks-c {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 0;
}
.id-blocks .gjs-block {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid #d9e2ec;
  border-radius: 5px;
  box-shadow: none;
  color: #172b4d;
  display: flex;
  font-size: 12px;
  height: 42px;
  justify-content: flex-start;
  margin: 0;
  padding: 8px 10px;
  width: 100%;
}
.id-blocks .gjs-block:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Google Slides-style canvas stage */
.id-canvas-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  overflow: hidden;
}
.id-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e5ebf2;
  background: #fafbfc;
  flex-shrink: 0;
}
.id-canvas-toolbar strong {
  font-size: 13px;
  color: #172b4d;
  margin-right: 10px;
}
.id-canvas-toolbar span {
  font-size: 12px;
  color: #6b778c;
}

.id-canvas-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #eef2f6 0%, #e2e8f0 100%);
  padding: 28px 24px 32px;
  min-height: 520px;
  overflow: auto;
}

.id-screen-bezel {
  background: #1a2332;
  border-radius: 10px;
  padding: 10px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.25),
    0 12px 40px rgba(23,43,77,0.22),
    0 4px 12px rgba(23,43,77,0.12);
  transition: width 0.25s ease, height 0.25s ease;
}

.id-screen {
  aspect-ratio: var(--screen-ratio, 16 / 9);
  background: #fff;
  border-radius: 3px;
  overflow: hidden;
  width: min(100%, 1100px);
  max-height: min(68vh, 720px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
  position: relative;
}

.id-canvas-stage[data-orientation="portrait"] .id-screen {
  width: min(100%, calc(min(68vh, 720px) * 9 / 16));
  max-height: min(72vh, 780px);
}
.id-canvas-stage[data-orientation="square"] .id-screen {
  width: min(100%, min(68vh, 640px));
  max-height: min(68vh, 640px);
}

.id-screen .gjs-editor,
.id-screen #industrialGrapesCanvas,
.id-screen #industrialPreviewFocus {
  width: 100% !important;
  height: 100% !important;
}
.id-screen .gjs-cv-canvas {
  background: transparent !important;
}
.id-screen .gjs-frame {
  background: #fff;
}

.id-styles { min-height: 40px; }
.id-styles .gjs-sm-sector { background: transparent; border: 0; }
.id-styles .gjs-sm-sector-title,
.id-styles .gjs-clm-tags {
  background: #f7f9fc;
  border-color: #d9e2ec;
  color: #172b4d;
}
.id-styles .gjs-field,
.id-styles .gjs-input-holder input,
.id-styles .gjs-field select {
  background: #fff;
  border-color: #c8d4e3;
  color: #172b4d;
}

.id-rows { display: flex; flex-direction: column; gap: 10px; }
.id-row-editor {
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  padding: 10px;
  background: #fafbfc;
}
.id-row-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,120,212,0.12);
}
.id-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.id-row-num {
  font-size: 11px;
  font-weight: 700;
  color: #6b778c;
  letter-spacing: 0.04em;
}
.id-icon-btn {
  background: transparent;
  border: 0;
  color: #97a6ba;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.id-icon-btn:hover { color: #d13438; }
.id-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.id-row-grid label,
.id-options {
  font-size: 10px;
  margin: 0 !important;
  color: #5c6b7a;
  font-weight: 600;
}
.id-row-grid .input,
.id-options .input {
  font-size: 12px;
  margin-top: 3px;
  min-height: 32px;
  padding: 4px 8px;
  width: 100%;
}
.id-row-wide { grid-column: 1 / -1; }
.id-options { display: block; margin-top: 8px !important; }

.id-mapping-panel,
.id-preview-panel {
  min-height: 520px;
}
.id-workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}
.id-workspace-head h2 {
  margin: 4px 0 4px;
  font-size: 20px;
}
.id-workspace-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.id-badge {
  background: #deecf9;
  color: #005a9e;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  white-space: nowrap;
}
.id-mapping-card {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  overflow: hidden;
}
.id-mapping-head {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  background: #f7f9fc;
  border-bottom: 1px solid #e5ebf2;
  color: #6b778c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 12px 18px;
  text-transform: uppercase;
}
.id-mapping-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid #e5ebf2;
  padding: 14px 18px;
}
.id-mapping-row:last-child { border-bottom: 0; }
.id-mapping-field strong {
  display: block;
  font-size: 14px;
}
.id-mapping-field span {
  color: #6b778c;
  font-size: 13px;
  margin-top: 2px;
  display: block;
}
.id-note {
  margin-top: 14px;
  color: #6b778c;
  font-size: 13px;
}
.id-source-label {
  display: block;
  margin-top: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #5c6b7a;
}

.id-full-preview-stage {
  background: #e9eef4;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 32px 24px;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.id-full-preview-stage .id-canvas-stage {
  background: transparent;
  padding: 0;
  min-height: 0;
  width: 100%;
}

/* Starter / template picker */
.id-starter {
  max-width: 1280px;
  margin: 20px auto 40px;
}
.id-starter-header {
  border-bottom: 1px solid #e5ebf2;
  padding-bottom: 22px;
  margin-bottom: 8px;
}
.id-starter-header h1 {
  font-size: 28px;
  margin: 6px 0 8px;
  letter-spacing: -0.02em;
}
.id-starter-header p {
  color: #6b778c;
  font-size: 14px;
  margin: 0;
  max-width: 560px;
}
.id-starter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.id-starter-card {
  appearance: none;
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  color: #172b4d;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  text-align: left;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.id-starter-card:hover,
.id-starter-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(23,43,77,0.1);
  outline: none;
  transform: translateY(-2px);
}
.id-starter-card.is-recommended {
  border-top: 3px solid var(--accent);
}
.id-starter-preview {
  background: #172b4d;
  border: 8px solid #101b30;
  aspect-ratio: 16 / 9;
  min-height: 110px;
  padding: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.id-starter-preview span {
  display: block;
  border: 1px solid #5ca8ef;
  background: rgba(92,168,239,0.12);
}
.id-preview-dashboard .starter-zone { height: 60px; flex: 1; }
.id-preview-dashboard .starter-zone.chart { border-bottom: 3px solid #4cc38a; }
.id-preview-storyboard .starter-scene { height: 70px; flex: 1; border-radius: 4px; }
.id-preview-gantt { flex-direction: column; align-items: stretch; }
.id-preview-gantt .starter-gantt {
  height: 10px;
  width: 80%;
  background: #4cc38a !important;
  border: 0 !important;
}
.id-preview-gantt .starter-gantt.short { width: 50%; }
.id-preview-animated { flex-direction: column; align-items: flex-start; }
.id-preview-animated .starter-hero { width: 70%; height: 28px; }
.id-preview-animated .starter-line { width: 45%; height: 7px; }
.id-preview-signboard { border-color: #f0c36b; }
.id-preview-signboard .starter-sign {
  width: 80%;
  height: 54px;
  border-color: #f0c36b !important;
}
.id-starter-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 8px;
}
.id-starter-body strong { font-size: 14px; }
.id-starter-body span {
  color: #6b778c;
  font-size: 12px;
  line-height: 1.4;
}
.id-starter-body em {
  color: #97a6ba;
  font-size: 11px;
  font-style: normal;
}
.id-starter-cta {
  background: var(--accent);
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 600;
  margin: 4px 14px 14px;
  padding: 9px 12px;
  text-align: center;
  border-radius: 5px;
}
.id-starter-foot {
  align-items: center;
  color: #6b778c;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 22px;
  font-size: 13px;
}

@media (max-width: 1200px) {
  .id-builder {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .id-rail-right {
    grid-column: 1 / -1;
    max-height: none;
  }
}
@media (max-width: 860px) {
  .id-builder {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .id-rail {
    max-height: none;
  }
  .id-canvas-stage {
    min-height: 420px;
    padding: 16px;
  }
  .id-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .id-orient-group {
    order: 3;
  }
  .id-topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .id-starter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .id-starter-grid {
    grid-template-columns: 1fr;
  }
  .id-orient-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
  .id-orient-btn svg { display: none; }
}

/* TDN deployment mode: keep engineering-only routes and controls out of the customer UI. */
html:not(.internal-tools) .internal-only,
html:not(.internal-tools) [data-internal-nav] { display: none !important; }
.internal-tools [data-internal-nav] { display: list-item !important; }

/* Per-display personalization keeps operators focused on values, not HTML. */
.widget-personalize-modal{width:min(1120px,calc(100vw - 40px));max-height:calc(100vh - 40px);display:flex;flex-direction:column}
.widget-modal-subtitle{margin:3px 0 0;color:var(--text-muted);font-size:13px}
.widget-personalize-body{display:grid;grid-template-columns:minmax(300px,390px) minmax(0,1fr);min-height:0;flex:1}
.widget-personalize-form{padding:22px;border-right:1px solid var(--border);overflow:auto;background:var(--bg-card)}
.widget-personalize-form>.input{margin-bottom:8px}
.widget-personalize-status{min-height:28px;padding:7px 10px;margin-bottom:14px;background:var(--bg-input);border-left:3px solid var(--primary);color:var(--text-muted);font-size:12px}
.widget-personalize-preview{padding:22px;display:flex;flex-direction:column;min-width:0;background:var(--bg-secondary)}
.widget-preview-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;font-size:13px;color:var(--text-muted)}
.widget-preview-heading strong{color:var(--text-primary)}
.widget-preview-stage{flex:1;min-height:390px;display:grid;place-items:center;padding:18px;background:#dfe6ed;border:1px solid var(--border);border-radius:6px;overflow:hidden}
.widget-preview-stage iframe{width:100%;aspect-ratio:16/9;max-height:100%;border:0;background:#fff;box-shadow:0 8px 24px rgba(23,43,77,.16)}
.content-item-actions{gap:8px;flex-wrap:wrap}
.content-item-actions .btn{flex:1;white-space:nowrap}

@media(max-width:800px){
  .widget-personalize-body{grid-template-columns:1fr;overflow:auto}
  .widget-personalize-form{border-right:0;border-bottom:1px solid var(--border);overflow:visible}
  .widget-preview-stage{min-height:260px}
}

/* Display Studio: a large TV canvas with one compact, scrollable editing column. */
.id-shell { max-width: none; }
.id-builder {
  grid-template-columns: minmax(640px, 1fr) 330px;
  grid-template-rows: minmax(250px, 44%) minmax(260px, 56%);
  height: calc(100vh - 205px);
  min-height: calc(100vh - 205px);
  gap: 12px;
}
.id-canvas-col { grid-column: 1; grid-row: 1 / 3; min-height: 620px; }
.id-rail-left { grid-column: 2; grid-row: 1; }
.id-rail-right { grid-column: 2; grid-row: 2; }
.id-rail { max-height: none; box-shadow: 0 8px 24px rgba(18, 44, 70, .05); }
.id-canvas-stage { min-height: 0; padding: 30px; }
.id-screen-bezel { width: min(100%, 1180px); }
.id-screen { width: 100%; max-height: none; }
.id-canvas-stage[data-orientation="portrait"] .id-screen-bezel { width: min(100%, 430px); }
.id-canvas-stage[data-orientation="square"] .id-screen-bezel { width: min(100%, 680px); }
.id-screen .gjs-cv-canvas {
  inset: 0 !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
}
.id-screen .gjs-frame-wrapper,
.id-screen .gjs-frame { width: 100% !important; height: 100% !important; }
.id-canvas-toolbar { min-height: 48px; padding: 10px 16px; }
.id-section { padding: 14px 16px; }
.id-blocks .gjs-blocks-c { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.id-blocks .gjs-block { min-width: 0; height: 38px; font-size: 11px; }
.id-block-code{display:grid;place-items:center;min-width:30px;height:22px;margin-right:7px;border-radius:3px;background:var(--bg-subtle);color:var(--primary);font-size:9px;font-weight:750;letter-spacing:.04em}
.id-preview-iframe{display:block;width:100%;height:100%;border:0;background:#fff}
.id-inspector-empty{display:grid;gap:5px;padding:18px;border:1px dashed var(--border);border-radius:5px;background:var(--bg-subtle);color:var(--text-muted);font-size:12px}
.id-inspector-empty strong{color:var(--text-primary);font-size:13px}
.id-friendly-inspector{display:grid;gap:14px}
.id-friendly-inspector label{display:grid;gap:5px;color:var(--text-muted);font-size:11px;font-weight:600}
.id-inspector-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.id-inspector-position{display:grid;gap:8px;padding-top:12px;border-top:1px solid var(--border)}
.id-inspector-position>span{font-size:11px;color:var(--text-muted)}
.id-inspector-actions{display:flex;gap:8px;padding-top:12px;border-top:1px solid var(--border)}
.id-inspector-actions .btn{flex:1}
.id-starter { max-width: 1480px; margin-top: 8px; }
.id-starter-header {
  background: linear-gradient(110deg, #f1fbfb 0%, #fff 65%);
  border: 1px solid #d7e8e8;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 24px;
}
.id-starter-grid { grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 18px; margin-top: 0; }
.id-starter-card { border-radius: 10px; box-shadow: 0 4px 14px rgba(18, 44, 70, .05); }
.id-starter-preview { border-width: 6px; min-height: 132px; }
.id-preview-birthday {
  background: linear-gradient(135deg, #e9f8f7, #fff8e7);
  border-color: #0f7377;
  justify-content: flex-start;
  padding: 20px 28px;
}
.id-preview-birthday .starter-person {
  border: 0; border-radius: 50%; width: 72px; height: 72px; flex: none;
  display: grid; place-items: center; background: #00aeb3; color: #fff; font-size: 22px; font-weight: 700;
}
.id-preview-birthday .starter-celebration { border: 0; background: transparent; display: grid; gap: 8px; flex: 1; }
.id-preview-birthday .starter-celebration b { color: #17324d; font-size: 18px; }
.id-preview-birthday .starter-celebration i { display: block; width: 82%; height: 6px; border-radius: 4px; background: #8bd7d6; }
.id-preview-birthday .starter-celebration i:last-child { width: 58%; background: #ffd166; }
.id-full-preview-stage .id-screen-bezel { width: min(100%, 1280px); }

@media (max-width: 1280px) {
  .id-builder { grid-template-columns: minmax(520px, 1fr) 300px; }
  .id-starter-grid { grid-template-columns: repeat(2, minmax(230px, 1fr)); }
}
@media (max-width: 940px) {
  .id-builder { display: flex; flex-direction: column; height: auto; }
  .id-canvas-col { order: 1; min-height: 520px; }
  .id-rail-left { order: 2; }
  .id-rail-right { order: 3; }
}

/* Visual contract lives in shell.css (loaded last). Designer layout
   rules above this line stay; color/chrome overlays were removed so
   they can no longer fight the product theme. */
