:root {
  --bg: #f6f7f9; --card: #fff; --text: #1a1f2b; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-dark: #1d4ed8; --danger: #dc2626; --ok: #16a34a;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; } h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; } h3 { font-size: 1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .85em; }
code { font-size: .9em; background: var(--bg); padding: 1px 4px; border-radius: 3px; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: 0 1.5rem; height: 54px; background: #111827; color: #fff; white-space: nowrap; }
.topbar a:hover { text-decoration: none; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 1.15rem; } .topbar .brand span, .brand-lg span { color: #60a5fa; }
.topbar .links { display: flex; gap: .25rem; flex: 1; }
.topbar .links a { color: #cbd5e1; padding: .4rem .7rem; border-radius: 6px; } .topbar .links a.active, .topbar .links a:hover { background: #1f2937; color: #fff; text-decoration: none; }
.topbar .right { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.topbar .right a { color: #cbd5e1; padding: .35rem .8rem; border: 1px solid #374151; border-radius: 6px; font-size: .9rem; }
.topbar .right a:hover { background: #1f2937; border-color: #4b5563; color: #fff; }
.topbar select { background: #1f2937; color: #fff; border: 1px solid #374151; border-radius: 6px; padding: .3rem .5rem; }
.brand-lg { font-size: 2rem; text-align: center; margin-bottom: 1.5rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 380px; margin: 4rem auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; } .grid-2.editor { grid-template-columns: 3fr 2fr; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-2.editor { grid-template-columns: 1fr; } }

label { display: block; margin-bottom: .8rem; font-weight: 500; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin-right: 1rem; }
input[type=checkbox] { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; } .row label { flex: 1; min-width: 140px; margin-bottom: .8rem; } .row > input { flex: 1; width: auto; margin: 0; }
.row.days { gap: .5rem 1.1rem; align-items: center; }
.row.days label { flex: 0 0 auto; min-width: 0; margin: 0 0 .8rem; user-select: none; cursor: pointer; }
.btn { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; font: inherit; cursor: pointer; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); } .btn.danger:hover { background: #fef2f2; }
.btn.small { padding: .25rem .55rem; font-size: .85em; }
.inline-form { display: inline; } .actions { display: flex; gap: .4rem; align-items: center; }
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; background: #eff6ff; border: 1px solid #bfdbfe; }
.flash.success { background: #f0fdf4; border-color: #bbf7d0; } .flash.danger { background: #fef2f2; border-color: #fecaca; } .flash.warning { background: #fffbeb; border-color: #fde68a; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafafa; }
.table tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; vertical-align: middle; margin-right: .2rem; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px #dcfce7; } .dot.off { background: #d1d5db; }
.stats { display: flex; gap: 1rem; margin-bottom: 1rem; } .stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat .num { font-size: 2rem; font-weight: 700; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-all; }

.dropzone { border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 1.5rem; text-align: center; background: #fff; margin-bottom: 1.25rem; }
.dropzone.over { border-color: var(--accent); background: #eff6ff; } .dropzone p { margin: .25rem 0; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.media-grid.compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; max-height: 70vh; overflow: auto; margin-top: .75rem; }
.media-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.media-card .thumb { position: relative; aspect-ratio: 16/9; background: #0f172a; border-radius: 5px; overflow: hidden; }
.media-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.media-card .badge { position: absolute; bottom: 4px; left: 4px; font-size: .7rem; background: rgba(0,0,0,.65); color: #fff; padding: 1px 6px; border-radius: 3px; }
.media-card .title { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card .title-form input { margin: 0; padding: .3rem .4rem; }
.media-card .meta { font-size: .8rem; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: .75rem; padding: .5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: .5rem; }
.item.dragging { opacity: .4; } .item.disabled { opacity: .5; }
.item .handle { cursor: grab; color: #9ca3af; user-select: none; }
.item img.thumb { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; background: #0f172a; }
.item .body { flex: 1; min-width: 0; } .item .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .item .sub { font-size: .8rem; }
.item .dur { display: flex; align-items: center; gap: .3rem; margin: 0; font-weight: 400; } .item .dur input { width: 4.5em; margin: 0; padding: .3rem .4rem; }
