:root {
  --bg: #0f1412;
  --panel: #161c19;
  --panel-2: #1d2521;
  --line: #2a3530;
  --text: #e9e6df;
  --muted: #8f9a94;
  --accent: #f26a1f;
  --green: #4fae7f;
  --red: #d9655b;
  --blue: #5b9bd9;
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; font-size: 14px; }
a { color: inherit; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; }
.hidden { display: none !important; }

/* sidebar */
.sidebar { width: 240px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 22px; }
.brand-mark { width: 36px; height: 36px; flex: none; color: var(--text); }
.brand-name { font-weight: 700; font-size: 13px; line-height: 1.2; }
.brand-handle { color: var(--muted); font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { text-decoration: none; padding: 9px 10px; border-radius: 8px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
nav a:hover { background: var(--panel-2); color: var(--text); }
nav a.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.pill { background: var(--accent); color: #1c1612; border-radius: 99px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.pill.muted { background: var(--line); color: var(--muted); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.agent-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.agent-status.running .dot { background: var(--green); box-shadow: 0 0 0 4px #4fae7f33; animation: pulse 1.2s infinite; }
.agent-status.running { color: var(--text); }
@keyframes pulse { 50% { opacity: .4; } }
.cost { font-size: 11px; color: var(--muted); padding: 0 4px; }
.me { font-size: 12px; color: var(--muted); padding: 8px 4px 0; border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.me b { color: var(--text); font-weight: 600; }
.me button { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }

/* login */
body.login { align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.login-card .err { color: var(--red); font-size: 13px; min-height: 18px; }

/* main */
main { flex: 1; min-width: 0; padding: 28px 34px 60px; }
h1.view-title { font-size: 26px; margin: 0 0 4px; letter-spacing: -.01em; }
.view-sub { color: var(--muted); margin: 0 0 20px; }
.banner { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; }
.banner.warn { background: #3a2a14; border-color: #6b4d22; color: #f1d7a8; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 7px 12px; border-radius: 7px; cursor: pointer; font: inherit; }
.tabs button.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.spacer { flex: 1; }

.btn { font: inherit; text-decoration: none; display: inline-block; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3d4b44; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: #1c1612; border-color: var(--accent); font-weight: 600; }
.btn.good { background: #1f4a35; border-color: #2d6b4c; color: #c9f0dc; font-weight: 600; }
.btn.bad { background: #3d1f1c; border-color: #6b302a; color: #f5c9c4; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; position: relative; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #46564e; transform: translateY(-2px); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #f26a1f66; }
.thumb { aspect-ratio: 4 / 5; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .meta { padding: 10px 12px 12px; }
.card .title { font-weight: 600; line-height: 1.35; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .sub { color: var(--muted); font-size: 11px; margin-top: 6px; }
.score { position: absolute; top: 10px; right: 10px; background: #0f1412dd; border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 99px; }
.score.hi { color: #9fe3bf; border-color: #2d6b4c; }
.score.mid { color: #f1d7a8; border-color: #6b4d22; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--line); color: var(--muted); }
.badge.review { background: #3a2a14; color: #f1d7a8; }
.badge.approved { background: #1f4a35; color: #c9f0dc; }
.badge.learned { background: #2a3a5c; color: #d6e2ff; }
.badge.posted { background: #1c3550; color: #c4dcf5; }
.badge.rejected, .badge.skipped, .badge.error { background: #3d1f1c; color: #f5c9c4; }
.badge.scored { background: #1f4a35; color: #c9f0dc; }
.badge.drafted { background: #1c3550; color: #c4dcf5; }
.check { position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #ffffffaa; background: #0f141288; }
.card.selected .check { background: var(--accent); border-color: var(--accent); }
.select-mode .check { display: block; }
.check { display: none; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: #000b; }
.modal-panel { position: relative; width: min(1180px, 96vw); max-height: 94vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.detail { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; }
.viewer { display: flex; flex-direction: column; gap: 10px; }
.stage { position: relative; aspect-ratio: 4 / 5; background: var(--panel-2); border-radius: 10px; overflow: hidden; }
.stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: #000a; color: #fff; font-size: 18px; cursor: pointer; }
.stage .nav.prev { left: 10px; } .stage .nav.next { right: 10px; }
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.strip img { width: 64px; aspect-ratio: 4/5; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; opacity: .65; }
.strip img.active { border-color: var(--accent); opacity: 1; }
.detail h2 { margin: 0 0 6px; font-size: 20px; line-height: 1.3; }
.kv { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
textarea, input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=url], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input, .row > select { flex: 1; min-width: 160px; }
.scores { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.scores div { background: var(--panel-2); border-radius: 8px; padding: 8px; text-align: center; }
.scores b { display: block; font-size: 18px; }
.scores span { font-size: 10px; color: var(--muted); text-transform: uppercase; }
ul.plain { margin: 0; padding-left: 18px; color: #c9cec9; line-height: 1.5; }
.slide-edit { background: var(--panel-2); border-radius: 10px; padding: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.slide-edit .head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.slide-edit label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.slide-edit textarea { min-height: 54px; }
.slide-edit .photo-row .btn { flex: none; }
.slide-edit .hint a { color: inherit; }
.inner-tabs { margin-bottom: 12px; }
.repost-pick { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-left: 10px; }
.repost-pick input { width: auto; }
.reject-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.reject-box.hidden { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rchip { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.rchip.on { border-color: #e5534b; color: #fff; background: #e5534b33; }
.taste { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.taste ul { margin: 4px 0 8px 18px; padding: 0; }
.modal-panel.narrow { width: min(520px, 94vw); }
.run-title { margin: 0 0 6px; font-size: 20px; }
.modal-panel .small { color: var(--muted); font-size: 12px; }
.small.block { display: block; margin-top: 2px; }
.run-brands { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.run-brand { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.run-brand:has(input:checked) { border-color: var(--accent); }
.run-brand input { margin-top: 3px; }
.run-brand i { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; }
.run-actions { margin-top: 14px; }
.close-x { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.actions { position: sticky; bottom: -22px; background: var(--panel); padding: 14px 0 4px; margin-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head h2 { margin: 0; font-size: 18px; min-width: 180px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { color: var(--muted); font-size: 11px; text-transform: uppercase; padding: 4px 6px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.day.other { opacity: .4; }
.day.today { border-color: var(--accent); }
.day .n { font-size: 11px; color: var(--muted); }
.ptag { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 8px 5px 0; }
.ptag i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
td .ptag { display: flex; }
.chip { border-left: 3px solid transparent; font-size: 11px; padding: 4px 6px; border-radius: 6px; cursor: pointer; background: #1f4a35; color: #c9f0dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.posted { background: #1c3550; color: #c4dcf5; }
.chip.due { background: #6b4d22; color: #fff1d6; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; background: var(--panel-2); }
td .small { color: var(--muted); font-size: 12px; margin-top: 3px; }
tr:last-child td { border-bottom: 0; }
pre.log { background: #0a0e0c; border: 1px solid var(--line); border-radius: 10px; padding: 14px; white-space: pre-wrap; font-size: 12px; line-height: 1.55; max-height: 60vh; overflow: auto; margin: 0; }

/* settings */
.form { display: grid; gap: 16px; max-width: 860px; }
.form .group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.form .group h3 { margin: 0; font-size: 15px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.form .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.form .hint { font-size: 11px; color: var(--muted); }
.swatch { display: flex; gap: 8px; align-items: center; }
.swatch input[type=color] { width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 2px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #24302a; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 80; box-shadow: 0 10px 30px #0008; }
.toast.err { background: #3d1f1c; border-color: #6b302a; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .detail { grid-template-columns: 1fr; }
  main { padding: 18px 16px 60px; }
  .day { min-height: 70px; }
}
