:root {
  --bg: #0D0D0D;
  --bg-2: #141414;
  --bg-3: #1C1C1C;
  --bg-4: #262626;
  --line: #2A2A2A;
  --line-2: #3A3A3A;
  --ink: #FFFFFF;
  --ink-2: #B8B8B8;
  --ink-3: #7A7A7A;
  --boca: #ED761B;
  --boca-2: #FF8B1A;
  --boca-soft: rgba(237, 118, 27, 0.14);
  --ok: #2FBF71;
  --warn: #F5B700;
  --bad: #FB2C36;
  --radius: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .display { font-family: Outfit, Inter, sans-serif; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.1; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--boca-2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { flex: none; display: block; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- casca ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { height: 22px; width: auto; display: block; }
.brand .tag { font-family: Outfit, sans-serif; font-weight: 800; font-size: 13px; letter-spacing: 0.12em; }
.topbar .spacer { flex: 1; }
.topnav { display: none; gap: 4px; }
.topnav a {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px;
}
.topnav a.on { color: var(--ink); background: var(--bg-3); }
.topnav a:hover { color: var(--ink); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-family: Outfit, sans-serif; font-weight: 800; font-size: 13px; color: #0D0D0D; flex: none;
  border: 0; padding: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -4px; box-shadow: 0 0 0 2px var(--bg-2); }
.avatars .avatar:first-child { margin-left: 0; }

main.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px calc(96px + var(--safe-b)); }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.eyebrow {
  display: inline-block; font-family: Outfit, sans-serif; font-weight: 800; font-size: 12px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--boca); margin-bottom: 6px;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(13, 13, 13, 0.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-b));
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
  color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 600;
}
.tabbar a.on { color: var(--boca); }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  main.page { padding-bottom: 48px; padding-top: 28px; }
  h1 { font-size: 34px; }
}

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--bg-3); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { border-color: #555; }
.btn.primary { background: var(--boca); border-color: var(--boca); color: #0D0D0D; font-weight: 700; }
.btn.primary:hover { background: var(--boca-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--bg-3); }
.btn.danger { color: #FF6568; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.icon { padding: 0; width: 42px; }
.btn.icon.sm { width: 34px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, input.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--ink);
  font-size: 16px; font-weight: 400; outline: none;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field textarea.tall { min-height: 220px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--boca); }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check > span {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 6px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; font-size: 14px;
}
.chip-check input:checked + span { border-color: var(--boca); color: var(--ink); background: var(--boca-soft); }
.chip-check input:focus-visible + span { outline: 2px solid var(--boca); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: var(--ink); }

/* ---------- etiquetas ---------- */
.slash {
  display: inline-flex; align-items: center; padding: 3px 12px; transform: skewX(-12deg);
  background: var(--boca); color: #0D0D0D; font-family: Outfit, sans-serif; font-weight: 800;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
.slash > * , .slash > span { transform: skewX(12deg); display: inline-block; }
.slash.red { background: var(--bad); color: #fff; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--line-2); color: var(--ink-2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- cartões e listas ---------- */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.panel.pad { padding: 16px; }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 12px; }
.empty {
  border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 28px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: center; color: var(--ink-2);
}
.empty h3 { color: var(--ink); }

/* ---------- hoje ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 14px; padding: 22px 18px;
  background: linear-gradient(120deg, #1A1008 0%, #0D0D0D 60%);
  border: 1px solid #3A2410;
}
.hero::after {
  content: ''; position: absolute; right: -40px; top: -30px; width: 200px; height: 200%;
  background: var(--boca); opacity: 0.08; transform: skewX(-18deg);
}
.hero h1 { font-size: 30px; margin: 10px 0 6px; }
.hero .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; margin-bottom: 16px; }
.hero .meta b { color: var(--ink); font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi .n { font-family: Outfit, sans-serif; font-size: 26px; font-weight: 800; line-height: 1; }
.kpi .l { font-size: 12px; color: var(--ink-2); margin-top: 6px; }

/* ---------- pautas (quadro) ---------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 82vw); gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}
@media (min-width: 900px) { .board { grid-auto-columns: minmax(210px, 1fr); margin: 0; padding-left: 0; padding-right: 0; } }
.col { scroll-snap-align: start; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 200px; }
.col.drop { border-color: var(--boca); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-weight: 700; font-size: 14px; }
.col-head .count { color: var(--ink-3); font-weight: 600; }
.col-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; flex: 1; }
.card {
  text-align: left; width: 100%; background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; color: var(--ink);
}
.card:hover { border-color: var(--line-2); }
.card .t { font-weight: 600; line-height: 1.3; }
.card .m { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.card.dragging { opacity: 0.4; }
.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-left: 38px; }

/* ---------- espelho ---------- */
.datebar { display: flex; align-items: center; gap: 8px; }
.datebar .label { min-width: 0; font-size: 22px; }
@media (min-width: 900px) { .datebar .label { font-size: 30px; } }
.timebar { margin: 4px 0 16px; }
.timebar .track { height: 8px; border-radius: 99px; background: var(--bg-4); overflow: hidden; display: flex; }
.timebar .seg { height: 100%; }
.timebar .legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.timebar .legend b { font-family: Outfit, sans-serif; font-size: 18px; color: var(--ink); }
.timebar.over .legend b { color: var(--bad); }
.over-msg { color: #FF6568; font-weight: 600; }
.rundown { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.ri {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 10px 10px 12px; border-top: 1px solid var(--line); position: relative;
}
.ri:first-child { border-top: 0; }
.ri::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--line-2)); }
.ri .clock { font-family: Outfit, sans-serif; font-weight: 700; font-size: 15px; color: var(--ink-2); }
.ri .main { min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.ri .main .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ri .main .m { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.ri .side { display: flex; align-items: center; gap: 2px; }
.ri .dur { font-family: Outfit, sans-serif; font-weight: 700; font-size: 15px; min-width: 44px; text-align: right; margin-right: 4px; }
.ri.now { background: var(--boca-soft); }
.ri.done { opacity: 0.5; }
.ri .mv { display: flex; flex-direction: column; }
.ri .mv button { background: none; border: 0; color: var(--ink-3); padding: 2px 4px; }
.ri .mv button:hover { color: var(--ink); }
.ri .mv button:disabled { opacity: 0.25; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rundown-end { display: flex; justify-content: space-between; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.edited { font-size: 12px; color: var(--ink-3); margin-top: 10px; }

/* ---------- semana ---------- */
.week { display: grid; gap: 12px; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(5, 1fr); } }
.day { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); }
.day:hover { border-color: var(--line-2); }
.day.today { border-color: var(--boca); }
.day .dh { display: flex; justify-content: space-between; align-items: baseline; }
.day .dn { font-family: Outfit, sans-serif; font-weight: 800; font-size: 18px; text-transform: capitalize; }
.day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.day li { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); min-width: 0; }
.day li span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- formato ---------- */
.seg-tabs { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.seg-tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 7px; color: var(--ink-2); font-weight: 600; }
.seg-tabs button.on { background: var(--bg-4); color: var(--ink); }
.list { display: grid; gap: 10px; }
@media (min-width: 900px) { .list.two { grid-template-columns: 1fr 1fr; } }
.qcard { display: grid; grid-template-columns: 6px 1fr auto; gap: 12px; align-items: stretch; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: left; color: var(--ink); width: 100%; }
.qcard:hover { border-color: var(--line-2); }
.qcard .bar { border-radius: 3px; }
.qcard .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qcard .d { font-family: Outfit, sans-serif; font-weight: 700; align-self: center; }

/* ---------- equipe ---------- */
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.member:first-child { border-top: 0; }
.member .grow { flex: 1; min-width: 0; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; word-break: break-all; font-size: 13px; }

/* ---------- folha (dialog) ---------- */
dialog#sheet {
  padding: 0; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink);
  width: min(620px, 100%); max-width: 100%; max-height: 92dvh; border-radius: 16px;
  margin: auto;
}
dialog#sheet::backdrop { background: rgba(0, 0, 0, 0.7); }
@media (max-width: 640px) {
  dialog#sheet { margin: auto 0 0; border-radius: 16px 16px 0 0; width: 100%; max-height: 94dvh; border-bottom: 0; }
}
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 18px; }
.sheet-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-b)); background: var(--bg-2); border-top: 1px solid var(--line); }
.sheet-foot .spacer { flex: 1; }
.links a { display: block; word-break: break-all; font-size: 13px; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(800px 400px at 80% -10%, rgba(237, 118, 27, 0.18), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.auth-card .logo { display: flex; align-items: center; gap: 12px; }
.auth-card .logo img { height: 34px; }
.auth-card h1 { font-size: 30px; }
.err { color: #FF6568; font-size: 14px; min-height: 20px; }

/* ---------- no ar ---------- */
.live { min-height: 100dvh; display: flex; flex-direction: column; background: #000; padding: calc(12px + var(--safe-t)) 16px calc(16px + var(--safe-b)); gap: 14px; }
.live-top { display: flex; align-items: center; gap: 10px; }
.live-top .clock { font-family: Outfit, sans-serif; font-weight: 800; font-size: 22px; margin-left: auto; font-variant-numeric: tabular-nums; }
.live-now { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.live-now .kind { display: flex; gap: 8px; align-items: center; }
.live-now h1 { font-size: 30px; line-height: 1.1; }
.countdown {
  font-family: Outfit, sans-serif; font-weight: 900; font-size: clamp(72px, 24vw, 168px); line-height: 0.9;
  font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
}
.countdown.warn { color: var(--warn); }
.countdown.over { color: var(--bad); }
.progress { height: 6px; background: var(--bg-4); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--boca); }
.progress.over > div { background: var(--bad); }
.live-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.live-stats > div { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.live-stats b { display: block; font-family: Outfit, sans-serif; font-size: 18px; font-variant-numeric: tabular-nums; }
.live-stats span { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.live-stats .late b { color: var(--bad); }
.live-stats .early b { color: var(--ok); }
.roteiro { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-y: auto; max-height: 34dvh; }
.next-up { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.next-up .grow { flex: 1; min-width: 0; }
.next-up .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-ctrl { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.live-ctrl .btn { min-height: 64px; font-size: 17px; border-radius: 12px; }
.live-list { display: flex; flex-direction: column; gap: 4px; }
.live-list button { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--ink); }
.live-list button.on { border-color: var(--boca); }
.live-list button.done { opacity: 0.5; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #0D0D0D; font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: calc(100% - 32px); text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: #FF6568; color: #fff; }
@media (min-width: 900px) { #toast { bottom: 32px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
