/* --- Custom Reset & Base Variables --- */
:root {
  --bg-dark: #07090e;
  --bg-card: rgba(13, 19, 33, 0.45);
  --bg-card-hover: rgba(20, 29, 51, 0.65);
  --border-color: rgba(255, 255, 255, 0.05);
  --border-glow: rgba(139, 61, 255, 0.25);
  
  /* Vibrant Curated Color Palette */
  --primary: #8b3dff; /* Canva Purple */
  --secondary: #00c4cc; /* Canva Turquoise */
  --accent-cyan: #39e3fe; /* Glowing Cyan */
  --accent-purple: #9a4dff;
  --text-primary: #f3f6f9;
  --text-muted: #798b9e;
  --text-highlight: #ffc837;
  
  --success: #00f2a1; /* Glowing Emerald */
  --danger: #ff2a5f; /* Coral Red */
  --warning: #ffb800; /* Neon Gold */
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --canva-preview-min: 110px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(139, 61, 255, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(0, 196, 204, 0.07) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Typography --- */
h1, h2, h3, h4, .logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- Header Section --- */
header {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(7, 9, 14, 0.8);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.logo {
  font-size: 1.6rem;
  color: #fff;
  font-weight: 800;
}

.logo-accent {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-size: 0.65rem;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Pill Badges --- */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.status-pill.connected {
  border-color: rgba(0, 242, 161, 0.25);
  color: var(--success);
  background: rgba(0, 242, 161, 0.05);
}

.status-pill.disconnected {
  border-color: rgba(255, 42, 95, 0.2);
  color: var(--danger);
  background: rgba(255, 42, 95, 0.03);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.connected .pulse-dot {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse-green 2s infinite;
}

.disconnected .pulse-dot {
  background-color: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(0, 242, 161, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(0, 242, 161, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 242, 161, 0); }
}

/* --- Icons --- */
.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: var(--transition);
  font-size: 1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* --- Developer Drawer --- */
.developer-drawer {
  background: rgba(11, 16, 28, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s ease, opacity 0.3s ease;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  display: none;
}

.developer-drawer.open {
  display: block;
  max-height: 420px;
  opacity: 1;
  padding: 24px 0;
}

.developer-drawer.open.help-open {
  max-height: 820px;
}

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

.drawer-header-row h3 {
  margin-bottom: 0;
}

.canva-help-toggle {
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(139, 61, 255, 0.45);
  background: rgba(139, 61, 255, 0.14);
  color: #d8b4fe;
  font: 800 .78rem/1 inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.canva-help-toggle[aria-expanded="true"] {
  background: rgba(139, 61, 255, 0.32);
  border-color: rgba(139, 61, 255, 0.7);
  color: #fff;
}

.canva-help-link {
  appearance: none;
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #67e8f9;
  font: 700 .72rem/1.35 inherit;
  cursor: pointer;
  text-align: left;
}

.canva-help-link:hover {
  text-decoration: underline;
}

.canva-setup-help {
  max-width: 640px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid rgba(139, 61, 255, 0.22);
  border-radius: 12px;
  background: rgba(139, 61, 255, 0.07);
}

.canva-help-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: .78rem;
  line-height: 1.45;
}

.canva-help-steps + .canva-callback-row {
  margin-top: 10px;
}

.canva-help-steps + .canva-help-steps,
.canva-callback-row + .canva-help-steps {
  margin-top: 10px;
}

.canva-help-steps a {
  color: #67e8f9;
}

.canva-callback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.canva-callback-row code {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: #e9d5ff;
  font-size: .68rem;
  word-break: break-all;
}

.canva-help-note {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: .68rem;
  line-height: 1.4;
}

.canva-help-note code {
  color: #d8b4fe;
}

.drawer-form-compact {
  max-width: 520px;
}

.canva-sync-btn {
  white-space: nowrap;
}

.lock-role-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  text-align: center;
}

.console-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.console-role-badge.is-admin {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.console-role-badge.is-operator {
  color: #a5f3fc;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.console-lock-btn {
  white-space: nowrap;
}

body[data-console-role="operator"] #dev-drawer-toggle,
body[data-console-role="operator"] #disconnect-btn {
  display: none !important;
}

.canva-library-card {
  margin-top: 24px;
  padding: 20px;
  position: relative;
  min-height: 180px;
}

.canva-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.canva-library-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.canva-sync-status-line {
  margin: 4px 0 0 0 !important;
  font-size: 0.78rem !important;
  min-height: 1.25em;
  line-height: 1.25em;
}

.canva-allowlist-hint {
  margin: 4px 0 0 0 !important;
  font-size: 0.68rem !important;
  color: rgba(167, 139, 250, 0.9) !important;
}

.sync-pin-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.9);
  color: #ecfeff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.btn-unpin-sync {
  appearance: none;
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.72);
  color: #fecaca;
  font: 700 .58rem/1 inherit;
  cursor: pointer;
}

.btn-unpin-sync:hover {
  background: rgba(185, 28, 28, 0.85);
  color: #fff;
}

.btn-rename-panel {
  appearance: none;
  position: absolute;
  bottom: 6px;
  right: 6px;
  z-index: 3;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(103, 232, 249, 0.35);
  background: rgba(0, 0, 0, 0.72);
  color: #a5f3fc;
  font: 700 .58rem/1 inherit;
  cursor: pointer;
}

.btn-rename-panel:hover {
  background: rgba(8, 145, 178, 0.9);
  color: #fff;
}

.panel-named-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(139, 61, 255, 0.9);
  color: #f3e8ff;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.design-thumbnail .sync-pin-badge + .panel-named-badge {
  top: 28px;
}

body[data-console-role="operator"] .btn-rename-panel,
body[data-console-role="operator"] .btn-unpin-sync {
  display: none !important;
}

.media-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.media-delete-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  right: auto;
  z-index: 4;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.media-delete-btn:hover {
  background: var(--danger);
  border-color: rgba(255,42,95,0.7);
}

.design-thumbnail-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #09090b;
}

.media-library-empty {
  grid-column: 1 / -1;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.media-upload-dropzone {
  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.72rem;
  background: rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  flex: 1;
  min-width: 180px;
}

#slot-edit-header-save-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.preview-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  user-select: none;
}

.preview-size-control input[type="range"] {
  width: 90px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.canva-design-grid,
.design-grid.canva-design-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(var(--canva-preview-min, 110px), 1fr)) !important;
  gap: 12px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
}

.media-design-grid,
.design-grid.media-design-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(var(--media-preview-min, 110px), 1fr)) !important;
  gap: 12px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.panel-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent-cyan);
  color: #050a14;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.selector-subtitle {
  font-size: 0.58rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 2px;
}

@media (max-width: 767px) {
  .canva-design-grid,
  .design-grid.canva-design-grid,
  .media-design-grid,
  .design-grid.media-design-grid {
    max-height: min(60vh, 520px);
  }

  .preview-size-control span {
    display: none;
  }

  .preview-size-control input[type="range"] {
    width: 120px;
  }
}

.status-pill.syncing {
  background: rgba(255, 193, 7, 0.12);
  border-color: rgba(255, 193, 7, 0.35);
  color: #ffc107;
}

.status-pill.syncing .pulse-dot {
  background: #ffc107;
}

.auth-cover-content {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
  padding: 24px 16px;
}

.auth-cover-content .canva-glow-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.auth-cover-content h3 {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 6px;
  font-weight: 700;
}

.auth-cover-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 auto 16px auto;
  line-height: 1.45;
}

.drawer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.drawer-header {
  margin-bottom: 20px;
}

.drawer-header h3 {
  color: var(--accent-cyan);
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.drawer-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 30px;
}

.drawer-form {
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.drawer-logs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-logs h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* --- Form Groups --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

input[type="text"], input[type="password"] {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(57, 227, 254, 0.15);
}

.copy-input {
  display: flex;
  gap: 8px;
}

.copy-input input {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
}

/* --- Buttons --- */
button {
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  padding: 10px 20px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(139, 61, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139, 61, 255, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 14px;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-accent {
  background: linear-gradient(135deg, var(--secondary), var(--accent-cyan));
  color: #050a14;
  padding: 12px 24px;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(0, 196, 204, 0.35);
  position: relative;
  overflow: hidden;
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(57, 227, 254, 0.6);
}

.btn-accent:disabled {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.15);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-danger {
  background: rgba(255, 42, 95, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 42, 95, 0.2);
  padding: 10px 18px;
  font-size: 0.85rem;
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-large {
  width: 100%;
}

.btn-glow-pulse {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 6px;
  box-shadow: 0 0 0 0 rgba(57, 227, 254, 0.6);
  animation: pulse-button 2s infinite;
  pointer-events: none;
}

@keyframes pulse-button {
  0% { transform: scale(0.97); box-shadow: 0 0 0 0 rgba(57, 227, 254, 0.6); }
  70% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(57, 227, 254, 0); }
  100% { transform: scale(0.97); box-shadow: 0 0 0 0 rgba(57, 227, 254, 0); }
}

/* --- Console Logs --- */
.console-logs {
  background: #04060b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #798b9e;
  height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.log-line {
  line-height: 1.4;
}

.log-line.system { color: #5c6bc0; }
.log-line.info { color: #cfd8dc; }
.log-line.working { color: var(--accent-cyan); }
.log-line.success { color: var(--success); }
.log-line.error { color: var(--danger); }

/* --- Container & Layout --- */
.container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  flex: 1;
  transition: grid-template-columns 0.3s ease;
}



/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card h2 {
  font-size: 1.3rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.description {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* --- TV Simulator Screens Grid --- */
.screens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  flex: 1;
}

.screen-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.screen-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 4px 20px rgba(139, 61, 255, 0.15);
}

.screen-header {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 8px;
}

.screen-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.screen-status.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.screen-name {
  color: #fff;
  flex: 1;
}

.screen-orientation {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* Simulated TV Viewports */
.screen-viewport {
  background: #040507;
  border-radius: 8px;
  border: 4px solid #141722;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Landscape Viewport aspect 16:9 */
.screen-card.landscape .screen-viewport {
  aspect-ratio: 16/9;
  width: 100%;
}

/* Portrait Viewport aspect 9:16 */
.screen-card.portrait .screen-viewport {
  aspect-ratio: 9/16;
  width: 170px;
  margin-left: auto;
  margin-right: auto;
}

.viewport-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: linear-gradient(135deg, #090a10, #111420);
}

.viewport-placeholder {
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.viewport-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #040507;
  animation: fadeIn 0.5s ease-out;
}

.split-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 6px;
  width: 100%;
  height: 100%;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease-in-out;
}

.split-placeholder:hover {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.15);
}

.split-placeholder-icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
  opacity: 0.6;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 8px;
}

.active-design-name {
  color: #fff;
  font-weight: 500;
}

/* --- Right Column: Canva Explorer / Studio --- */
.design-explorer {
  position: relative;
  overflow: visible;
}

/* Auth Covered Page Overlay */
.auth-overlay {
  position: relative;
  width: 100%;
  padding: 36px 20px;
  box-sizing: border-box;
  background: rgba(13, 19, 33, 0.4);
  border-radius: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.auth-cover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 440px;
  gap: 20px;
}

.canva-glow-icon {
  font-size: 4rem;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(139, 61, 255, 0.4);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

.auth-overlay h1 {
  font-size: 1.8rem;
  color: #fff;
}

.auth-overlay p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-help-text {
  font-size: 0.75rem !important;
  color: rgba(255, 255, 255, 0.3) !important;
}

/* Canva Design Grid */
.design-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  overflow-y: auto;
  max-height: 820px;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}

/* Custom Scrollbar */
.design-grid::-webkit-scrollbar, .console-logs::-webkit-scrollbar {
  width: 6px;
}
.design-grid::-webkit-scrollbar-thumb, .console-logs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.design-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
}

.design-card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  border-color: rgba(139, 61, 255, 0.2);
  box-shadow: 0 8px 24px rgba(139, 61, 255, 0.15);
}

.design-thumbnail {
  aspect-ratio: 8/9;
  background: #09090b;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.design-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.design-thumbnail-icon {
  font-size: 2rem;
  opacity: 0.25;
}

.design-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.design-title {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.design-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: monospace;
}

.recently-updated-tag {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #041018;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(69, 243, 255, 0.25);
}

.btn-sync {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.8rem;
  padding: 8px;
  width: 100%;
  border-radius: 6px;
}

.design-card:hover .btn-sync {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
  color: #fff;
}

/* --- Sync Progressive Overlay Modal --- */
.progress-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.progress-modal {
  max-width: 440px;
  width: 100%;
  background: rgba(13, 19, 33, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 35px 25px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* Bottom sheet overlays: hidden class overrides the inline display:flex */
#design-selector-overlay.hidden,
#slot-edit-overlay.hidden {
  display: none !important;
}

.progress-spinner {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  width: 70px;
  height: 70px;
  border: 4px solid rgba(255, 255, 255, 0.04);
  border-left-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
}

.spinner-icon {
  font-size: 2rem;
  animation: heartbeats 1.5s infinite ease-in-out;
}

@keyframes heartbeats {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.progress-modal h3 {
  font-size: 1.3rem;
  color: #fff;
}

.progress-modal p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  margin: 5px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.4s ease;
}

.progress-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 15px;
  margin-top: 8px;
}

.step-line {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-line::before {
  content: '○';
  color: var(--text-muted);
  font-weight: bold;
}

.step-line.active {
  color: var(--accent-cyan);
}
.step-line.active::before {
  content: '●';
  color: var(--accent-cyan);
  animation: flash 1s infinite alternate;
}

.step-line.completed {
  color: var(--success);
}
.step-line.completed::before {
  content: '✓';
  color: var(--success);
}

@keyframes flash {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* --- Pairing Screen Overlays --- */
.pairing-overlay, .pairing-overlay.hidden {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 6, 10, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.app-confirm-overlay.hidden {
  display: none;
}

.app-confirm-modal {
  max-width: 400px;
  width: 100%;
  background: rgba(13, 19, 33, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-confirm-modal h3 {
  margin: 0;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.app-confirm-modal p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-line;
}

.app-confirm-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  text-align: left;
  margin-top: 2px;
}

.app-confirm-input-wrap.hidden {
  display: none;
}

.app-confirm-input-label {
  color: var(--accent-cyan);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.app-confirm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.35);
  color: #fff;
  font: 600 .9rem/1.3 inherit;
  outline: none;
}

.app-confirm-input:focus {
  border-color: rgba(139, 61, 255, .55);
  box-shadow: 0 0 0 3px rgba(139, 61, 255, .15);
}

.app-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.app-confirm-actions .btn-secondary,
.app-confirm-actions .btn-accent,
.app-confirm-actions .btn-danger {
  min-width: 110px;
}

.pairing-modal {
  max-width: 400px;
  width: 100%;
  background: rgba(13, 19, 33, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Expanded Setup Modal for Widescreen Layout */
@media (min-width: 992px) {
  .setup-modal-expanded {
    max-width: 1800px !important;
    width: 96vw !important;
    height: 95vh !important;
    max-height: 95vh !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between;
    overflow: hidden !important;
    padding: 25px !important;
  }
}

/* Active dropzone focus border style */
.visual-dropzone.active-focus-zone,
.mini-dropzone.active-focus-zone {
  border-color: var(--accent) !important;
  box-shadow: 0 0 10px rgba(255, 77, 0, 0.4);
  outline: 2px solid var(--accent);
}

/* Modal bottom asset shelf grid layout */
.modal-asset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding: 4px;
  align-items: flex-start;
  justify-content: flex-start;
}

/* Shelf individual thumb cards */
.modal-asset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-width: 80px;
  height: fit-content;
}

.modal-asset-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

.modal-asset-card.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 180, 216, 0.05);
}

.modal-asset-thumb {
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #09090b;
  overflow: hidden;
  height: 100px; /* default initial height, overridden dynamically by slider */
}

.modal-asset-title {
  font-size: 0.65rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
  font-weight: 500;
}

/* Layout button styles in slots */
.period-layout-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-layout-btn:hover {
  background: rgba(255,255,255,0.05);
}

.period-layout-btn.active {
  background: var(--accent-cyan) !important;
  border-color: var(--accent-cyan);
  color: #050a14 !important;
  font-weight: 700;
}


.pairing-modal h3 {
  color: #fff;
  font-size: 1.25rem;
}

.pairing-modal p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pairing-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  font-weight: 800;
  text-align: center;
  color: var(--accent-cyan);
  width: 100%;
}

.pairing-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.pairing-actions button {
  flex: 1;
  padding: 10px;
}

/* --- Utilities --- */
.hidden {
  display: none !important;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--border-color);
  background: rgba(7, 9, 14, 0.4);
  padding: 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1100px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .screen-card.portrait .screen-viewport {
    width: 200px;
  }
}

/* --- Split Screen & Design Selector Custom Styling --- */
.layout-toggle-group {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  align-self: flex-start;
  margin-top: 5px;
}

.layout-toggle-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
}

.layout-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139, 61, 255, 0.3);
}

.split-viewport-container {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 4px;
  background: #141722;
}

.split-half {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #090a10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.split-half-label {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent-cyan);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.05em;
}

.split-half-label.right {
  left: auto;
  right: 6px;
  color: var(--secondary);
}

.screen-slots-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 5px;
}

.slot-control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
}

.slot-name {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.btn-assign-slot {
  background: rgba(57, 227, 254, 0.1);
  border: 1px solid rgba(57, 227, 254, 0.2);
  color: var(--accent-cyan);
  padding: 4px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
  font-weight: 600;
}

.btn-assign-slot:hover {
  background: var(--accent-cyan);
  color: #050a14;
}

/* Design Selector Modal */
.design-selector-modal {
  max-width: 650px !important;
  width: 100%;
  padding: 25px !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 1.2rem;
  color: #fff;
}

.selector-design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--canva-preview-min, 140px), 1fr));
  gap: 12px;
  width: 100%;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 15px;
  padding-right: 4px;
}

.selector-design-grid::-webkit-scrollbar {
  width: 6px;
}
.selector-design-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.selector-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selector-card:hover {
  border-color: var(--primary);
  background: rgba(139, 61, 255, 0.05);
}

.selector-thumb {
  aspect-ratio: 8/9;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #09090b;
}

.selector-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.selector-title {
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Drag and Drop visual feedback styling */
.viewport-content.drag-hover, .split-half.drag-hover {
  outline: 3px dashed var(--accent-cyan) !important;
  outline-offset: -6px;
  background: rgba(0, 242, 254, 0.1) !important;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.3) !important;
  transition: all 0.25s ease-in-out;
}

.design-card.dragging {
  opacity: 0.4;
  transform: scale(0.96);
  border-color: var(--accent-cyan);
}

/* Unified Setup Modal Toggle Button Styles */
.setup-toggle-btn {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.02) !important;
  color: rgba(255, 255, 255, 0.5) !important;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.setup-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.setup-toggle-btn.active {
  background: rgba(0, 242, 254, 0.1) !important;
  color: var(--accent-cyan) !important;
  border-color: rgba(0, 242, 254, 0.3) !important;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15) !important;
}

.studio-content:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* --- Switch Toggle Styles --- */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: .4s;
  border-radius: 34px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 50%;
}

.switch-toggle input:checked + .slider-round {
  background-color: rgba(0, 242, 161, 0.15);
  border-color: rgba(0, 242, 161, 0.3);
}

.switch-toggle input:checked + .slider-round:before {
  transform: translateX(22px);
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* --- Schedule Period Card Styles --- */
.schedule-period-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.schedule-period-card.active-period {
  border-color: rgba(139, 61, 255, 0.35);
  box-shadow: 0 8px 30px rgba(139, 61, 255, 0.12), inset 0 1px 0 rgba(139, 61, 255, 0.1);
  background: rgba(13, 19, 33, 0.6);
}

.period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.period-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
}

.active-period .period-dot {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 1.5s infinite;
}

.period-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.active-period-badge {
  background: rgba(0, 242, 161, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 242, 161, 0.2);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

.period-time-inputs {
  background: rgba(0, 0, 0, 0.15);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.time-input {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: #fff;
  font-family: 'Inter', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  width: 100%;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
}

.time-input::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}

.time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.1s;
}

.time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.period-screens-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-screen-item {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 12px;
}

.schedule-screen-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.schedule-screen-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-slot-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  transition: var(--transition);
}

.schedule-slot-box.drag-hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.05);
}

.schedule-slot-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(255,255,255,0.03);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.03);
  text-transform: uppercase;
}

.schedule-slot-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: space-between;
  margin-left: 6px;
  min-width: 0;
}

.schedule-slot-media-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.schedule-slot-thumb {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
}

.schedule-slot-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-schedule-clear {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-schedule-clear:hover {
  color: var(--danger);
  background: rgba(255, 42, 95, 0.1);
}

.schedule-slot-empty {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.2);
  font-style: italic;
  flex: 1;
  text-align: right;
}

.btn-schedule-assign {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-primary);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-schedule-assign:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(139, 61, 255, 0.3);
}

.schedule-layout-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 6px;
}

.schedule-layout-toolbar span {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.schedule-layout-btn {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: var(--transition);
}

.schedule-layout-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
}

.schedule-layout-btn.active {
  background: rgba(139, 61, 255, 0.15);
  color: var(--accent-purple);
  border-color: rgba(139, 61, 255, 0.3);
}

/* --- Lock Screen Keypad Overlay --- */
.lock-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 6, 10, 0.7);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease-in-out, visibility 0.5s;
}

.lock-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  background: rgba(13, 19, 33, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 40px;
  width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.lock-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  margin-bottom: 8px;
}

.lock-status {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-weight: 500;
}

.pin-dots {
  display: flex;
  gap: 16px;
  margin-bottom: 35px;
}

.pin-dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease-in-out;
}

.pin-dots .dot.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
}

.key-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: all 0.2s ease-in-out;
  outline: none;
}

.key-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.key-btn:active {
  transform: scale(0.95);
  background: rgba(255, 77, 0, 0.2);
}

.key-btn.key-action {
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.01);
  border-color: transparent;
}

.key-btn.key-action:hover {
  background: rgba(255, 255, 255, 0.05);
}

#key-enter {
  color: var(--success);
}
#key-enter:hover {
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.3);
}

#key-clear {
  color: var(--danger);
}
#key-clear:hover {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
}

/* --- Schedule Sets Tabs & Day Pills --- */
.sets-tabs {
  display: flex;
  gap: 8px;
}

.set-tab-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.set-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.set-tab-btn.active {
  background: rgba(139, 61, 255, 0.12);
  color: var(--accent-purple);
  border-color: rgba(139, 61, 255, 0.35);
  box-shadow: 0 0 10px rgba(139, 61, 255, 0.1);
}

.day-pill-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
}

.day-pill-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.day-pill-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(255, 77, 0, 0.2);
}

/* --- Inline Row-based Multi-Display Layout --- */
.screen-row-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  width: 100%;
}

.screen-row-col-settings {
  width: 260px;
  flex-shrink: 0;
}

.screen-row-col-preview {
  width: 280px;
  flex-shrink: 0;
}

/* Active library card highlight styling */
.design-card.active-library-card,
.custom-media-card.active-library-card {
  outline: 3px solid var(--accent-cyan) !important;
  outline-offset: 2px;
  background: rgba(0, 180, 216, 0.08) !important;
}

/* Prevent schedule rows from squishing */
.modal-period-row {
  flex-shrink: 0 !important;
}

/* Limit time slots list maximum width on desktop to prevent infinite stretch space */
.screen-row-col-schedules {
  flex: 1;
  min-width: 0;
  max-width: 720px; /* Snug width constraint */
}

/* Local media drawer — stacked: drop zone, then Canva-style card grid */
.media-library-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.media-library-controls {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.media-library-controls .description {
  flex: 1 1 220px;
}

.media-library-grid-container {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Period row header details styling */
.period-row-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.015);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.period-row-header:hover {
  background: rgba(255,255,255,0.04);
}

.period-row-header-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.period-col-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.slot-name-title {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-layout-tag {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 180, 216, 0.12);
  border: 1px solid rgba(0, 180, 216, 0.2);
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 800;
  flex-shrink: 0;
}

.period-col-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.slot-time-text {
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

.slot-days-inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.slot-media-text {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.period-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 6px;
  margin-top: 2px;
}

.period-actions button {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.15s;
}

.btn-clone-period {
  background: rgba(139, 61, 255, 0.15);
  border-color: rgba(139, 61, 255, 0.25) !important;
  color: #d8b4fe !important;
}

.btn-edit-toggle {
  background: rgba(0, 180, 216, 0.12);
  border-color: rgba(0, 180, 216, 0.2) !important;
  color: var(--accent-cyan) !important;
}

.btn-delete-period {
  background: transparent !important;
  border: none !important;
  color: rgba(239, 68, 68, 0.7) !important;
  padding: 4px 6px !important;
}

/* ============================================================
   RESPONSIVE ARCHITECTURE — MOBILE FIRST
   Default base styles target phone viewports (< 768px).
   Progressive enhancement via min-width media queries.
   ============================================================ */

/* ── Base Mobile Styles (< 768px) ── */
.container {
  padding: 16px 10px;
  width: 100%;
  box-sizing: border-box;
}

.header-container {
  padding: 0 10px;
  flex-wrap: wrap;
  gap: 12px;
}

.screens-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}

.screen-card {
  width: 100%;
  max-width: 100%;
  padding: 14px;
  border-radius: 14px;
  box-sizing: border-box;
}

/* ── Tablet Viewport (>= 768px) ── */
@media (min-width: 768px) {
  .container {
    padding: 24px 20px;
  }
  
  .screens-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
  }
  
  .period-row-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .period-actions {
    width: auto;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
  }
}

/* ── Desktop Master-Detail Split Viewport (>= 1200px) ── */
@media (min-width: 1200px) {
  .container {
    max-width: 1440px;
    padding: 30px 24px;
  }
  
  .screens-grid {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 24px;
  }

  .screen-card {
    padding: 20px;
  }
}

/* =========================================================
   v8 Mobile-first admin experience
   The phone home screen is a live display queue. Editing is
   revealed only after opening a display.
   ========================================================= */

.schedule-day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.schedule-day-chip {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
}

.schedule-day-chip.is-today {
  border-color: rgba(139,61,255,.55);
  background: rgba(139,61,255,.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139,61,255,.12);
}

@media (max-width: 767px) {
  body { overflow-x: hidden; }

  header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(18px);
  }

  .header-container {
    min-height: 58px;
    padding: 0 14px !important;
  }

  .logo { font-size: 1.05rem !important; }
  .logo .badge { display: none; }
  .status-pill { padding: 6px 9px !important; }

  .container {
    width: 100%;
    padding: 14px 12px 32px !important;
  }

  .dashboard-layout { display: block !important; }

  .screen-manager {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .screen-manager > .card-header {
    align-items: center;
    padding: 4px 2px 0;
  }

  .screen-manager > .card-header h2 {
    font-size: 1.35rem !important;
    letter-spacing: -.02em;
  }

  .screen-manager > .description {
    margin: 6px 2px 15px !important;
    font-size: .78rem !important;
    line-height: 1.45;
  }

  #pair-screen-btn {
    min-height: 38px;
    padding: 0 12px !important;
  }

  .screens-grid {
    display: flex !important;
    flex-direction: column;
    gap: 14px !important;
  }

  .screen-card {
    padding: 12px !important;
    gap: 12px !important;
    border-radius: 18px !important;
    background: rgba(13,19,33,.82) !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.24);
  }

  .screen-card-header {
    min-height: 44px;
    padding-bottom: 9px !important;
  }

  .screen-card-header strong {
    max-width: none !important;
    font-size: .95rem !important;
  }

  .screen-card-header strong + span { display: none !important; }
  .screen-row-unpair-btn { display: none !important; }

  .screen-row-gear-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
  }

  .card-preview-section {
    margin: 0 !important;
    align-items: center;
  }

  .tv-bezel-wrapper {
    max-width: 100% !important;
    border-width: 2px !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 28px rgba(0,0,0,.45) !important;
  }

  .live-status-details {
    padding: 10px 11px !important;
    border-radius: 11px !important;
    font-size: .74rem !important;
  }

  .screen-row-toggle-expand-btn {
    min-height: 44px;
    margin-top: 0;
    font-size: .8rem !important;
    border-radius: 11px !important;
    background: rgba(139,61,255,.14) !important;
    border-color: rgba(139,61,255,.3) !important;
  }

  .screen-row-content-body {
    gap: 14px !important;
    padding-top: 12px !important;
  }

  .screen-row-col-schedules > div:first-child {
    position: sticky;
    top: 58px;
    z-index: 5;
    padding: 10px 0 !important;
    background: #0d1321;
  }

  .screen-row-periods-list {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  .period-row,
  .screen-period-row {
    border-radius: 13px !important;
  }

  .screen-row-col-settings {
    padding: 12px !important;
    border-radius: 13px !important;
  }

  #media-library-drawer {
    margin-top: 18px !important;
  }

  #media-library-drawer .media-uploader {
    padding: 14px !important;
    border-radius: 16px !important;
  }

  .media-library-layout {
    display: flex !important;
    flex-direction: column !important;
  }

  .media-library-controls { width: 100% !important; }

  .developer-drawer .drawer-content { padding: 16px 12px !important; }
  .drawer-grid { grid-template-columns: 1fr !important; }

  #slot-edit-sheet,
  #design-selector-sheet {
    max-width: none !important;
    max-height: 96dvh !important;
    border-radius: 18px 18px 0 0 !important;
  }

  footer { display: none; }
}

@media (min-width: 768px) {
  .schedule-day-strip { max-width: 520px; }
}

/* =========================================================
   v9 Coverage-first schedule workspace
   Phone: one selected day with natural page flow.
   Desktop: full seven-day schedule using the available width.
   ========================================================= */
.schedule-workspace {
  flex-direction: column;
  gap: 14px;
  width: 100%;
  text-align: left;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.schedule-toolbar > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.schedule-kicker {
  color: var(--accent-cyan);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.schedule-title {
  color: #fff;
  font-size: .86rem;
}

.schedule-toolbar .screen-row-add-slot-btn {
  min-height: 36px;
  padding: 0 12px !important;
  white-space: nowrap;
}

.schedule-day-chip {
  appearance: none;
  cursor: pointer;
  padding: 7px 2px 6px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
}

.schedule-day-chip.is-selected {
  border-color: rgba(139,61,255,.8);
  background: linear-gradient(180deg, rgba(139,61,255,.34), rgba(139,61,255,.16));
  color: #fff;
  box-shadow: 0 0 0 1px rgba(139,61,255,.15), 0 8px 20px rgba(50,20,100,.2);
}

.coverage-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: .51rem;
  line-height: 1.2;
  font-weight: 800;
  white-space: nowrap;
}

.coverage-status.good {
  color: #86efac;
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.22);
}

.coverage-status.warning {
  color: #fde68a;
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.25);
}

.coverage-status.danger {
  color: #fda4af;
  background: rgba(244,63,94,.12);
  border: 1px solid rgba(244,63,94,.25);
}

.selected-day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.025);
}

.selected-day-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.selected-day-summary span:first-child {
  color: var(--text-muted);
  font-size: .61rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.selected-day-summary strong {
  color: #fff;
  font-size: .92rem;
}

.coverage-alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coverage-alert,
.coverage-issue {
  border-radius: 8px;
  padding: 7px 9px;
  font-size: .64rem;
  font-weight: 700;
}

.coverage-alert.warning,
.coverage-issue.gap {
  color: #fde68a;
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.22);
}

.coverage-alert.danger,
.coverage-issue.overlap {
  color: #fda4af;
  background: rgba(244,63,94,.1);
  border: 1px solid rgba(244,63,94,.22);
}

.mobile-schedule-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.desktop-schedule-view {
  display: none;
}

.screen-row-periods-list {
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}

@media (min-width: 1100px) {
  .container {
    max-width: 1780px !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
  }

  .screens-grid {
    grid-template-columns: 1fr !important;
  }

  .screen-card {
    width: 100%;
  }

  .screen-row-content-body {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 18px !important;
  }

  .screen-row-col-schedules {
    grid-column: 1;
  }

  .screen-row-col-settings {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 118px);
    overflow: auto;
  }

  .mobile-schedule-view {
    display: none;
  }

  .desktop-schedule-view {
    display: block;
    min-width: 0;
  }

  .desktop-week-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .week-day-column {
    min-width: 0;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 12px;
    background: rgba(4,9,18,.4);
    overflow: hidden;
  }

  .week-day-column.is-today {
    border-color: rgba(139,61,255,.45);
    box-shadow: inset 0 0 0 1px rgba(139,61,255,.09);
  }

  .week-day-column > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    min-height: 54px;
    padding: 9px;
    border-bottom: 1px solid rgba(255,255,255,.055);
    background: rgba(255,255,255,.025);
  }

  .week-day-column > header > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .week-day-column > header span:first-child {
    display: none;
  }

  .week-day-column > header strong {
    color: #fff;
    font-size: .72rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .week-day-column .coverage-status {
    padding: 2px 5px;
    font-size: .46rem;
  }

  .week-day-slots {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px;
    min-height: 230px;
  }

  .week-slot-card {
    appearance: none;
    width: 100%;
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.07);
    border-left: 3px solid rgba(34,211,238,.7);
    border-radius: 8px;
    background: rgba(255,255,255,.035);
    color: #fff;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .18s, background .18s, transform .18s;
  }

  .week-slot-card:hover {
    border-color: rgba(139,61,255,.45);
    background: rgba(139,61,255,.09);
    transform: translateY(-1px);
  }

  .week-slot-card span,
  .week-slot-card strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .week-slot-time {
    margin-bottom: 3px;
    color: #67e8f9;
    font-size: .56rem;
    font-weight: 800;
    white-space: nowrap;
  }

  .week-slot-card strong {
    font-size: .68rem;
    line-height: 1.25;
  }

  .week-slot-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: .52rem;
    line-height: 1.25;
    white-space: nowrap;
  }

  .week-empty-day {
    display: grid;
    place-items: center;
    min-height: 80px;
    padding: 12px 8px;
    border: 1px dashed rgba(244,63,94,.18);
    border-radius: 8px;
    color: rgba(253,164,175,.7);
    font-size: .6rem;
    text-align: center;
  }

  .coverage-issue {
    padding: 6px;
    font-size: .54rem;
  }
}

@media (min-width: 1450px) {
  .screen-row-content-body {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .week-day-column > header strong {
    font-size: .78rem;
  }

  .week-slot-card strong {
    font-size: .72rem;
  }
}

/* =========================================================
   Pass 10: operational phone cards + desktop slot-set workspace
   ========================================================= */
.day-chip-alert {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: .52rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.day-chip-alert.warning { color: #111827; background: #fbbf24; }
.day-chip-alert.danger { color: white; background: #f43f5e; }
.schedule-day-chip { position: relative; }
.coverage-summary-ok { color: #86efac; font-size: .68rem; font-weight: 700; }

.now-playing-details {
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  text-align: left;
}
.now-playing-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.now-playing-heading > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.now-playing-heading span:first-child,
.now-playing-facts span { color: var(--text-muted); font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.now-playing-heading strong { color: #fff; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing-details .active-source-badge {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 999px;
  color: #d8b4fe;
  background: rgba(139,61,255,.15);
  border: 1px solid rgba(139,61,255,.25);
  font-size: .62rem;
  font-weight: 800;
}
.now-playing-facts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.now-playing-facts > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.now-playing-facts strong { color: #fff; font-size: .7rem; line-height: 1.3; }

.phone-slot-preview,
.slot-set-preview {
  background: #05070b;
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.1);
}
.phone-slot-preview { width: 78px; aspect-ratio: 16/9; border-radius: 7px; }
.phone-slot-preview.is-portrait { aspect-ratio: 9/16; width: 44px; }
.phone-slot-preview.is-split.is-portrait { flex-direction: column; }
.phone-slot-preview > div,
.slot-set-preview > div { flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.phone-slot-preview > div + div,
.slot-set-preview > div + div { border-left: 1px solid rgba(255,255,255,.14); }
.phone-slot-preview.is-portrait > div + div,
.slot-set-preview.is-portrait > div + div { border-left: 0; border-top: 1px solid rgba(255,255,255,.14); }
.phone-slot-preview img,
.slot-set-preview img { width: 100%; height: 100%; object-fit: contain; }
.phone-slot-preview span,
.slot-set-preview span { color: rgba(255,255,255,.28); font-size: .5rem; }

.modal-period-row .period-row-header {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 78px;
  padding: 10px;
  cursor: pointer;
}
.modal-period-row .period-row-header-details { min-width: 0; }
.modal-period-row .period-col-info { display: flex; align-items: center; gap: 7px; min-width: 0; }
.modal-period-row .slot-name-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.modal-period-row .slot-layout-tag { margin-left: auto; }
.modal-period-row .period-col-meta { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.modal-period-row .slot-time-text { font-size: .7rem; font-weight: 750; color: #dbeafe; }
.modal-period-row .slot-media-text { display: none !important; }
.modal-period-row .btn-slot-menu {
  appearance: none;
  width: 32px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.75);
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-period-row .period-actions[hidden] { display: none !important; }

.desktop-coverage-summary,
.desktop-slot-set-list { display: none; }

@media (max-width: 767px) {
  .schedule-toolbar { align-items: flex-start; }
  .schedule-toolbar .schedule-title { max-width: 220px; line-height: 1.35; }
  .schedule-day-chip { gap: 0; min-height: 48px; }
  .selected-day-summary { padding: 8px 10px; }
  .now-playing-facts { grid-template-columns: 1fr 1fr; }
  .now-playing-facts > div:last-child { grid-column: 1 / -1; }
  .modal-period-row { margin-bottom: 9px !important; }
  .slot-days-inline { white-space: nowrap; }
}

@media (min-width: 1100px) {
  .card-preview-section .tv-bezel-wrapper {
    max-width: min(720px, 54vw) !important;
    min-width: 520px;
  }
  .screen-card:not(:has(.screen-row-content-body[style*="display: flex"])) .card-preview-section,
  .screen-card:not(:has(.screen-row-content-body[style*="display: flex"])) .live-status-details {
    width: calc(50% - 10px) !important;
  }
  .screen-card:not(:has(.screen-row-content-body[style*="display: flex"])) .card-preview-section { align-self: flex-start; }
  .screen-card:not(:has(.screen-row-content-body[style*="display: flex"])) .live-status-details { position: absolute; right: 20px; top: 78px; min-height: 220px; }
  .screen-card { position: relative; }
  .screen-card:not(:has(.screen-row-content-body[style*="display: flex"])) .screen-row-toggle-expand-btn { margin-top: 4px; }

  .desktop-week-board { display: none !important; }
  .desktop-coverage-summary {
    display: grid;
    grid-template-columns: repeat(7,minmax(0,1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .desktop-day-health {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,.07);
    background: rgba(255,255,255,.025);
  }
  .desktop-day-health strong { color: #fff; font-size: .72rem; }
  .desktop-day-health span { font-size: .57rem; font-weight: 800; white-space: nowrap; }
  .desktop-day-health.good span { color: #86efac; }
  .desktop-day-health.warning { border-color: rgba(245,158,11,.25); }
  .desktop-day-health.warning span { color: #fde68a; }
  .desktop-day-health.danger { border-color: rgba(244,63,94,.25); }
  .desktop-day-health.danger span { color: #fda4af; }

  .desktop-slot-set-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
  }
  .desktop-slot-set-heading,
  .desktop-slot-set-row {
    display: grid;
    grid-template-columns: minmax(360px,1.4fr) minmax(420px,1fr) 64px;
    align-items: center;
    gap: 18px;
  }
  .desktop-slot-set-heading {
    padding: 0 13px 5px;
    color: var(--text-muted);
    font-size: .59rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
  }
  .desktop-slot-set-row {
    appearance: none;
    width: 100%;
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 11px;
    background: rgba(255,255,255,.025);
    color: #fff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: .18s ease;
  }
  .desktop-slot-set-row:hover { border-color: rgba(139,61,255,.4); background: rgba(139,61,255,.07); transform: translateY(-1px); }
  .slot-set-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .slot-set-preview { width: 112px; aspect-ratio: 16/9; border-radius: 8px; }
  .slot-set-preview.is-portrait { width: 48px; aspect-ratio: 9/16; }
  .slot-set-identity > div:last-child { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .slot-set-identity strong { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .slot-set-identity span { color: var(--text-muted); font-size: .65rem; }
  .slot-set-days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 6px; }
  .slot-set-days span { display: grid; place-items: center; min-height: 31px; border-radius: 7px; border: 1px solid rgba(255,255,255,.07); color: rgba(255,255,255,.28); font-size: .62rem; font-weight: 800; }
  .slot-set-days span.active { color: #fff; border-color: rgba(139,61,255,.42); background: rgba(139,61,255,.2); }
  .slot-set-open { color: #67e8f9; font-size: .65rem; font-weight: 800; text-align: right; }
  .desktop-empty-schedule { padding: 24px; border: 1px dashed rgba(255,255,255,.1); border-radius: 10px; color: var(--text-muted); text-align: center; }
}

/* =========================================================
   Pass 11: playback-first schedule workspace
   ========================================================= */
@media (min-width: 1100px) {
  .schedule-workspace {
    width: 100%;
  }

  .schedule-workspace > .schedule-toolbar {
    display: none;
  }

  .desktop-schedule-view {
    display: block;
    width: 100%;
  }

  .desktop-playback-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, .55fr) minmax(600px, 1.45fr);
    align-items: end;
    gap: 24px;
    margin-bottom: 14px;
  }

  .desktop-playback-toolbar > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .desktop-playback-toolbar > div:first-child strong {
    color: #fff;
    font-size: 1rem;
  }

  .desktop-day-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(70px, 1fr));
    gap: 8px;
  }

  .desktop-day-tab {
    min-height: 42px;
    width: 100%;
    border-radius: 9px;
    font-size: .7rem;
  }

  .desktop-day-tab.has-warning:not(.is-selected) { border-color: rgba(245,158,11,.28); }
  .desktop-day-tab.has-error:not(.is-selected),
  .desktop-day-tab.has-empty:not(.is-selected) { border-color: rgba(244,63,94,.22); }

  .desktop-coverage-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  .desktop-playback-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .desktop-playback-row {
    appearance: none;
    width: 100%;
    display: grid;
    grid-template-columns: 42px 150px 150px minmax(300px, 1fr) 70px;
    align-items: center;
    gap: 18px;
    min-height: 92px;
    padding: 11px 16px;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
    color: #fff;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .18s, background .18s, transform .18s;
  }

  .desktop-playback-row:hover {
    border-color: rgba(139,61,255,.42);
    background: rgba(139,61,255,.07);
    transform: translateY(-1px);
  }

  .desktop-playback-sequence {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: rgba(139,61,255,.13);
    border: 1px solid rgba(139,61,255,.24);
  }

  .desktop-playback-sequence span {
    color: #d8b4fe;
    font-size: .62rem;
    font-weight: 800;
  }

  .desktop-playback-time,
  .desktop-playback-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }

  .desktop-playback-time strong {
    color: #67e8f9;
    font-size: .85rem;
  }

  .desktop-playback-time span,
  .desktop-playback-copy span {
    color: var(--text-muted);
    font-size: .65rem;
  }

  .desktop-playback-copy strong {
    overflow: hidden;
    color: #fff;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-playback-preview {
    width: 150px;
    aspect-ratio: 16/9;
    display: flex;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    background: #030508;
  }

  .desktop-playback-preview.is-portrait {
    width: 52px;
    aspect-ratio: 9/16;
  }

  .desktop-playback-preview.is-split.is-portrait { flex-direction: column; }
  .desktop-playback-preview > div { flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; }
  .desktop-playback-preview > div + div { border-left: 1px solid rgba(255,255,255,.14); }
  .desktop-playback-preview.is-portrait > div + div { border-left: 0; border-top: 1px solid rgba(255,255,255,.14); }
  .desktop-playback-preview img { width: 100%; height: 100%; object-fit: contain; }
  .desktop-playback-preview span { color: rgba(255,255,255,.28); font-size: .55rem; }

  .desktop-playback-edit {
    color: #67e8f9;
    font-size: .68rem;
    font-weight: 800;
    text-align: right;
  }

  .desktop-empty-schedule {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 34px;
  }

  .desktop-empty-schedule strong { color: #fff; font-size: .9rem; }
  .desktop-empty-schedule span { color: var(--text-muted); font-size: .72rem; }

  .desktop-coverage-summary,
  .desktop-slot-set-list {
    display: none !important;
  }
}

@media (min-width: 1450px) {
  .desktop-playback-row {
    grid-template-columns: 46px 170px 190px minmax(380px, 1fr) 80px;
    gap: 22px;
    min-height: 104px;
  }
  .desktop-playback-preview { width: 190px; }
}

@media (max-width: 767px) {
  .schedule-toolbar .schedule-kicker { display: block; }
  .schedule-toolbar .schedule-title { font-size: 1rem; }
  .selected-day-summary { margin-top: 2px; }
  .selected-day-summary strong { font-size: .86rem; }
  .coverage-summary-ok { color: var(--text-muted); font-weight: 600; }
  .now-playing-heading strong { white-space: normal; }
  .active-source-badge { display: none; }
}

/* =========================================================
   Pass 12: visual playback timeline carousel
   ========================================================= */
.playback-carousel-host {
  width: 100%;
}

.playback-carousel {
  width: 100%;
  padding: 4px 0 0;
}

.playback-carousel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.playback-carousel-heading > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.playback-carousel-heading span {
  color: var(--accent-cyan);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.playback-carousel-heading strong {
  color: #fff;
  font-size: .82rem;
}

.playback-return-now {
  appearance: none;
  border: 1px solid rgba(139,61,255,.38);
  border-radius: 8px;
  background: rgba(139,61,255,.13);
  color: #d8b4fe;
  padding: 7px 11px;
  font: 700 .68rem/1 inherit;
  cursor: pointer;
}

.playback-carousel-stage {
  display: grid;
  grid-template-columns: clamp(42px, 5vw, 72px) minmax(0, 1fr) clamp(42px, 5vw, 72px);
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.playback-arrow {
  appearance: none;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: #fff;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
  min-width: 0;
}

.playback-arrow:hover:not(:disabled) {
  border-color: rgba(139,61,255,.42);
  background: rgba(139,61,255,.08);
  transform: translateY(-1px);
}

.playback-arrow:disabled {
  opacity: .2;
  cursor: default;
}

.playback-arrow span {
  font-size: 2rem;
  line-height: .8;
  color: #d8b4fe;
}

.playback-arrow small {
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.playback-slides {
  display: grid;
  grid-template-columns: minmax(0, .28fr) minmax(0, 1fr) minmax(0, .28fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.playback-slide,
.playback-slide-placeholder {
  min-width: 0;
  border-radius: 14px;
}

.playback-slide {
  appearance: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.085);
  background: rgba(255,255,255,.025);
  color: #fff;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: opacity .2s, transform .2s, border-color .2s, background .2s;
}

.playback-slide:hover {
  border-color: rgba(139,61,255,.42);
  background: rgba(139,61,255,.06);
}

.playback-slide.is-current {
  padding: 15px;
  border-color: rgba(139,61,255,.38);
  background: rgba(8,12,22,.88);
  box-shadow: 0 16px 36px rgba(0,0,0,.28);
}

.playback-slide.is-previous,
.playback-slide.is-next {
  opacity: .56;
  transform: scale(.92);
}

.playback-slide.is-previous:hover,
.playback-slide.is-next:hover {
  opacity: .9;
}

.playback-slide-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: .61rem;
  font-weight: 700;
}

.playback-relation {
  color: #d8b4fe;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.playback-carousel-preview {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: #000;
}

.playback-carousel-preview.is-portrait {
  width: min(42%, 250px);
  margin-inline: auto;
  aspect-ratio: 9/16;
}

.playback-carousel-preview.is-split.is-portrait {
  flex-direction: column;
}

.playback-carousel-preview > div {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.playback-carousel-preview.has-slot-captions > .playback-preview-column {
  display: flex;
  place-items: unset;
  overflow: visible;
}

.playback-carousel-preview > div + div {
  border-left: 1px solid rgba(255,255,255,.14);
}

.playback-carousel-preview.has-slot-captions > .playback-preview-column + .playback-preview-column {
  border-left: 0;
  border-top: 0;
}

.playback-carousel-preview.is-portrait > div + div {
  border-left: 0;
  border-top: 1px solid rgba(255,255,255,.14);
}

.playback-carousel-preview.has-slot-captions.is-portrait > .playback-preview-column + .playback-preview-column {
  border-top: 0;
}

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

.playback-carousel-preview span {
  color: rgba(255,255,255,.25);
  font-size: .65rem;
  font-weight: 800;
}

.playback-carousel-preview.is-blank {
  display: grid;
  place-items: center;
  background: #000;
}

.playback-slide-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.playback-slide-copy strong {
  color: #fff;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playback-slide-copy span {
  color: var(--text-muted);
  font-size: .68rem;
  line-height: 1.35;
}

.playback-slide-action {
  color: #67e8f9;
  font-size: .64rem;
  font-weight: 800;
}

.playback-slide.is-blank .playback-slide-action {
  color: var(--text-muted);
}

.playback-mobile-nav {
  display: none;
}

@media (min-width: 1450px) {
  .playback-carousel-stage {
    grid-template-columns: clamp(48px, 6vw, 82px) minmax(0, 1fr) clamp(48px, 6vw, 82px);
    gap: 14px;
  }

  .playback-slides {
    grid-template-columns: minmax(0, .28fr) minmax(0, 1fr) minmax(0, .28fr);
    gap: 14px;
  }

  .playback-slide.is-current {
    padding: 16px;
  }
}

@media (max-width: 900px) {
  .playback-carousel-heading {
    margin-bottom: 8px;
  }

  .playback-carousel-heading strong {
    font-size: .75rem;
  }

  .playback-carousel-stage {
    grid-template-columns: 42px minmax(0,1fr) 42px;
    gap: 7px;
  }

  .playback-arrow {
    min-height: 96px;
    padding: 0;
    border-radius: 10px;
  }

  .playback-arrow span {
    font-size: 1.7rem;
  }

  .playback-arrow small {
    display: none;
  }

  .playback-slides {
    display: block;
    overflow: hidden;
  }

  .playback-slide.is-previous,
  .playback-slide.is-next,
  .playback-slide-placeholder {
    display: none;
  }

  .playback-slide.is-current {
    width: 100%;
    padding: 12px;
    transform: none;
  }

  .playback-carousel-preview.is-portrait {
    width: min(52%, 220px);
  }

  .playback-mobile-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 49px 0;
    color: var(--text-muted);
    font-size: .6rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .playback-mobile-nav strong {
    color: #d8b4fe;
  }
}

@media (max-width: 560px) {
  .playback-carousel-heading > div strong {
    display: none;
  }

  .playback-return-now {
    padding: 6px 9px;
    font-size: .62rem;
  }

  .playback-slide-copy strong {
    font-size: .92rem;
  }

  .playback-slide-copy span {
    font-size: .64rem;
  }
}

/* Video assets are rendered as intentional poster cards, never broken image tiles. */
.media-preview-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #05070b;
}

.media-preview-panel > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.media-preview-panel.has-preview-error::after {
  content: "Preview unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.5);
  font-size: .68rem;
  background: linear-gradient(145deg, #101522, #07090e);
}

.video-poster-preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 38%, rgba(91, 72, 160, .32), transparent 42%),
    linear-gradient(145deg, #111726 0%, #05070b 70%);
}

.video-poster-preview > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.video-poster-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(3,5,9,.12), rgba(3,5,9,.58));
}

.video-poster-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .42rem;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.75);
}

.video-play-symbol {
  display: grid;
  place-items: center;
  width: clamp(32px, 10%, 58px);
  aspect-ratio: 1;
  border-radius: 999px;
  padding-left: .15em;
  background: rgba(9, 12, 20, .72);
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  font-size: clamp(.8rem, 2vw, 1.25rem);
}

.video-poster-center strong {
  font-size: clamp(.52rem, 1.2vw, .75rem);
  letter-spacing: .16em;
}

.video-poster-title,
.video-duration {
  position: absolute;
  bottom: .45rem;
  z-index: 2;
  border-radius: 5px;
  background: rgba(3,5,9,.74);
  color: rgba(255,255,255,.9);
  font-size: clamp(.46rem, .85vw, .65rem);
  line-height: 1;
  padding: .32rem .4rem;
  backdrop-filter: blur(5px);
}

.video-poster-title {
  left: .45rem;
  max-width: calc(100% - 4rem);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.video-duration { right: .45rem; font-variant-numeric: tabular-nums; }
.media-preview-empty { color: rgba(255,255,255,.28); font-size: .58rem; }

/* Image frame + name/date tags (shown on central playback previewer only) */
.image-preview-frame {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

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

.preview-asset-title,
.preview-asset-date,
.preview-asset-meta {
  display: none;
}

/* Keep central playback art clean — no name/date overlays on images */
.playback-carousel-preview .video-poster-title {
  display: none;
}

/* NOW panel: per-image naming + File Date & Time under each column */
.playback-carousel-preview.has-slot-captions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  aspect-ratio: auto;
  height: auto;
  max-height: none;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.playback-carousel-preview.has-slot-captions.is-split.is-portrait {
  flex-direction: column;
}

.playback-preview-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playback-carousel-preview.has-slot-captions:not(.is-split) .playback-preview-column {
  width: 100%;
}

.playback-preview-art {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: #000;
}

.playback-carousel-preview.has-slot-captions.is-split:not(.is-portrait) .playback-preview-art {
  /* Each half of a landscape split screen is effectively 8:9 */
  aspect-ratio: 8 / 9;
}

.playback-carousel-preview.has-slot-captions.is-portrait .playback-preview-art {
  aspect-ratio: 9 / 16;
  width: min(100%, 250px);
  margin-inline: auto;
}

.playback-carousel-preview.has-slot-captions.is-split.is-portrait .playback-preview-art {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.playback-preview-art .media-preview-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.playback-now-slot-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
  align-items: flex-start;
}

.playback-now-slot-caption.is-empty {
  min-height: 1px;
}

.playback-now-set,
.playback-now-panel,
.playback-now-stamp-label,
.playback-now-stamp {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.playback-now-set {
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.playback-now-panel {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
}

.playback-now-stamp-label {
  color: #39ff14;
  font-size: 0.6rem;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(57, 255, 20, .25);
  margin-top: 2px;
}

.playback-now-stamp {
  color: #7cff6b;
  font-size: 0.58rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.playback-slide.is-current .playback-slide-copy {
  display: none;
}

/* Force full asset visibility in NOW preview (ignore cover/custom zoom). */
.playback-slide.is-current .playback-preview-art .image-preview-frame > img,
.playback-slide.is-current .playback-preview-art .media-preview-panel > img,
.playback-slide.is-current .playback-preview-art .video-poster-preview > img {
  object-fit: contain !important;
  object-position: center center;
  transform: none !important;
}

/* 4-line tags under Canva / Media library cards only */
.library-asset-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.library-info-set,
.library-info-panel,
.library-info-date,
.library-info-time {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.library-info-set {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.library-info-panel {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.library-info-date,
.library-info-time {
  color: #39ff14;
  font-size: 0.62rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(57, 255, 20, .25);
}

.library-info-time {
  color: #7cff6b;
  font-size: 0.58rem;
}

.library-asset-info .recently-updated-tag {
  margin-top: 4px;
}

.schedule-slot-thumb.media-preview-panel {
  width: 52px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.1);
}

/* =========================================================
   Pass 14: carousel metadata polish and smart schedule toggle
   ========================================================= */
.playback-slides {
  overflow: visible;
}

.playback-slide.is-current {
  overflow: hidden;
  padding-bottom: 18px;
}

.playback-slide-topline {
  align-items: flex-start;
}

.playback-slide-datetime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

.playback-slide-datetime strong {
  color: #fff;
  font-size: .7rem;
  line-height: 1.2;
  white-space: nowrap;
}

.playback-slide-datetime small {
  color: var(--text-muted);
  font-size: .62rem;
  line-height: 1.2;
  white-space: nowrap;
}

.playback-slide-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.playback-slide.is-previous .playback-slide-title,
.playback-slide.is-next .playback-slide-title {
  font-size: .84rem;
}

.playback-slide-copy {
  min-height: 18px;
}

.playback-slide-action {
  min-height: 16px;
  line-height: 1.25;
}

.screen-row-toggle-expand-btn .schedule-toggle-chevron {
  color: #d8b4fe;
  font-size: .72rem;
  line-height: 1;
  transition: transform .18s ease;
}

/* Today is context, selected is the active day. Never make both look selected. */
.schedule-day-chip.is-today:not(.is-selected) {
  position: relative;
  border-color: rgba(255,255,255,.08);
  background: rgba(255,255,255,.025);
  color: var(--text-muted);
  box-shadow: none;
}

.schedule-day-chip.is-today:not(.is-selected)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a855f7;
  transform: translateX(-50%);
  box-shadow: 0 0 7px rgba(168,85,247,.75);
}

@media (min-width: 901px) {
  .playback-slide.is-current .playback-carousel-preview:not(.has-slot-captions) {
    max-height: 430px;
  }
  .playback-slide.is-current .playback-carousel-preview.has-slot-captions {
    max-height: none;
  }
}

@media (max-width: 900px) {
  .playback-slides {
    overflow: hidden;
  }

  .playback-slide-title {
    font-size: .94rem;
  }

  .playback-slide-datetime strong {
    font-size: .66rem;
  }

  .playback-slide-datetime small {
    font-size: .58rem;
  }
}


/* =========================================================
   Pass 15: reliable schedule visibility and unclipped previews
   ========================================================= */
/* Desktop grid rules previously overrode the inline collapsed state. */
.screen-row-content-body.is-collapsed {
  display: none !important;
}

.screen-row-content-body.is-expanded {
  visibility: visible;
}

/* Preserve the complete asset inside every carousel panel. */
.playback-carousel-preview {
  max-height: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.playback-carousel-preview .media-preview-panel,
.playback-carousel-preview .media-preview-panel > img {
  min-height: 0;
  max-height: 100%;
  min-width: 0;
  max-width: 100%;
}

.playback-carousel-preview .media-preview-panel > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center center;
}

.playback-carousel-preview .image-preview-frame > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center center;
}

.playback-slide.is-current {
  height: auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.playback-slide.is-current .playback-carousel-preview:not(.has-slot-captions) {
  overflow: hidden;
}

.playback-slide.is-current .playback-carousel-preview.has-slot-captions {
  overflow: visible;
}

.playback-slide-copy,
.playback-slide-action {
  flex: 0 0 auto;
}

@media (min-width: 901px) {
  .playback-slide.is-current .playback-carousel-preview:not(.has-slot-captions) {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
  }
  .playback-slide.is-current .playback-carousel-preview.has-slot-captions {
    width: 100%;
    max-width: 100%;
    aspect-ratio: auto;
    height: auto;
    max-height: none;
  }
}

/* =========================================================
   Pass 16: compact desktop playback rows per approved markup
   ========================================================= */
@media (min-width: 901px) {
  /* Keep the schedule as a compact working block instead of stretching
     across the entire desktop canvas. */
  .desktop-playback-list {
    width: min(100%, 1020px);
    max-width: 1020px;
  }

  .desktop-playback-row {
    width: 100%;
    grid-template-columns: 42px 150px 190px minmax(260px, 1fr) 72px;
    gap: 18px;
  }

  /* Give the descriptive copy the room marked in the desktop review. */
  .desktop-playback-copy {
    width: 100%;
    min-width: 0;
  }

  .desktop-playback-copy strong,
  .desktop-playback-copy span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  /* Keep Edit immediately adjacent to the details column and aligned
     consistently down the right edge of the compact schedule block. */
  .desktop-playback-edit {
    justify-self: end;
    align-self: center;
    min-width: 58px;
    text-align: right;
  }
}

@media (min-width: 1450px) {
  .desktop-playback-list {
    width: min(100%, 1080px);
    max-width: 1080px;
  }

  .desktop-playback-row {
    grid-template-columns: 46px 170px 190px minmax(300px, 1fr) 76px;
    gap: 20px;
  }
}

/* =========================================================
   Pass 18: portrait-aware blank states and first-schedule creation
   ========================================================= */
/* Blank carousel slides must honor the configured hardware orientation too. */
.playback-carousel-preview.is-blank.is-portrait {
  width: min(42%, 250px);
  margin-inline: auto;
  aspect-ratio: 9 / 16;
}

@media (max-width: 900px) {
  .playback-carousel-preview.is-blank.is-portrait {
    width: min(58%, 230px);
  }
}

/* Make an empty, brand-new screen read as an actionable starting point. */
.playback-slide.is-blank .playback-slide-action {
  color: #67e8f9;
}

/* =========================================================
   Pass 20: portrait WYSIWYG previews + restored schedule width
   ========================================================= */
/* Pass 15's generic desktop carousel rule was more specific than the
   portrait rule and forced the current slide back to 16:9. Keep the
   whole preview frame portrait so the admin matches the physical screen. */
@media (min-width: 901px) {
  .playback-slide.is-current .playback-carousel-preview.is-portrait {
    width: min(44%, 430px);
    max-width: 430px;
    margin-inline: auto;
    aspect-ratio: 9 / 16;
    height: auto;
  }

  .playback-slide.is-current .playback-carousel-preview.is-split.is-portrait {
    flex-direction: column;
  }
}

/* When Display Settings is closed, do not continue reserving its desktop
   grid column. That reservation compressed the schedule and pushed its
   details/Edit columns outside the visible row background. */
@media (min-width: 1100px) {
  .screen-row-content-body:not(:has(.screen-row-col-settings[style*="display: flex"])) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .screen-row-content-body:not(:has(.screen-row-col-settings[style*="display: flex"])) .screen-row-col-schedules {
    grid-column: 1 / -1;
  }
}

/* Keep every compact schedule row self-contained even at narrower desktop
   widths. The descriptive text and Edit action stay inside the same card. */
@media (min-width: 901px) {
  .desktop-playback-list {
    width: min(100%, 1080px);
    max-width: 1080px;
  }

  .desktop-playback-row {
    box-sizing: border-box;
    grid-template-columns: 42px 150px 190px minmax(220px, 1fr) 72px;
    width: 100%;
    max-width: 100%;
  }
}

@media (min-width: 1450px) {
  .desktop-playback-row {
    grid-template-columns: 46px 170px 190px minmax(300px, 1fr) 76px;
  }
}


/* Pass 21: screen-level display fit controls and WYSIWYG preview behavior */
.media-preview-panel,
.playback-carousel-card .media-preview-panel,
.desktop-playback-preview .media-preview-panel,
.slot-set-preview .media-preview-panel {
  overflow: hidden;
}
.media-preview-panel > img,
.media-preview-panel .video-poster-preview > img,
.viewport-img {
  object-fit: var(--display-object-fit, contain) !important;
  transform: var(--display-transform, none);
  transform-origin: center center;
}
.display-fit-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.screen-fit-mode-btn,
.screen-fit-reset-btn {
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.28);
  color: rgba(255,255,255,.72);
  border-radius: 6px;
  padding: 7px 8px;
  font: inherit;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
}
.screen-fit-mode-btn.active {
  background: var(--accent-purple);
  color: #fff;
  border-color: rgba(255,255,255,.2);
}
.display-fit-sliders {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(0,0,0,.18);
}
.display-fit-sliders label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 8px;
  color: rgba(255,255,255,.72);
  font-size: .67rem;
  font-weight: 700;
}
.display-fit-sliders input[type=range] { grid-column: 1 / -1; width: 100%; }
.display-fit-help { margin-top: 7px; color: rgba(255,255,255,.35); font-size: .61rem; line-height: 1.35; }

/* =========================================================
   Pass 22: asset-level fitting + permanent desktop row containment
   ========================================================= */
.media-preview-panel > img,
.media-preview-panel .video-poster-preview > img,
.viewport-img {
  object-fit: var(--asset-object-fit, contain) !important;
  transform: var(--asset-transform, none) !important;
  transform-origin: center center;
}

.asset-fit-controls-host {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.asset-fit-card {
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.asset-fit-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.asset-fit-heading strong { color:#fff; font-size:.76rem; }
.asset-fit-heading span { color:var(--text-muted); font-size:.6rem; }
.asset-fit-mode-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
}
.asset-fit-mode-btn,
.asset-fit-reset-btn {
  border:1px solid rgba(255,255,255,.1);
  border-radius:7px;
  background:rgba(0,0,0,.28);
  color:#fff;
  padding:8px 6px;
  font:700 .66rem inherit;
  cursor:pointer;
}
.asset-fit-mode-btn.active {
  border-color:var(--accent-purple);
  background:rgba(139,61,255,.22);
  color:#e9d5ff;
}
.asset-fit-sliders {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;
  gap:10px;
  align-items:end;
  margin-top:10px;
}
.asset-fit-sliders label {
  display:flex;
  flex-direction:column;
  gap:5px;
  color:var(--text-muted);
  font-size:.62rem;
}
.asset-fit-sliders input { width:100%; }

@media (min-width: 901px) {
  .desktop-playback-list {
    width: min(100%, 1020px) !important;
    max-width: 1020px !important;
    overflow: visible;
  }
  .desktop-playback-row {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: 42px 132px minmax(90px, 180px) minmax(0, 1fr) 62px !important;
    gap: 16px !important;
    overflow: hidden;
  }
  .desktop-playback-row > * { min-width: 0; }
  .desktop-playback-copy {
    overflow: hidden;
    min-width: 0;
  }
  .desktop-playback-copy strong,
  .desktop-playback-copy span {
    display:block;
    max-width:100%;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
  }
  .desktop-playback-edit {
    position: static !important;
    justify-self: end !important;
    min-width: 0 !important;
    max-width: 62px;
    white-space: nowrap;
  }
}

@media (min-width: 1450px) {
  .desktop-playback-row {
    grid-template-columns: 46px 150px 190px minmax(0, 1fr) 68px !important;
    gap: 18px !important;
  }
}

@media (max-width: 767px) {
  .asset-fit-mode-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .asset-fit-sliders { grid-template-columns:1fr; }
  .asset-fit-heading { align-items:flex-start; flex-direction:column; gap:3px; }
}

/* =========================================================
   Pass 23: phone Now window — wider stage, slim side arrows (Option B)
   Keep arrows as columns; expand stage + Now card toward card edges.
   Swipe left/right remains the primary browse gesture on phones.
   ========================================================= */
.playback-carousel {
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}

@media (max-width: 900px) {
  .screen-card {
    overflow-x: hidden;
  }

  .playback-carousel-host {
    width: calc(100% + 16px);
    max-width: none;
    margin-inline: -8px;
  }

  .playback-carousel-heading {
    padding-inline: 8px;
  }

  .playback-carousel-stage {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 4px;
    width: 100%;
  }

  .playback-arrow {
    align-self: stretch;
    min-width: 30px;
    min-height: 0;
    padding: 0;
    border-radius: 12px;
  }

  .playback-arrow span {
    font-size: 1.55rem;
  }

  .playback-slides,
  .playback-slide.is-current {
    width: 100%;
    max-width: none;
  }

  .playback-slide.is-current {
    padding: 12px 10px 14px;
  }

  .playback-carousel-preview.has-slot-captions {
    gap: 6px;
  }

  .playback-mobile-nav {
    margin: 8px 34px 0;
  }
}

@media (max-width: 560px) {
  .playback-carousel-host {
    width: calc(100% + 24px);
    margin-inline: -12px;
  }

  .playback-carousel-heading {
    padding-inline: 10px;
  }

  .playback-carousel-stage {
    grid-template-columns: 26px minmax(0, 1fr) 26px;
    gap: 3px;
  }

  .playback-arrow {
    min-width: 26px;
    border-radius: 10px;
  }

  .playback-arrow span {
    font-size: 1.45rem;
  }

  .playback-mobile-nav {
    margin: 8px 29px 0;
  }

  .playback-slide.is-current {
    padding: 11px 9px 13px;
  }
}
