:root {
  --bg: #08111f;
  --bg-soft: #0f172a;
  --bg-card: #111c31;
  --bg-card-2: #16243d;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --muted: #97a6ba;
  --accent: #34d399;
  --accent-2: #2dd4bf;
  --danger: #f87171;
  --warning: #fbbf24;
  --ok: #22c55e;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.15), transparent 24rem),
    linear-gradient(180deg, #050b15 0%, #08111f 100%);
  color: var(--text);
}

body {
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
}

.shell-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(8, 17, 31, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand-block,
.brand-stack {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo,
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.4rem;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-subtitle,
.muted-card span,
.page-intro p,
.screen-card p,
.meta-list dt,
.field span,
.login-card p {
  color: var(--muted);
}

.top-nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.top-nav a {
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
}

.top-nav a.is-active,
.top-nav a:hover {
  color: var(--text);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.12);
}

.page-shell {
  width: min(1360px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.guest-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.stack {
  display: grid;
  gap: 1rem;
}

.narrow {
  width: min(760px, 100%);
  margin: 0 auto;
}

.card {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.98), rgba(10, 19, 35, 0.98));
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.compact-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid transparent;
}

.alert.success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.alert.danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span,
.field legend {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.inline-form input,
.inline-form select,
.screen-url input,
.upload-row input[type="file"] {
  width: 100%;
  padding: 0.82rem 0.95rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 10, 20, 0.65);
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.fieldset,
fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}

.checkbox-grid label,
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox-row span {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.96rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.82rem 1rem;
  border-radius: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #022c22;
}

.btn.ghost {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.btn.danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.btn.small {
  padding: 0.55rem 0.8rem;
  font-size: 0.84rem;
}

.btn.full {
  width: 100%;
}

.login-grid {
  width: min(460px, calc(100vw - 2rem));
}

.login-card {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.98), rgba(7, 15, 28, 0.98));
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

.page-intro,
.section-head,
.group-head,
.screen-top,
.user-head,
.action-row,
.screen-url,
.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.wrap {
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form.compact input,
.inline-form.compact select {
  min-width: 180px;
}

.screen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.screen-card,
.playlist-card,
.user-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1rem;
}

.screen-card h3,
.playlist-card h3,
.card h1,
.card h2 {
  margin: 0;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 0.9rem;
  margin: 1rem 0;
}

.meta-list div,
.flat-list {
  margin: 0;
}

.meta-list dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}

.meta-list dd {
  margin: 0;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-online {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.status-warning {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

.status-offline {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.empty-card,
.muted-card {
  display: grid;
  gap: 0.3rem;
  place-items: start;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 1rem;
}

.editor-sidebar,
.editor-main {
  min-width: 0;
}

.slide-add-grid,
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.grid-form .full-span,
.slide-add-grid .full-span {
  grid-column: 1 / -1;
}

.playlist-stack {
  display: grid;
  gap: 1rem;
}

.day-grid {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.day-pill {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.day-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.day-pill span {
  display: inline-flex;
  min-width: 2.2rem;
  justify-content: center;
  align-items: center;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.day-pill.active {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.16);
}

.top-gap {
  margin-top: 0.8rem;
}

.flat-list {
  padding-left: 1.2rem;
}

.player-body {
  background: #000;
}

.player-stage {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

#content,
.player-stage iframe,
.player-stage img,
.player-stage video {
  width: 100%;
  height: 100%;
}

#content {
  position: absolute;
  inset: 0;
}

.player-stage img,
.player-stage video {
  object-fit: contain;
  background: #000;
}

.player-stage iframe {
  border: 0;
  background: #fff;
}

.p-clock {
  position: absolute;
  z-index: 40;
  padding: 1rem 1.2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
}

.pos-top-right {
  top: 0;
  right: 0;
}

.pos-top-left {
  top: 0;
  left: 0;
}

.pos-top-center {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.p-logo {
  position: absolute;
  z-index: 45;
  padding: 1rem;
  max-width: 15%;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.7));
}

.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.weather {
  min-width: 230px;
  padding: 0.8rem 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.weather-location,
.weather-location-enhanced,
.rss-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #bbf7d0;
}

.weather-days {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.35rem;
}

.w-day {
  text-align: center;
}

.w-name {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
}

.w-temp {
  font-size: 1rem;
  font-weight: 700;
}

.w-rain {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.8);
}

.ticker {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-move {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  font-weight: 700;
  animation: ticker-move var(--speed, 18s) linear infinite;
}

@keyframes ticker-move {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-200%);
  }
}

.weather-vertical,
.rss-sidebar {
  position: absolute;
  right: 1.2rem;
  width: 260px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  border-radius: 1rem;
  padding: 1rem;
  z-index: 50;
}

.weather-vertical {
  top: 1.2rem;
}

.weather-day-enhanced {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.weather-day-enhanced:last-child,
.rss-item:last-child {
  border-bottom: 0;
}

.weather-date,
.rss-item {
  font-size: 0.84rem;
}

.weather-temp-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.rss-sidebar.pos-top-right {
  top: 4.8rem;
}

.rss-sidebar.pos-middle-right {
  top: 50%;
  transform: translateY(-50%);
}

.rss-sidebar.pos-bottom-right {
  bottom: 5rem;
}

.rss-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.status-badge {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.status-badge.online-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--danger);
}

#dot.ok {
  background: var(--ok);
}

.fallback-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.7);
}

.fallback-box {
  width: min(560px, 100%);
  padding: 1.5rem;
  border-radius: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 17, 31, 0.92);
  text-align: center;
}

@media (max-width: 980px) {
  .editor-layout,
  .slide-add-grid,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100vw - 1rem, 100%);
  }

  .shell-header,
  .page-intro,
  .group-head,
  .screen-top,
  .section-head,
  .screen-url,
  .upload-row {
    align-items: stretch;
    flex-direction: column;
  }

  .meta-list {
    grid-template-columns: 1fr;
  }
}
