/* PawCast Control – Dashboard Styles
   Consistent with local PawCast UI design system */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
@font-face {
  font-family: "Karla";
  src: url("/static/fonts/Karla-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("/static/fonts/Karla-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("/static/fonts/Karla-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("/static/fonts/Karla-BoldItalic.ttf") format("truetype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #0f1117;
  --surface: #1e2330;
  --surface2: #252b3b;
  --border: #2d3748;
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #6366f1;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --brand-header-bg: var(--surface);
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--brand-header-bg);
}
header h1 {
  font-size: 1.1rem;
  font-weight: 700;
}
header small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.hdr-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.hdr-logo {
  width: 1.85rem;
  height: 1.85rem;
  object-fit: contain;
  flex: 0 0 auto;
}
.hdr-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}
.hdr-account {
  position: relative;
}
.hdr-account-trigger {
  min-height: 2.4rem;
  padding-right: 0.5rem;
  padding-left: 0.75rem;
  border-radius: 999px;
}
.hdr-user {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
}
.hdr-user-label {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.hdr-account .hdr-account-menu {
  left: auto;
  top: calc(100% + 0.5rem);
  right: max(0.5rem, env(safe-area-inset-right));
  width: min(220px, calc(100vw - 1rem - env(safe-area-inset-right)));
  min-width: 0;
  max-width: calc(100vw - 1rem - env(safe-area-inset-right));
  gap: 0.35rem;
  padding: 0.5rem;
  border-radius: 12px;
  border-color: #374151;
  transform: none;
  transform-origin: top right;
  background: rgba(37, 43, 59, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.44);
}
.hdr-account-menu .btn {
  justify-content: flex-start;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 500;
}
.hdr-account-menu .btn:hover:not(:disabled) {
  border-color: #3b465d;
  background: rgba(99, 102, 241, 0.08);
  filter: none;
}
.hdr-account-menu .btn:active:not(:disabled) {
  background: rgba(99, 102, 241, 0.12);
}
.hdr-account-menu .btn + .btn {
  margin-top: 0;
}
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(135deg, #1f6feb 0%, #0f766e 100%);
  color: #f8fafc;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-avatar-sm {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.7rem;
}
.user-avatar-md {
  width: 2.3rem;
  height: 2.3rem;
  font-size: 0.82rem;
}
.user-avatar-lg {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.3rem;
}
.profile-avatar-field {
  .hdr-account-menu {
    right: max(0.5rem, env(safe-area-inset-right));
    top: calc(100% + 0.45rem);
    width: calc(100vw - 1rem - env(safe-area-inset-right));
    max-width: min(220px, calc(100vw - 1rem - env(safe-area-inset-right)));
  }
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
}
.profile-avatar-preview {
  display: inline-flex;
}
.profile-avatar-visual {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
}
.profile-avatar-copy {
  flex: 1;
}
.profile-avatar-copy label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
}
.users-user-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.hdr-notifications {
  position: relative;
}
.notifications-icon-btn {
  position: relative;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
}
.notifications-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(440px, 92vw);
  max-height: min(70vh, 680px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111722;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
  z-index: 2300;
}
.live-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.74rem;
  color: var(--muted);
}
.live-badge.on {
  border-color: #166534;
  background: #0f2a1b;
  color: #86efac;
}
.live-badge.off {
  border-color: #7f1d1d;
  background: #2b1616;
  color: #fda4af;
}
.live-badge.wait {
  border-color: #334155;
  background: #1e293b;
  color: #cbd5e1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border-radius: 7px;
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: filter 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.12);
}
.btn:active:not(:disabled) {
  filter: brightness(0.9);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}
.btn-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
}
.btn-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-icon-only {
  min-width: 2rem;
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

/* Status dot */
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.dot.on {
  background: var(--success);
  box-shadow: 0 0 5px #22c55e88;
}
.dot.off {
  background: var(--danger);
  box-shadow: 0 0 5px #ef444488;
}
.dot.virtual {
  background: #818cf8;
  box-shadow: 0 0 5px #818cf888;
}
.dot.wait {
  background: #94a3b8;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.form-group-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.form-group-inline input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
}
.form-group-inline label {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0;
}
.form-hint {
  font-size: 0.76rem;
  color: var(--muted);
  display: block;
  margin-top: 0.1rem;
}
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
input:focus {
  border-color: var(--accent);
}

/* Login overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
}
.login-box {
  width: 100%;
  max-width: 360px;
  margin: 1rem;
  padding: 2rem;
  border-top: 3px solid var(--accent);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.login-logo {
  width: 2.1rem;
  height: 2.1rem;
  object-fit: contain;
  flex: 0 0 auto;
}
.login-brand-copy {
  min-width: 0;
}
.login-title {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.2;
}
.login-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.15rem 0 0;
}
.login-box .btn {
  width: 100%;
  justify-content: center;
  margin-top: 0.7rem;
}
.login-error {
  color: var(--danger);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 0.6rem;
  min-height: 1.1em;
}

/* Main container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

/* Dashboard toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.toolbar h2 {
  font-size: 1rem;
  font-weight: 600;
}
.toolbar-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.toolbar-dropdown {
  position: relative;
}
.toolbar-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 170px;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.38rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #141b28;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  z-index: 60;
}
.toolbar-dropdown-trigger {
  display: inline-flex;
  align-items: center;
}
.toolbar-dropdown-caret {
  font-size: 0.72rem;
  color: var(--muted);
}
.toolbar-dropdown.open .toolbar-dropdown-trigger {
  border-color: #475569;
  background: #1a2234;
}
.toolbar-dropdown.open .toolbar-dropdown-menu {
  display: flex;
}
.toolbar-dropdown.open .toolbar-dropdown-caret {
  color: #c7d2fe;
}
.toolbar-dropdown-menu .btn {
  width: 100%;
  justify-content: flex-start;
}
.notifications-unread {
  position: absolute;
  top: -0.25rem;
  right: -0.28rem;
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 1px solid #7f1d1d;
  background: #b91c1c;
  color: #fff;
  font-size: 0.63rem;
  line-height: 1;
  padding: 0 0.24rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.motd-board-section {
  margin-top: 1.2rem;
}
.motd-section {
  display: grid;
  gap: 0.8rem;
}
.motd-board-list {
  display: grid;
  gap: 0.8rem;
}
.motd-board-card {
  padding: 0.85rem;
}
.motd-board-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.motd-board-head h3 {
  margin: 0;
  font-size: 0.96rem;
}
.motd-board-meta {
  color: var(--muted);
  font-size: 0.76rem;
}
.motd-loop-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.95rem;
}
.motd-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.motd-dropzone {
  border: 2px dashed #334155;
  border-radius: 10px;
  background: #111722;
  color: #a0b2cf;
  text-align: center;
  padding: 0.75rem;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  margin-bottom: 0.55rem;
}
.motd-dropzone:hover,
.motd-dropzone.over {
  border-color: #6366f1;
  background: #1a2232;
  color: #dbe4ff;
}
.motd-slides-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  min-height: 42px;
  position: relative;
  padding-right: 0.24rem;
}
.motd-slides-strip.motd-animating {
  pointer-events: none;
}
.motd-slides-strip.motd-strip-drop-end::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a5b4fc 0%, #6366f1 100%);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
  animation: motd-drop-marker-pulse 0.9s ease-in-out infinite alternate;
}
.motd-slide-tile {
  width: 160px;
  background: #121826;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
  display: grid;
  position: relative;
  will-change: transform;
}
.motd-slide-tile.motd-flip-moving {
  z-index: 5;
}
.motd-slide-tile.motd-flip-source {
  z-index: 6;
  box-shadow: 0 12px 30px rgba(2, 9, 23, 0.45);
}
.motd-slide-tile:hover {
  border-color: #64748b;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.35);
}
.motd-slides-strip.motd-animating .motd-slide-tile:hover {
  transform: none;
  box-shadow: none;
}
.motd-slide-tile.motd-slide-dragging {
  opacity: 0.42;
  transform: scale(0.96) rotate(-1deg);
  cursor: grabbing;
}
.motd-slide-tile img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0b0f17;
}
.motd-slide-tile img.motd-slide-preview {
  cursor: zoom-in;
}
.motd-slide-tile .motd-slide-caption {
  display: block;
  font-size: 0.68rem;
  color: #cbd5e1;
  padding: 0.28rem 0.36rem 0.38rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.motd-slide-actions-overlay {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: inline-flex;
  gap: 0.25rem;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
  z-index: 2;
}
.motd-slide-tile:hover .motd-slide-actions-overlay {
  opacity: 1;
  transform: translateY(0);
}
.motd-slide-actions-overlay .btn {
  min-height: 1.7rem;
  width: 1.7rem;
  padding: 0;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  border-color: #475569;
}
.motd-slide-actions-overlay .btn .btn-icon {
  width: 16px;
  height: 16px;
}
.motd-slide-tile.motd-slide-drop-before::before,
.motd-slide-tile.motd-slide-drop-after::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #a5b4fc 0%, #6366f1 100%);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
  pointer-events: none;
  animation: motd-drop-marker-pulse 0.9s ease-in-out infinite alternate;
  z-index: 3;
}
.motd-slide-tile.motd-slide-drop-before::before {
  left: 3px;
}
.motd-slide-tile.motd-slide-drop-after::after {
  right: 3px;
}
.motd-slide-tile.motd-slide-drop-before {
  box-shadow:
    inset 5px 0 0 rgba(99, 102, 241, 0.35),
    0 0 0 1px rgba(99, 102, 241, 0.28);
}
.motd-slide-tile.motd-slide-drop-after {
  box-shadow:
    inset -5px 0 0 rgba(99, 102, 241, 0.35),
    0 0 0 1px rgba(99, 102, 241, 0.28);
}
@keyframes motd-drop-marker-pulse {
  from {
    opacity: 0.65;
    transform: scaleY(0.95);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}
.motd-empty-slides {
  color: var(--muted);
  font-size: 0.8rem;
}
.motd-actions {
  margin-top: 0.62rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.motd-whatsapp-status {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  min-width: 180px;
  max-width: min(720px, 100%);
  overflow-wrap: anywhere;
}
.motd-whatsapp-status-ok {
  color: #7dd3a8;
}
.motd-whatsapp-status-error {
  color: #fca5a5;
}
.motd-whatsapp-status-warn {
  color: #fbbf24;
}
.motd-whatsapp-status-busy {
  color: #93c5fd;
}
.motd-progress-panel {
  margin-top: 0.55rem;
}
.motd-board-card.motd-board-card-reordering .motd-progress-panel {
  display: none;
}
.motd-dispatch-panel {
  margin-top: 0.65rem;
  border-top: 1px solid #273449;
  padding-top: 0.55rem;
}
.motd-dispatch-title {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.motd-device-list {
  display: grid;
  gap: 0.42rem;
}
.motd-device-row {
  border: 1px solid #273449;
  border-radius: 9px;
  background: #0f1623;
  padding: 0.45rem 0.52rem;
}
.motd-device-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
}
.motd-device-name {
  font-size: 0.76rem;
  color: #e2e8f0;
}
.motd-device-id {
  font-size: 0.68rem;
  color: #94a3b8;
}
.motd-device-states {
  margin-top: 0.28rem;
  display: grid;
  gap: 0.2rem;
}
.motd-device-state {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.68rem;
  color: #cbd5e1;
}
.motd-device-render-progress {
  margin-top: 0.32rem;
}
.motd-device-render-label {
  margin-top: 0.14rem;
  font-size: 0.66rem;
  color: #93a6c7;
}
.motd-settings-modal {
  max-width: 760px;
  width: min(96vw, 760px);
}
.motd-slide-modal {
  max-width: 620px;
  width: min(96vw, 620px);
}
.motd-quick-message-modal {
  max-width: 760px;
  width: min(96vw, 760px);
}
.motd-slide-modal-overlay {
  z-index: 1950;
}
.motd-quick-message-list {
  max-height: min(58vh, 620px);
  overflow: auto;
  display: grid;
  gap: 0.7rem;
  margin-top: 0.65rem;
  padding-right: 0.2rem;
}
.motd-quick-message-entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  padding: 0.65rem;
  display: grid;
  gap: 0.48rem;
}
.motd-quick-message-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.motd-quick-message-text {
  min-height: 160px;
  resize: vertical;
}
.motd-media-browser-modal {
  max-width: 1040px;
  width: min(96vw, 1040px);
}
.motd-media-browser-window {
  position: fixed;
  z-index: 1880;
  width: min(1120px, 88vw);
  max-height: min(82vh, 760px);
  background: #0d1522;
  border: 1px solid #2b3d57;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 72px rgba(1, 6, 18, 0.6);
  display: grid;
  grid-template-rows: auto auto minmax(120px, 1fr) auto;
}
.motd-media-browser-window-dragging {
  cursor: grabbing;
  user-select: none;
}
.motd-media-browser-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 0.85rem 0.65rem;
  background: #111a2a;
  border-bottom: 1px solid #223148;
  cursor: grab;
}
.motd-media-browser-head-title h3 {
  margin: 0;
  font-size: 0.95rem;
}
.motd-media-browser-head-title p {
  margin: 0.3rem 0 0;
}
.motd-media-browser-controls {
  display: flex;
  align-items: end;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem 0.55rem;
  border-bottom: 1px solid #1f2c40;
}
.motd-media-browser-controls label {
  display: grid;
  gap: 0.28rem;
  min-width: 240px;
}
.motd-media-browser-controls span {
  font-size: 0.72rem;
  color: #9fb2cf;
}
.motd-media-browser-footnote {
  padding: 0.5rem 0.85rem 0.62rem;
  border-top: 1px solid #1f2c40;
  font-size: 0.7rem;
  color: #98abc6;
}
.motd-library-body {
  max-height: none;
  overflow: auto;
  padding: 0.65rem 0.85rem 0.7rem;
  display: grid;
  gap: 0.62rem;
}
.motd-library-board {
  border: 1px solid #263246;
  border-radius: 10px;
  background: #0d1522;
  padding: 0.52rem 0.55rem;
}
.motd-library-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.42rem;
  cursor: pointer;
}
.motd-library-folder-title-wrap {
  flex: 1;
  min-width: 0;
}
.motd-library-board h4 {
  margin: 0;
  font-size: 0.85rem;
}
.motd-library-folder-toggle {
  width: 1.8rem;
  min-width: 1.8rem;
  padding: 0;
}
.motd-library-grid {
  margin-top: 0.48rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.55rem;
}
.motd-library-tile {
  border: 1px solid #2b3b54;
  border-radius: 10px;
  background: #111b2b;
  padding: 0.35rem;
  display: grid;
  gap: 0.28rem;
  cursor: grab;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}
.motd-library-tile:hover {
  border-color: #6d80a0;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(2, 9, 23, 0.33);
}
.motd-library-tile img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #05080f;
}
.motd-library-file-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: 1px dashed #385274;
  background: #0a121f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9fb3d2;
}
.motd-library-file-placeholder .btn-icon {
  width: 22px;
  height: 22px;
}
.motd-library-title {
  font-size: 0.72rem;
  color: #d8e0ef;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.motd-library-meta {
  font-size: 0.64rem;
  color: #91a5c6;
}
.motd-library-actions {
  margin-top: 0.2rem;
  display: flex;
  gap: 0.28rem;
}
.motd-library-orphan {
  border-style: dashed;
}
.motd-drag-ghost {
  position: fixed;
  left: -9999px;
  top: -9999px;
  pointer-events: none;
  opacity: 0.92;
  transform: rotate(-1deg);
  box-shadow: 0 18px 32px rgba(2, 9, 23, 0.55);
}
.motd-toolbar-actions .motd-toolbar-input {
  min-height: 2.2rem;
}
.motd-toolbar-actions .motd-toolbar-btn {
  min-height: 2.2rem;
}
.motd-slide-modal-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.motd-slide-modal-preview img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #020617;
}

.media-gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: blur(3px);
  display: grid;
  grid-template-columns: minmax(3rem, 6rem) minmax(0, 1fr) minmax(3rem, 6rem);
  align-items: center;
  gap: clamp(0.45rem, 1.6vw, 1rem);
  padding: clamp(0.75rem, 2vw, 1.35rem);
}
.media-gallery-stage {
  margin: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.75rem;
  justify-items: center;
  align-items: center;
  max-height: calc(100vh - 2rem);
}
.media-gallery-image-wrap {
  max-width: min(82vw, 1680px);
  max-height: calc(100vh - 8.6rem);
  border-radius: 8px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-gallery-image-wrap img,
.media-gallery-image-wrap video {
  display: block;
  max-width: min(82vw, 1680px);
  max-height: calc(100vh - 8.6rem);
  width: auto;
  height: auto;
  object-fit: contain;
}
.media-gallery-caption {
  width: min(82vw, 1680px);
  color: #e5edf8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  min-width: 0;
}
.media-gallery-caption-main {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}
.media-gallery-caption-main strong,
.media-gallery-caption-main span {
  overflow-wrap: anywhere;
}
.media-gallery-context {
  font-size: 0.72rem;
  color: #93a6c7;
}
.media-gallery-caption-main strong {
  font-size: 0.9rem;
}
.media-gallery-caption-main span:not(.media-gallery-context) {
  font-size: 0.76rem;
  color: #b6c6df;
}
.media-gallery-caption-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}
.media-gallery-count {
  color: #cbd5e1;
  font-size: 0.78rem;
  min-width: 3.2rem;
  text-align: right;
}
.media-gallery-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.45rem;
  min-width: 2.45rem;
  height: 2.45rem;
  padding: 0;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.76);
  border-color: rgba(148, 163, 184, 0.32);
  z-index: 2;
}
.media-gallery-nav {
  justify-self: center;
  width: clamp(2.8rem, 5vw, 3.5rem);
  min-width: clamp(2.8rem, 5vw, 3.5rem);
  height: clamp(2.8rem, 5vw, 3.5rem);
  padding: 0;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.32);
}
.media-gallery-nav .btn-icon,
.media-gallery-close .btn-icon {
  width: 22px;
  height: 22px;
}
@media (max-width: 720px) {
  .media-gallery-overlay {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.75rem;
  }
  .media-gallery-stage {
    width: 100%;
  }
  .media-gallery-image-wrap,
  .media-gallery-image-wrap img,
  .media-gallery-image-wrap video,
  .media-gallery-caption {
    max-width: calc(100vw - 1.5rem);
    width: calc(100vw - 1.5rem);
  }
  .media-gallery-caption {
    flex-direction: column;
    gap: 0.45rem;
  }
  .media-gallery-caption-actions {
    width: 100%;
    justify-content: space-between;
  }
  .media-gallery-nav {
    position: fixed;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 2.55rem;
    min-width: 2.55rem;
    height: 2.55rem;
  }
  .media-gallery-nav-prev {
    left: 0.45rem;
  }
  .media-gallery-nav-next {
    right: 0.45rem;
  }
}

/* Device card */
.device-card {
  cursor: default;
  transition: border-color 0.15s;
}
.device-card:hover {
  border-color: var(--accent);
}
.device-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: margin-bottom 0.22s ease;
}
.device-card-header:focus-visible {
  box-shadow: 0 0 0 2px rgba(124, 163, 216, 0.55);
}
.device-card-collapsed .device-card-header {
  margin-bottom: 0;
}
.device-card-header .dot {
  margin-top: 1px;
}
.device-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.device-card-header .device-id {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.device-id-virtual {
  color: #818cf8;
  background: #1e1b4b;
  border: 1px solid #4338ca44;
}
.device-card-virtual {
  border-color: #4338ca66;
  opacity: 0.85;
}
.device-card-virtual:hover {
  border-color: #818cf8;
}
.muted-placeholder {
  color: var(--muted) !important;
  font-style: italic;
}
.device-card-body {
  font-size: 0.82rem;
  color: var(--muted);
  max-height: 32rem;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition:
    max-height 0.24s ease,
    opacity 0.18s ease,
    transform 0.22s ease;
}
.device-card-collapsed .device-card-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.18rem);
}
.device-card-body .row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
}
.device-card-body .row .val {
  color: var(--text);
}
.device-two-line {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.12rem;
}
.device-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
}
.device-group-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #334155;
  background: #121c2d;
  color: #c7d2e6;
  border-radius: 999px;
  padding: 0.12rem 0.44rem;
  font-size: 0.68rem;
}
.device-group-chip-slate {
  background: #263244;
  border-color: #475569;
  color: #e2e8f0;
}
.device-group-chip-blue {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #eff6ff;
}
.device-group-chip-cyan {
  background: #0e7490;
  border-color: #67e8f9;
  color: #ecfeff;
}
.device-group-chip-green {
  background: #15803d;
  border-color: #86efac;
  color: #f0fdf4;
}
.device-group-chip-amber {
  background: #b45309;
  border-color: #fcd34d;
  color: #fffbeb;
}
.device-group-chip-orange {
  background: #c2410c;
  border-color: #fdba74;
  color: #fff7ed;
}
.device-group-chip-rose {
  background: #be123c;
  border-color: #fda4af;
  color: #fff1f2;
}
.device-group-chip-violet {
  background: #6d28d9;
  border-color: #c4b5fd;
  color: #f5f3ff;
}
.device-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  transition: margin-top 0.22s ease;
}
.device-card-collapsed .device-card-actions {
  margin-top: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
  .device-card-header,
  .device-card-body,
  .device-card-actions {
    transition: none;
  }
}

/* Skeleton loading cards */
.skeleton-card {
  pointer-events: none;
  padding: 1.2rem;
}
.skeleton-line {
  height: 0.85rem;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    var(--border) 50%,
    var(--surface2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  margin-bottom: 0.6rem;
}
.skeleton-title {
  height: 1.1rem;
  width: 55%;
  margin-bottom: 0.9rem;
}
.skeleton-short {
  width: 40%;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Register modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  overflow: hidden;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 420px;
  max-width: 90vw;
  overscroll-behavior: contain;
}
.modal h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.app-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 12, 0.72);
}
.app-dialog-modal {
  width: min(520px, 96vw);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.app-dialog-head {
  padding: 0.72rem 0.85rem 0.62rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.96rem;
  font-weight: 600;
}
.app-dialog-body {
  padding: 0.8rem 0.85rem 0.82rem;
}
.app-dialog-message {
  color: #d6deef;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}
.app-dialog-input {
  margin-top: 0.65rem;
}
.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem 0.8rem;
  border-top: 1px solid var(--border);
  background: #171c27;
}
.modal-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.modal-shell-head h3 {
  margin-bottom: 0;
}
#audit-modal .modal-shell-head {
  position: relative;
  z-index: 5;
  background: var(--surface);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}
#control-settings-modal .modal-shell-head {
  position: relative;
  z-index: 5;
  background: var(--surface);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}
.bulk-modal {
  width: min(920px, 96vw);
  max-height: calc(100vh - 2.5rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}
.bulk-modal > h3,
.bulk-modal > .modal-shell-head {
  flex: 0 0 auto;
}
.bulk-modal > :is(
    #users-modal-content,
    #groups-modal-content,
    #organizer-modal-content,
    #bulk-schedule-content,
    #control-settings-content,
    #audit-modal-content
  ) {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 0.12rem;
}
#control-settings-modal .bulk-modal {
  width: min(1180px, 97vw);
}
.control-settings-split {
  margin-top: 0.35rem;
}
.control-settings-sidebar {
  min-width: 220px;
}
.control-settings-content-scroll {
  min-height: 360px;
  max-height: calc(100vh - 12rem);
}
.control-settings-stack {
  display: grid;
  gap: 0.65rem;
}
#control-settings-modal .detail-doc-hint {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.f-in {
  width: 100%;
  max-width: 360px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.32rem 0.5rem;
  font-size: 0.82rem;
}
textarea.f-in {
  max-width: 560px;
  min-height: 64px;
  resize: vertical;
  line-height: 1.35;
  font-family: inherit;
}
.field-error {
  display: block;
  margin-top: 0.36rem;
  color: #fca5a5;
  font-size: 0.76rem;
}
.control-media-exts {
  min-height: 72px;
}
.control-media-toggle-cell {
  display: grid;
  gap: 0.42rem;
  padding: 0.06rem 0;
}
.control-media-toggle-line {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}
.control-media-toggle-line > span {
  line-height: 1.32;
}
.control-media-input-cell {
  display: grid;
  gap: 0.42rem;
}
.control-media-inline-hint {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #171c27;
  padding: 0.36rem 0.55rem;
  max-width: 720px;
}
.control-cache-rollout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.control-deploy-time-input {
  min-width: 132px;
  max-width: 132px;
  width: 132px;
  color-scheme: dark;
}
.control-deploy-time-input::-webkit-calendar-picker-indicator {
  filter: invert(0.82);
  opacity: 0.9;
}
.control-audit-stack {
  display: grid;
  gap: 0.65rem;
}
.audit-table-scroll {
  max-height: clamp(260px, 40vh, 460px);
  overflow: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.audit-table-scroll .detail-table {
  border-top: none;
}
.audit-table-scroll .detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface2);
}
#control-settings-modal .audit-table-scroll {
  max-height: clamp(220px, 34vh, 380px);
}
#audit-modal .audit-table-scroll {
  max-height: clamp(260px, 48vh, 620px);
}
.control-health-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.control-health-head-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.control-settings-inline-error {
  margin-top: 0;
}
.whatsapp-settings-section {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}
.whatsapp-panel {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.whatsapp-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem;
  min-height: 46px;
  color: var(--text);
  background: var(--surface2);
  font-weight: 750;
  font-size: 0.92rem;
}
.whatsapp-setting-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  padding: 0.72rem;
  border-top: 1px solid var(--border);
}
.whatsapp-setting-label {
  color: var(--text);
  font-weight: 650;
}
.whatsapp-setting-content {
  min-width: 0;
}
.whatsapp-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.whatsapp-links-table th,
.whatsapp-links-table td {
  background: transparent;
}
.whatsapp-setting-content .detail-footnote,
.whatsapp-settings-footnote {
  border-top: 0;
  background: transparent;
  padding: 0.42rem 0 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.whatsapp-settings-footnote {
  padding: 0.15rem 0.2rem 0.1rem;
}
.whatsapp-new-link-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  max-width: 680px;
}
.whatsapp-new-link-grid .detail-select-inline,
.whatsapp-template-grid .detail-select-inline {
  width: 100%;
  min-width: 0;
  max-width: none;
}
.whatsapp-new-link-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.5rem;
}
.whatsapp-template-grid {
  display: grid;
  align-items: center;
  gap: 0.45rem;
}
.whatsapp-template-grid {
  margin-top: 0.55rem;
  grid-template-columns: minmax(0, 1fr);
  max-width: 680px;
}
.whatsapp-template-grid input[type="color"] {
  width: 48px;
  min-width: 48px;
  height: 36px;
  padding: 0.1rem;
}
.whatsapp-template-filter {
  min-width: 0;
}
.whatsapp-new-link-actions .motd-loop-toggle {
  flex: 0 0 auto;
  margin-top: 0;
  min-height: 36px;
  white-space: nowrap;
}
.whatsapp-new-link-advanced {
  margin-top: 0.6rem;
  max-width: 720px;
}
.whatsapp-new-link-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
}
.whatsapp-links-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.whatsapp-links-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.78rem;
}
.whatsapp-links-table thead th {
  background: var(--surface2);
}
.whatsapp-links-table th,
.whatsapp-links-table td {
  vertical-align: middle;
  padding: 0.42rem 0.34rem;
  box-sizing: border-box;
}
.whatsapp-col-group {
  width: 120px;
}
.whatsapp-col-board {
  width: 100px;
}
.whatsapp-col-status {
  width: 220px;
}
.whatsapp-col-count {
  width: 56px;
}
.whatsapp-col-toggle {
  width: 50px;
}
.whatsapp-col-interval {
  width: 82px;
}
.whatsapp-col-slides {
  width: 96px;
}
.whatsapp-col-media {
  width: 98px;
}
.whatsapp-col-filter {
  width: 118px;
}
.whatsapp-col-actions {
  width: 162px;
}
.whatsapp-link-name,
.whatsapp-link-board {
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.whatsapp-fetch-status {
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
}
.whatsapp-fetch-next {
  margin-top: 0.14rem;
  color: var(--muted);
  opacity: 0.9;
}
.whatsapp-fetch-status-ok {
  color: #7dd3a8;
}
.whatsapp-fetch-status-error {
  color: #fca5a5;
}
.whatsapp-fetch-status-warn {
  color: #fbbf24;
}
.whatsapp-fetch-status-busy {
  color: #93c5fd;
}
.whatsapp-link-toggle {
  text-align: center;
}
.whatsapp-link-count {
  text-align: center;
  color: var(--text);
  font-weight: 700;
}
.whatsapp-links-table .whatsapp-link-interval,
.whatsapp-links-table .whatsapp-link-slide-mode,
.whatsapp-links-table .whatsapp-link-media-mode,
.whatsapp-links-table .whatsapp-link-filter {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.whatsapp-link-filter {
  min-height: 42px;
  resize: vertical;
}
.whatsapp-link-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
}
.whatsapp-link-actions .btn {
  justify-content: center;
  min-height: 1.9rem;
  min-width: 1.9rem;
  padding-inline: 0.28rem;
}
.whatsapp-link-editor-overlay {
  z-index: 2080;
}
.whatsapp-link-editor-modal {
  width: min(980px, 96vw);
  border-radius: 8px;
  padding: 0.95rem;
}
.whatsapp-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.whatsapp-editor-head h3 {
  margin: 0;
}
.whatsapp-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}
.whatsapp-editor-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  background: var(--surface2);
}
.whatsapp-editor-panel-wide {
  grid-column: 1 / -1;
}
.whatsapp-editor-panel h4 {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
}
.whatsapp-editor-panel label {
  display: grid;
  gap: 0.28rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.76rem;
}
.whatsapp-link-editor-modal input.detail-select:not([type="color"]),
.whatsapp-link-editor-modal select.detail-select {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  padding-block: 0;
  line-height: 38px;
}
.whatsapp-link-editor-modal textarea.detail-select {
  box-sizing: border-box;
}
.whatsapp-editor-panel .motd-loop-toggle {
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 0.8rem;
}
.whatsapp-mode-row,
.whatsapp-editor-inline,
.whatsapp-bg-preview-actions,
.whatsapp-bg-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.whatsapp-editor-fields-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.whatsapp-bg-preview {
  display: grid;
  gap: 0.45rem;
}
.whatsapp-bg-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.whatsapp-bg-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 132px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}
.whatsapp-bg-preview > .detail-footnote {
  margin: 0.05rem -0.8rem -0.8rem;
  padding-inline: 1.2rem;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}
.whatsapp-bg-library-overlay {
  z-index: 2090;
  background: rgba(2, 6, 12, 0.72);
}
.whatsapp-bg-library-modal {
  width: min(1240px, 96vw);
  border-radius: 8px;
}
.whatsapp-bg-upload-row {
  margin-bottom: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}
.whatsapp-bg-upload-row label {
  display: grid;
  gap: 0.25rem;
  min-width: min(320px, 100%);
  color: var(--muted);
  font-size: 0.76rem;
}
.whatsapp-bg-library-body {
  max-height: min(62vh, 620px);
  overflow: auto;
}
.whatsapp-bg-library-tile {
  text-align: left;
  cursor: pointer;
}
.whatsapp-bg-library-tile.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.whatsapp-bg-media-toolbar {
  margin: 0 -0.1rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.whatsapp-bg-media-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 0.8rem;
  min-height: 430px;
}
.whatsapp-bg-media-browser {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.whatsapp-bg-media-grid {
  padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.whatsapp-bg-media-tile .media-tile-actions {
  justify-content: flex-end;
}
.whatsapp-bg-media-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #151c2a;
  overflow: hidden;
  align-self: start;
}
.whatsapp-bg-media-preview-frame {
  aspect-ratio: 16 / 9;
  background: #0b111b;
  display: flex;
  align-items: center;
  justify-content: center;
}
.whatsapp-bg-media-preview-frame img,
.whatsapp-bg-media-preview-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.whatsapp-bg-media-preview-empty {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #8190aa;
  font-weight: 700;
}
.whatsapp-bg-media-info {
  display: grid;
  gap: 0.32rem;
  padding: 0.72rem;
  color: #aeb9cd;
  font-size: 0.76rem;
  line-height: 1.35;
  border-top: 1px solid var(--border);
}
.whatsapp-bg-media-preview > .btn {
  margin: 0 0.72rem 0.72rem;
  width: calc(100% - 1.44rem);
  justify-content: center;
}
.whatsapp-bg-media-preview > .detail-footnote {
  margin: -0.3rem 0.72rem 0.72rem;
}
.whatsapp-bg-media-loading {
  padding: 1rem;
}
@media (max-width: 900px) {
  .whatsapp-bg-media-layout {
    grid-template-columns: 1fr;
  }
  .whatsapp-bg-media-preview {
    order: -1;
  }
}
.whatsapp-recent-panel {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.72rem;
}
.whatsapp-contacts-panel {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.72rem;
}
.whatsapp-contacts-panel > .detail-footnote {
  margin: 0.62rem -0.72rem -0.72rem;
  padding: 0.55rem 0.72rem;
  border-top: 1px solid var(--border);
  background: #111722;
}
.whatsapp-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}
.whatsapp-recent-head h3 {
  margin: 0;
  font-size: 0.9rem;
}
.whatsapp-recent-list {
  display: grid;
  gap: 0.45rem;
  max-height: 320px;
  overflow: auto;
}
.whatsapp-recent-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
}
.whatsapp-recent-item:first-child {
  border-top: 0;
  padding-top: 0;
}
.whatsapp-recent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: baseline;
  min-width: 0;
}
.whatsapp-recent-meta strong {
  color: var(--text);
  overflow-wrap: anywhere;
}
.whatsapp-recent-meta span,
.whatsapp-recent-ignored {
  color: var(--muted);
  font-size: 0.76rem;
}
.whatsapp-recent-body {
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.whatsapp-mention {
  color: var(--wa-mention-color, #38bdf8);
  font-weight: 800;
  white-space: normal;
}
.whatsapp-recent-message {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.22rem;
  min-width: 0;
}
.whatsapp-recent-media-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #101722;
  color: #93c5fd;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
}
.whatsapp-recent-media-hint {
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.whatsapp-recent-content {
  min-width: 0;
}
.whatsapp-recent-avatar,
.whatsapp-contact-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--wa-contact-color, #0ea5e9) 18%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--wa-contact-color, #0ea5e9) 48%, transparent);
  font-weight: 750;
  line-height: 1;
  flex: 0 0 auto;
}
.whatsapp-recent-avatar {
  width: 38px;
  height: 38px;
  font-size: 0.72rem;
}
.whatsapp-contact-avatar {
  width: 44px;
  height: 44px;
  font-size: 0.78rem;
}
.whatsapp-recent-avatar img,
.whatsapp-contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.whatsapp-contact-create,
.whatsapp-contact-row {
  display: grid;
  grid-template-columns: minmax(160px, 260px) minmax(190px, 360px) max-content auto;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
}
.whatsapp-contact-create {
  margin-bottom: 0.55rem;
}
.whatsapp-contact-list {
  display: grid;
  gap: 0.45rem;
}
.whatsapp-contact-row {
  grid-template-columns: 44px minmax(340px, 560px) minmax(0, 1fr);
  padding: 0.48rem 0;
  border-top: 1px solid var(--border);
}
.whatsapp-contact-fields {
  display: grid;
  grid-template-columns: minmax(140px, 210px) minmax(170px, 270px) max-content;
  gap: 0.45rem;
  min-width: 0;
}
.whatsapp-contact-create .detail-select-inline,
.whatsapp-contact-fields .detail-select-inline {
  width: 100%;
  min-width: 0;
  max-width: none;
}
.whatsapp-contact-color-field {
  display: grid;
  grid-template-columns: auto 42px;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
}
.whatsapp-contact-color-field input[type="color"] {
  width: 42px;
  height: 2.3rem;
  min-height: 2.3rem;
  padding: 0.15rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.whatsapp-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}
.hidden-file-input {
  display: none;
}
.whatsapp-live-status {
  margin-top: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 520px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
}
.whatsapp-live-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
  flex: 0 0 auto;
}
.whatsapp-btn-spinner {
  width: 13px;
  height: 13px;
  border-width: 2px;
  margin-right: 0.35rem;
}
.whatsapp-live-copy {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
  flex: 1;
}
.whatsapp-live-copy strong {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 650;
}
.whatsapp-live-copy span {
  color: var(--muted);
  font-size: 0.76rem;
}
.whatsapp-live-progress {
  max-width: 100%;
  margin-top: 0.15rem;
}
@media (max-width: 900px) {
  .whatsapp-setting-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }
  .whatsapp-new-link-grid,
  .whatsapp-template-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .whatsapp-new-link-actions {
    gap: 0.5rem;
  }
  .whatsapp-template-grid input[type="color"] {
    width: 64px;
  }
  .whatsapp-contact-create,
  .whatsapp-contact-row,
  .whatsapp-contact-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .whatsapp-contact-actions {
    justify-content: flex-start;
  }
}
.control-settings-placeholder {
  min-height: 240px;
}
.control-settings-placeholder-body {
  padding: 0.75rem 0.85rem;
  display: grid;
  align-content: start;
  gap: 0.45rem;
}
.control-settings-placeholder-title {
  margin: 0;
  font-size: 0.92rem;
  color: #e6edf8;
}
.control-settings-device-targets-wrap .detail-table {
  min-width: 560px;
}
.bulk-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.4fr);
  gap: 0.9rem;
}
.bulk-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #171c27;
}
.bulk-card h4 {
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.bulk-card .tab-strip {
  margin: 0;
  padding: 0 0.65rem;
  border-bottom: 1px solid var(--border);
  background: #131925;
}
.bulk-card .tab-strip .tab-btn {
  font-size: 0.75rem;
  padding: 0.5rem 0.58rem;
}
.bulk-card-body {
  padding: 0.6rem 0.65rem;
}
.bulk-device-list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 0.35rem;
}
.bulk-device-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.36rem 0.45rem;
  font-size: 0.8rem;
}
.bulk-device-row .muted {
  font-size: 0.74rem;
  color: var(--muted);
}
.bulk-weekdays {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.36rem;
  margin-top: 0.45rem;
}
.bulk-weekdays label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.bulk-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}
.bulk-results {
  margin-top: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.bulk-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.bulk-results th,
.bulk-results td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.5rem;
  text-align: left;
}
.bulk-results tbody tr:last-child td {
  border-bottom: none;
}
.bulk-media-progress-stack {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.bulk-transfer-progress {
  margin: 0;
}
.bulk-cache-note {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #101622;
  padding: 0.5rem 0.6rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.bulk-cache-note strong {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-transfer-alert {
  border: 1px solid #6b4f1f;
  border-radius: 7px;
  background: #241b0c;
  color: #f3d38a;
  padding: 0.55rem 0.65rem;
  font-size: 0.76rem;
  line-height: 1.35;
}
.bulk-device-progress-list {
  display: grid;
  gap: 0.45rem;
  max-height: 300px;
  overflow: auto;
}
.bulk-pill {
  display: inline-flex;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
}
.bulk-pill.ok {
  color: #9ef1b7;
  border-color: #1f6d3c;
  background: #0f2a1b;
}
.bulk-pill.queue {
  color: #f6d38b;
  border-color: #87611f;
  background: #322712;
}
.bulk-pill.fail {
  color: #fecaca;
  border-color: #9f1d2a;
  background: #35141a;
}
.bulk-group-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
  align-items: center;
}
.detail-header-actions {
  margin-top: 0;
}
.users-modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.85rem;
}
.users-modal-tab {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition:
    color 0.15s,
    border-color 0.15s;
  user-select: none;
  white-space: nowrap;
}
.users-modal-tab:hover {
  color: var(--text);
}
.users-modal-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.users-modal-panel {
  display: none;
}
.users-modal-panel.active {
  display: block;
}
.users-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #171c27;
}
.users-card h4 {
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.users-card-body {
  padding: 0.65rem;
}
.users-card .form-group {
  margin-bottom: 0.7rem;
}
.users-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.users-table th,
.users-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}
.users-table tbody tr:last-child td {
  border-bottom: none;
}
.users-table .actions {
  width: 132px;
}
.users-form-actions {
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
  margin-top: 0.65rem;
}
.users-form-hint {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.notification-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}
.notification-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.notification-switch input {
  accent-color: var(--accent);
}
.notification-head {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  background: #121927;
  padding: 0.58rem 0.62rem 0.44rem;
}
.notification-tabs {
  display: flex;
  gap: 0.36rem;
  margin-top: 0.45rem;
}
.notification-tab {
  border: 1px solid var(--border);
  background: #1b2434;
  color: #c7d2e8;
  border-radius: 999px;
  padding: 0.2rem 0.52rem;
  font-size: 0.74rem;
  cursor: pointer;
}
.notification-tab.active {
  background: #334155;
  border-color: #475569;
  color: #fff;
}
.notification-list {
  border-top: 1px solid var(--border);
  overflow: hidden;
  background: #111722;
}
.notification-item {
  display: grid;
  grid-template-columns: 132px 1fr auto auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.52rem 0.68rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-item .kind {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notification-item .message {
  color: #dbe4f3;
  overflow-wrap: anywhere;
}
.notification-item .time {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  justify-self: end;
}
.notification-item.level-success .kind {
  color: #7ce3a2;
}
.notification-item.level-error .kind {
  color: #fda4af;
}
.notification-item.level-info .kind {
  color: #93c5fd;
}
.notification-row-actions {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  justify-self: end;
}
.notification-empty {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.8rem 0.68rem;
}

.group-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.2fr);
  gap: 0.9rem;
}
.group-list {
  display: grid;
  gap: 0.45rem;
  max-height: 380px;
  overflow: auto;
  padding-right: 0.2rem;
}
.group-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171c27;
  padding: 0.5rem 0.58rem;
  display: grid;
  gap: 0.35rem;
}
.group-item.active {
  border-color: var(--accent);
  background: #1d2340;
}
.group-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}
.group-item-name {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e7ecf8;
}
.group-color-dot {
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 999px;
  border-width: 1px;
  border-style: solid;
  flex: 0 0 auto;
}
.group-item-meta {
  color: var(--muted);
  font-size: 0.74rem;
}
.group-item-actions {
  display: flex;
  gap: 0.38rem;
}
.group-device-list {
  max-height: 290px;
  overflow: auto;
  display: grid;
  gap: 0.28rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.42rem 0.5rem;
  background: #101827;
}
.group-device-list label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #d3dcf1;
  font-size: 0.79rem;
}
.group-color-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.42rem;
}
.group-color-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.72;
}
.group-color-swatch:hover,
.group-color-swatch.active {
  opacity: 1;
}
.group-color-swatch.active {
  box-shadow: 0 0 0 2px rgba(226, 232, 240, 0.55);
}
.group-color-swatch:disabled {
  cursor: default;
}

/* Device detail modal */
.device-detail-overlay {
  align-items: flex-start;
  padding: 2.75rem 1rem 1rem;
  overflow-y: auto;
}
.device-detail-modal {
  width: min(1560px, 99vw);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.device-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.detail-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: -0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}
.detail-subtitle-part {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}
.detail-subtitle-groups {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
}
.detail-subtitle-empty {
  color: var(--muted);
  font-size: 0.76rem;
}
.device-group-chip-compact {
  padding: 0.08rem 0.36rem;
  font-size: 0.66rem;
}
.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 0.7rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition:
    color 0.15s,
    border-color 0.15s;
  user-select: none;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: transparent;
}
.detail-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.15rem;
}
.detail-loading {
  color: var(--muted);
  padding: 1.5rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-text {
  font-size: 0.9rem;
  color: var(--text);
}
.loading-subtext {
  font-size: 0.78rem;
  color: var(--muted);
}
.detail-error {
  color: var(--danger);
  border: 1px solid #7f1d1d;
  background: #2b1616;
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 0.84rem;
}
.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
}
.detail-row .val {
  color: var(--text);
  text-align: right;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.3rem;
}
.detail-schedule-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.detail-table thead {
  background: var(--surface2);
}
.detail-table th,
.detail-table td {
  text-align: left;
  padding: 0.55rem 0.72rem;
  border-bottom: 1px solid var(--border);
}
.detail-table tbody tr:last-child td {
  border-bottom: none;
}
.detail-select {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.32rem 0.5rem;
  font-size: 0.82rem;
}
.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.72rem;
  border-top: 1px solid var(--border);
  background: #171c27;
}
.detail-toolbar-wrap {
  row-gap: 0.45rem;
}
.detail-select-inline {
  width: auto;
  min-width: 220px;
  max-width: 360px;
}
.detail-toolbar-hint {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}
.detail-schedule-wrap > .detail-toolbar-hint {
  display: block;
  padding: 0.36rem 0.72rem 0.56rem;
  background: #171c27;
}
.detail-schedule-wrap > table + .detail-toolbar-hint,
.detail-schedule-wrap > .detail-toolbar + .detail-toolbar-hint,
.detail-schedule-wrap > .detail-footnote + .detail-toolbar-hint {
  border-top: 1px solid var(--border);
}
.detail-schedule-wrap > .detail-toolbar-hint + .detail-toolbar-hint {
  padding-top: 0.08rem;
  border-top: none;
}
.schedule-v2 {
  display: grid;
  gap: 14px;
  padding: 12px;
}
.schedule-v2-settings,
.schedule-v2-savebar {
  margin: -12px -12px 0;
  border-bottom: 1px solid var(--border);
  background: #141a26;
}
.schedule-v2-settings-row {
  margin: 0;
  padding: 0.55rem 0.72rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: transparent;
}
.schedule-v2-settings-row:last-child {
  border-bottom: 0;
}
.schedule-v2-savebar {
  margin-top: 0;
  margin-bottom: -12px;
  padding: 0.55rem 0.72rem;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}
.schedule-v2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
}
.schedule-v2-day,
.schedule-v2-exception {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.schedule-v2-day-head,
.schedule-v2-exception-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0.55rem 0.72rem;
  background: #171c27;
  border-bottom: 1px solid var(--border);
}
.schedule-v2-day-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.schedule-v2-day-action {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding-left: 0;
  padding-right: 0;
  color: var(--muted);
}
.schedule-v2-day-action:hover:not(:disabled) {
  color: var(--text);
}
.schedule-v2-slots {
  margin: 0;
  table-layout: fixed;
  width: 100%;
}
.schedule-v2-slots th:first-child,
.schedule-v2-slots td:first-child {
  width: 24px;
  min-width: 24px;
  padding-left: 0.28rem;
  padding-right: 0.12rem;
}
.schedule-v2-slots th:nth-child(2),
.schedule-v2-slots th:nth-child(3),
.schedule-v2-slots td:nth-child(2),
.schedule-v2-slots td:nth-child(3) {
  width: 86px;
}
.schedule-v2-slots th:last-child,
.schedule-v2-slot-row td:last-child {
  width: 42px;
  padding-left: 0.2rem;
  padding-right: 0.35rem;
}
.schedule-v2-slots input[type="time"].detail-select {
  width: 76px;
  min-width: 76px;
  padding-left: 0.45rem;
  padding-right: 0.35rem;
}
.schedule-v2-slots .btn-icon-only {
  width: 34px;
  min-width: 34px;
  padding-left: 0;
  padding-right: 0;
}
.schedule-v2-slot-row {
  transition: transform 170ms ease, background-color 140ms ease;
}
.schedule-v2-slot-row.schedule-v2-dragging {
  opacity: 0.62;
}
.schedule-v2-drag-cell {
  width: 24px;
  min-width: 24px;
  text-align: center;
}
.schedule-v2-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 28px;
  color: var(--muted);
  cursor: grab;
  border-radius: 6px;
}
.schedule-v2-drag-handle:active {
  cursor: grabbing;
}
.schedule-v2-drag-handle:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
}
.schedule-v2-row-invalid td {
  background: rgba(239, 68, 68, 0.06);
}
.schedule-v2-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.7) !important;
}
.schedule-v2-action-row td {
  padding-top: 0.34rem;
  padding-bottom: 0.34rem;
  background: rgba(96, 165, 250, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
}
.schedule-v2-action-row .detail-select {
  min-height: 30px;
  height: 30px;
  font-size: 0.8rem;
}
.schedule-v2-action-select-cell {
  width: 170px;
  max-width: 170px;
}
.schedule-v2-action-select-cell .detail-select {
  width: 158px;
  min-width: 158px;
  max-width: 158px;
}
.schedule-v2-system-row td {
  background: rgba(148, 163, 184, 0.08);
}
.schedule-v2-system-row .btn-icon {
  transform: translateY(1px);
}
.schedule-v2-timeline-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}
.schedule-v2-multi-btn {
  width: 100%;
  justify-content: center;
  min-height: 28px;
}
.schedule-v2-rotation-modal {
  width: min(560px, 96vw);
}
.schedule-v2-rotation-list {
  display: grid;
  gap: 6px;
  margin: 0.85rem 0;
  max-height: min(58vh, 520px);
  overflow: auto;
}
.schedule-v2-rotation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0.46rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #111827;
}
.schedule-v2-rotation-row.selected {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.11);
}
.schedule-v2-rotation-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}
.schedule-v2-rotation-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-v2-rotation-actions {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.schedule-v2-small {
  width: 86px;
  min-width: 86px;
}
.detail-footnote {
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.55rem 0.72rem;
  border-top: 1px solid var(--border);
  background: #171c27;
}
.detail-footnote-inline {
  color: var(--muted);
  font-size: 0.76rem;
}
.settings-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.34rem;
  height: 1.34rem;
  margin-left: 0.42rem;
  border: 1px solid #4d799b;
  border-radius: 999px;
  background: linear-gradient(160deg, #244165, #1a2f4b);
  color: #f7fbff;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  box-shadow: 0 2px 8px #00000040;
}
.settings-help-icon:hover {
  background: linear-gradient(160deg, #2f537f, #203959);
  border-color: #6aa2cc;
}
.detail-doc-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.settings-inline-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.77rem;
  text-decoration: none;
  color: #7fd8bf;
  border: 1px solid #275d5a;
  border-radius: 999px;
  background: #122527;
  padding: 0.16rem 0.48rem;
  white-space: nowrap;
}
.settings-inline-doc-link:hover {
  color: #b6f3e1;
  border-color: #35837d;
  background: #173033;
}

/* -- Status tab layout -- */
.status-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.status-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem;
  background: #171c27;
  min-height: 100%;
}
.status-panel-title {
  margin: 0 0 0.2rem;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.54rem 0.7rem;
  font-size: 0.82rem;
  background: #141b28;
}
.status-info-row[role="button"] {
  cursor: pointer;
}
.status-info-row[role="button"]:hover {
  border-color: #3d4a62;
  background: #1a2230;
}
.status-info-body {
  min-width: 0;
  flex: 1;
}
.status-info-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
}
.status-info-sub {
  margin-top: 0.18rem;
  color: #9fb0c8;
  font-size: 0.74rem;
}
.status-issue-card {
  border: 1px solid #991b1b;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.32);
  padding: 0.62rem 0.72rem;
  color: #fecaca;
  font-size: 0.78rem;
  line-height: 1.38;
}
.status-issue-card strong {
  display: block;
  color: #fee2e2;
  font-size: 0.84rem;
  margin-bottom: 0.24rem;
}
.status-issue-line {
  display: block;
  color: #fca5a5;
  font-weight: 700;
}
.status-issue-card ul {
  margin: 0.35rem 0 0;
  padding-left: 1.05rem;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.36rem;
}
.status-dot-green {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e55;
}
.status-dot-red {
  background: #ef4444;
  box-shadow: 0 0 6px #ef444455;
}
.status-dot-yellow {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b55;
}
.status-dot-blue {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf855;
}
.status-dot-grey {
  background: #475569;
}
.status-info-label {
  color: var(--muted);
}
.status-info-val {
  color: var(--text);
  font-weight: 600;
  text-align: right;
}
.status-info-val .status-output-stack {
  align-items: flex-end;
}
.status-sub-stack,
.status-output-stack {
  display: grid;
  gap: 0.08rem;
  line-height: 1.28;
}
.status-sub-heading {
  color: var(--muted);
  font-weight: 650;
}
.status-sub-line {
  color: #9fb0c8;
}
.status-mini-table {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.7rem;
  row-gap: 0.12rem;
  line-height: 1.28;
}
.status-mini-key {
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}
.status-mini-val {
  color: #9fb0c8;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}
.status-output-line {
  display: block;
  color: var(--text);
  font-weight: 650;
}
.status-output-meta {
  display: block;
  color: #9fb0c8;
  font-weight: 500;
}
.status-meter-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.52rem 0.7rem;
  background: #141b28;
  display: grid;
  gap: 0.4rem;
}
.status-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.8rem;
}
.status-meter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
}
.status-meter-label .status-dot {
  margin-top: 0;
}
.status-meter-val {
  color: var(--text);
  font-size: 0.76rem;
}
.status-meter-track {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #2f3b50;
  background: #0f1521;
}
.status-meter-sub {
  margin-top: 0.15rem;
  color: #9fb0c8;
  font-size: 0.72rem;
}
.status-meter-fill {
  display: block;
  height: 100%;
  width: var(--meter-to, 0%);
  animation: status-meter-grow 1.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes status-meter-grow {
  from {
    width: var(--meter-from, var(--meter-to, 0%));
  }
  to {
    width: var(--meter-to, 0%);
  }
}
.status-meter-fill-green {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}
.status-meter-fill-yellow {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}
.status-meter-fill-red {
  background: linear-gradient(90deg, #dc2626, #ef4444);
}
.status-meter-fill-grey {
  background: linear-gradient(90deg, #475569, #64748b);
}
.status-actions-panel {
  overflow: hidden;
}
.status-actions-inner {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.status-action-btn {
  width: 100%;
  justify-content: flex-start;
}
.status-schedule-panel {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #171c27;
}
.status-schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem;
}
.status-schedule-body {
  display: grid;
  gap: 0.75rem;
  padding: 0 0.72rem 0.72rem;
}
.status-schedule-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}
.status-schedule-summary .status-info-row {
  min-width: 0;
}
.status-schedule-table {
  margin: 0;
}
.status-schedule-table tr.status-schedule-current-day td {
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 -1px 0 rgba(56, 189, 248, 0.35), 0 1px 0 rgba(56, 189, 248, 0.35);
}
.status-schedule-table tr.status-schedule-current-day td:first-child {
  color: #e0f2fe;
  font-weight: 700;
}
.status-schedule-table td:last-child {
  line-height: 1.45;
}

/* -- Display override section -- */
.detail-override-section {
  margin-top: 0.4rem;
  border-top: 1px dashed #3a465d;
  padding-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.detail-override-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.1rem;
}
.detail-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.override-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
}
.override-badge-active {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.override-badge-inactive {
  background: rgba(100, 116, 139, 0.15);
  color: var(--muted);
  border: 1px solid var(--border);
}
.override-toggle-row {
  justify-content: space-between;
  width: 100%;
  color: #c7d2e7;
  margin-top: 0.1rem;
}
.override-output-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.override-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.override-mode-card {
  appearance: none;
  border: 1px solid #2e3b52;
  border-radius: 10px;
  background: #101827;
  color: inherit;
  text-align: left;
  padding: 0.45rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.override-mode-card:hover:not(:disabled) {
  border-color: #4f5d78;
  transform: translateY(-1px);
}
.override-mode-card:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}
.override-mode-card[aria-disabled="true"] {
  opacity: 0.56;
  cursor: not-allowed;
  pointer-events: none;
}
.override-mode-card.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28);
}
.override-mode-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  border: 1px solid #2b3548;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #a5b4cf;
  background: #0b0f18;
}
.override-mode-preview-black {
  background: #000;
}
.override-mode-preview-white {
  background: #fff;
  color: #475569;
}
.override-mode-preview-media .proxy-thumb-wrap {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}
.override-media-preview-empty {
  pointer-events: none;
}
.override-media-picker-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.55rem;
  height: 1.55rem;
  border: 1px solid #3b4a67;
  border-radius: 7px;
  background: rgba(7, 13, 24, 0.72);
  color: #d8e2f4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.override-media-picker-btn:hover {
  border-color: #6284d9;
  background: rgba(17, 28, 49, 0.88);
}
.override-media-picker-btn .btn-icon {
  width: 14px;
  height: 14px;
  margin: 0;
}
.override-mode-preview-media-empty {
  background: repeating-linear-gradient(
    135deg,
    #0f1728 0 14px,
    #111d32 14px 28px
  );
}
.override-mode-meta {
  min-width: 0;
}
.override-mode-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #edf2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.override-mode-sub {
  margin-top: 0.1rem;
  font-size: 0.68rem;
  color: #98a8c3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.override-media-quick-actions {
  align-items: center;
}
.override-media-modal {
  width: min(940px, 96vw);
  max-height: min(82vh, 760px);
}
.override-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.7rem;
  max-height: min(58vh, 520px);
  overflow: auto;
  padding: 0.2rem 0.1rem 0.1rem;
}
.override-media-tile {
  background: #141b28;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}
.override-media-tile:hover:not(:disabled) {
  border-color: #5b6882;
  transform: translateY(-1px);
}
.override-media-tile:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.override-media-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.22);
}
.override-media-tile-thumb {
  aspect-ratio: 16/9;
  background: #0b0f17;
}
.override-media-tile-thumb .proxy-thumb-wrap {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}
.override-media-tile-thumb .proxy-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.override-media-tile-body {
  padding: 0.5rem 0.58rem 0.55rem;
}
.override-media-tile-title {
  color: #edf2ff;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
}
.override-media-tile-file {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 0.16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1150px) {
  .status-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-schedule-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .status-layout {
    grid-template-columns: 1fr;
  }
  .status-schedule-summary {
    grid-template-columns: 1fr;
  }
}
.preview-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}
.preview-source-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.preview-source-switch .toggle-switch {
  flex-shrink: 0;
}

.proxy-thumb-wrap {
  width: 72px;
  height: 42px;
  border-radius: 6px;
  background: #0b0f17;
  border: 1px solid var(--border);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.proxy-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.proxy-thumb.loaded {
  opacity: 1;
}
.proxy-thumb.failed {
  opacity: 0.25;
}
.proxy-thumb-xs {
  width: 56px;
  height: 32px;
}
.proxy-thumb-sm {
  width: 72px;
  height: 42px;
}
.proxy-thumb-media {
  width: 100%;
  height: 100%;
}
.proxy-thumb-modal {
  width: 320px;
  height: 190px;
}

.transfer-progress {
  margin: 0.6rem 0.72rem 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #101622;
  padding: 0.5rem 0.6rem;
}
.transfer-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.transfer-progress-head strong {
  color: var(--text);
  font-size: 0.78rem;
}
.transfer-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #0a0f19;
  border: 1px solid #1f2937;
  overflow: hidden;
}
.transfer-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.2s ease;
}
.media-upload-progress-stack {
  display: grid;
  gap: 0.5rem;
}
.media-upload-phase {
  margin-top: 0.5rem;
}
.media-upload-phase .detail-footnote {
  margin-top: 0.35rem;
}
.media-tab-layout {
  display: grid;
  gap: 0.72rem;
}
.media-create-panel {
  overflow: hidden;
}
.media-create-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) minmax(300px, 2fr);
  gap: 0.7rem;
  padding: 0.72rem;
  border-top: 1px solid var(--border);
  background: #121927;
}
.media-create-actions {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #151d2b;
  padding: 0.62rem;
  display: grid;
  align-content: start;
  gap: 0.45rem;
}
.media-create-actions-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #d7e4ff;
}
.media-create-actions .btn {
  justify-content: flex-start;
}
.media-create-panel .media-upload-progress-stack,
.media-create-panel .transfer-progress {
  margin: 0 0.72rem 0.72rem;
}
.media-upload-drop {
  border: 2px dashed #334155;
  border-radius: 10px;
  background: #111722;
  color: #a0b2cf;
  text-align: center;
  padding: 0.8rem 0.6rem;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  display: grid;
  gap: 0.2rem;
}
.media-upload-drop-panel {
  min-height: 162px;
  align-content: center;
}
.media-upload-drop:hover,
.media-upload-drop.over {
  border-color: #6366f1;
  background: #1a2232;
  color: #dbe4ff;
}
.media-upload-drop-icon {
  display: inline-flex;
  justify-content: center;
  color: #9fb0ff;
}
.media-upload-drop .btn-icon {
  width: 20px;
  height: 20px;
  margin: 0 auto;
}
.media-export-hints {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #121a28;
  padding: 0.7rem 0.75rem;
  display: grid;
  gap: 0.45rem;
}
.media-export-hints-panel {
  min-height: 162px;
  align-content: start;
}
.media-export-hints-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #d9e3ff;
}
.media-export-hints-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.media-export-hint-card {
  border: 1px solid #2a3344;
  border-radius: 8px;
  background: #0f1725;
  padding: 0.52rem 0.58rem;
  display: grid;
  gap: 0.28rem;
}
.media-export-hint-heading {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cde1ff;
}
.media-export-hint-text {
  font-size: 0.75rem;
  line-height: 1.35;
  color: #9fb2d1;
}
.media-folder-toolbar {
  display: grid;
  gap: 0.42rem;
}
.media-folder-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
}
.media-browser-toolbar {
  padding: 0.68rem 0.72rem 0.64rem;
  border-bottom: 1px solid var(--border);
  background: #171f2f;
}
.media-browser-controls {
  gap: 0.52rem;
  --media-toolbar-control-height: 2.2rem;
}
.media-browser-controls .btn,
.media-browser-controls .detail-select {
  height: var(--media-toolbar-control-height);
  min-height: var(--media-toolbar-control-height);
  box-sizing: border-box;
}
.media-browser-controls .detail-select {
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.2;
}
.media-browser-sort {
  min-width: 188px;
}
.media-browser-filter {
  min-width: 140px;
}
.media-browser-search {
  min-width: 220px;
  max-width: 360px;
  width: min(360px, 45vw);
}
.media-browser-summary {
  margin-left: auto;
  white-space: nowrap;
}
.media-folder-pathline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.18rem;
  font-size: 0.74rem;
  color: #7384a3;
  line-height: 1.2;
  user-select: none;
}
.media-folder-path-item {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
}
.media-folder-path-sep {
  color: #5f6f8c;
}
.media-folder-path-link {
  color: #7f90af;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}
.media-folder-path-link:hover {
  color: #a5b5d3;
  border-color: rgba(165, 181, 211, 0.5);
}
.media-folder-path-link.is-current {
  color: #9caece;
}
.media-folder-path-link.is-disabled {
  pointer-events: none;
  opacity: 0.58;
}
.media-folder-pathline-highlight {
  border: 1px solid #2f425f;
  border-radius: 9px;
  background: #111a29;
  padding: 0.45rem 0.55rem;
}
.media-folder-select-wrap {
  display: inline-flex;
  gap: 0.42rem;
  align-items: center;
}
.media-folder-select {
  min-width: 220px;
  max-width: 320px;
}

.media-browser-panel {
  overflow: hidden;
  max-width: none;
  width: 100%;
  margin: 0;
}
.media-browser-scroll {
  max-height: min(60vh, 760px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #131a28;
}
.media-browser-sticky {
  position: sticky;
  top: 0;
  z-index: 6;
  background: linear-gradient(180deg, rgba(19, 26, 40, 0.98), rgba(19, 26, 40, 0.94));
  backdrop-filter: blur(2px);
}
.media-browser-sticky .detail-error {
  margin: 0.6rem 0.72rem 0.3rem;
}

.media-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  padding: 0.72rem;
}
.media-tile {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}
.media-tile:hover {
  border-color: #55617a;
  transform: translateY(-1px);
}
.media-tile-thumb {
  position: relative;
  height: 138px;
  background: #0b0f17;
}
.media-tile-thumb .proxy-thumb-wrap {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  display: block;
}
.media-tile-thumb .proxy-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-tile-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  border-radius: 999px;
  padding: 0.18rem 0.46rem;
  font-size: 0.68rem;
  border: 1px solid #36445e;
  background: rgba(9, 14, 22, 0.82);
  color: #d7dee8;
  z-index: 2;
}
.media-tile-badge-duration {
  left: auto;
  right: 0.5rem;
  border-color: #2b5c3d;
  color: #96f0b4;
}
.media-tile-badge-persistent {
  left: auto;
  right: 0.5rem;
  top: auto;
  bottom: 0.5rem;
  border-color: #4b7f62;
  color: #9df8bf;
}
.media-tile-desc {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 0.55rem;
  font-size: 0.72rem;
  color: #c9d7ea;
  line-height: 1.35;
  background: linear-gradient(
    180deg,
    rgba(4, 8, 14, 0.05) 20%,
    rgba(4, 8, 14, 0.85) 100%
  );
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.media-tile:hover .media-tile-desc {
  opacity: 1;
}
.media-tile-body {
  padding: 0.55rem 0.62rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.media-tile-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: #edf2ff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.media-tile-name {
  font-size: 0.72rem;
  color: #a8b3c8;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.media-tile-meta {
  font-size: 0.7rem;
  color: #8292ac;
}
.media-tile-actions {
  display: flex;
  gap: 0.45rem;
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.6rem 0.6rem;
  background: #171c27;
}
.media-folder-tile .media-tile-actions {
  display: none;
}
.media-folder-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 18% 18%, #1f2d4a 0%, #111827 100%);
}
.media-folder-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  border: 1px solid #3d4b65;
  background: rgba(11, 18, 31, 0.65);
  color: #b4c2dc;
}
.media-folder-icon .btn-icon {
  width: 26px;
  height: 26px;
}

/* Media tile selection checkbox */
.media-tile-cb {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
  line-height: 0;
  display: block;
}
.media-tile:hover .media-tile-cb,
.media-tile.selected .media-tile-cb {
  opacity: 1;
}
.media-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.22);
}
.media-cb-input {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #4a5568;
  border-radius: 4px;
  background: rgba(9, 14, 22, 0.85);
  cursor: pointer;
  display: block;
  position: relative;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.media-cb-input:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.media-cb-input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
/* Media selection action bar – wrapper drives height via CSS grid rows */
.media-sel-wrap {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0;
  transition:
    grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    margin-top 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.media-sel-wrap.open {
  grid-template-rows: 1fr;
  margin-top: 0.42rem;
}
.media-sel-inner {
  overflow: hidden;
  min-height: 0;
  padding: 0 0.72rem;
}
.media-selection-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.65rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 7px;
  flex-wrap: wrap;
}
.media-sel-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.media-sel-sep {
  flex: 1;
  min-width: 0.25rem;
}
.media-browser-empty {
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.media-browser-footnote {
  margin: 0.2rem 0.72rem 0.72rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.btn-inline-link {
  background: none;
  border: none;
  padding: 0 0.1rem;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 600;
}
.media-context-overlay {
  position: fixed;
  inset: 0;
  z-index: 1700;
}
.media-context-menu {
  position: fixed;
  min-width: 214px;
  max-width: min(88vw, 320px);
  display: grid;
  gap: 0.26rem;
  background: #121927;
  border: 1px solid #303d55;
  border-radius: 9px;
  box-shadow: 0 10px 32px rgba(1, 8, 20, 0.52);
  padding: 0.4rem;
}
.media-context-menu .btn {
  width: 100%;
  justify-content: flex-start;
}
.broken-tl-section {
  margin: 0.6rem 0;
}
.broken-tl-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.broken-tl-list {
  list-style: disc;
  padding-left: 1.2rem;
  margin: 0;
  display: grid;
  gap: 0.18rem;
  font-size: 0.82rem;
}
.modal-footer-row {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.tl-board {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.tl-row-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
  align-items: stretch;
  --tl-editor-panel-height: 520px;
}
.tl-col-media,
.tl-col-timeline,
.tl-col-effects {
  min-width: 0;
}
.tl-scroll {
  max-height: 420px;
  overflow: auto;
  padding-right: 0.2rem;
}
.tl-col-media .tl-scroll {
  height: var(--tl-editor-panel-height);
  max-height: var(--tl-editor-panel-height);
}
.tl-lib-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.58rem 0.62rem 0.44rem;
  border-bottom: 1px solid var(--border);
  background: #171c27;
}
.tl-lib-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  min-width: 220px;
  flex: 1 1 260px;
}
.tl-lib-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8ca2c5;
}
.tl-lib-search-icon .btn-icon {
  width: 16px;
  height: 16px;
}
.tl-lib-search {
  width: 100%;
}
.tl-lib-icon-btn {
  white-space: nowrap;
  gap: 0.3rem;
}
.tl-lib-icon-btn .btn-icon {
  width: 14px;
  height: 14px;
}
.tl-lib-select-fallback {
  display: none;
}
.tl-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.tl-panel-heading .btn {
  flex: 0 0 auto;
}
.tl-lib-pathline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.14rem;
  padding: 0.42rem 0.62rem 0.38rem;
  border-bottom: 1px solid var(--border);
  background: #171c27;
}
.tl-lib-path-item {
  display: inline-flex;
  align-items: center;
  gap: 0.14rem;
}
.tl-lib-path-sep {
  color: #66758f;
  font-size: 0.73rem;
}
.tl-lib-path-link {
  color: #9db8e5;
  font-size: 0.74rem;
  text-decoration: none;
}
.tl-lib-path-link:hover {
  color: #c7dcff;
  text-decoration: underline;
}
.tl-lib-path-link.is-current {
  color: #e2edff;
  font-weight: 600;
  text-decoration: none;
  pointer-events: none;
}
.tl-lib-summary {
  padding: 0.36rem 0.62rem 0.44rem;
  font-size: 0.72rem;
  color: #8ea2c0;
}
.tl-lib-scroll {
  padding: 0 0.62rem 0.62rem;
}
.tl-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}
.tl-lib-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.tl-lib-card:hover {
  border-color: var(--accent);
}
.tl-lib-card-file {
  cursor: grab;
}
.tl-lib-card-folder {
  cursor: pointer;
}
.tl-lib-folder-thumb {
  width: 64px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #394862;
  background: radial-gradient(circle at 18% 18%, #223451 0%, #121926 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b5c6e4;
  flex: 0 0 auto;
}
.tl-lib-folder-thumb .btn-icon {
  width: 20px;
  height: 20px;
}
.tl-lib-meta {
  min-width: 0;
  flex: 1 1 auto;
}
.tl-lib-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tl-lib-tech {
  font-size: 0.68rem;
  color: #9da9bf;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tl-lib-sub {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tl-lib-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}
.tl-fx-card {
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: max-content;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tl-fx-card:hover {
  border-color: var(--accent);
  color: #cdd0ff;
}
.tl-fx-symbol {
  font-size: 0.92rem;
  color: #9eb7ff;
  min-width: 1.2rem;
  text-align: center;
}
.tl-row-effects .detail-table td {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.tl-fx-summary {
  font-size: 0.74rem;
  color: #8ea2c0;
  margin-bottom: 0.45rem;
}
.tl-fx-apply-all {
  border: 1px dashed #40516d;
  border-radius: 8px;
  background: #121926;
  color: #a9b9d2;
  min-height: 54px;
  margin-bottom: 0.55rem;
  padding: 0.52rem 0.68rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.tl-fx-apply-all strong {
  color: #e1e9f7;
  font-size: 0.82rem;
}
.tl-fx-apply-all span {
  color: #91a4c1;
  font-size: 0.74rem;
  white-space: nowrap;
}
.tl-fx-apply-all.over {
  border-color: var(--accent);
  background: #182236;
  color: #dce6ff;
}
.tl-fx-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
}
.tl-fx-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  min-width: max-content;
  padding: 0.1rem 0.05rem 0.22rem;
}
.timeline-cache-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #171c27;
}
.timeline-cache-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.78rem;
  border-bottom: 1px solid var(--border);
  background: #111722;
}
.timeline-cache-panel-copy {
  min-width: 0;
}
.timeline-cache-panel-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e6edf8;
}
.timeline-cache-panel-meta {
  margin-top: 0.16rem;
  font-size: 0.73rem;
  color: #9cb0cb;
  line-height: 1.35;
}
.timeline-cache-panel-summary {
  font-size: 0.74rem;
  color: #c7d2fe;
  white-space: nowrap;
}
.timeline-cache-panel.collapsed .timeline-cache-panel-head {
  border-bottom: none;
}
.timeline-cache-panel-body {
  display: grid;
  gap: 0;
}
.timeline-cache-panel .detail-toolbar {
  border-top: none;
}
.timeline-cache-panel .detail-table {
  font-size: 0.79rem;
}
.tl-dropzone {
  min-height: 240px;
  max-height: 560px;
  overflow: auto;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  background: #121722;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.tl-col-timeline {
  display: flex;
  flex-direction: column;
}
.tl-col-timeline .detail-table {
  flex: 1 1 auto;
  height: 100%;
}
.tl-col-timeline .detail-table tbody,
.tl-col-timeline .detail-table tbody tr,
.tl-col-timeline .detail-table tbody td {
  height: 100%;
}
.tl-col-timeline .detail-table tbody td {
  padding: 0;
  vertical-align: top;
}
.tl-col-timeline .tl-dropzone {
  box-sizing: border-box;
  height: 100%;
  min-height: var(--tl-editor-panel-height);
  max-height: none;
  border-radius: 0 0 8px 8px;
}
.tl-dropzone.over {
  border-color: var(--accent);
}
.tl-edit-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tl-edit-item.over {
  border-color: var(--accent);
}
.tl-edit-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tl-drag-handle {
  color: var(--muted);
  user-select: none;
  cursor: grab;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.tl-edit-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  flex: 1;
}
.tl-edit-title strong {
  font-size: 0.8rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tl-edit-title span {
  font-size: 0.72rem;
  color: var(--muted);
}
.tl-edit-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.tl-edit-controls label {
  font-size: 0.75rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tl-edit-controls input,
.tl-edit-controls select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.26rem 0.42rem;
  font-size: 0.76rem;
}
.tl-trim-wrap {
  margin-top: 0.15rem;
}
.tl-trim-bar {
  position: relative;
  height: 20px;
  border-radius: 4px;
  background: #141b29;
  border: 1px solid #283547;
  overflow: hidden;
  cursor: pointer;
}
.tl-trim-range {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(99, 102, 241, 0.35);
  pointer-events: none;
}
.tl-trim-handle {
  position: absolute;
  top: 0;
  width: 8px;
  height: 100%;
  margin-left: -4px;
  background: #6366f1;
  border-radius: 3px;
  cursor: ew-resize;
  z-index: 2;
}
.tl-trim-handle.active,
.tl-trim-handle:hover {
  background: #818cf8;
}
.tl-trim-handle-in {
  border-right: 2px solid rgba(255, 255, 255, 0.35);
}
.tl-trim-handle-out {
  border-left: 2px solid rgba(255, 255, 255, 0.35);
}
.tl-trim-tc {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: #74839d;
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tl-trim-disabled {
  font-size: 0.72rem;
  color: #6f809c;
  background: #141b29;
  border: 1px dashed #2b3a4f;
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
}
.tl-gap-row {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #0f1521;
}
.tl-trans-slot {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.45rem;
}
.tl-trans-slot.over {
  border-color: var(--accent);
}
.tl-trans-slot.loop-slot {
  border-style: solid;
  border-color: #415173;
  background: #101a2b;
}
.tl-trans-empty {
  color: var(--muted);
  font-size: 0.74rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tl-loop-label {
  margin-top: 0.15rem;
  margin-bottom: 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #8fa8d8;
}
.tl-trans-active {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.tl-trans-label {
  color: var(--muted);
  font-size: 0.72rem;
  min-width: 220px;
}
.tl-trans-active label {
  font-size: 0.74rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tl-trans-active input,
.tl-trans-active select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.26rem 0.42rem;
  font-size: 0.74rem;
}
.tl-trans-symbol {
  width: 1.2rem;
  text-align: center;
  font-size: 0.92rem;
  color: #9eb7ff;
}
.tl-trans-compact {
  gap: 0.4rem;
}
.tl-trans-compact select {
  min-width: 170px;
}
.tl-trans-compact input {
  width: 78px;
  text-align: right;
}

.settings-index-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.62rem 0.72rem;
  background: #171c27;
}
.settings-index-title {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.45rem;
  font-weight: 600;
}
.settings-index-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.settings-index-list-vertical {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}
.settings-index-btn {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 7px;
  padding: 0.32rem 0.6rem;
  font-size: 0.76rem;
  cursor: pointer;
}
.settings-index-btn.active {
  color: #fff;
  border-color: var(--accent);
  background: #3940b7;
}
.settings-split {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}
.settings-index-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
}
.settings-content-scroll {
  max-height: none;
  overflow: visible;
  padding-right: 0.2rem;
}
.settings-panel-grid {
  gap: 0.6rem;
}

.detail-action-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2050;
  background: rgba(2, 6, 12, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.detail-action-modal {
  width: min(640px, 96vw);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.detail-action-modal-lg {
  width: min(940px, 98vw);
}
.detail-action-modal-xl {
  width: min(1260px, 99vw);
}
.detail-action-modal h3 {
  margin-bottom: 0.75rem;
  font-size: 0.98rem;
}
.detail-action-modal-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.2fr);
  gap: 0.85rem;
}
.detail-action-preview {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #141a25;
  padding: 0.6rem;
}
.detail-action-preview .proxy-thumb-wrap {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}
.detail-action-preview .proxy-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-action-preview-meta {
  margin-top: 0.55rem;
  font-size: 0.76rem;
  color: var(--muted);
  display: grid;
  gap: 0.22rem;
}
.detail-action-form {
  display: grid;
  gap: 0.58rem;
}
.detail-action-form label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.detail-select-textarea {
  min-height: 116px;
  font-family: inherit;
  resize: vertical;
}
.media-edit-filename-label {
  margin-top: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem !important;
  opacity: 0.75;
}
.media-edit-filename-input {
  font-size: 0.82rem;
}
.detail-action-media-layout {
  display: grid;
  gap: 0.75rem;
}
.detail-action-media-thumb {
  padding: 0.65rem;
}
.detail-action-media-columns {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.15fr) minmax(170px, 0.62fr);
  gap: 0.75rem;
  align-items: start;
}
.detail-action-media-col {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #141a25;
  padding: 0.58rem;
}
.detail-action-media-col h4 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: #c9d6ee;
}
.detail-action-media-info .detail-action-preview-meta {
  margin-top: 0;
}
.detail-action-media-form {
  display: grid;
  gap: 0.58rem;
}
.detail-action-media-form label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.detail-action-media-form .detail-select-textarea {
  min-height: 120px;
}
.detail-action-media-actions {
  display: grid;
  gap: 0.46rem;
  align-content: start;
}
.detail-action-media-actions .btn {
  width: 100%;
  justify-content: center;
}
.detail-action-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.58rem;
}
.text-slide-preview {
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.8rem;
  font-size: 1rem;
  line-height: 1.3;
  border: 1px solid var(--border);
  min-height: 80px;
}
.detail-action-modal-text-slide .detail-action-modal-layout {
  grid-template-columns: minmax(220px, 0.75fr) minmax(300px, 1.2fr);
}
.text-slide-preview-panel {
  align-self: start;
}
/* Wrapper: visible 16:9 box, clips any text overflow */
.text-slide-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
}
/* Inner preview fills the wrapper exactly; font size is scaled proportionally via JS */
.text-slide-preview-wrap .text-slide-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  overflow: hidden;
  word-break: break-word;
  padding: 5%;
  line-height: 1.3;
  border: none;
  border-radius: 0;
  min-height: unset;
}
.text-slide-size-row {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 0.55rem;
  align-items: center;
}
.text-slide-size-row input[type="range"] {
  width: 100%;
  accent-color: #6366f1;
}
.text-slide-size-input {
  text-align: right;
}
.text-slide-color-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #151c2a;
  padding: 0.45rem 0.52rem;
  display: grid;
  gap: 0.4rem;
}
.text-slide-color-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  color: #bac6db;
  font-size: 0.76rem;
}
.text-slide-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.text-slide-color-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #3b475e;
  background: var(--swatch, #000);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease;
}
.text-slide-color-btn:hover {
  transform: translateY(-1px);
  border-color: #a5b4fc;
}
.text-slide-color-btn.active {
  border-color: #eef2ff;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}
.text-slide-color-picker {
  width: 36px;
  height: 24px;
  padding: 0;
  border: 1px solid #3b475e;
  border-radius: 6px;
  background: #0f172a;
  cursor: pointer;
}
.text-slide-v2-overlay {
  z-index: 2125;
}
.text-slide-v2-modal {
  padding-bottom: 0.85rem;
}
.text-slide-v2-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.45fr) minmax(360px, 1fr);
  gap: 0.8rem;
  align-items: start;
}
.text-slide-v2-canvas-wrap {
  display: grid;
  gap: 0.5rem;
}
.text-slide-v2-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}
.text-slide-v2-stage-shell {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0f1a;
  aspect-ratio: 16 / 9;
}
.text-slide-v2-stage {
  width: 100%;
  height: 100%;
  position: relative;
  user-select: none;
}
.text-slide-v2-el {
  position: absolute;
  cursor: move;
  border: 1px dashed rgba(148, 163, 184, 0.65);
  border-radius: 6px;
  overflow: visible;
  touch-action: none;
}
.text-slide-v2-el.selected {
  border-color: #f8fafc;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6);
}
.text-slide-v2-el-text {
  width: 100%;
  height: 100%;
  padding: 2%;
  line-height: 1.2;
  overflow: hidden;
  word-break: break-word;
  pointer-events: none;
}
.text-slide-v2-el-image {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.text-slide-v2-el-image-border {
  position: absolute;
  inset: 0;
  border-style: solid;
  pointer-events: none;
}
.text-slide-v2-el-shape {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.text-slide-v2-resize {
  position: absolute;
  width: 13px;
  height: 13px;
  right: 2px;
  bottom: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.86);
  cursor: nwse-resize;
}
.text-slide-v2-empty {
  opacity: 0.65;
}
.text-slide-v2-sidebar {
  display: grid;
  gap: 0.55rem;
}
.text-slide-v2-panel {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #111827;
  padding: 0.56rem;
  display: grid;
  gap: 0.42rem;
}
.text-slide-v2-panel h4 {
  margin: 0;
  font-size: 0.8rem;
  color: #dbeafe;
}
.text-slide-v2-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.42rem;
}
.text-slide-v2-grid label {
  display: grid;
  gap: 0.16rem;
  font-size: 0.74rem;
  color: var(--muted);
}
.text-slide-v2-size-stepper {
  display: flex;
  justify-content: flex-end;
  gap: 0.24rem;
  align-items: center;
}
.text-slide-v2-size-stepper .btn {
  justify-content: center;
  padding: 0.2rem 0.3rem;
}
.text-slide-v2-numrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 0.36rem;
  align-items: center;
}
.text-slide-v2-range {
  width: 100%;
  accent-color: #60a5fa;
}
.text-slide-v2-num-input {
  width: 74px;
  text-align: right;
}
.text-slide-v2-color-input {
  min-height: 32px;
  padding: 0.18rem;
}
.text-slide-v2-checkrow {
  display: flex;
  gap: 0.62rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}
.text-slide-v2-layer-list {
  max-height: 170px;
  overflow: auto;
  display: grid;
  gap: 0.26rem;
}
.text-slide-v2-layer {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #0f172a;
  color: #d6e2f7;
  padding: 0.32rem 0.46rem;
  text-align: left;
  font-size: 0.74rem;
  cursor: pointer;
  user-select: none;
}
.text-slide-v2-layer:active {
  cursor: grabbing;
}
.text-slide-v2-layer.selected {
  border-color: #93c5fd;
  background: #1e293b;
}
.text-slide-v2-layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.text-slide-v2-font-hint {
  margin-top: 0.1rem;
}
.text-slide-v2-shadow-box {
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.4);
  padding: 0.42rem;
  display: grid;
  gap: 0.34rem;
}
.text-slide-v2-library-window {
  position: fixed;
  z-index: 1400;
  width: min(780px, calc(100vw - 28px));
  max-height: min(72vh, 680px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0f172a;
  box-shadow: 0 26px 60px rgba(2, 6, 23, 0.55);
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr);
  overflow: hidden;
}
.text-slide-v2-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.52rem 0.68rem;
  background: linear-gradient(180deg, #172554 0%, #1e293b 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  cursor: move;
  color: #e2e8f0;
}
.text-slide-v2-library-controls {
  padding: 0.58rem 0.66rem;
  display: grid;
  gap: 0.44rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.text-slide-v2-library-controls label {
  display: grid;
  gap: 0.16rem;
  font-size: 0.74rem;
  color: var(--muted);
}
.text-slide-v2-library-grid {
  overflow: auto;
  padding: 0.6rem 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 0.5rem;
}
.text-slide-v2-library-body {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  min-height: 0;
}
.text-slide-v2-library-folders {
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.45);
  padding: 0.42rem 0.3rem;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0.22rem;
}
.text-slide-v2-library-folder {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #dbe6f8;
  padding: 0.34rem 0.5rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.text-slide-v2-library-folder:hover {
  background: rgba(30, 41, 59, 0.8);
}
.text-slide-v2-library-folder.active {
  border-color: #60a5fa;
  background: rgba(30, 64, 175, 0.28);
}
.text-slide-v2-library-folder-label {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.text-slide-v2-library-folder-count {
  font-size: 0.65rem;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.22);
  border-radius: 999px;
  padding: 0.05rem 0.38rem;
}
.text-slide-v2-library-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.text-slide-v2-library-active-folder {
  padding: 0.4rem 0.74rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.72rem;
  color: #cbd5e1;
}
.text-slide-v2-library-tile {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  padding: 0.34rem;
  display: grid;
  gap: 0.26rem;
  text-align: left;
  cursor: grab;
}
.text-slide-v2-library-tile:active {
  cursor: grabbing;
}
.text-slide-v2-library-tile img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #020617;
}
.text-slide-v2-library-title {
  font-size: 0.71rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.text-slide-v2-library-meta {
  font-size: 0.67rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-stage {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(340px, 1fr);
  gap: 0.7rem;
  padding: 0.72rem;
  align-items: start;
}
.preview-stage-media {
  background: #0b0f17;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: grid;
  min-height: 0;
  position: relative;
  width: 100%;
  min-width: 0;
  align-self: start;
}
.preview-stage-stack {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  overflow: hidden;
  display: grid;
  background:
    radial-gradient(circle at top, rgba(99, 102, 241, 0.1), transparent 48%),
    linear-gradient(180deg, #0f1522 0%, #05070d 100%);
}
.preview-stage-media .proxy-thumb-wrap,
.preview-stage-stack > video,
.preview-stage-stack > .preview-stage-placeholder,
.preview-stage-stack > .preview-stage-status {
  position: absolute;
  inset: 0;
}
.preview-stage-media .proxy-thumb-wrap {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  display: block;
  transition: opacity 0.18s ease;
}
.preview-stage-media .proxy-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #05070d;
}
.preview-stage-media .preview-stage-video,
.preview-stage-media .preview-stage-image,
.preview-stage-media .preview-stage-video-layer {
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: contain;
  background: #05070d;
  display: block;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.proxy-thumb-preview {
  width: 100%;
  height: 100%;
}
.preview-stage-stack.is-video-ready .preview-stage-video-layer,
.preview-stage-video-layer.loaded {
  opacity: 1;
}
.preview-seq-row-compact {
  gap: 0.38rem;
}
.preview-seq-transition-inline {
  color: #7f8fa8;
  font-size: 0.71rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.preview-seq-item.transition {
  padding: 0.28rem 0.5rem;
  background: rgba(148, 163, 184, 0.03);
}
.preview-seq-item.transition.current {
  outline-color: #64748b;
}
.preview-seq-item.transition .preview-seq-progress {
  background: linear-gradient(
    90deg,
    rgba(100, 116, 139, 0.22),
    rgba(100, 116, 139, 0.04)
  );
}
.preview-seq-item.transition .meta {
  color: #7f8fa8;
  font-size: 0.68rem;
}
.preview-stage-stack.is-video-ready .preview-stage-thumb-wrap {
  opacity: 0;
}
.preview-stage-stack.is-cache-miss .preview-stage-thumb-wrap,
.preview-stage-stack.is-video-loading .preview-stage-thumb-wrap,
.preview-stage-stack.is-video-failed .preview-stage-thumb-wrap,
.preview-stage-stack.preview-stage-stack-thumbnail .preview-stage-thumb-wrap {
  opacity: 1;
}
.preview-stage-stack.is-override-full-ready .preview-stage-thumb-wrap {
  opacity: 0;
}
.preview-stage-stack.is-override-full-ready .preview-stage-video-layer {
  opacity: 1;
  z-index: 1;
}
.preview-stage-stack.preview-stage-stack-transition .preview-stage-video-layer {
  z-index: 1;
}
.preview-stage-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: #c7d2fe;
  background: radial-gradient(
    circle at top,
    rgba(99, 102, 241, 0.16),
    rgba(5, 7, 13, 0.92) 60%
  );
  z-index: 0;
}
.preview-stage-stack.preview-stage-stack-media .preview-stage-placeholder,
.preview-stage-stack.is-video-ready .preview-stage-status,
.preview-stage-stack.preview-stage-stack-thumbnail .preview-stage-status {
  display: none;
}
.preview-stage-status {
  inset: auto 0 0 0;
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: left;
  color: #dbe7ff;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  background: linear-gradient(
    180deg,
    rgba(5, 7, 13, 0) 0%,
    rgba(5, 7, 13, 0.86) 88%
  );
  z-index: 2;
  pointer-events: none;
}
.preview-stage-status[hidden] {
  display: none;
}
.preview-stage-info {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem;
  background: #171c27;
  font-size: 0.8rem;
  color: var(--muted);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.48rem;
  min-height: 0;
}
.preview-stage-info-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.48rem;
  align-items: stretch;
}
.preview-stage-info-card {
  border: 1px solid #243042;
  border-radius: 8px;
  background: #101621;
  padding: 0.58rem 0.62rem;
  min-width: 0;
  height: 132px;
  display: grid;
  align-content: start;
}
.preview-stage-info-top {
  display: grid;
  gap: 0.24rem;
  align-content: start;
}
.preview-stage-info-card-title {
  color: #dbe4f3;
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.preview-seq-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101621;
  overflow: auto;
  min-height: 120px;
  max-height: 280px;
}
.preview-seq-item {
  position: relative;
  padding: 0.44rem 0.5rem;
  border-bottom: 1px solid #1f2937;
  overflow: hidden;
}
.preview-seq-item:last-child {
  border-bottom: none;
}
.preview-seq-item:first-child {
  border-radius: 7px 7px 0 0;
}
.preview-seq-item:last-child {
  border-radius: 0 0 7px 7px;
}
.preview-seq-item:only-child {
  border-radius: 7px;
}
.preview-seq-item.current {
  outline: 1px solid #4f46e5;
  outline-offset: -1px;
}
.preview-seq-item.media {
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.62),
    rgba(16, 22, 33, 0.9)
  );
}
.preview-seq-item.transition {
  padding: 0.28rem 0.5rem;
  background: rgba(148, 163, 184, 0.03);
}
.preview-seq-item.transition.current {
  outline-color: #64748b;
}
.preview-seq-progress {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(
    90deg,
    rgba(79, 70, 229, 0.35),
    rgba(79, 70, 229, 0.08)
  );
  pointer-events: none;
}
.preview-seq-item.transition .preview-seq-progress {
  background: linear-gradient(
    90deg,
    rgba(100, 116, 139, 0.22),
    rgba(100, 116, 139, 0.04)
  );
}
.preview-seq-progress-static {
  transition: width 0.2s ease;
}
.preview-seq-progress-anim {
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  animation: previewSeqProgress var(--preview-progress-duration, 6s) linear both;
  animation-delay: var(--preview-progress-delay, 0s);
}
@keyframes previewSeqProgress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.preview-seq-row {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.preview-seq-row strong {
  color: #e8eefc;
  font-size: 0.78rem;
  max-width: 75%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.preview-seq-row .meta {
  font-size: 0.72rem;
  color: #9cb0cb;
  white-space: nowrap;
}
.preview-seq-transition {
  position: relative;
  z-index: 1;
  margin-top: 0.16rem;
  font-size: 0.7rem;
  color: #8ea3c1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.preview-seq-item.transition .preview-seq-transition {
  display: none;
}
.preview-seq-item.transition .meta {
  color: #7f8fa8;
  font-size: 0.68rem;
}
.preview-stage-desc {
  color: #bac6db;
  line-height: 1.4;
  min-width: 0;
  overflow: auto;
  scrollbar-width: thin;
}
.preview-stage-info-card-desc .preview-stage-desc {
  height: 100%;
}
.preview-stage-desc.empty {
  color: #7f8fa8;
}
.preview-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}
.preview-render-card {
  margin: 0 0.72rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #171c27;
  padding: 0.7rem 0.78rem;
  display: grid;
  gap: 0.45rem;
}
.detail-schedule-wrap > .detail-toolbar + .preview-render-card {
  margin-top: 0.72rem;
}
.preview-render-card.live {
  border-color: #4f46e5;
  background: linear-gradient(
    180deg,
    rgba(49, 46, 129, 0.3),
    rgba(23, 28, 39, 0.92)
  );
}
.preview-render-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.7rem;
}
.preview-render-title {
  font-size: 0.78rem;
  color: #c7d2fe;
  font-weight: 600;
}
.preview-render-subtitle {
  margin-top: 0.18rem;
  font-size: 0.76rem;
  color: #dbe4f3;
}
.preview-render-progress {
  max-width: none;
}
.preview-render-meta {
  font-size: 0.73rem;
  color: #a8b8d4;
  line-height: 1.35;
}
.preview-cache-panel {
  margin: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #171c27;
}
.preview-cache-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.78rem;
  border-bottom: 1px solid var(--border);
  background: #111722;
}
.preview-cache-panel-copy {
  min-width: 0;
}
.preview-cache-panel-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e6edf8;
}
.preview-cache-panel-meta {
  margin-top: 0.16rem;
  font-size: 0.73rem;
  color: #9cb0cb;
  line-height: 1.35;
}
.preview-cache-panel-summary {
  font-size: 0.74rem;
  color: #c7d2fe;
  white-space: nowrap;
}
.preview-cache-panel-body {
  display: grid;
  gap: 0;
}
.preview-cache-panel.collapsed .preview-cache-panel-head {
  border-bottom: none;
}
.preview-cache-panel .detail-toolbar {
  border-top: none;
}
.preview-cache-panel .detail-table {
  font-size: 0.79rem;
  min-width: 980px;
}
.preview-cache-table-wrap {
  overflow-x: auto;
}
.preview-cache-actions {
  display: inline-flex;
  gap: 0.32rem;
  align-items: center;
}
.preview-cache-size {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}
.preview-cache-error {
  margin-top: 0.24rem;
  font-size: 0.72rem;
  color: #fecaca;
  max-width: 230px;
  line-height: 1.24;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cache-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.1rem 0.42rem;
  font-size: 0.71rem;
}
.cache-pill.ok {
  border-color: #1f6d3c;
  color: #9ef1b7;
  background: #0f2a1b;
}
.cache-pill.warn {
  border-color: #9f1d2a;
  color: #fecaca;
  background: #35141a;
}
.cache-pill.live {
  border-color: #4338ca;
  color: #c7d2fe;
  background: #1e1b4b;
}
.cache-row-actions {
  display: inline-flex;
  gap: 0.32rem;
  align-items: center;
}
.cache-progress-wrap {
  width: 100%;
  max-width: 180px;
  height: 7px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #0b1321;
  overflow: hidden;
}
.cache-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #22c55e, #4ade80);
}
.cache-progress-fill.warn {
  background: linear-gradient(90deg, #ef4444, #f97316);
}
.cache-progress-fill.active {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

/* Token display */
.token-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-all;
  margin: 0.75rem 0;
  user-select: all;
}
.token-warning {
  font-size: 0.78rem;
  color: var(--warning);
  margin-bottom: 0.5rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}
.empty-state p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  z-index: 2000;
  animation: slideIn 0.3s ease;
}
.toast.error {
  border-color: var(--danger);
}
.toast.success {
  border-color: var(--success);
}
@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ── Mobile (≤ 768px) ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .whatsapp-editor-grid,
  .whatsapp-editor-fields-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .whatsapp-editor-panel-wide {
    grid-column: auto;
  }
  /* Header */
  header {
    padding: 0.6rem 0.9rem;
    gap: 0.5rem;
  }
  header h1 {
    font-size: 0.95rem;
  }
  .hdr-logo {
    width: 1.55rem;
    height: 1.55rem;
  }
  header small {
    display: none;
  }

  /* Live-Badge: nur Punkt + sehr kurzer Text */
  .live-badge {
    font-size: 0;
    padding: 0;
    min-width: 0;
    background: none;
    border: none;
    box-shadow: none;
  }
  .live-badge::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
  }
  .live-badge.on::before {
    background: var(--success);
    box-shadow: 0 0 5px #22c55e88;
  }
  .live-badge.off::before {
    background: var(--danger);
    box-shadow: 0 0 5px #ef444488;
  }
  .live-badge.wait::before {
    background: #94a3b8;
    animation: livePulse 1.2s ease-in-out infinite;
  }
  @keyframes livePulse {
    0%,
    100% {
      opacity: 1;
    }
    50% {
      opacity: 0.4;
    }
  }

  /* hdr-right: enger zusammen */
  .hdr-right {
    gap: 0.5rem;
  }

  /* Notifications-Button */
  .notifications-popover {
    right: -0.5rem;
    width: min(94vw, 380px);
  }

  /* Account-Button: nur Avatar, kein Labeltext */
  .hdr-user-label {
    display: none;
  }
  .hdr-account-trigger {
    padding: 0.25rem;
    border-radius: 50%;
    min-height: 2rem;
  }
  .hdr-account-menu {
    right: max(0.5rem, env(safe-area-inset-right));
    top: calc(100% + 0.45rem);
    width: calc(100vw - 1rem - env(safe-area-inset-right));
    max-width: min(220px, calc(100vw - 1rem - env(safe-area-inset-right)));
  }

  /* Hauptcontainer */
  .container {
    padding: 0.9rem;
  }

  /* Toolbar */
  .toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* Buttons: größere Touch-Targets */
  .btn {
    min-height: 2.4rem;
  }
  .btn-sm {
    min-height: 2.2rem;
  }
  .btn-xs {
    min-height: 2rem;
  }

  /* Tab-Strip (Device-Detail Tabs) */
  .tab-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 0;
  }
  .tab-strip::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Device-Grid: 1 Spalte */
  .device-grid {
    grid-template-columns: 1fr;
  }
  .motd-slide-tile {
    width: 100%;
    max-width: none;
  }
  .motd-actions {
    flex-wrap: wrap;
  }

  /* Device-Detail: Vollbild */
  .device-detail-overlay {
    padding-top: 0;
    padding-bottom: 0;
    align-items: flex-start;
  }
  .device-detail-modal {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    max-height: 100dvh;
  }
  .device-detail-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  .detail-header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* Detail-Aktions-Grids */
  .detail-action-modal-layout {
    grid-template-columns: 1fr;
  }
  .detail-action-media-columns {
    grid-template-columns: 1fr;
  }
  .detail-action-media-actions {
    grid-template-columns: 1fr 1fr;
  }
  .detail-action-two-col {
    grid-template-columns: 1fr;
  }

  /* Media-Tiles */
  .media-create-grid {
    grid-template-columns: 1fr;
  }
  .media-browser-controls {
    align-items: stretch;
  }
  .media-browser-sort,
  .media-browser-filter,
  .media-browser-search {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
  .media-browser-summary {
    margin-left: 0;
    width: 100%;
  }
  .media-browser-scroll {
    max-height: min(64vh, 680px);
  }
  .media-tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .detail-select-inline {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  /* Bulk-Popup: Vollbild */
  .bulk-grid {
    grid-template-columns: 1fr;
  }
  .bulk-weekdays {
    grid-template-columns: 1fr;
  }

  /* Groups-Modal */
  .group-admin-grid {
    grid-template-columns: 1fr;
  }

  /* Gruppen- / Audit-Modal: Vollbild */
  .modal-overlay {
    align-items: flex-start;
  }
  .modal-content,
  .bulk-modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 0;
    max-height: 100dvh;
    margin: 0;
  }

  /* Preview */
  .preview-stage {
    grid-template-columns: 1fr;
  }
  .text-slide-v2-layout {
    grid-template-columns: 1fr;
  }
  .text-slide-v2-grid {
    grid-template-columns: 1fr;
  }
  .text-slide-v2-library-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(120px, 180px) minmax(0, 1fr);
  }
  .text-slide-v2-library-folders {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  }
  .preview-stage-info-panels {
    grid-template-columns: 1fr;
  }
  .preview-stage-info-card {
    height: 120px;
  }
  .preview-toolbar-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .preview-cache-panel-head {
    grid-template-columns: 1fr auto;
  }
  .preview-cache-panel-summary {
    grid-column: 1 / -1;
  }
  .timeline-cache-panel-head {
    grid-template-columns: 1fr auto;
  }
  .timeline-cache-panel-summary {
    grid-column: 1 / -1;
  }

  /* Notifications */
  .notification-item {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }

  /* Tabellen */
  .users-permissions-table th,
  .users-permissions-table td {
    padding: 0.4rem 0.55rem;
    font-size: 0.78rem;
  }

  /* Login */
  .login-box {
    width: min(100% - 1.5rem, 360px);
    margin: 0.75rem auto;
    border-radius: 10px;
    min-height: 0;
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
    padding: 1.25rem;
  }
  .login-logo {
    width: 1.8rem;
    height: 1.8rem;
  }
  .login-overlay {
    padding: 0;
    align-items: flex-start;
  }
}

@media (max-width: 400px) {
  .detail-action-media-actions {
    grid-template-columns: 1fr;
  }
  header h1 {
    font-size: 0.85rem;
  }
  .container {
    padding: 0.65rem;
  }
  .tab-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Responsive */
@media (max-width: 600px) {
  /* Kept for back-compat; 768px block covers the same rules */
}

@media (max-width: 1200px) {
  .tl-row-grid {
    grid-template-columns: 1fr;
  }
  .tl-scroll {
    max-height: 260px;
  }
  .tl-lib-controls {
    flex-direction: row;
    align-items: stretch;
  }
  .tl-lib-search-wrap {
    min-width: 0;
    flex-basis: 100%;
  }
  .tl-lib-icon-btn {
    flex: 1 1 180px;
    justify-content: center;
  }
  .tl-lib-controls .detail-select-inline {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .tl-dropzone {
    max-height: 420px;
  }
  .tl-col-media .tl-scroll,
  .tl-col-timeline .tl-dropzone {
    height: 420px;
    max-height: 420px;
    min-height: 420px;
  }
  .settings-split {
    grid-template-columns: 1fr;
  }
  .settings-index-sidebar {
    position: static;
  }
  .settings-index-list-vertical {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .settings-content-scroll {
    max-height: none;
    overflow: visible;
  }
}

/* Users Management UI */
.users-permissions-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.users-permissions-table th,
.users-permissions-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  text-align: left;
}
.users-permissions-table th {
  background: var(--surface2);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.users-permissions-table tr:last-child td {
  border-bottom: none;
}
.users-permissions-table .cb-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  width: 100%;
}
.users-badge {
  display: inline-flex;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.users-badge-global {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.users-badge-device {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ── Maintenance banner (Punkt 6) ─────────────────────────────────────────── */
.maintenance-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  color: #fbbf24;
  font-size: 0.85rem;
}
.maintenance-banner-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Deploy section badges/indicators (Punkt 6) ──────────────────────────── */
.deploy-maintenance-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.deploy-stable-badge {
  display: inline-block;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: middle;
}
.deploy-window-in {
  color: #4ade80;
  font-weight: 600;
}
.deploy-window-out {
  color: var(--text-muted);
}
.btn-xs {
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  border-radius: 4px;
}

/* ── Practice / Room sections on device overview ──────────────────────────── */
.practice-section {
  grid-column: 1 / -1;
  border: 1px solid #2d3a52;
  border-radius: 10px;
  background: #0e1420;
  padding: 0.85rem 0.9rem 0.9rem;
}
#device-grid > .device-grid {
  grid-column: 1 / -1;
}
.practice-section + .practice-section {
  margin-top: 0.75rem;
}
.practice-section-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7ca3d8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: margin-bottom 0.24s ease;
}
.practice-section-header:focus-visible {
  box-shadow: 0 0 0 2px rgba(124, 163, 216, 0.55);
}
.practice-section-collapsed .practice-section-header {
  margin-bottom: 0;
}
.practice-section-header-muted {
  color: var(--muted);
}
.overview-group-title {
  min-width: 0;
}
.overview-group-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
}
.overview-group-meta-item {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  border: 1px solid #24344d;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  padding: 0.12rem 0.42rem;
  color: #aebfd6;
}
.practice-section-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 0.6rem;
  max-height: 160rem;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition:
    max-height 0.3s ease,
    opacity 0.2s ease,
    transform 0.24s ease;
}
.practice-section-collapsed .practice-section-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.2rem);
}
.room-section {
  min-width: 0;
  border: 1px solid #1e2d44;
  border-radius: 7px;
  background: #111827;
  padding: 0.55rem 0.7rem 0.7rem;
}
.room-section-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.32rem 0.45rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}
.room-section-unassigned {
  border-style: dashed;
  border-color: #1e2d44;
  background: transparent;
}
.room-section .device-grid {
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (max-width: 768px) {
  .practice-section {
    padding: 0.7rem;
  }
  .practice-section-body {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .room-section {
    padding: 0.55rem;
  }
  .room-section .device-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .device-card {
    min-width: 0;
    max-width: 100%;
    padding: 0.95rem;
  }
  .device-card-body .row {
    gap: 0.45rem;
  }
  .device-card-body .row .val {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
  }
}

@media (prefers-reduced-motion: reduce) {
  .practice-section-header,
  .practice-section-body {
    transition: none;
  }
}

/* ── Organizer Modal ──────────────────────────────────────────────────────── */
.organizer-modal {
  width: min(1100px, 97vw) !important;
}
#organizer-modal-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 0.12rem;
}
.organizer-tabs {
  margin-bottom: 0.85rem;
}
.organizer-practices-tab {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1rem;
  min-height: 400px;
}
.organizer-left,
.organizer-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
}
.organizer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}
.organizer-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.organizer-tree {
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.organizer-practice {
  border: 1px solid #2d3a52;
  border-radius: 9px;
  background: #0e1420;
  overflow: hidden;
}
.organizer-practice-new {
  border-color: var(--accent);
}
.organizer-practice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: #131c2e;
  border-bottom: 1px solid #1e2d44;
}
.organizer-practice-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #7ca3d8;
}
.organizer-practice-body {
  padding: 0.5rem 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.organizer-room {
  border: 1px solid #1e2d44;
  border-radius: 6px;
  background: #111827;
  padding: 0.35rem 0.55rem 0.45rem;
  transition: border-color 0.15s, background 0.15s;
}
.organizer-room-new {
  border-color: var(--accent);
}
.organizer-room.organizer-drag-over {
  border-color: #4f7ebe;
  background: #162140;
}
.organizer-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.organizer-room-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}
.organizer-practice-drop {
  border: 1px dashed #1e2d44;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  min-height: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  transition: border-color 0.15s, background 0.15s;
}
.organizer-practice-drop.organizer-drag-over {
  border-color: #4f7ebe;
  background: #162140;
}
.organizer-head-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-shrink: 0;
}
.organizer-device-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 22px;
}
.organizer-device-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #334155;
  background: #121c2d;
  color: #c7d2e6;
  border-radius: 999px;
  padding: 0.28rem 0.45rem 0.28rem 0.6rem;
  font-size: 0.72rem;
  cursor: grab;
  user-select: none;
}
.organizer-device-chip:active {
  cursor: grabbing;
  opacity: 0.7;
}
.organizer-device-chip-unassigned {
  background: #0e1420;
  border-color: #253348;
}
.organizer-chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.1rem;
  font-size: 0.65rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.organizer-chip-remove:hover {
  color: #ef4444;
}
.organizer-drop-hint {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
}
.organizer-unassigned-list {
  flex: 1 1 auto;
  overflow-y: auto;
  border: 1px dashed #2d3a52;
  border-radius: 7px;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-content: flex-start;
  min-height: 80px;
  transition: border-color 0.15s, background 0.15s;
}
.organizer-unassigned-list.organizer-drag-over {
  border-color: #4f7ebe;
  background: #0d1829;
}
.organizer-inline-input {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0.45rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.82rem;
}
.organizer-inline-input-sm {
  font-size: 0.78rem;
  padding: 0.18rem 0.35rem;
}
.organizer-inline-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Setup Wizard ─────────────────────────────────────────────────────────── */
.setup-wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  overflow: hidden;
}
.setup-wizard-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(620px, 95vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.setup-wizard-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.setup-wizard-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.setup-wizard-header-row h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.setup-wizard-steps {
  display: flex;
  align-items: center;
}
.setup-wizard-step-item {
  display: flex;
  align-items: center;
  flex: 1;
}
.setup-wizard-step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.setup-wizard-step-dot.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.setup-wizard-step-dot.done {
  border-color: var(--accent);
  background: var(--surface2);
  color: var(--accent);
  font-size: 0.7rem;
}
.setup-wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  transition: background 0.25s;
}
.setup-wizard-step-line.done {
  background: var(--accent);
}
.setup-wizard-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.setup-wizard-illustration {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: #0f1117;
}
.setup-wizard-illustration img {
  max-height: 200px;
  max-width: 100%;
  object-fit: contain;
}
.setup-wizard-step-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
}
.setup-wizard-step-desc {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.setup-wizard-step-desc a {
  color: var(--accent);
}
.setup-wizard-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.setup-wizard-checklist li {
  padding-left: 1.3rem;
  position: relative;
  font-size: 0.84rem;
  color: var(--fg);
  line-height: 1.5;
}
.setup-wizard-checklist li::before {
  content: "✓";
  color: var(--accent);
  font-weight: 700;
  font-size: 0.76rem;
  position: absolute;
  left: 0;
  top: 0.14em;
}
.setup-wizard-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.7rem 2.8rem 0.7rem 0.85rem;
  font-family: monospace;
  font-size: 0.76rem;
  word-break: break-all;
  margin-bottom: 0.75rem;
  user-select: all;
  line-height: 1.55;
  position: relative;
}
.setup-wizard-copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.22rem 0.55rem;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.setup-wizard-copy-btn:hover {
  color: var(--fg);
  border-color: var(--accent);
}
.setup-wizard-note {
  font-size: 0.79rem;
  color: var(--muted);
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.8rem;
  line-height: 1.5;
}
.setup-wizard-note strong { color: var(--fg); }
.setup-wizard-note code {
  font-size: 0.75rem;
  background: var(--bg);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.setup-wizard-check-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.setup-wizard-check-status {
  font-size: 0.82rem;
  color: var(--muted);
}
.setup-wizard-check-status.online { color: #4ade80; }
.setup-wizard-check-status.checking { color: var(--accent); }
.setup-wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  gap: 0.5rem;
  flex-shrink: 0;
}
.setup-wizard-progress-label {
  font-size: 0.74rem;
  color: var(--muted);
}
.setup-wizard-success-box {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  color: #86efac;
  line-height: 1.5;
}

/* Inline SVG animation keyframes for wizard illustrations */
@keyframes wiz-pulse { 0%,100%{opacity:.6} 50%{opacity:1} }
@keyframes wiz-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
@keyframes wiz-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
.wiz-pulse { animation: wiz-pulse 2s ease-in-out infinite; }
.wiz-bounce { animation: wiz-bounce 1.8s ease-in-out infinite; }
