:root {
  --bg: #070d1c;
  --bg-2: #0a1226;
  --panel: #101a33;
  --panel-2: #15213f;
  --line: #22304f;
  --line-2: #2c3d63;
  --text: #e8eeff;
  --muted: #8d9bbd;
  --blue: #2f6bff;
  --blue-2: #5b8cff;
  --blue-soft: rgba(47, 107, 255, .14);
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(47, 107, 255, .16), transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 14px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* buttons + inputs */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: #1b2a50; border-color: #3a4f80; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #2259e6; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .5); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--blue-2); outline-offset: 2px;
}
input, textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 70px; }
input::placeholder, textarea::placeholder { color: #5f6f95; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #c3cdea; }
label .hint { font-weight: 400; color: var(--muted); }

/* layout */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; background: rgba(7, 13, 28, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--blue), #7aa2ff); display: grid; place-items: center; }
.logo::after { content: ""; border-left: 10px solid #fff; border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent; margin-left: 3px; }
.projects-nav { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.projects-nav::-webkit-scrollbar { display: none; }
.pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted);
  font-weight: 600; font-size: 13px; white-space: nowrap; background: transparent;
}
.pill:hover { color: var(--text); text-decoration: none; border-color: #3a4f80; }
.pill.active { background: var(--blue-soft); border-color: var(--blue); color: #cfe0ff; }
main { max-width: 1120px; margin: 0 auto; padding: 22px 20px 80px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 16px 0 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-color: var(--blue); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.tight { padding: 14px; }
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .value.sm { font-size: 18px; }
.stat.bad .value { color: var(--red); }
.project-card { display: block; color: inherit; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: var(--blue); text-decoration: none; transform: translateY(-2px); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--green); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .1); }
.badge.bad { color: var(--red); border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .1); }
.badge.warn { color: var(--amber); border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .1); }
.badge.blue { color: #b9ceff; border-color: rgba(47, 107, 255, .5); background: var(--blue-soft); }
.notice { border: 1px solid rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .08); color: #fde9a8; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.notice.bad { border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); color: #fecaca; }
.notice.info { border-color: rgba(47, 107, 255, .4); background: var(--blue-soft); color: #cfe0ff; }

/* empty states */
.empty { text-align: center; padding: 38px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }
.empty .icon { font-size: 30px; margin-bottom: 6px; }
.empty h3 { color: var(--text); margin-bottom: 4px; font-size: 16px; }
.empty .btn { margin-top: 14px; }

/* media */
.folders { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--blue); background: var(--blue-soft); color: var(--text); }
.progress { height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #7aa2ff); transition: width .2s; }
.upload-item { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.video { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.video.dragging { opacity: .4; }
.video.drop-target { border-color: var(--blue); }
.handle { cursor: grab; color: var(--muted); padding: 4px 2px; user-select: none; font-size: 18px; line-height: 1; }
.video .meta { color: var(--muted); font-size: 12.5px; }
.video .actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.caption-edit { display: grid; gap: 8px; margin-top: 10px; }

/* schedules + queue */
.daypick, .platpick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); font-weight: 600; font-size: 13px; }
.chip.on { background: var(--blue-soft); border-color: var(--blue); color: #cfe0ff; }
.chip:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.times { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.times .time { display: flex; align-items: center; gap: 4px; }
.times input { width: 130px; }
.day-group h3 { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }
.slot { display: grid; grid-template-columns: 78px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); margin-bottom: 8px; }
.slot.skipped { opacity: .5; }
.slot.dragging { opacity: .4; } .slot.drop-target { border-color: var(--blue); }
.slot .when { font-weight: 800; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 2px; }
.cal-day { min-height: 104px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--bg-2); }
.cal-day.today { border-color: var(--blue); }
.cal-day.past { opacity: .35; }
.cal-date { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.cal-item { display: block; width: 100%; text-align: left; font-size: 11.5px; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px; background: var(--blue-soft); border: 1px solid rgba(47, 107, 255, .35); color: #cfe0ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.empty-slot { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .35); color: #fde9a8; }
.cal-item.skipped { opacity: .45; text-decoration: line-through; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel); }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; } tbody tr:hover { background: rgba(47, 107, 255, .06); }
pre { margin: 0; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 260px; font-size: 12px; white-space: pre-wrap; word-break: break-word; }

/* modal + toast */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(3, 7, 18, .7); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { width: min(760px, 100%); }
.modal h2 { margin-bottom: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; animation: rise .18s ease-out; }
.toast.ok { border-color: rgba(52, 211, 153, .5); }
.toast.bad { border-color: rgba(248, 113, 113, .6); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); padding: 28px; }
.login .brand { margin-bottom: 18px; font-size: 18px; }

@media (max-width: 860px) {
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  main { padding: 16px 14px 80px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand span { display: none; }
  .video { grid-template-columns: auto 1fr; }
  .video .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .slot { grid-template-columns: 64px 1fr; }
  .slot .actions { grid-column: 1 / -1; }
  .calendar { display: none; }
  .cal-only-note { display: block !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
