/* Tokens: Design System Horizon X v2.0 — preto domina, branco fala, vermelho aponta. */
:root {
  color-scheme: dark;
  --hx-black: #000000;
  --hx-red: #B80000;
  --hx-red-deep: #940000;
  --hx-white: #FFFFFF;
  --hx-offwhite: #F6F6F6;
  --hx-ink: #121212;
  --hx-graphite: #212121;
  --muted: rgba(255,255,255,.82);
  --subtle: rgba(255,255,255,.6);
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.12);
  --red-line: rgba(184,0,0,.35);
  --red-tint: rgba(184,0,0,.08);
  --cta: linear-gradient(135deg,#B80000 0%,#940000 100%);
  --label: linear-gradient(90deg,#212121 0%,#B80000 100%);
  --ok: #3fae6a;
  --warn: #d9a400;
  --font-title: "Plus Jakarta Sans","Helvetica Neue",Arial,sans-serif;
  --font-body: "Inter","Helvetica Neue",Arial,sans-serif;
  --r-sm: 8px; --r-md: 12px; --r-lg: 24px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--hx-black); color: var(--hx-white); font: 14px/1.5 var(--font-body); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--subtle); }

.shell { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; background: var(--hx-black); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--cta); display: grid; place-items: center; font: 800 14px var(--font-title); }
.brand strong { display: block; font: 800 16px var(--font-title); letter-spacing: .02em; }
.brand small { color: var(--subtle); font-size: 12px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); text-decoration: none; font-weight: 500; }
#nav a:hover { background: var(--hx-ink); color: var(--hx-white); }
#nav a.on { background: var(--hx-graphite); color: var(--hx-white); box-shadow: inset 3px 0 0 var(--hx-red); }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); }

main { overflow: auto; padding: 24px 28px 48px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { display: inline-block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--red-line); background: var(--red-tint); padding: 3px 10px; border-radius: 99px; margin-bottom: 8px; }
h1 { font: 800 28px/1.1 var(--font-title); letter-spacing: -.02em; margin: 0; }
h2 { font: 700 16px var(--font-title); margin: 0 0 12px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn { border: 1px solid var(--line-strong); background: var(--hx-ink); padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: rgba(255,255,255,.3); }
.btn.primary { background: var(--cta); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8a8a; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
select, input, textarea { background: var(--hx-black); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 7px 10px; width: 100%; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--hx-white); outline-offset: 1px; }
textarea { min-height: 72px; resize: vertical; }
.tools select { width: auto; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { background: var(--hx-ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; cursor: pointer; }
.kpi b { display: block; font: 800 30px/1.1 var(--font-title); }
.kpi.alert b { color: #ff5c5c; }
.kpi span { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.panel { background: var(--hx-ink); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.list { display: flex; flex-direction: column; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; }
.row .s { color: var(--subtle); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--subtle); padding: 8px 0; }

/* Kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 240px; background: var(--hx-ink); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
.col.special { border-style: dashed; border-color: var(--red-line); background: var(--red-tint); }
.col.over { border-color: var(--hx-white); }
.col-h { padding: 12px 14px 8px; display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.col-b { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.hint { color: var(--subtle); font-size: 12px; padding: 4px 4px 0; text-transform: none; letter-spacing: 0; }
.card { background: var(--hx-graphite); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 10px 12px; cursor: grab; }
.card:hover { border-color: rgba(255,255,255,.28); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 600; margin-bottom: 2px; }
.card .s { color: var(--subtle); font-size: 12.5px; }
.card .na { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.tag.red { border-color: var(--red-line); background: var(--red-tint); color: #ff8a8a; }
.tag.ok { border-color: rgba(63,174,106,.4); color: #8fe0ae; }
.tag.warn { border-color: rgba(217,164,0,.4); color: #f0cf6b; }
.bar { height: 4px; background: var(--line-strong); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--hx-red); }

/* Tabela */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--subtle); font-weight: 600; border-top: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255,255,255,.02); }

/* Drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 100vw); background: var(--hx-ink); border-left: 1px solid var(--line-strong); z-index: 20; display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.6); }
.drawer-h { padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { font-size: 20px; margin: 4px 0 8px; }
.drawer-b { padding: 16px 20px 40px; overflow-y: auto; flex: 1; }
.x { position: absolute; top: 14px; right: 14px; }
.tabs { display: flex; gap: 4px; margin-top: 10px; }
.tabs button { background: transparent; border: 0; padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--hx-graphite); color: var(--hx-white); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--subtle); }
.form .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--hx-red); flex: none; }
.check .lbl { flex: 1; }
.check.done .lbl { color: var(--subtle); text-decoration: line-through; }
.grp { margin-top: 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.act { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.act time { color: var(--subtle); font-size: 12px; margin-right: 8px; }
.act.manual { color: var(--hx-white); }
.act.auto { color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal-c { background: var(--hx-ink); border: 1px solid var(--line-strong); border-radius: var(--r-lg); width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 22px; position: relative; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--hx-graphite); border: 1px solid var(--red-line); padding: 10px 16px; border-radius: var(--r-sm); z-index: 40; }


/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(60% 50% at 50% 0%, rgba(184,0,0,.18), transparent 70%), var(--hx-black); }
.login-card { width: min(400px, 100%); background: var(--hx-ink); border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 28px; }
.lerr { margin-top: 12px; color: #ff8a8a; font-size: 13px; }

/* "Ver como" */
.preview-bar { position: sticky; top: -24px; z-index: 5; margin: -24px -28px 20px; padding: 10px 28px; background: var(--hx-graphite); border-bottom: 1px solid var(--red-line); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview-bar .btn { margin-left: auto; }

/* Seções, mês, tabelas */
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); margin: 4px 0 10px; }
.month { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 2px; }
.month b { min-width: 150px; text-align: center; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.sheet td.cap { max-width: 260px; color: var(--muted); font-size: 13px; }
.caption { white-space: pre-wrap; background: var(--hx-black); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13.5px; max-height: 260px; overflow: auto; }
.lbl-s { font-size: 12px; color: var(--subtle); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.panel.clickable { cursor: pointer; }
.panel.clickable:hover { border-color: rgba(255,255,255,.2); }
.panel.review { padding: 14px 16px; margin-top: 16px; border-color: var(--red-line); background: var(--red-tint); }
.page-tabs { margin: 0 0 18px; border-bottom: 1px solid var(--line); padding-bottom: 8px; overflow-x: auto; }
.kpi b { overflow-wrap: anywhere; }
.kpi.money b { font-size: 22px; white-space: nowrap; overflow-wrap: normal; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Barras horizontais (receita por cliente, despesa por categoria) */
.hbar { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; margin-top: 6px; border-radius: var(--r-sm); background: var(--hx-black); overflow: hidden; font-size: 13px; }
.hbar span, .hbar b { position: relative; z-index: 1; }
.hbar i { position: absolute; inset: 0 auto 0 0; background: var(--red-tint); border-right: 2px solid var(--hx-red); }

/* Etiquetas: pessoa e tipo de tarefa */
.tag.person { border-color: transparent; background: var(--hx-graphite); color: var(--hx-white); font-weight: 600; }
.tag.person::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--subtle); vertical-align: 1px; }
.tag.p-rafael::before { background: var(--hx-red); }
.tag.p-gabriel::before { background: #e8e8e8; }
.tag.p-yuri::before { background: #8fe0ae; }
.tag.p-emanuel::before { background: #f0cf6b; }
.tag.kind { border-style: dashed; }
.row .s .tag { margin-right: 4px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { flex-direction: row; align-items: center; padding: 10px 16px; overflow-x: auto; }
  #nav { flex-direction: row; }
  .side-foot { display: none; }
  main { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .preview-bar { margin: -16px -16px 16px; padding: 10px 16px; top: -16px; }
  .month b { min-width: 110px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.money b { font-size: 18px; }
}

/* v3 — status com cor (sempre com o nome escrito) */
.tag.st { border-color: transparent; color: var(--hx-white); font-weight: 600; }
.st-planejado { background: rgba(57,135,229,.22) !important; box-shadow: inset 0 0 0 1px rgba(57,135,229,.6); }
.st-producao { background: rgba(201,133,0,.22) !important; box-shadow: inset 0 0 0 1px rgba(201,133,0,.65); }
.st-produzido { background: rgba(144,133,233,.22) !important; box-shadow: inset 0 0 0 1px rgba(144,133,233,.65); }
.st-revisao_interna { background: rgba(213,81,129,.2) !important; box-shadow: inset 0 0 0 1px rgba(213,81,129,.6); }
.st-aguardando_cliente { background: rgba(217,89,38,.24) !important; box-shadow: inset 0 0 0 1px rgba(217,89,38,.7); }
.st-ajustes { background: rgba(230,103,103,.24) !important; box-shadow: inset 0 0 0 1px #e66767; }
.st-aprovado { background: rgba(25,158,112,.24) !important; box-shadow: inset 0 0 0 1px rgba(25,158,112,.7); }
.st-publicado { background: rgba(63,174,106,.45) !important; box-shadow: inset 0 0 0 1px #3fae6a; }
select.st-sel { width: auto; min-width: 150px; font-size: 12.5px; font-weight: 600; padding: 4px 8px; border: 0; border-radius: 99px; }
select.st-sel option { background: var(--hx-ink); }

/* aprovação por parte */
.chk-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chk { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.chk.ok { color: #8fe0ae; background: rgba(63,174,106,.15); }
.chk.no { color: #fff; background: #b80000; letter-spacing: .02em; }
.chk.wait { color: var(--subtle); border: 1px dashed var(--line-strong); font-weight: 500; }
.chk-btns { display: inline-flex; gap: 4px; }
.chk-b { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--hx-black); cursor: pointer; font-weight: 800; line-height: 1; }
.chk-b:hover { border-color: rgba(255,255,255,.4); }
.chk-b.on-ok { background: #1f6b40; border-color: #3fae6a; }
.chk-b.on-no { background: #b80000; border-color: #ff5c5c; }
td.cell-no, .part-box.cell-no { background: rgba(184,0,0,.14); box-shadow: inset 3px 0 0 #ff5c5c; }
td.cell-ok { box-shadow: inset 3px 0 0 #3fae6a; }
.part-box { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); }
table.sheet td.part { min-width: 170px; max-width: 280px; }
.snip { font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.card .dates { margin-top: 6px; font-size: 11.5px; }

/* alertas e controles */
.alert-red { border: 1px solid #ff5c5c; background: rgba(184,0,0,.22); border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 16px; }
.alert-red.soft { border-color: var(--red-line); background: var(--red-tint); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 2px; }
.seg button { background: transparent; border: 0; padding: 4px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--hx-graphite); color: var(--hx-white); }

/* metas e gráficos */
.meter { margin-top: 12px; }
.meter-h { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.meter-bar { height: 10px; background: var(--hx-black); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: #3fae6a; border-radius: 99px; }
.meter.over .meter-bar i { background: #ff5c5c; }
.meter.over .meter-h b { color: #ff8a8a; }
.donut-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; flex: none; }
.donut-v { fill: var(--hx-white); font: 800 15px var(--font-title); }
.donut-l { fill: var(--subtle); font-size: 11px; }
.legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; font-size: 13px; }
.legend > div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend span { flex: 1; color: var(--muted); }
.legend em { font-style: normal; color: var(--subtle); width: 38px; text-align: right; }
.legend.row-legend { flex-direction: row; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.legend.row-legend span { flex: none; }
.bars { width: 100%; height: auto; }
.bars .base { stroke: var(--line-strong); }
.bars .ax { fill: var(--subtle); font-size: 11px; }
.bars .ax.neg, .neg { fill: #ff8a8a; color: #ff8a8a; }

/* prints */
.prints { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 8px; }
.prints.sm { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.prints figure { margin: 0; background: var(--hx-black); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.prints img { display: block; width: 100%; height: 140px; object-fit: cover; object-position: top; }
.prints.sm img { height: 90px; }
.prints figcaption { padding: 6px 8px; font-size: 12px; color: var(--muted); }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 22px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--hx-white); background: rgba(255,255,255,.03); }
.pl-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-top: 10px; }
.pl-math { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.pl-math b { color: var(--hx-white); }
.pl-math .neg b { color: #ff8a8a; }
.pl-form { padding: 10px 12px; border: 1px dashed var(--red-line); border-radius: var(--r-sm); }
tr.virtual td { opacity: .72; font-style: italic; }
