:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #fff;
  --ink: #111317;
  --muted: #737985;
  --line: #e6eaf0;
  --blue: #2864e8;
  --red: #d71920;
  --shadow: 0 16px 42px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.sidebar {
  background: #101522;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 26px;
  inset: 0 auto 0 0;
  padding: 28px;
  position: fixed;
  width: 260px;
}
.brand strong { display: block; font-size: 1.25rem; }
.brand span { color: #aab3c5; display: block; font-size: .82rem; margin-top: 6px; }
nav { display: grid; gap: 8px; }
nav a, .ghost-button {
  border-radius: 8px;
  color: #d9dfeb;
  display: block;
  padding: 12px 14px;
}
nav a.active, nav a:hover { background: #26314a; color: #fff; }
.ghost-button {
  background: transparent;
  border: 1px solid #3b465c;
  cursor: pointer;
  margin-top: auto;
  text-align: left;
  width: 100%;
}

.main {
  margin-left: 260px;
  padding: 34px;
}
.page-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-head p {
  color: var(--muted);
  font-weight: 800;
  margin: 0 0 6px;
  text-transform: uppercase;
}
.page-head h1 { font-size: 2rem; margin: 0; }
.pill {
  background: #edf3ff;
  border: 1px solid #dbe7ff;
  border-radius: 999px;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 800;
  padding: 9px 13px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  padding: 24px;
}
.panel-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}
.panel-head h2 { font-size: 1.15rem; margin: 0; }
.panel-head span, .muted { color: var(--muted); }
.text-link {
  color: var(--blue);
  font-size: .84rem;
  font-weight: 850;
}

.summary-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 22px;
}
.summary-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.summary-grid span,
.summary-grid small {
  color: var(--muted);
  display: block;
}
.summary-grid span {
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
}
.summary-grid strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1.1;
  margin: 10px 0 8px;
}
.summary-grid small {
  font-size: .78rem;
  line-height: 1.35;
}

.dashboard-columns {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr 1fr;
}
.content-summary {
  display: grid;
  gap: 12px;
}
.content-summary div,
.latest-list a {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  padding: 13px 14px;
}
.content-summary span,
.latest-list span {
  color: var(--muted);
  font-size: .82rem;
}
.latest-list {
  display: grid;
  gap: 10px;
}
.latest-list a {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.form-grid, .movie-form {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.movie-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.compact { grid-template-columns: 1fr 1fr auto; }
label {
  color: #3c4452;
  display: grid;
  font-size: .82rem;
  font-weight: 800;
  gap: 7px;
}
input, select, textarea {
  background: #fff;
  border: 1px solid #d8dde7;
  border-radius: 8px;
  color: var(--ink);
  padding: 11px 12px;
  width: 100%;
}
textarea { resize: vertical; }
.wide { grid-column: span 2; }
button {
  align-self: end;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  padding: 12px 16px;
}
button.danger { background: var(--red); }

.asset-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}
.editor-list {
  display: grid;
  gap: 16px;
}
.content-editor-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(180px, .5fr) minmax(0, 1.5fr) minmax(180px, .5fr);
  padding: 16px;
}
.movie-editor-card {
  grid-template-columns: minmax(220px, .6fr) minmax(0, 1.8fr);
}
.movie-editor-fields {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.editor-media img,
.editor-media .image-placeholder {
  aspect-ratio: 16 / 7;
  border-radius: 10px;
  display: block;
  object-fit: cover;
  width: 100%;
}
.wide-media {
  grid-row: span 2;
}
.delete-check {
  align-items: center;
  align-self: end;
  display: flex;
  flex-direction: row;
  gap: 9px;
}
.delete-check input {
  width: auto;
}
.content-action-bar {
  align-items: center;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 14px;
  bottom: 18px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding: 14px;
  position: sticky;
  z-index: 15;
}
.secondary-button {
  background: #eef3fb;
  color: #243044;
}
.preview-panel pre {
  background: #101522;
  border-radius: 12px;
  color: #e9eef8;
  font-size: .82rem;
  line-height: 1.5;
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 18px;
}
.banner-preview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
}
.banner-preview-grid figure {
  margin: 0;
}
.banner-preview-grid img,
.banner-preview-grid .image-placeholder {
  aspect-ratio: 16 / 6;
  border-radius: 10px;
}
.banner-preview-grid figcaption {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  margin-top: 8px;
}
.asset-list article, .movie-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.asset-list img {
  aspect-ratio: 16 / 7;
  border-radius: 8px;
  display: block;
  margin-bottom: 10px;
  object-fit: cover;
  width: 100%;
}
.image-placeholder,
.video-placeholder {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(40, 100, 232, .08), rgba(17, 19, 23, .04)),
    #f3f6fa;
  border: 1px dashed #c8d0dc;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-size: .82rem;
  font-weight: 850;
  justify-content: center;
  min-height: 92px;
  padding: 16px;
  text-align: center;
  width: 100%;
}
.movie-table { display: grid; gap: 12px; }
.movie-row {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(230px, .9fr) minmax(220px, .8fr) minmax(360px, 1.7fr) auto;
}
.movie-media {
  display: grid;
  gap: 10px;
}
.movie-media img {
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  display: block;
  object-fit: cover;
  width: 100%;
}
.movie-media video,
.video-lazy-card {
  aspect-ratio: 16 / 9;
  background: #05070b;
  border-radius: 10px;
  display: block;
  width: 100%;
}
.video-lazy-card {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(5, 7, 11, .68), rgba(5, 7, 11, .92)),
    #05070b;
  display: flex;
  justify-content: center;
  padding: 16px;
}
.load-video-button {
  align-self: center;
  background: #fff;
  color: #111317;
  min-width: 126px;
}
.movie-media .image-placeholder {
  aspect-ratio: 2 / 3;
}
.movie-media .video-placeholder {
  aspect-ratio: 16 / 9;
  min-height: 0;
}
.movie-row span {
  color: var(--muted);
  display: block;
  font-size: .82rem;
  margin-top: 5px;
}
summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 850;
  margin-bottom: 12px;
}
.notice {
  background: #eaf7ee;
  border: 1px solid #c6ead1;
  border-radius: 10px;
  margin-bottom: 18px;
  padding: 13px 16px;
}
.notice.error {
  background: #fff0f0;
  border-color: #ffd1d1;
  color: #ad1717;
}

.log-browser {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.sync-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.sync-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.sync-card.ok {
  background: #f0fbf4;
  border-color: #bde8ca;
}
.sync-card.bad {
  background: #fff8ed;
  border-color: #f4d4a3;
}
.sync-card strong,
.sync-card span,
.sync-card b {
  display: block;
}
.sync-card span {
  color: var(--muted);
  font-size: .82rem;
  margin-top: 4px;
}
.sync-card b {
  font-size: 1.05rem;
  margin: 14px 0;
}
.sync-card dl {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: 1fr auto;
  margin: 0;
}
.sync-card dt {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 850;
  text-transform: uppercase;
}
.sync-card dd {
  font-size: .82rem;
  margin: 0;
  text-align: right;
}
.sync-error {
  color: #ad1717;
  font-size: .82rem;
  margin: 12px 0 0;
}
.log-browser article {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.log-browser h3 { margin: 0 0 12px; }
.log-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.log-links a {
  background: #f0f4fa;
  border-radius: 999px;
  color: #29313d;
  font-size: .76rem;
  font-weight: 800;
  padding: 7px 10px;
}
.chart-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.bar-chart {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 240px;
  width: 100%;
}
.table-wrap { overflow: auto; }
table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}
th, td {
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); }
.split {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr);
}
dt { color: var(--muted); font-size: .76rem; font-weight: 850; text-transform: uppercase; }
dd { margin: 4px 0 14px; }

.login-page {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}
.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 30px;
  width: 100%;
}
.login-card h1 { margin: 0; }
.login-card p, .login-card span { color: var(--muted); margin: 0; }

@media (max-width: 900px) {
  .sidebar {
    inset: auto 0 0 0;
    padding: 10px;
    width: auto;
    z-index: 20;
  }
  .brand, .sidebar form { display: none; }
  nav { display: grid; grid-template-columns: repeat(3, 1fr); }
  nav a { text-align: center; }
  .main { margin: 0 0 76px; padding: 18px; }
  .page-head, .panel-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .summary-grid, .dashboard-columns, .banner-preview-grid, .form-grid, .movie-form, .form-grid.compact, .asset-list, .content-editor-card, .movie-editor-card, .movie-editor-fields, .movie-row, .sync-grid, .log-browser, .chart-grid, .split {
    grid-template-columns: 1fr;
  }
  .content-action-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .wide { grid-column: auto; }
}
