:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8dee7;
  --brand: #0f766e;
  --brand-2: #2563eb;
  --accent: #f59e0b;
  --danger: #b91c1c;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --soft: #e8f4f2;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  margin-bottom: 6px;
}

h2 {
  font-size: 24px;
  line-height: 1.15;
  margin-bottom: 7px;
}

h3 {
  font-size: 15px;
  line-height: 1.2;
  margin-bottom: 16px;
}

.muted {
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 520px) minmax(0, 1fr);
  background: #0f172a;
}

.login-box {
  min-height: 100vh;
  background: var(--surface);
  padding: clamp(28px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-visual {
  min-height: 100vh;
  padding: clamp(28px, 6vw, 70px);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.42), transparent 42%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.26), transparent 38%),
    #111827;
}

.login-visual h2 {
  max-width: 600px;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-visual p {
  max-width: 520px;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1.6;
}

.login-panel {
  max-width: 430px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand.compact {
  margin-bottom: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 900;
}

.sidebar .brand-mark {
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.34);
}

.sidebar .brand h1,
.sidebar .brand p {
  color: white;
}

.sidebar .brand p {
  color: #a7b0bf;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

label {
  color: #475569;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input[type="file"] {
  padding: 10px;
  background: var(--surface-2);
}

.btn {
  min-height: 42px;
  border-radius: 7px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--brand);
  color: white;
  font-weight: 850;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  background: #115e59;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.2);
  transform: translateY(-1px);
}

.btn.secondary {
  background: #e8edf3;
  color: #1f2937;
}

.btn.secondary:hover {
  background: #dce3ec;
  box-shadow: none;
}

.btn.full {
  width: 100%;
}

.btn.mini {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn.danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn.danger:hover {
  background: #fecaca;
  box-shadow: none;
}

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

.form-actions {
  margin-top: 4px;
}

.compact-actions {
  flex-wrap: nowrap;
}

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

.sidebar {
  background: var(--sidebar);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 20px;
}

.nav button {
  min-height: 42px;
  text-align: left;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: #cbd5e1;
  font-weight: 760;
}

.nav button.active,
.nav button:hover {
  background: var(--sidebar-soft);
  color: white;
}

.content {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar p {
  margin-bottom: 0;
}

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

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

.two {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.stat {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 3px solid var(--brand);
}

.stat:nth-child(2) {
  border-top-color: var(--brand-2);
}

.stat:nth-child(3) {
  border-top-color: var(--accent);
}

.stat:nth-child(4) {
  border-top-color: #6366f1;
}

.stat strong {
  font-size: 34px;
  line-height: 1;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: var(--surface-2);
}

.table tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--soft);
  color: #115e59;
  font-size: 12px;
  font-weight: 850;
}

.media-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.media-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.media-preview {
  aspect-ratio: 16 / 9;
  background: #0b0f19;
  display: grid;
  place-items: center;
}

.media-preview img,
.media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-info {
  padding: 14px;
}

.media-info strong {
  display: block;
  margin-bottom: 5px;
}

.media-info p {
  margin-bottom: 0;
  font-size: 13px;
}

.media-info .actions {
  margin-top: 12px;
}

.check-list {
  display: grid;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: var(--surface-2);
}

.check-row {
  min-height: 38px;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  background: white;
  color: #334155;
  font-size: 14px;
  font-weight: 650;
}

.check-row input {
  width: auto;
}

.toast {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 760;
}

.tv-link-list {
  display: grid;
  gap: 12px;
}

.tv-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: var(--surface-2);
}

.tv-link p {
  margin-bottom: 0;
}

.tv-body {
  margin: 0;
  background: #000;
  overflow: hidden;
}

.tv-stage {
  width: 100vw;
  height: 100vh;
  background: #000;
  color: white;
  display: grid;
  place-items: center;
}

.tv-stage img,
.tv-stage video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #000;
}

.tv-empty {
  text-align: center;
  padding: 30px;
}

.tv-empty h1 {
  font-size: clamp(32px, 7vw, 84px);
}

@media (max-width: 960px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-box {
    min-height: 100vh;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

  .content {
    padding: 18px;
  }
}
