:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f0f1f5;
  --border: #e2e4ea;
  --text: #1b1d23;
  --muted: #6b7080;
  --accent: #4f6df5;
  --accent-text: #ffffff;
  --ok: #22a06b;
  --warn: #e3a008;
  --danger: #e0453a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117; --surface: #181b24; --surface-2: #20242f; --border: #2b303d;
    --text: #eef0f5; --muted: #8b91a3; --accent: #6d85ff;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: .95rem; margin: 0 0 .4rem; }
p { margin: .3rem 0; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }

/* layout */
.nav { display: flex; align-items: center; gap: 1.2rem; padding: .7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.nav .brand { font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem; color: var(--text); }
.nav a.link { color: var(--muted); font-weight: 500; padding: .3rem .2rem; }
.nav a.link.active, .nav a.link:hover { color: var(--text); text-decoration: none; }
.nav .spacer { flex: 1; }
.page { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.page.wide { max-width: 1800px; }
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar h1 { margin: 0; }
.toolbar .spacer { flex: 1; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.two-col { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card .head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.pill.accent { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.stat { display: flex; flex-direction: column; }
.stat .num { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .lbl { font-size: .78rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: .6rem 0; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: .5rem 0 .3rem; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.danger { background: var(--danger); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: .25rem .6rem; font-size: .82rem; }
.btn.xs { padding: .12rem .45rem; font-size: .75rem; }
form.inline { display: inline; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: .7rem 0 .25rem; }
label.check { display: flex; align-items: center; gap: .4rem; font-weight: 500; color: var(--text); margin: .3rem 0; }
input[type=text], input[type=number], input[type=time], input[type=date], input[type=datetime-local], input[type=password], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
input[type=color] { width: 3rem; height: 2.2rem; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.row { display: flex; gap: .8rem; align-items: end; }
.row > * { flex: 1; }
.counter { font-size: .75rem; color: var(--muted); text-align: right; }
.counter.over { color: var(--danger); font-weight: 600; }
.alert { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.alert.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.alert.danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.alert.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--accent); color: var(--accent); }
.dropzone input { display: none; }
progress { width: 100%; height: 8px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* thumbnails */
.thumb { width: 54px; aspect-ratio: 9/16; border-radius: 6px; background: var(--surface-2); object-fit: cover; display: block; flex-shrink: 0; }
.thumb.lg { width: 100%; max-width: 280px; }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .7rem; }

/* calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: .6rem; overflow-x: auto; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 60vh; display: flex; flex-direction: column; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.day.past { opacity: .7; }
.day .dh { padding: .6rem .7rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline; }
.day .dh b { font-size: .95rem; }
.day .dh span { color: var(--muted); font-size: .8rem; }
.day .body { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; }
.occ { border-radius: 10px; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--accent)); background: var(--surface); padding: .5rem .55rem; display: flex; gap: .5rem; }
.occ.empty { border-style: dashed; background: transparent; }
.occ .info { min-width: 0; flex: 1; }
.occ .title { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ .meta { font-size: .75rem; color: var(--muted); }
.occ .plats { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .3rem; }
.plat { font-size: .68rem; font-weight: 700; padding: .08rem .35rem; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.plat.published { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.plat.publishing { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.plat.failed { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.plat.auto { outline: 1px solid currentColor; }

/* plan list */
.plan-item { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: start; }
.plan-item.compact { grid-template-columns: auto 1fr auto; }
.plan-item pre { white-space: pre-wrap; font: inherit; background: var(--surface-2); padding: .6rem .7rem; border-radius: 8px; margin: .4rem 0; max-height: 12rem; overflow: auto; }
.plan-item.compact pre { max-height: 5rem; }
.plan-item .actions { display: flex; flex-direction: column; gap: .4rem; min-width: 150px; }
.done-list { opacity: .55; }

details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.login { max-width: 360px; margin: 12vh auto; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
