/* Roadmap · rebelatto.tech */
:root {
  --bg: #0b0b0d;
  --surface: #141417;
  --surface-2: #1b1b1f;
  --border: #2a2a30;
  --text: #ececef;
  --muted: #9a9aa3;
  --accent: #ef4444;
  --accent-ink: #fff;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --name-w: 300px;

  --c-gray: #8b8b94;
  --c-blue: #3b82f6;
  --c-amber: #f59e0b;
  --c-violet: #8b5cf6;
  --c-red: #ef4444;
  --c-green: #22c55e;
  --c-emerald: #10b981;
  --c-slate: #64748b;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --border: #e2e2e8;
  --text: #17171a;
  --muted: #62626c;
  --accent: #dc2626;
  --shadow: 0 1px 2px rgba(16,16,24,.06);
  --c-gray: #71717a;
  --c-amber: #d97706;
  --c-green: #16a34a;
  --c-emerald: #059669;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1680px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.warn { color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Cores das etapas */
.c-gray { --c: var(--c-gray); }
.c-blue { --c: var(--c-blue); }
.c-amber { --c: var(--c-amber); }
.c-violet { --c: var(--c-violet); }
.c-red { --c: var(--c-red); }
.c-green { --c: var(--c-green); }
.c-emerald { --c: var(--c-emerald); }
.c-slate { --c: var(--c-slate); }

/* Topo */
.topbar { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }
.user-name { color: var(--muted); font-size: 13px; padding: 0 4px; }

/* Botões */
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 7px 12px; border: 1px solid transparent; cursor: pointer; text-decoration: none; background: none; white-space: nowrap; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--accent); }
.btn-outline:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.btn-ghost { border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: none; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

/* Barra de ferramentas */
.toolbar { padding: 16px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 16px; display: grid; gap: 10px; }
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-row:first-child .segmented { margin-left: auto; }
.project-picker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); color: var(--accent); }
.project-picker select { color: var(--text); font-weight: 600; }
select, input[type="search"] { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-height: 34px; max-width: 260px; }
input[type="search"] { width: 200px; }
.sync-box { display: inline-flex; align-items: center; gap: 8px; }
.sync-err { color: var(--warn); font-size: 12px; max-width: 280px; }
.sync-box.is-loading .spin-on-request { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toolbar-filters { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.segmented a, .segmented button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); background: none; border: 0; cursor: pointer; }
.segmented a.active, .segmented button.active { background: var(--accent); color: #fff; }
.segmented a:not(.active):hover, .segmented button:not(.active):hover { color: var(--text); }
.segmented-sm a, .segmented-sm button { padding: 4px 10px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip b { font-weight: 600; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.chip:hover { border-color: var(--c, var(--muted)); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active b { background: rgba(0,0,0,.2); color: #fff; }
.chip-warn { color: var(--warn); }

/* KPIs */
.kpis { display: grid; grid-template-columns: 2fr repeat(3, 1fr) 1.6fr 1.6fr; gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.kpi-value { font-size: 24px; font-weight: 700; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi-text { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.kpi-warn .kpi-value { color: var(--warn); }
.kpi-progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.kpi-progress strong { font-size: 20px; }

/* Barras de progresso */
.bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-lg { height: 10px; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #f97316)); }
.card-progress { display: flex; align-items: center; gap: 8px; }
.card .bar, .table .bar, .cycle-items .bar { background: var(--border); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.tag-id { font-variant-numeric: tabular-nums; }
.tag-strong { color: var(--text); }
.tag-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.tag-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; padding: 4px 10px; border-radius: 7px; background: var(--c); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }

/* Kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(290px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: start; }
.column { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 290px); min-height: 360px; }
.column-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.column-head h2 { font-size: 15px; }
.column-head p { margin: 2px 0 0; }
.count { font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 3px 8px; white-space: nowrap; }
.column-body { padding: 12px; display: grid; gap: 10px; overflow-y: auto; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; margin: 0; }

.card { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: 9px; padding: 12px; display: grid; gap: 8px; cursor: pointer; box-shadow: var(--shadow); }
.card:hover, .card:focus-visible { border-color: var(--c); outline: none; }
.card-title { font-size: 14px; font-weight: 600; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-foot { border-top: 1px dashed var(--border); padding-top: 6px; }
.card.is-late { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent); }

/* Lista */
.list { display: grid; gap: 12px; padding-bottom: 24px; }
.list-section { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: var(--radius); }
.list-section summary { cursor: pointer; padding: 14px 16px; display: flex; gap: 8px; align-items: center; list-style: none; }
.list-section summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.list-section[open] summary::before { transform: rotate(90deg); }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.col-progress { width: 170px; }

/* Cronograma */
.gantt-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.gantt-actions { display: flex; gap: 8px; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 22px; height: 10px; border-radius: 3px; }
.lg-planned { border: 1.5px dashed var(--muted); }
.lg-current { background: color-mix(in srgb, var(--c-blue) 35%, transparent); }
.lg-actual { background: var(--accent); }
.lg-today { width: 2px; height: 14px; background: var(--accent); }
.lg-mile { width: 10px; height: 10px; background: var(--c-amber); transform: rotate(45deg); border-radius: 2px; }
.gantt { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: calc(100vh - 300px); }
.gantt-inner { position: relative; width: calc(var(--name-w) + var(--track)); }
.g-row { display: flex; min-height: 34px; border-bottom: 1px solid var(--border); }
.g-name { position: sticky; left: 0; z-index: 3; width: var(--name-w); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); border-right: 1px solid var(--border); min-width: 0; text-align: left; }
.g-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.g-track { position: relative; width: var(--track); flex: none; }
.g-head { position: sticky; top: 0; z-index: 5; min-height: 46px; background: var(--surface); }
.g-name-head { z-index: 6; color: var(--muted); font-size: 12px; }
.g-track-head { background: var(--surface); }
.g-month { position: absolute; top: 0; height: 22px; padding: 3px 8px; font-size: 12px; font-weight: 600; border-left: 1px solid var(--border); text-transform: capitalize; white-space: nowrap; overflow: hidden; }
.g-week { position: absolute; top: 24px; font-size: 10px; color: var(--muted); padding-left: 3px; border-left: 1px solid var(--border); height: 22px; line-height: 22px; }
.g-mile { position: absolute; top: 28px; width: 10px; height: 10px; margin-left: -5px; background: var(--c-amber); transform: rotate(45deg); border-radius: 2px; z-index: 2; }
.g-group { background: var(--surface-2); }
.g-group .g-name { background: var(--surface-2); font-weight: 600; }
.g-toggle { border: 0; border-right: 1px solid var(--border); cursor: pointer; color: inherit; font: inherit; }
.g-toggle .chev { display: inline-block; transition: transform .15s; color: var(--muted); }
.g-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.g-pct { font-size: 12px; color: var(--muted); font-weight: 500; }
.g-item { cursor: pointer; }
.g-item:hover .g-name, .g-item:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.g-item .g-name { padding-left: 30px; }
.g-bar { position: absolute; border-radius: 4px; }
.g-planned { top: 6px; bottom: 6px; border: 1.5px dashed var(--muted); opacity: .8; }
.g-current { top: 9px; bottom: 9px; background: color-mix(in srgb, var(--c-blue) 32%, transparent); }
.g-actual { top: 13px; bottom: 13px; background: var(--c, var(--accent)); min-width: 4px; }
.g-group .g-actual { background: var(--accent); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.g-mile-line { position: absolute; top: 46px; bottom: 0; border-left: 1px dashed color-mix(in srgb, var(--c-amber) 55%, transparent); z-index: 1; pointer-events: none; }
.gantt-note { margin: 8px 0 24px; }

/* Ciclos */
.cycles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; padding-bottom: 24px; }
.cycle { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; align-content: start; }
.cycle header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cycle h2 { font-size: 15px; }
.cycle.is-current { border-color: var(--c-amber); box-shadow: 0 0 0 1px var(--c-amber); }
.cycle.is-past { opacity: .8; }
.stack { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack-seg { background: var(--c); }
.stack-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }
.stack-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cycle-items summary { cursor: pointer; color: var(--muted); }
.cycle-items ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.cycle-items li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.cycle-items li span:nth-child(2) { flex: 1; }
.cycle-items li:hover { background: var(--surface-2); }

/* Detalhe */
.dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); padding: 0; }
.dialog::backdrop { background: rgba(0,0,0,.55); }
.detail { padding: 20px 22px 24px; display: grid; gap: 16px; }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.detail-head h2 { font-size: 19px; margin: 4px 0 8px; }
.detail-head p { margin: 0; }
.detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.detail p { margin: 0; }
.dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.dates div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.dates dt { font-size: 12px; color: var(--muted); }
.dates dd { margin: 2px 0 0; font-weight: 600; }
.checklist, .leaf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checklist li { padding-left: 24px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 4px; }
.checklist li.done::before { background: var(--ok); border-color: var(--ok); }
.leaf-list li { display: flex; align-items: center; gap: 8px; }
.leaf-list li span:nth-child(2) { flex: 1; }
.team-only { border-top: 1px dashed var(--border); padding-top: 12px; }
.team-only ul { padding-left: 18px; margin: 6px 0 0; }

/* Projetos e login */
.page-title { font-size: 22px; margin: 24px 0 16px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-decoration: none; display: grid; gap: 10px; }
.project-card:hover { border-color: var(--accent); }
.project-card p { margin: 0; }
.empty-state { padding: 40px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.login { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; display: grid; gap: 12px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: 0; }
.login-card form { display: grid; gap: 12px; margin-top: 6px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); }
.field-error { color: var(--accent); font-size: 12px; }
.login-card label input { width: 100%; }
.notice { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
.alert { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 8px; padding: 8px 12px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi-wide { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  :root { --name-w: 190px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .toolbar-row:first-child .segmented { margin-left: 0; }
  .segmented span { display: none; }
  .toolbar-filters { margin-left: 0; width: 100%; }
  .toolbar-filters select, input[type="search"] { flex: 1; max-width: none; width: auto; }
  .user-name { display: none; }
  .column { max-height: none; }
}
