:root {
  --bg: #0f1420;
  --surface: #161d2e;
  --surface-2: #1e2740;
  --border: #2a3450;
  --text: #e6e9f0;
  --text-dim: #9aa4bf;
  --accent: #4f7cff;
  --accent-hover: #6b90ff;
  --success: #2fb673;
  --warning: #e0a640;
  --danger: #e0555a;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand a { color: var(--text); font-weight: 600; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-weight: 500;
}
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a.active { background: var(--surface-2); color: var(--text); }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .who { color: var(--text-dim); font-size: 13px; }

.content { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 28px 0 12px; }
.subtitle { color: var(--text-dim); margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.login-wrap { display: flex; justify-content: center; padding-top: 60px; }
.login-card { width: 360px; }
.login-card h1 { font-size: 18px; text-align: center; }
.login-card .subtitle { text-align: center; }

label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--text-dim); }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; }
legend { color: var(--text-dim); font-size: 13px; padding: 0 6px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.checkbox-row input { width: auto; margin: 0; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.linkbtn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; padding: 0; }
.linkbtn:hover { color: var(--text); }
.inline { display: inline; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
th { color: var(--text-dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; }
.badge-draft { background: #3a4160; color: #b7c0e0; }
.badge-review { background: #4a3f1e; color: var(--warning); }
.badge-approved { background: #1e3a4a; color: #6cc0e0; }
.badge-published { background: #1e4a30; color: var(--success); }
.badge-archived { background: #2a2f3d; color: var(--text-dim); }
.badge-processing, .badge-pending, .badge-running { background: #4a3f1e; color: var(--warning); }
.badge-ready, .badge-success, .badge-completed, .badge-active, .badge-sent { background: #1e4a30; color: var(--success); }
.badge-failed, .badge-error, .badge-suspended { background: #4a1e22; color: var(--danger); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 13.5px; }
.flash-info { background: #1e2740; color: var(--text-dim); }
.flash-success { background: #163a26; color: var(--success); }
.flash-error { background: #3a1c1e; color: var(--danger); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.stat-card { flex: 1; min-width: 140px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .label { color: var(--text-dim); font-size: 12.5px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; color: var(--text-dim); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.thumb-row .thumb {
  width: 140px; background: var(--surface-2); border-radius: 4px; padding: 6px;
  font-size: 10px; color: var(--text-dim); border: 1px solid var(--border); text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.thumb-row .thumb.thumb-selected { border-color: var(--accent); border-width: 2px; }
.thumb-row .thumb img { width: 100%; height: 80px; object-fit: cover; border-radius: 2px; display: block; }
.thumb-row .thumb form { margin: 0; }
.thumb-row .thumb .btn { font-size: 10px; padding: 3px 8px; width: 100%; }
.transcript-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; max-height: 260px; overflow-y: auto; font-size: 13.5px; }
.meta-list dt { color: var(--text-dim); font-size: 12px; margin-top: 12px; }
.meta-list dd { margin: 2px 0 0; }
.empty-state { color: var(--text-dim); padding: 30px 0; text-align: center; }

.actions-bar { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.channel-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center;
}
.channel-icon { font-size: 32px; margin-bottom: 8px; }
.channel-name { font-weight: 600; font-size: 15px; }

.proto-example {
  display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 7px; font-size: 12px; color: var(--accent-hover); word-break: break-all;
}
.proto-example:hover { border-color: var(--accent); }

.scrub-timeline {
  position: relative; height: 40px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; margin: 6px 0 16px; cursor: pointer; user-select: none;
}
.scrub-selected {
  position: absolute; top: 0; bottom: 0; background: rgba(79, 124, 255, 0.25);
  border-left: 2px solid var(--success); border-right: 2px solid var(--danger);
  pointer-events: none;
}
.scrub-handle {
  position: absolute; top: 0; bottom: 0; width: 14px; margin-left: -7px;
  cursor: ew-resize; z-index: 2;
}
.scrub-handle::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px;
}
.scrub-handle-start::after { background: var(--success); }
.scrub-handle-end::after { background: var(--danger); }
.scrub-handle:hover::after, .scrub-handle.dragging::after { width: 4px; left: 5px; }

.clip-thumb {
  width: 72px; height: 44px; flex-shrink: 0; border-radius: 4px; object-fit: cover;
  background: var(--surface-2);
}
.clip-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; color: var(--text-dim); text-align: center;
}

.char-counter { font-size: 11px; color: var(--text-dim); font-weight: 400; float: right; }
.char-counter-over { color: var(--danger); font-weight: 600; }

.platform-preview {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.platform-preview .preview-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.platform-preview .preview-body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; }
.platform-preview .preview-tags { margin-top: 10px; color: var(--accent-hover); font-size: 13px; }

.content-field-box {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap;
}
.content-field-box strong { color: var(--text); margin-right: 4px; }
