/* ==========================================================================
   Teleprompter Pro — interface do painel
   Temas: escuro (padrão), claro e alto contraste — via [data-theme] no <html>.
   A cor da marca (--brand) vem de /brand.css (personalização no painel).
   ========================================================================== */

:root {
  --brand: #3b82f6;
  --brand-2: #22d3ee;
  --bg: #0b0f17;
  --bg-2: #0e131d;
  --surface: #131a26;
  --surface-2: #1a2232;
  --surface-3: #222c3f;
  --border: #243047;
  --border-2: #2f3c57;
  --text: #e7ecf4;
  --text-2: #b9c3d4;
  --muted: #8592a8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eaeef5;
  --border: #e1e6ef;
  --border-2: #cfd7e4;
  --text: #121826;
  --text-2: #374154;
  --muted: #6b778c;
  --shadow: 0 10px 30px rgba(15, 23, 42, .10);
  --shadow-sm: 0 1px 4px rgba(15, 23, 42, .08);
  color-scheme: light;
}

[data-theme="contrast"] {
  --brand: #ffd400 !important;
  --brand-2: #00e5ff !important;
  --bg: #000;
  --bg-2: #000;
  --surface: #000;
  --surface-2: #0a0a0a;
  --surface-3: #161616;
  --border: #ffffff;
  --border-2: #ffffff;
  --text: #ffffff;
  --text-2: #ffffff;
  --muted: #e0e0e0;
  --shadow: none;
  --shadow-sm: none;
}
[data-theme="contrast"] .btn-primary { color: #000 !important; }
[data-theme="contrast"] a:not(.btn):not(.nav-item):not(.dropdown-item) { text-decoration: underline; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
code, kbd { font-family: var(--mono); font-size: .85em; }
kbd {
  display: inline-block; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2);
  box-shadow: inset 0 -1px 0 var(--border-2);
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand) 40%, transparent); }
.muted { color: var(--muted); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; gap: .75rem; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 999; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* Ícones (sprite SVG) */
.ic {
  width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ic-lg { width: 24px; height: 24px; }
.ic-xl { width: 32px; height: 32px; }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 45%, transparent);
}
.brand-mark .ic { width: 20px; height: 20px; }
.brand-logo { height: 34px; width: auto; max-width: 160px; object-fit: contain; }
.brand-name { font-size: 1.05rem; }

/* ---------- Botões ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: var(--border-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 38px; padding: .45rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s, opacity .15s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #fff); }
.btn-danger { --btn-bg: color-mix(in srgb, var(--danger) 14%, transparent); --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 24%, transparent); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 32px; padding: .3rem .7rem; font-size: .82rem; }
.btn-lg { min-height: 48px; padding: .7rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; position: relative; transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon.is-on { color: #f5c518; }
.link-btn { border: 0; background: none; color: var(--brand); cursor: pointer; font: inherit; font-size: .8rem; padding: 0; }
.btn .spinner { width: 14px; height: 14px; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field > label, .label { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.hint { font-size: .78rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: .5rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); font: inherit; font-size: .92rem;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.input[type="color"] { padding: 3px; width: 56px; cursor: pointer; }
.input-group { display: flex; gap: .5rem; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.check { display: inline-flex; gap: .55rem; align-items: center; cursor: pointer; font-size: .9rem; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.range { width: 100%; accent-color: var(--brand); }

/* Interruptor */
.switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 22px; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--border-2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Layout do app ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--border); padding: 1rem .75rem; overflow-y: auto; z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: .25rem .5rem 1rem; }
.sidebar-brand { text-decoration: none !important; }
.sidebar-close { display: none; }
.sidebar-cta { padding: 0 .25rem 1rem; }
.sidebar-nav { flex: 1; }
.nav-group { margin-bottom: 1.1rem; }
.nav-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 .75rem .4rem; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 9px;
  color: var(--text-2); font-weight: 500; font-size: .92rem; text-decoration: none !important; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav-item.is-active .ic { color: var(--brand); }
.sidebar-foot { display: flex; justify-content: space-between; gap: .5rem; font-size: .75rem; color: var(--muted); padding: .75rem .5rem 0; border-top: 1px solid var(--border); }
.sidebar-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.topbar-search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; }
.topbar-search .ic { position: absolute; left: 12px; color: var(--muted); }
.topbar-search input { width: 100%; height: 40px; padding: 0 2.6rem 0 2.4rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.topbar-search input:focus { outline: none; border-color: var(--brand); }
.topbar-search kbd { position: absolute; right: 10px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.user-btn { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem; border-radius: 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: .85rem; }
.user-meta small { font-size: .72rem; color: var(--muted); }
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }

.content { padding: 1.75rem 1.5rem 3rem; width: 100%; max-width: 1400px; margin: 0 auto; flex: 1; }
.app-footer { padding: 1rem 1.5rem; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border); text-align: center; }

/* Avatar */
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-initials { display: inline-grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }
.breadcrumb { display: flex; gap: .4rem; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.breadcrumb a { color: var(--muted); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 1rem; }
.grid > .card, .grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-flush { padding: 0; }
.card-flush > .table-wrap { border-radius: var(--radius); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

.stat {
  display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .2s var(--ease), border-color .2s; position: relative; overflow: hidden;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-2); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 15%, transparent); }
.stat-icon .ic { width: 22px; height: 22px; }
.stat-value { display: block; font-size: 1.55rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { display: block; font-size: .8rem; color: var(--muted); }

/* ---------- Listas / tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: .85rem; padding: .7rem .25rem; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: .78rem; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .ic { width: 42px; height: 42px; margin-bottom: .75rem; opacity: .6; }
.empty h3 { color: var(--text); }
.empty-mini { padding: 1rem; color: var(--muted); font-size: .85rem; text-align: center; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-draft { background: color-mix(in srgb, var(--muted) 20%, transparent); }
.badge-review { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.badge-ready { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge-done { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.badge-danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.project-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--brand)); flex: none; }

/* Abas / filtros */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab { padding: .6rem .9rem; color: var(--muted); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--brand); }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .input { width: auto; min-width: 150px; }

/* Lista de roteiros */
.script-row { display: grid; grid-template-columns: 34px minmax(0, 2.4fr) minmax(0, 1fr) 110px 100px 130px 150px; gap: 1rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--border); transition: background .12s; }
.script-row:hover { background: var(--surface-2); }
.script-row.is-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: transparent; }
.script-row .actions { display: flex; justify-content: flex-end; gap: .15rem; }
.script-title a { color: var(--text); font-weight: 600; }
.script-sub { font-size: .76rem; color: var(--muted); }

/* Paginação */
.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 .6rem; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-size: .85rem; text-decoration: none !important; }
.pagination .is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); padding: .35rem;
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top; transition: opacity .14s, transform .14s, visibility .14s;
}
.dropdown.is-open > .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-right { left: auto; right: 0; }
.dropdown-up { top: auto; bottom: calc(100% + 6px); }
.dropdown-item {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 0;
  background: none; color: var(--text); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; text-decoration: none !important;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-sep { height: 1px; background: var(--border); margin: .3rem 0; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: .5rem .7rem; font-weight: 700; font-size: .85rem; }
.dropdown-item form { margin: 0; }
.notif-menu { width: 340px; max-width: calc(100vw - 24px); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif { display: block; padding: .6rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none !important; }
.notif:hover { background: var(--surface-2); }
.notif.is-unread { box-shadow: inset 3px 0 0 var(--brand); }
.notif strong { display: block; font-size: .86rem; }
.notif span { display: block; font-size: .8rem; color: var(--muted); }
.logout-form { margin: 0; }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #0b0f17; color: #fff; font-size: .74rem; font-weight: 600; padding: .3rem .55rem; border-radius: 6px;
  white-space: nowrap; pointer-events: none; z-index: 80; border: 1px solid #2f3c57; animation: tipIn .12s ease-out;
}
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, -3px); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem;
  background: rgba(3, 6, 12, .66); backdrop-filter: blur(3px); animation: fadeIn .15s ease-out;
}
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow); animation: popIn .18s var(--ease); max-height: calc(100vh - 2rem); overflow-y: auto; }
.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem .5rem; }
.modal-head h3 { margin: 0; }
.modal-body { padding: .5rem 1.25rem 1rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Toasts / flash ---------- */
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: .65rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow); font-size: .9rem;
  animation: toastIn .25s var(--ease); border-left: 4px solid var(--info);
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.flash-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash { display: flex; gap: .6rem; align-items: center; padding: .75rem 1rem; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); font-size: .9rem; }
.flash-success { border-color: color-mix(in srgb, var(--success) 50%, transparent); }
.flash-success .ic { color: var(--success); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.flash-error .ic { color: var(--danger); }
.js .flash-list[data-flash] { display: none; }

/* Spinner */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Marcações (editor, versões, remoto) ---------- */
.tp-marker {
  display: inline-block; padding: .05em .45em; margin: 0 .1em; border-radius: .3em;
  font-weight: 800; font-size: .85em; letter-spacing: .03em; color: #0b1220; background: #facc15;
  user-select: all; white-space: nowrap; line-height: 1.35;
}
.tp-note { color: #fde68a; background: color-mix(in srgb, #f59e0b 16%, transparent); font-style: italic; border-radius: 4px; padding: 0 .25em; }
[data-theme="light"] .tp-note { color: #92400e; }
.tp-comment { background: color-mix(in srgb, var(--info) 18%, transparent); border-bottom: 2px dotted var(--info); cursor: help; }
hr.tp-scene { border: 0; height: 0; border-top: 3px dashed var(--brand); margin: 1.5em 0; position: relative; overflow: visible; }
hr.tp-scene::after { content: "CENA"; position: absolute; top: -.75em; left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--brand); padding: 0 .6em; font-size: .7rem; font-weight: 800; letter-spacing: .15em; }

/* Comparação de versões */
.diff { font-size: 1rem; line-height: 1.7; }
.diff p { margin: 0 0 .6em; padding: .25rem .6rem; border-radius: 6px; }
.diff ins { background: color-mix(in srgb, var(--success) 25%, transparent); color: inherit; text-decoration: none; border-radius: 3px; padding: 0 2px; }
.diff del { background: color-mix(in srgb, var(--danger) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.diff .diff-ins { border-left: 3px solid var(--success); }
.diff .diff-del { border-left: 3px solid var(--danger); }
.diff .diff-changed { border-left: 3px solid var(--warning); }
.diff .diff-same { color: var(--muted); }
.version-content { font-size: 1.05rem; line-height: 1.7; }

/* ---------- Login ---------- */
.auth-body { min-height: 100vh; background: #070a10; color: #e7ecf4; }
.auth-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(900px 500px at 15% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(700px 400px at 100% 100%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 60%);
}
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 410px; background: rgba(19, 26, 38, .88); border: 1px solid #243047; border-radius: 18px; padding: 2rem; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); backdrop-filter: blur(12px); }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1.5rem; text-decoration: none !important; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.auth-brand .brand-name { font-size: 1.3rem; }
.auth-card h1 { font-size: 1.15rem; text-align: center; text-transform: uppercase; letter-spacing: .2em; color: #8592a8; font-weight: 700; margin-bottom: 1.5rem; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: .25rem 0 1.25rem; font-size: .88rem; }
.auth-foot { margin-top: 1.5rem; font-size: .78rem; color: #8592a8; text-align: center; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 2.8rem; }
.password-wrap .btn-icon { position: absolute; right: 2px; top: 1px; }

/* ---------- Erros ---------- */
.blank-body { min-height: 100vh; }
.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.error-code { font-size: 5rem; font-weight: 900; letter-spacing: -.04em; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ---------- Diversos ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.check-list .ok { color: var(--success); }
.check-list .fail { color: var(--danger); }
.log-box { font-family: var(--mono); font-size: .76rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: .75rem; max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.color-swatch { width: 22px; height: 22px; border-radius: 6px; display: inline-block; border: 1px solid var(--border-2); vertical-align: middle; }
.key-capture { font-family: var(--mono); cursor: pointer; text-align: center; }
.key-capture.is-capturing { border-color: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 30%, transparent); }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 1.5rem 0 .75rem; }
.section-title:first-child { margin-top: 0; }
.icon-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.icon-picker label { cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-2); color: var(--text-2); }
.icon-picker input:checked + span { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.project-card { display: flex; flex-direction: column; gap: .75rem; border-top: 3px solid var(--c, var(--brand)); }
.project-card .project-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 8px; transition: width .4s var(--ease); }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .script-row { grid-template-columns: 34px minmax(0, 2fr) minmax(0, 1fr) 90px 150px; }
  .script-row .col-created, .script-row .col-status { display: none; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow); }
  .sidebar.is-open { transform: none; }
  .sidebar-close, .menu-btn { display: inline-grid; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); }
  .grid-3, .grid-sidebar { grid-template-columns: 1fr; }
  .user-meta { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .content { padding: 1.1rem 1rem 2.5rem; }
  .topbar { padding: 0 .75rem; gap: .5rem; }
  .topbar-search kbd { display: none; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .script-row { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .script-row .col-project, .script-row .col-time, .script-row .col-updated { display: none; }
  .script-row.is-head { display: none; }
  .page-head { align-items: flex-start; }
  .card { padding: 1rem; }
  .toolbar .input { flex: 1 1 140px; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .app-footer, .toast-stack { display: none !important; }
  .app { display: block; }
}
