:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #64748b;
  --line: #dbe2ea;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #2563eb;
  --danger: #b42318;
  --warning: #b7791f;
  --success-bg: #e8f7ef;
  --error-bg: #fff1f0;
  --radius: 8px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

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

button,
.primary,
.secondary,
.ghost,
.danger {
  align-items: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  padding: 0 14px;
  transition: 0.16s ease;
  white-space: nowrap;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: #e8eef7;
  color: #1e3a5f;
}

.secondary:hover {
  background: #dce7f5;
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.ghost:hover {
  background: #eef2f6;
  color: var(--text);
}

.danger {
  background: #fee4e2;
  color: var(--danger);
}

.danger:hover {
  background: #ffd7d2;
}

.full {
  width: 100%;
}

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

.sidebar {
  background: #0f172a;
  color: #e5edf7;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
}

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

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

.brand-mark {
  align-items: center;
  background: #14b8a6;
  border-radius: 8px;
  color: #061a18;
  display: inline-flex;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #9fb1c7;
  margin-top: 2px;
}

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

.nav a {
  border-radius: 7px;
  color: #b6c2d2;
  padding: 11px 12px;
}

.nav a.active,
.nav a:hover {
  background: #1e293b;
  color: #fff;
}

.content {
  min-width: 0;
  padding: 30px;
}

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

.page-header h1 {
  font-size: 30px;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

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

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

.stats-grid article,
.panel,
.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats-grid article {
  padding: 18px;
}

.stats-grid span {
  display: block;
  font-size: 30px;
  font-weight: 900;
}

.stats-grid small,
.section-title small,
.account-head small,
.video-card small,
.channel-row small,
.thumb-card small {
  color: var(--muted);
}

.section {
  margin-bottom: 22px;
  padding: 20px;
}

.section-title {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title h2,
.panel h2 {
  font-size: 18px;
  letter-spacing: 0;
  margin: 0;
}

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

table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

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

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

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

.pill,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  text-transform: capitalize;
}

.pill {
  background: #eef6f5;
  color: #0f766e;
}

.status.success {
  background: var(--success-bg);
  color: #147a48;
}

.status.error {
  background: var(--error-bg);
  color: var(--danger);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  border-radius: 7px;
  font-weight: 700;
  padding: 12px 14px;
}

.flash.success {
  background: var(--success-bg);
  color: #147a48;
}

.flash.error {
  background: var(--error-bg);
  color: var(--danger);
}

.account-grid {
  display: grid;
  gap: 18px;
}

.notice-panel {
  background: #fff7e8;
  border: 1px solid #f0c36d;
  border-radius: var(--radius);
  color: #583b00;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.notice-panel p {
  margin: 6px 0 0;
}

.panel {
  padding: 20px;
}

.account-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.account-head h2 {
  overflow-wrap: anywhere;
}

.channel-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.channel-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 10px;
  grid-template-columns: 38px 1fr auto;
  min-height: 56px;
  padding: 8px 10px;
}

.channel-row:hover,
.video-card:hover {
  border-color: #9bb6d6;
}

.channel-row img {
  border-radius: 50%;
  height: 38px;
  object-fit: cover;
  width: 38px;
}

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

.video-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.video-card img {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

.video-card span {
  font-weight: 800;
  line-height: 1.35;
}

.split-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  margin-bottom: 22px;
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
}

input,
select {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.fixed-times {
  display: none;
  gap: 10px;
}

.schedule-form.fixed-mode .fixed-times {
  display: grid;
}

.schedule-form.fixed-mode [data-interval-field] {
  display: none;
}

.thumb-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.thumb-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.thumb-card img {
  aspect-ratio: 16 / 9;
  background: #eef2f6;
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
}

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

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

.log-item {
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 7px;
  padding: 12px;
}

.log-item.success {
  border-left-color: #14945f;
}

.log-item.error {
  border-left-color: var(--danger);
}

.log-item span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.log-item strong {
  text-transform: capitalize;
}

.log-item p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.empty,
.empty-panel p {
  color: var(--muted);
}

.empty-panel {
  max-width: 520px;
}

.login-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

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

  .sidebar {
    position: static;
  }

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

@media (max-width: 640px) {
  .content {
    padding: 18px;
  }

  .page-header,
  .account-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .channel-row {
    grid-template-columns: 38px 1fr;
  }

  .channel-row small {
    grid-column: 2;
  }
}
