* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

:root {
  --brand-blue: #1664d6;
  --brand-blue-hover: #1458bc;
  --brand-blue-soft: #e8eef8;
}

body {
  margin: 0;
  background: #f4f6f8;
  color: #1a1a1a;
}

.admin-body {
  min-height: 100vh;
}

.global-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #1a1a1a;
  font-weight: 600;
}

.global-loading-overlay[hidden] {
  display: none;
}

.toast-container {
  position: fixed;
  top: 82px;
  right: 16px;
  z-index: 100000;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
}

.admin-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  border-radius: 12px;
  border: 1px solid #d0d5dd;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  padding: 16px;
}

.admin-modal-card h3 {
  margin: 0 0 10px;
}

.admin-modal-card label {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.admin-toast {
  border-radius: 10px;
  border: 1px solid #ccd3da;
  background: #fff;
  color: #1a1a1a;
  padding: 10px 12px;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.admin-toast--success {
  border-left: 4px solid var(--brand-blue);
}

.admin-toast--warning {
  border-left: 4px solid #d18a00;
}

.admin-toast--error {
  border-left: 4px solid #b42318;
}

.global-loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #d6dfec;
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: global-spin 0.9s linear infinite;
}

@keyframes global-spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e3e6ea;
}

.admin-navbar h1 {
  margin: 0;
}

.admin-navbar-brand {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.admin-navbar-logo {
  display: block;
  width: auto;
  height: 46px;
  max-width: min(320px, 48vw);
}

.admin-navbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-user-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccd3da;
  border-radius: 999px;
  background: var(--brand-blue-soft);
  font-size: 16px;
}

.sidebar-toggle-btn,
.sidebar-hide-btn {
  background: var(--brand-blue-soft);
  color: #1a1a1a;
}

.admin-shell {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 84px 16px 24px;
}

.admin-sidebar {
  width: 250px;
  margin-bottom: 0;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow: auto;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.container {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 16px 24px;
}

.admin-content.container {
  flex: 1;
  max-width: none;
  margin: 0;
  padding: 0;
}

h1 {
  margin-bottom: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card {
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.admin-menu {
  display: grid;
  gap: 8px;
}

.admin-menu-btn {
  background: var(--brand-blue-soft);
  color: #1a1a1a;
  text-align: left;
  width: 100%;
}

.admin-menu-btn.active {
  background: var(--brand-blue);
  color: #fff;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-body.sidebar-collapsed .admin-sidebar {
  display: none;
}

@media (max-width: 900px) {
  .admin-shell {
    padding: 84px 12px 20px;
  }

  .admin-navbar h1 {
    font-size: 18px;
  }

  .admin-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.playlist-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  margin-top: 12px;
}

.playlist-list-pane {
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  padding: 10px;
  background: #f7f9fc;
}

.playlist-icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  margin: 0 6px 8px 0;
}

.playlist-list-pane h3 {
  margin: 0 0 10px;
}

.playlist-hidden-select {
  display: none;
}

.playlist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.playlist-list-item {
  width: 100%;
  text-align: left;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #ccd3da;
}

.playlist-list-item.active {
  background: var(--brand-blue);
  color: #fff;
}

.playlist-main-pane {
  min-width: 0;
}

.playlist-add-card {
  margin-bottom: 10px;
}

.playlist-add-card h3 {
  margin-top: 0;
}

.playlist-add-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.playlist-add-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #586273;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th,
.data-table td {
  border: 1px solid #e3e6ea;
  padding: 8px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.data-table th {
  background: #f7f9fc;
  font-weight: 600;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.screen-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.screen-status--online {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-color: var(--brand-blue);
}

.screen-status--offline {
  background: #fff;
  color: #b42318;
  border-color: #b42318;
}

.proof-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.proof-status--ok {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-color: var(--brand-blue);
}

.proof-status--missing {
  background: #fff;
  color: #b42318;
  border-color: #b42318;
}

.dashboard-proof-row--missing {
  background: #fff4f4;
}

.playlist-kebab-trigger {
  cursor: pointer;
  user-select: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #ccd3da;
  background: var(--brand-blue);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.playlist-context-menu {
  position: fixed;
  z-index: 99999;
}

.playlist-context-list {
  min-width: 300px;
  max-width: 340px;
  margin: 0;
  padding: 10px;
  list-style: none;
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 10px;
}

.playlist-context-item {
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}

.playlist-context-item strong {
  display: block;
  font-size: 14px;
}

.playlist-context-item + .playlist-context-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eef2f6;
}

.playlist-context-item:hover {
  background: #f7f9fc;
}

.playlist-context-item p {
  margin: 6px 0 0;
  font-size: 12px;
  color: #586273;
}

.playlist-context-item.is-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.table-empty {
  color: #586273;
  text-align: center;
}

input, select, button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccd3da;
}

button {
  background: var(--brand-blue);
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover {
  background: var(--brand-blue-hover);
}

.hint {
  color: #586273;
  margin-top: 8px;
}

.screen-body {
  margin: 0;
  background: #000;
}

.screen-container {
  --screen-brightness: 1.12;
  --screen-saturation: 1.08;
  --screen-contrast: 1.03;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #000;
  color: #fff;
}

.screen-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.screen-transition-enabled .screen-layer {
  opacity: 0;
  transition: opacity var(--screen-transition-ms, 450ms) linear;
}

.screen-transition-enabled .screen-layer.visible {
  opacity: 1;
}

.screen-transition-enabled .screen-layer.leaving {
  opacity: 0;
}

.screen-media {
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  filter: brightness(var(--screen-brightness)) saturate(var(--screen-saturation)) contrast(var(--screen-contrast));
}

.loading {
  color: #fff;
  font-size: 20px;
}

.screen-offline-badge {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 40;
  background: rgba(180, 35, 24, 0.9);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.screen-offline-badge[hidden] {
  display: none;
}

.screen-offline-badge--heartbeat {
  animation: screen-offline-heartbeat 700ms ease-out 1;
}

@keyframes screen-offline-heartbeat {
  0% {
    transform: scale(1);
    opacity: 0.82;
  }

  35% {
    transform: scale(1.08);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.screen-install-hint {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 41;
  max-width: 360px;
  background: rgba(10, 16, 28, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.screen-install-hint[hidden] {
  display: none;
}

.screen-install-hint-text {
  font-size: 13px;
  line-height: 1.3;
}

.screen-install-hint-actions {
  display: flex;
  gap: 8px;
}

.screen-install-hint-actions button {
  padding: 8px 10px;
  font-size: 13px;
}

.screen-install-dismiss {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.screen-install-dismiss:hover {
  background: rgba(255, 255, 255, 0.12);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 18px 0;
}

.login-body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(22, 100, 214, 0.28), transparent 38%),
    radial-gradient(circle at 88% 80%, rgba(22, 100, 214, 0.22), transparent 42%),
    linear-gradient(140deg, #f4f7fc 0%, #eef3fb 42%, #f7f9fc 100%);
}

.login-wrap::before,
.login-wrap::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}

.login-wrap::before {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -100px;
  background: rgba(22, 100, 214, 0.16);
  animation: login-orb-float-a 18s ease-in-out infinite;
}

.login-wrap::after {
  width: 280px;
  height: 280px;
  bottom: -90px;
  left: -90px;
  background: rgba(22, 100, 214, 0.14);
  animation: login-orb-float-b 22s ease-in-out infinite;
}

.setup-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 440px;
}

.login-card-modern {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: clamp(22px, 3.6vw, 30px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 252, 255, 0.92) 100%);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 45px rgba(22, 100, 214, 0.15);
  animation: login-card-breathe 7s ease-in-out infinite;
}

.login-brand-mark {
  display: block;
  width: min(290px, 100%);
  height: auto;
  margin: 0 auto 4px;
}

.login-eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #1e5fca;
  font-weight: 700;
}

.login-subtitle {
  margin: 0;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 2px;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field span {
  font-size: 12px;
  font-weight: 600;
  color: #2f3b4a;
}

.login-input {
  width: 100%;
  border: 1px solid #c8d3e3;
  background: rgba(255, 255, 255, 0.96);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: #2f71d8;
  box-shadow: 0 0 0 3px rgba(47, 113, 216, 0.16);
}

.login-submit {
  margin-top: 6px;
  padding: 12px 14px;
  font-weight: 600;
}

.login-card-modern .error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #f2c3c3;
  background: #fceded;
  color: #8a1f1f;
  font-size: 13px;
  line-height: 1.35;
}

@keyframes login-orb-float-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-12px, 10px, 0) scale(1.04);
  }
}

@keyframes login-orb-float-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(14px, -8px, 0) scale(1.03);
  }
}

@keyframes login-card-breathe {
  0%,
  100% {
    box-shadow: 0 20px 45px rgba(22, 100, 214, 0.15);
  }
  50% {
    box-shadow: 0 24px 52px rgba(22, 100, 214, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-wrap::before,
  .login-wrap::after,
  .login-card-modern {
    animation: none;
  }
}

@media (max-width: 520px) {
  .login-card-modern {
    gap: 12px;
    padding: 18px;
  }

  .login-form {
    gap: 12px;
  }
}

.setup-card {
  width: 100%;
  max-width: 860px;
}

.setup-brand-logo {
  display: block;
  width: min(360px, 100%);
  height: auto;
  margin: 0 0 10px;
}

.setup-form {
  display: grid;
  gap: 12px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.error {
  color: #c41d1d;
}

#refreshReportsBtn {
  margin-bottom: 10px;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.dashboard-card {
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #f7f9fc;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.dashboard-card strong {
  font-size: 13px;
}

.dashboard-card span {
  color: #2a3442;
  font-size: 13px;
}

.dashboard-proof-pagination {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.dashboard-proof-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-proof-page-info {
  font-size: 12px;
  color: #445164;
}

.dashboard-proof-page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #2a3442;
}

.report-graphs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.report-graph-card {
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #f7f9fc;
  padding: 10px;
}

.report-graph-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.report-graph-bars {
  display: grid;
  gap: 8px;
}

.report-graph-row {
  display: grid;
  gap: 4px;
}

.report-graph-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #2a3442;
}

.report-graph-track {
  width: 100%;
  height: 8px;
  background: #e3e6ea;
  border-radius: 999px;
  overflow: hidden;
}

.report-graph-fill {
  height: 100%;
  background: var(--brand-blue);
  border-radius: 999px;
}

.report-column-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.report-columns-minimal-row {
  align-items: center;
  margin-top: 8px;
}

.report-column-details {
  margin: 4px 0 12px;
}

.report-column-details > summary {
  cursor: pointer;
  color: #2a3442;
  font-size: 12px;
  user-select: none;
}

.report-column-selector label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #d8dfe7;
  border-radius: 999px;
  background: #f7f9fc;
  font-size: 12px;
  color: #2a3442;
}

.report-column-selector input[type="checkbox"] {
  margin: 0;
}

.media-thumb {
  width: 92px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d8dfe7;
  background: #0f1726;
}

.media-thumb--placeholder {
  width: 92px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid #d8dfe7;
  background: #eef3fb;
  color: #1458bc;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.4px;
}

.media-meta {
  font-size: 12px;
  line-height: 1.45;
  color: #2a3442;
}

.media-tab-nav {
  display: flex;
  gap: 0;
  margin: 8px 0 12px;
  border-bottom: 1px solid #d8dfe7;
}

.media-tab-btn {
  background: #f7f9fc;
  color: #1a1a1a;
  border: 1px solid #d8dfe7;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  padding: 8px 14px;
}

.media-tab-btn.active {
  background: #fff;
  color: var(--brand-blue);
  border-color: #d8dfe7;
  border-bottom: 1px solid #fff;
}

.media-tab-pane[hidden] {
  display: none;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.media-grid[hidden] {
  display: none;
}

.media-grid-card {
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.media-thumb--grid,
.media-thumb--grid-placeholder {
  width: 100%;
  height: 140px;
}

.media-grid-title {
  font-weight: 600;
  color: #1a1a1a;
  word-break: break-word;
}

.media-grid-type {
  font-size: 12px;
  color: #586273;
  text-transform: capitalize;
}

.media-grid-actions {
  display: flex;
  justify-content: flex-end;
}

.screen-tab-nav {
  display: flex;
  gap: 0;
  margin: 8px 0 12px;
  border-bottom: 1px solid #d8dfe7;
}

.screen-tab-btn {
  background: #f7f9fc;
  color: #1a1a1a;
  border: 1px solid #d8dfe7;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  padding: 8px 14px;
}

.screen-tab-btn.active {
  background: #fff;
  color: var(--brand-blue);
  border-color: #d8dfe7;
  border-bottom: 1px solid #fff;
}

.screen-tab-pane {
  display: none;
}

.screen-tab-pane.active {
  display: block;
}

.report-drill-btn {
  margin-right: 6px;
  margin-bottom: 4px;
  padding: 6px 8px;
  font-size: 12px;
}

.report-kebab-trigger {
  cursor: pointer;
  user-select: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #ccd3da;
  background: var(--brand-blue);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.navbar-user-trigger {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #ccd3da;
  background: var(--brand-blue-soft);
  color: #1a1a1a;
  font-size: 16px;
  padding: 0;
}

.navbar-user-trigger:hover {
  background: #d6e4fb;
}

.danger-delete-btn {
  background: #e35b5b;
  color: #fff;
}

.danger-delete-btn:hover {
  background: #cf4d4d;
}

@media (max-width: 900px) {
  .playlist-layout {
    grid-template-columns: 1fr;
  }

  .admin-navbar-logo {
    height: 36px;
    max-width: min(230px, 52vw);
  }
}
