:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #607086;
  --line: #d9e0e8;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --primary: #126c76;
  --primary-dark: #0a3f4b;
  --accent: #ce405b;
  --sun: #f7b733;
  --green: #28875b;
  --shadow: 0 18px 45px rgba(15, 33, 49, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(18, 108, 118, 0.2), transparent 40%),
    linear-gradient(315deg, rgba(206, 64, 91, 0.16), transparent 42%),
    #eef3f6;
}

.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--ink);
}

.login-card h1 {
  margin: 24px 0 8px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.form-error {
  border-radius: 7px;
  background: #f8e8eb;
  color: #a92841;
  padding: 10px 12px;
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: #111a24;
  color: #f5f7fb;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--sun);
  color: #101820;
  font-weight: 900;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button,
.side-link {
  width: 100%;
  min-height: 42px;
  border-radius: 7px;
  color: #dce5ef;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
  text-decoration: none;
}

.nav button.active,
.nav button:hover,
.side-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.side-note {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
  display: grid;
  gap: 10px;
  color: #afbdca;
  font-size: 13px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

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

.content {
  padding: 24px 28px 36px;
  display: grid;
  gap: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 33, 49, 0.05);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.dashboard-grid,
.settings-layout {
  display: grid;
  gap: 18px;
}

.dashboard-hero .panel-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-hero h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
}

.dashboard-actions,
.dashboard-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.settings-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.settings-layout .panel:nth-child(2) {
  grid-column: 1 / -1;
}

.settings-layout .panel:nth-child(3) {
  grid-column: 2;
  grid-row: 1;
}

.settings-layout .panel:nth-child(2) .two-cols {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-head {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px;
}

.button {
  min-height: 40px;
  border-radius: 7px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #e9eef3;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.button.primary {
  background: var(--primary);
  color: white;
}

.button.danger {
  background: #f8e8eb;
  color: #a92841;
}

.button.icon {
  width: 40px;
  padding: 0;
}

.dropzone {
  min-height: 156px;
  border: 2px dashed #b7c4d2;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragging {
  border-color: var(--primary);
  background: #eaf6f7;
}

.upload-progress {
  margin-top: 12px;
  border-radius: 7px;
  background: #eaf6f7;
  color: var(--primary-dark);
  padding: 10px 12px;
  font-weight: 800;
}

.clock-creative-form {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.clock-creative-head strong,
.clock-creative-head span {
  display: block;
}

.clock-creative-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.clock-creative-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.clock-date-option {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.clock-date-option input {
  width: 18px;
  height: 18px;
}

.dropzone strong {
  display: block;
  color: var(--ink);
  margin-bottom: 5px;
}

.hidden-input {
  display: none;
}

.playlist {
  display: grid;
  gap: 10px;
}

.media-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.media-row.drag-over {
  outline: 2px solid var(--primary);
}

.thumb {
  width: 86px;
  height: 54px;
  border-radius: 6px;
  background: #101820;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #f7f8fa;
  font-size: 12px;
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.clock-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background-color: #183842;
  background-position: center;
  background-size: cover;
  text-shadow: 0 2px 8px #000;
}

.media-meta {
  min-width: 0;
}

.media-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-meta span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.rename-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rename-row input {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  padding: 7px 9px;
}

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

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.screen-select {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 700;
}

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

.screen-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.screen-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(18, 108, 118, 0.12);
}

.screen-card strong,
.screen-card span {
  display: block;
}

.screen-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.screen-card span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}

.screen-status {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.copy-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--muted);
  background: #f8fafc;
}

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weekday-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-pill span {
  min-width: 42px;
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.check-pill input:checked + span {
  border-color: var(--primary);
  background: #eaf6f7;
  color: var(--primary-dark);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.segmented button {
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--primary);
  color: #ffffff;
}

.stats-grid {
  display: grid;
  gap: 16px;
}

.stats-controls {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.stats-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 8px;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 14px;
}

.stats-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.chart {
  display: grid;
  gap: 10px;
}

.chart-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.chart-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}

.chart-row div {
  height: 28px;
  border-radius: 7px;
  background: #edf2f6;
  overflow: hidden;
}

.chart-row i {
  display: block;
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--primary), var(--sun));
}

.chart-row b {
  text-align: right;
}

.line-chart-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.line-chart-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.line-chart {
  display: block;
  width: 100%;
  height: 190px;
  overflow: visible;
}

.line-chart line {
  stroke: #dbe3ec;
  stroke-width: 1;
}

.line-chart text {
  fill: var(--muted);
  font-size: 11px;
}

.line-path {
  fill: none;
  stroke: #ff4b16;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-point {
  fill: #ff4b16;
  stroke: #ffffff;
  stroke-width: 2;
  cursor: pointer;
}

.line-hit {
  fill: transparent;
  cursor: pointer;
}

.line-tooltip {
  opacity: 0;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 5px;
  stroke-linejoin: round;
  fill: var(--ink);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.line-point-group:hover .line-tooltip {
  opacity: 1;
}

.line-point-group:hover .line-point {
  r: 6;
}

.line-label {
  font-weight: 700;
  font-size: 9px !important;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-table th,
.stats-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.stats-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.upload-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.upload-preview div {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.upload-preview div:last-child {
  border-bottom: 0;
}

.upload-preview span {
  color: var(--muted);
}

.badge {
  align-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e5f4ed;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.badge.paused {
  background: #f8e8eb;
  color: #a92841;
}

.badge.online {
  background: #e5f4ed;
  color: var(--green);
}

.badge.offline {
  background: #f8e8eb;
  color: #a92841;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  background: #111a24;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 40px));
}

.player {
  position: fixed;
  inset: 0;
  background: #05080c;
  color: white;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #05080c;
}

.stage img,
.stage video {
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  display: block;
}

.stage.contain img,
.stage.contain video {
  object-fit: contain;
}

.clock-slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #12343d;
  background-position: center;
  background-size: cover;
  overflow: hidden;
}

.clock-slide:not(.with-background) {
  background: linear-gradient(145deg, #12343d 0%, #1d6a72 52%, #101820 100%);
}

.clock-slide-shade {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 14, 0.28);
}

.clock-slide-content {
  position: relative;
  z-index: 1;
  padding: 24px;
  text-align: center;
  text-shadow: 0 8px 36px rgba(0, 0, 0, 0.58);
}

.clock-slide-time {
  font-size: clamp(90px, 19vw, 330px);
  line-height: 0.9;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.clock-slide-date {
  margin-top: 30px;
  font-size: clamp(24px, 3.5vw, 64px);
  font-weight: 700;
  text-transform: capitalize;
}

.player-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 54px;
  display: flex;
  align-items: center;
  background: rgba(5, 8, 12, 0.78);
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.ticker span {
  white-space: nowrap;
  padding-left: 100%;
  animation: ticker 26s linear infinite;
  font-size: clamp(18px, 2vw, 28px);
}

.clock {
  position: absolute;
  top: 20px;
  right: 26px;
  font-size: clamp(18px, 2.3vw, 34px);
  font-weight: 800;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.player-empty {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(120deg, rgba(18, 108, 118, 0.45), transparent 46%),
    linear-gradient(240deg, rgba(206, 64, 91, 0.36), transparent 46%),
    #05080c;
}

.player-empty h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 76px);
}

.player-empty p {
  margin: 0;
  color: #dce5ef;
  font-size: clamp(17px, 2vw, 26px);
  max-width: 780px;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@media (max-width: 1050px) {
  .clock-creative-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: row;
    align-items: center;
    padding: 12px;
    gap: 12px;
    overflow-x: auto;
  }

  .brand {
    min-width: max-content;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }

  .side-note {
    display: none;
  }

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

  .settings-layout,
  .settings-layout .panel:nth-child(2) .two-cols {
    grid-template-columns: 1fr;
  }

  .stats-charts {
    grid-template-columns: 1fr;
  }

  .settings-layout .panel:nth-child(2),
  .settings-layout .panel:nth-child(3) {
    grid-column: 1;
    grid-row: auto;
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .clock-creative-grid {
    grid-template-columns: 1fr;
  }

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

  .content {
    padding: 16px;
  }

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

  .stats-summary,
  .stats-controls,
  .dashboard-cards,
  .copy-row {
    grid-template-columns: 1fr;
  }

  .dashboard-hero .panel-body {
    align-items: flex-start;
    flex-direction: column;
  }

  .rename-row {
    grid-template-columns: 1fr;
  }

  .media-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-row b {
    text-align: left;
  }
}
