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

:root {
  --bg: #edf5f7;
  --surface: #ffffff;
  --surface-soft: #f4fafb;
  --surface-muted: #e3f0f2;
  --ink: #10242f;
  --muted: #52707a;
  --faint: #8da1a8;
  --border: rgba(13, 127, 137, 0.18);
  --border-strong: rgba(13, 127, 137, 0.34);
  --primary: #0d7f89;
  --primary-hover: #0f6272;
  --primary-soft: rgba(13, 127, 137, 0.12);
  --accent: #f2b94b;
  --accent-soft: #fff2cd;
  --success: #1b766a;
  --success-soft: #e4f3ef;
  --danger: #b64b45;
  --danger-soft: #f8eaea;
  --shadow: 0 18px 46px rgba(15, 98, 114, 0.13);
  --shadow-soft: 0 8px 22px rgba(15, 98, 114, 0.09);
  --r: 8px;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(132deg, rgba(13, 127, 137, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(242, 185, 75, 0.16), rgba(255,255,255,0) 34%),
    repeating-linear-gradient(90deg, rgba(16, 36, 47, 0.05) 0 1px, transparent 1px 5rem),
    linear-gradient(145deg, #f8fcff 0%, var(--bg) 54%, #dfecef 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  background-attachment: fixed;
}

button, input, select {
  font: inherit;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

a {
  color: inherit;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.68), transparent 52%),
    transparent;
}

.login-box {
  width: min(100%, 420px);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.login-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--primary), var(--accent));
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-wrap {
  width: 108px;
  min-height: 34px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  background: transparent;
  padding: 0;
}

.brand-logo-wrap-large {
  width: 146px;
  min-height: 44px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 44px;
  object-fit: contain;
}

.brand-lockup h1,
.topbar h1,
.section-head h2,
.panel h3,
.modal-head h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand-lockup h1 {
  font-size: 1.5rem;
}

.brand-lockup p,
.panel p,
.sidebar-brand span {
  margin: 4px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.setup-box {
  width: min(100%, 680px);
}

.setup-status {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.setup-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-checks {
  display: grid;
  gap: 8px;
}

.setup-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.62);
}

.setup-check strong,
.setup-check span {
  display: block;
}

.setup-check span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.setup-check-badge {
  min-width: 78px;
  padding: 5px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--success);
  background: var(--success-soft);
}

.setup-check.failed {
  border-color: rgba(182, 75, 69, 0.28);
  background: rgba(248, 234, 234, 0.62);
}

.setup-check.failed .setup-check-badge {
  color: var(--danger);
  background: var(--danger-soft);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  isolation: isolate;
  position: relative;
}

.sidebar {
  width: 235px;
  min-height: 100vh;
  padding: 22px 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.78) 64%, rgba(244,250,251,0.92) 100%),
    repeating-linear-gradient(90deg, rgba(16, 36, 47, 0.045) 0 1px, transparent 1px 5rem);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 14px 0 34px rgba(15, 98, 114, 0.055);
  overflow: hidden;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-brand strong {
  display: block;
}

.sidebar-active-screen {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sidebar-active-screen-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  text-transform: none;
}

.sidebar-active-screen-name {
  margin: 0;
  display: block;
  font-size: 0.98rem;
}

.sidebar-active-screen-url {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-all;
}

.nav-tabs {
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.nav-tab {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.15;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.nav-tab::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(13, 127, 137, 0.22);
  box-shadow: 0 0 0 4px rgba(13, 127, 137, 0.06);
}

.nav-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--border);
}

.nav-tab.active {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(13, 127, 137, 0.11), rgba(255, 255, 255, 0.86));
  border-color: var(--border);
  box-shadow: 0 8px 18px rgba(15, 98, 114, 0.08);
}

.nav-tab.active::before {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 127, 137, 0.14);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.sidebar-footer .status-pill {
  width: 100%;
  justify-content: center;
}

.sidebar-footer .btn {
  justify-content: center;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 25, 32, 0.36);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.2s ease;
}

.app-version {
  color: var(--faint);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.field-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.84rem;
  font-weight: 650;
}

.status-pill.dirty {
  background: #f3efe7;
  color: #7a623f;
}

.status-pill.pending {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-pill.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  color: inherit;
  cursor: pointer;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

.menu-toggle span {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(-50%);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle span:nth-child(1) {
  top: 14px;
}

.menu-toggle span:nth-child(2) {
  top: 21px;
}

.menu-toggle span:nth-child(3) {
  top: 28px;
}

.menu-toggle-label {
  display: none;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 650;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.78)),
    linear-gradient(90deg, rgba(242, 185, 75, 0.16), transparent 42%),
    repeating-linear-gradient(135deg, rgba(16, 36, 47, 0.05) 0 1px, transparent 1px 13px);
  box-shadow: var(--shadow-soft);
}

.topbar h1 {
  font-size: 1.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

.tab-content {
  display: none;
  max-width: 100%;
}

.tab-content.active {
  display: grid;
  gap: 16px;
}

.settings-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.settings-tab {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
}

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

.settings-tab.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.settings-tab-content {
  display: none;
}

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

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

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.preset-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.preset-card {
  min-height: 82px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.preset-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-soft);
  transform: translateY(-1px);
}

.preset-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.status-row strong,
.status-row span {
  min-width: 0;
}

.status-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.storage-overview {
  display: grid;
  gap: 10px;
}

.storage-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary, #1D60FB);
  transition: width 0.3s ease;
}

.storage-bar-fill.warn {
  background: #d9870b;
}

.storage-bar-fill.danger {
  background: #d23b3b;
}

.screen-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}

.screen-list {
  display: grid;
  gap: 8px;
}

.screen-row {
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.screen-row:hover,
.screen-row.active {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.screen-row.active {
  background:
    linear-gradient(90deg, rgba(13, 127, 137, 0.12), rgba(255, 255, 255, 0.86));
}

.screen-row strong,
.screen-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.83rem;
}

.screen-row .mini-pill {
  white-space: nowrap;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.74));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.82);
}

.schedule-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(210px, auto);
  gap: 12px;
  align-items: end;
}

.schedule-name-field,
.schedule-time-grid label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.schedule-name-field span,
.schedule-time-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.schedule-time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  gap: 10px;
}

.weekday-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.weekday-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.weekday-pill input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.weekday-pill:has(input:checked) {
  border-color: var(--border-strong);
  background: var(--primary-soft);
  color: var(--primary);
}

.schedule-summary {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.schedule-actions {
  display: flex;
  justify-content: flex-end;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
}

.mini-pill.ok {
  background: var(--success-soft);
  color: var(--success);
}

.mini-pill.warn {
  background: #f3efe7;
  color: #7a623f;
}

.mini-pill.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}

.section-head.tight {
  margin-top: 12px;
}

.section-head h2 {
  font-size: 1.45rem;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.76));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(242, 185, 75, 0.8), rgba(13, 127, 137, 0.86));
  opacity: 0.72;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 1rem;
}

.panel p {
  font-size: 0.92rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-grid.compact {
  grid-template-columns: repeat(2, minmax(180px, 260px));
}

.field {
  display: grid;
  gap: 7px;
  align-content: start;
}

.field label,
.login-form label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="datetime-local"],
input[type="time"],
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-size: 0.95rem;
  padding-right: 40px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%, var(--muted) 52%, transparent 52%),
    linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 52%, transparent 52%),
    linear-gradient(var(--border), var(--border));
  background-position: calc(100% - 17px) 18px, calc(100% - 13px) 18px, calc(100% - 31px) 50%;
  background-size: 6px 6px, 6px 6px, 1px 14px;
  background-repeat: no-repeat;
  background-color: #f8fcff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

select:hover {
  border-color: #9cbacc;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 67, 98, 0.07);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(13, 127, 137, 0.16);
  background-color: #ffffff;
}

select:focus,
select:focus-visible {
  box-shadow: 0 0 0 3px rgba(13, 127, 137, 0.16), 0 4px 12px rgba(13, 127, 137, 0.12);
}

select:disabled {
  box-shadow: none;
  color: #7b8a98;
}

select option {
  padding: 9px 11px;
}

/* Hold Quill editor toolbar selects with its native UI */
.ql-toolbar select {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  padding: 0;
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  min-height: 0;
  background-image: none;
}

input[type="file"] {
  color: var(--muted);
  max-width: 100%;
}

.input-suffix {
  display: flex;
  align-items: center;
}

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

.input-suffix input {
  border-radius: var(--r) 0 0 var(--r);
}

.input-suffix span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--r) var(--r) 0;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.9rem;
}

.btn,
.file-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--r);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 8px 16px rgba(13, 127, 137, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #094b57);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.btn-danger:hover {
  background: #f5dddd;
}

.btn-sm {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.86rem;
}

.btn-full {
  width: 100%;
}

.icon-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 1.3rem;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--border-strong);
  background: #ffffff;
}

.segmented {
  width: fit-content;
  display: inline-flex;
  padding: 4px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
}

.toggle {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
  cursor: pointer;
}

.toggle.active {
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.switch-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.switch {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-weight: 700;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.switch:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.logo-control {
  display: grid;
  gap: 10px;
}

.logo-preview-card {
  --logo-preview-header: var(--primary);
  --logo-preview-bg: #0b4654;
  --logo-preview-accent: var(--accent);
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--logo-preview-accent) 20%, transparent), transparent 36%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 4.6rem),
    linear-gradient(120deg, var(--logo-preview-header), color-mix(in srgb, var(--logo-preview-header) 56%, var(--logo-preview-bg)) 58%, var(--logo-preview-bg));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--logo-preview-accent) 72%, transparent);
}

.logo-preview-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--logo-preview-accent) 16%, transparent), transparent),
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 46% 100%, 100% 18px;
  opacity: 0.58;
  pointer-events: none;
}

#logo-preview {
  width: auto;
  max-width: min(100%, 340px);
  max-height: 70px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

#logo-empty {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.logo-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-button {
  position: relative;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  border-color: var(--border);
}

.file-button:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.stop-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.stop-results:empty {
  display: none;
}

.stop-result {
  width: 100%;
  min-height: 42px;
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.stop-result:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.stop-result strong,
.stop-result span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop-result span {
  color: var(--muted);
  font-size: 0.84rem;
}

.stop-results-note {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.color-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input input[type="color"] {
  width: 46px;
  height: 42px;
  flex: 0 0 46px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #fff;
  padding: 3px;
  cursor: pointer;
}

.color-input input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.slides-list {
  display: grid;
  gap: 10px;
}

.slide-item {
  min-height: 78px;
  display: grid;
  grid-template-columns: 32px 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.slide-item.is-disabled {
  opacity: 0.68;
  background: #eef4f6;
}

.slide-item.is-disabled .slide-type-pill {
  text-decoration: line-through;
}

.slide-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.slide-item.is-scheduled {
  border-color: #c8d9df;
}

.slide-item.is-waiting,
.slide-item.is-expired {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(237,245,247,0.84));
}

.slide-drag {
  width: 28px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--faint);
  background: var(--surface-soft);
  cursor: grab;
  user-select: none;
  font-weight: 900;
}

.slide-drag:active {
  cursor: grabbing;
}

.slide-preview {
  width: 92px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #1f2730;
  display: grid;
  place-items: center;
}

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

.slide-type-pill {
  min-width: 44px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

.slide-info {
  min-width: 0;
}

.slide-name-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.slide-info .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.slide-state-pill {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}

.slide-state-pill.hidden,
.slide-state-pill.expired {
  background: var(--danger-soft);
  color: var(--danger);
}

.slide-state-pill.waiting {
  background: var(--accent-soft);
  color: #8b5d1f;
}

.slide-info .meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.slide-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.empty-list {
  min-height: 142px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.76), rgba(237,245,247,0.76));
  text-align: center;
}

.empty-list p {
  margin: 6px 0 14px;
}

.empty-list.small {
  min-height: 82px;
  padding: 14px;
}

.editor-panel {
  padding: 0;
  overflow: hidden;
}

#quill-editor {
  min-height: 320px;
  background: #fff;
  color: var(--ink);
}

.ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.ql-container.ql-snow {
  border: 0;
  font: inherit;
}

.ql-editor {
  min-height: 280px;
  font-size: 1rem;
  line-height: 1.6;
}

.ql-editor.ql-blank::before {
  color: var(--faint);
  font-style: normal;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 32, 47, 0.5);
  backdrop-filter: blur(10px);
}

.modal-content {
  width: min(100%, 1120px);
  max-height: min(92vh, 860px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,252,255,0.86)),
    repeating-linear-gradient(90deg, rgba(16, 36, 47, 0.045) 0 1px, transparent 1px 5rem);
  box-shadow: var(--shadow);
}

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

.modal-form {
  display: grid;
  gap: 14px;
}

.inline-panel {
  padding: 12px;
  background: var(--surface-soft);
}

.inline-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inline-panel-head h4 {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.2;
}

.inline-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.switch-row.compact {
  margin: 0 0 12px;
}

.schedule-panel .muted-help {
  display: block;
  margin-top: 10px;
}

.modal-preview-panel {
  position: sticky;
  top: 0;
  min-height: 360px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #0b0f14;
}

.preview-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.preview-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

#slide-preview-frame {
  width: 100%;
  min-height: 420px;
  height: min(48vh, 520px);
  border: 0;
  background: #000;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions {
  justify-content: flex-end;
  padding-top: 4px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 300;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--ink), #274052);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--danger);
}

.toast.ok {
  background: var(--success);
}

.form-error {
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.upload-status {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

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

.design-card {
  min-height: 150px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.design-card:hover,
.design-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-soft);
  transform: translateY(-1px);
}

.design-card strong {
  font-size: 0.98rem;
}

.design-card small {
  color: var(--muted);
  line-height: 1.35;
}

.design-preview {
  height: 54px;
  border-radius: 7px;
  border: 1px solid rgba(0,0,0,0.12);
  overflow: hidden;
  position: relative;
}

.design-preview::before,
.design-preview::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.design-preview::before {
  left: 10px;
  top: 12px;
  width: 44%;
  height: 8px;
  background: rgba(255,255,255,0.78);
}

.design-preview::after {
  left: 10px;
  bottom: 11px;
  width: 70%;
  height: 12px;
}

.design-preview-classic {
  background: linear-gradient(135deg, #1d60fb 0 28%, #0a0a0a 28% 100%);
}

.design-preview-classic::after {
  background: #ffffff;
}

.design-preview-terminal {
  background:
    linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    #02060d;
  background-size: 18px 18px;
}

.design-preview-terminal::after {
  background: #ffd400;
}

.design-preview-monochrome {
  background:
    linear-gradient(90deg, #222222 0 26%, transparent 26% 100%),
    linear-gradient(160deg, #f7f7f7 0 52%, #efefef 52% 100%);
}

.design-preview-monochrome::before {
  background: rgba(17, 17, 17, 0.76);
}

.design-preview-monochrome::after {
  background: #9a9a9a;
}

.design-preview-fjord {
  background: linear-gradient(145deg, #8ee3d0 0 24%, #1f7a8c 24% 58%, #0e2834 58%);
}

.design-preview-fjord::after {
  background: #f7fbff;
}

.design-preview-studio {
  background: linear-gradient(145deg, #ef476f 0 32%, #252a36 32% 68%, #11131a 68%);
}

.design-preview-studio::after {
  background: #ffd166;
}

.design-preview-signal {
  background:
    linear-gradient(90deg, #0f6272 0 26%, transparent 26% 100%),
    linear-gradient(145deg, #f8fcff 0 48%, #dcecf0 48% 100%);
}

.design-preview-signal::before {
  background: rgba(15, 98, 114, 0.76);
}

.design-preview-signal::after {
  background: #f2b94b;
}

.design-preview-aurora {
  background:
    linear-gradient(120deg, rgba(47, 191, 145, 0.42) 0 18%, transparent 18% 43%, rgba(216, 243, 90, 0.25) 43% 58%, transparent 58%),
    linear-gradient(145deg, #0a2b35 0 38%, #06131a 38% 100%);
}

.design-preview-aurora::after {
  background: #d8f35a;
}

.design-preview-lumen {
  background:
    linear-gradient(90deg, #203a49 0 28%, transparent 28%),
    linear-gradient(145deg, #f7fafc 0 50%, #dde8ee 50% 100%);
}

.design-preview-lumen::before {
  background: rgba(50, 117, 143, 0.72);
}

.design-preview-lumen::after {
  background: #f06a3d;
}

.design-preview-radar {
  background:
    linear-gradient(rgba(246, 200, 95, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 200, 95, 0.06) 1px, transparent 1px),
    linear-gradient(145deg, #102d29 0 38%, #07120f 38% 100%);
  background-size: 18px 18px, 18px 18px, auto;
}

.design-preview-radar::after {
  background: #f6c85f;
}

.design-preview-horizon {
  background:
    linear-gradient(132deg, rgba(255, 122, 89, 0.42) 0 24%, transparent 24% 52%, rgba(22, 163, 165, 0.44) 52% 70%, transparent 70%),
    linear-gradient(145deg, #0d4d5d 0 42%, #081a22 42% 100%);
}

.design-preview-horizon::after {
  background: #ff7a59;
}

.design-preview-editorial {
  background:
    linear-gradient(90deg, #20262e 0 24%, transparent 24%),
    linear-gradient(145deg, #f4f6f8 0 50%, #dce4e8 50% 100%);
}

.design-preview-editorial::before {
  background: rgba(211, 63, 73, 0.78);
}

.design-preview-editorial::after {
  background: #38a3a5;
}

.template-fields {
  display: grid;
  gap: 14px;
}

.field-action {
  align-content: end;
}

.checkbox-list {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.76);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--ink);
  font-size: 0.9rem;
}

.check-row input {
  width: auto;
}

.muted-help {
  color: var(--muted);
  font-size: 0.88rem;
}

.mode-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.mode-option input {
  width: auto;
  margin: 0;
}

.mode-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

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

.line-filter-actions {
  display: flex;
  gap: 6px;
}

.line-filter {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 200px;
  overflow: auto;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.76);
}

.line-filter .field-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.line-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.line-option:hover {
  background: var(--primary-soft);
}

.line-option input {
  width: auto;
  margin: 0;
}

.sortable-ghost {
  opacity: 0.5;
}

@keyframes adminStripe {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
    position: static;
  }

  .sidebar {
    min-height: auto;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(292px, 85vw);
    z-index: 70;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease;
    overflow-y: auto;
    box-shadow: var(--shadow);
  }

  .nav-tabs {
    display: grid;
    padding: 4px;
    border-color: transparent;
    box-shadow: none;
    background: transparent;
  }

  .nav-tab {
    width: 100%;
    font-size: 0.96rem;
  }

  .admin-shell.is-mobile-nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .admin-shell.is-mobile-nav-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .workspace {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-left {
    align-items: center;
    flex-wrap: nowrap;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .menu-toggle-label {
    display: inline;
  }

  .admin-shell.is-mobile-nav-open .menu-toggle span:nth-child(1) {
    transform: translate(-50%, 7px) rotate(45deg);
  }

  .admin-shell.is-mobile-nav-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .admin-shell.is-mobile-nav-open .menu-toggle span:nth-child(3) {
    transform: translate(-50%, -7px) rotate(-45deg);
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-preview-panel {
    position: static;
  }

}

@media (max-width: 720px) {
  .field-grid,
  .field-grid.compact,
  .color-grid,
  .screen-admin-grid,
  .schedule-row,
  .schedule-main {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-status-head,
  .setup-check {
    grid-template-columns: 1fr;
  }

  .setup-status-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-check-badge {
    justify-self: flex-start;
  }

  .slide-item {
    grid-template-columns: 28px 78px minmax(0, 1fr);
  }

  .slide-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .segmented {
    width: 100%;
  }

  .toggle {
    flex: 1;
  }
}
