:root {
  --bg: #f4f5f3;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #5d6670;
  --line: #e2e5e1;
  --accent: #0e8c7e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3f0;
  --danger: #c2372f;
  --warn: #b7791f;
  --ok: #1f8a4c;
  --side: #121517;
  --side-ink: #c9d1cf;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1213; --panel: #171b1d; --ink: #e8ecea; --muted: #97a1a0; --line: #283032;
    --accent: #2bb3a2; --accent-ink: #062623; --accent-soft: #123331;
    --danger: #ef6b61; --warn: #e0a74a; --ok: #4cc27f; --side: #0a0c0d; --side-ink: #b7c0be;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "IBM Plex Sans", system-ui, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
a { color: var(--accent); }
code, pre, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff; padding: 0 6px; }
.brand i { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.brand i::after { content: ""; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #7d8785; padding: 0 8px 6px; display: flex; justify-content: space-between; align-items: center; }
.nav a { color: var(--side-ink); text-decoration: none; padding: 7px 8px; border-radius: 7px; display: flex; justify-content: space-between; gap: 8px; }
.nav a:hover { background: #1d2224; color: #fff; }
.nav a.on { background: #213130; color: #fff; }
.nav a small { color: #7d8785; }
.side-foot { margin-top: auto; font-size: 13px; display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.side-foot button { all: unset; cursor: pointer; color: var(--side-ink); }
.main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
textarea.input { resize: vertical; min-height: 70px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.color { display: flex; align-items: center; gap: 6px; }
.color input[type=color] { flex: none; }
.alpha { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); flex: none; }
.alpha input { width: 64px; }
.swatch { flex: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background-image: linear-gradient(45deg,#0001 25%,transparent 25%,transparent 75%,#0001 75%); }
.color input[type=color] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }

/* status */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.empty { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.pill.uploading { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill.ready { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

/* ---------- biblioteca ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .input { max-width: 300px; }
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.vcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: border-color .15s; }
.vcard:hover { border-color: var(--accent); }
.thumb { aspect-ratio: 16/10; background: #1b2022 center/cover no-repeat; display: grid; place-items: center; color: #6c7775; font-size: 13px; }
.vbody { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.vname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmeta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- editor ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { all: unset; cursor: pointer; padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
.editor { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 24px; align-items: start; }
.editor > * { min-width: 0; }
.preview { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 10px; }
.preview-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.section-title { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 6px 0 -4px; }
.cta-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.savebar { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0 0; display: flex; gap: 10px; justify-content: flex-end; }
pre.code { background: #111516; color: #d7e2df; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: 13px; line-height: 1.5; margin: 0; white-space: pre; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.list th { color: var(--muted); font-weight: 500; font-size: 13px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 380px; padding: 28px; }
.auth .brand { color: var(--ink); padding: 0; margin-bottom: 18px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .nav-projects, .side-foot { display: none; }
  .main { padding: 18px 16px 50px; }
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
