/* ============================================================
   Gestão GBS — Design System
   Papel claro levemente esverdeado, tinta quase preta, verde-pinheiro
   como acento único. Fraunces nos títulos, Inter no corpo, JetBrains
   Mono nos códigos e datas. Um quadro se lê em varredura, então a cor
   carrega estado e o resto fica quieto.
   ============================================================ */

:root {
  --paper:        #F1F3F0;
  --surface:      #FFFFFF;
  --surface-2:    #F7F8F6;
  --ink:          #14181A;
  --ink-soft:     #5C6763;
  --ink-faint:    #8B9691;

  --line:         #DCE1DC;
  --line-soft:    #E8ECE7;

  --accent:       #24614A;
  --accent-ink:   #1B4C39;
  --accent-soft:  #E4EFE9;

  --crit:         #A33A2A;
  --crit-ink:     #8A2E20;
  --crit-soft:    #FAEDEA;

  --gold:         #8A6A22;
  --gold-soft:    #F7F0DE;

  --w-l:          #9AA5A0;
  --w-m:          #C99A2E;
  --w-p:          #A33A2A;

  --serif:  "Fraunces", Georgia, "Times New Roman", serif;
  --sans:   "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, Consolas, monospace;

  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;
  --r-pill: 999px;

  --sh-sm: 0 1px 2px rgba(20,24,26,.06), 0 1px 1px rgba(20,24,26,.04);
  --sh-md: 0 4px 14px rgba(20,24,26,.10);
  --sh-lg: 0 18px 46px rgba(20,24,26,.20);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0D1113;
    --surface:    #161B1E;
    --surface-2:  #1B2124;
    --ink:        #E9EEEB;
    --ink-soft:   #9AA8A2;
    --ink-faint:  #6E7C77;

    --line:       #262F32;
    --line-soft:  #1F2629;

    --accent:     #5FBF95;
    --accent-ink: #7ED0AA;
    --accent-soft:#14261F;

    --crit:       #E07963;
    --crit-ink:   #EE9079;
    --crit-soft:  #251612;

    --gold:       #C9A560;
    --gold-soft:  #241E12;

    --w-l:        #6E7C77;
    --w-m:        #C9A560;
    --w-p:        #E07963;

    --sh-sm: 0 1px 2px rgba(0,0,0,.4);
    --sh-md: 0 4px 14px rgba(0,0,0,.45);
    --sh-lg: 0 18px 46px rgba(0,0,0,.6);
  }
}

:root[data-theme="dark"] {
  --paper:#0D1113; --surface:#161B1E; --surface-2:#1B2124;
  --ink:#E9EEEB; --ink-soft:#9AA8A2; --ink-faint:#6E7C77;
  --line:#262F32; --line-soft:#1F2629;
  --accent:#5FBF95; --accent-ink:#7ED0AA; --accent-soft:#14261F;
  --crit:#E07963; --crit-ink:#EE9079; --crit-soft:#251612;
  --gold:#C9A560; --gold-soft:#241E12;
  --w-l:#6E7C77; --w-m:#C9A560; --w-p:#E07963;
  --sh-sm:0 1px 2px rgba(0,0,0,.4); --sh-md:0 4px 14px rgba(0,0,0,.45); --sh-lg:0 18px 46px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }

/* O atributo hidden vale sempre. Sem isto, qualquer regra nossa que declare
   display (o .confirm declara grid) vence o display:none do navegador e o
   elemento nasce visível. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Topo ────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(140deg, var(--accent) 0%, var(--accent-ink) 100%);
  display: inline-block; flex: none;
}
.brand-mark-lg { width: 30px; height: 30px; border-radius: 8px; }
.brand-name { font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; }

.team-pill, .user-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 5px 12px 5px 8px;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink);
  cursor: pointer;
}
.team-pill:hover, .user-trigger:hover { border-color: var(--ink-faint); }
.team-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.caret { color: var(--ink-faint); font-size: 10px; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #fff; letter-spacing: .02em;
}
.avatar-sm { width: 23px; height: 23px; font-size: 9.5px; }
.avatar-ghost { opacity: .75; border: 1px dashed rgba(255,255,255,.6); }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 7px); left: 0; min-width: 210px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-md); padding: 6px;
}
.dropdown-right { left: auto; right: 0; }
.dropdown-label {
  margin: 4px 8px 6px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
}
.dropdown-menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink); font-size: 14px;
}
.dropdown-menu a:hover { background: var(--surface-2); }
.dropdown-menu a.is-current { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ── Estrutura ───────────────────────────────────────── */

.shell { max-width: 1440px; margin: 0 auto; padding: 26px 20px 90px; }

.page-head { display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(23px, 3vw, 31px); font-weight: 600; margin: 2px 0 4px; text-wrap: balance; }
.page-sub { color: var(--ink-soft); margin: 0; max-width: 72ch; font-size: 14px; }
.eyebrow {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0;
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--accent-ink); }

.head-stats { display: flex; gap: 22px; margin-left: auto; }
.stat { text-align: right; }
.stat-n { display: block; font-family: var(--mono); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-l { display: block; font-size: 11.5px; color: var(--ink-faint); }
.stat-warn .stat-n { color: var(--crit-ink); }

.section-title { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 34px 0 6px; }
.lede { color: var(--ink-soft); max-width: 78ch; margin: 0 0 16px; font-size: 14px; }
.note { color: var(--ink-faint); font-size: 12.5px; margin-top: 10px; }
.muted { color: var(--ink-faint); }
.mono-sm { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.dot-sep { color: var(--ink-faint); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
  padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.flash {
  padding: 10px 14px; border-radius: var(--r-md); margin-bottom: 16px;
  font-size: 14px; border: 1px solid var(--line); background: var(--surface);
}
.flash-ok   { border-left: 3px solid var(--accent); }
.flash-erro { border-left: 3px solid var(--crit); }

.empty {
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--r-lg); padding: 26px; text-align: center; color: var(--ink-soft);
}
.empty-page { max-width: 460px; margin: 60px auto; }
.empty-page h1 { font-family: var(--serif); font-size: 22px; margin: 0 0 8px; color: var(--ink); }

/* ── Botões e formulários ────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 15px; border-radius: var(--r-pill); border: 1px solid transparent;
  text-decoration: none; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.push-right { margin-left: auto; }

.linkish {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent-ink); font-weight: 600;
}
.linkish:hover { text-decoration: underline; }
.linkish.del { color: var(--crit-ink); font-weight: 500; font-size: 12.5px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form-tight { gap: 11px; }
.field { display: flex; flex-direction: column; gap: 5px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  letter-spacing: .02em; padding: 0;
}
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="date"], .field select, .field textarea, #depSelect, #commentBody {
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 10px; width: 100%;
}
.field textarea, #commentBody { resize: vertical; font-size: 14px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--accent); }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ── Entrar ──────────────────────────────────────────── */

.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-wrap { width: 100%; max-width: 360px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 30px 26px; box-shadow: var(--sh-md);
}
.auth-card h1 { font-family: var(--serif); font-size: 24px; font-weight: 600; margin: 14px 0 2px; }
.auth-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 22px; }

/* ── Lista de projetos ───────────────────────────────── */

.home-grid { display: grid; grid-template-columns: 1fr 340px; gap: 30px; align-items: start; }
.project-list { display: grid; gap: 12px; }
.project-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px; transition: border-color .15s, box-shadow .15s;
}
.project-card:hover { border-color: var(--accent); box-shadow: var(--sh-sm); }
.project-card-top { display: flex; align-items: baseline; gap: 12px; }
.project-card-top h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0; }
.project-card-top .mono-sm { margin-left: auto; }
.project-card-sub { color: var(--ink-soft); font-size: 13.5px; margin: 5px 0 10px; }
.project-card-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); margin: 8px 0 0; }

.progress { height: 5px; border-radius: var(--r-pill); background: var(--line-soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.mine { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mine a {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline;
  padding: 9px 12px; border-radius: var(--r-md); text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
}
.mine a:hover { border-color: var(--accent); }
.mine-code { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--accent-ink); }
.mine-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.mine-meta.is-late, .card-when.is-late { color: var(--crit-ink); font-weight: 600; }

/* ── Filtros ─────────────────────────────────────────── */

.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter > span { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.filter select {
  font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 6px 12px;
}
.filter-count { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin: 0 0 6px; }

/* ── Quadro ──────────────────────────────────────────── */

.board {
  display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 14px; align-items: start;
}
.column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.column-head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.column-head h2 { font-size: 13px; font-weight: 700; margin: 0; letter-spacing: .01em; }
.column-count {
  margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--ink-faint); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.column-body { padding: 10px; display: grid; gap: 9px; min-height: 90px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.column-body.is-over { background: var(--accent-soft); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--w-m);
  border-radius: var(--r-md); padding: 10px 12px;
  cursor: grab; box-shadow: var(--sh-sm);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.card:hover { box-shadow: var(--sh-md); }
.card.is-dragging { opacity: .45; cursor: grabbing; }
.card.w-L { border-left-color: var(--w-l); }
.card.w-M { border-left-color: var(--w-m); }
.card.w-P { border-left-color: var(--w-p); }
.card.is-late { background: var(--crit-soft); }

.card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.card-code {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: var(--accent-ink); letter-spacing: .02em;
}
.card-title { font-size: 13.5px; line-height: 1.42; margin: 0 0 7px; }
.card-block { font-size: 11px; color: var(--ink-faint); margin: 0 0 7px; display: flex; align-items: center; gap: 5px; }
.block-dot { width: 7px; height: 7px; border-radius: 2px; display: inline-block; flex: none; }
.card-dep {
  font-family: var(--mono); font-size: 10.5px; color: var(--crit-ink);
  background: var(--crit-soft); border-radius: var(--r-sm);
  padding: 3px 7px; margin: 0 0 7px; display: inline-block;
}
.card-foot { display: flex; align-items: center; gap: 8px; }
.owners { display: flex; gap: -4px; }
.owners .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.card-when {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-faint); white-space: nowrap;
}

.chip {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line);
  color: var(--ink-faint); white-space: nowrap; letter-spacing: .02em;
}
.chip-crit  { color: var(--crit-ink);   border-color: var(--crit);   background: var(--crit-soft); }
.chip-warn  { color: var(--gold);       border-color: var(--gold);   background: var(--gold-soft); }
.chip-done  { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.chip-doing { color: var(--gold);       border-color: var(--gold);   background: var(--gold-soft); }
.chip-blocked { color: var(--crit-ink); border-color: var(--crit);   background: var(--crit-soft); }

/* ── Calendário ──────────────────────────────────────── */

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-p { background: var(--w-p); } .sw-m { background: var(--w-m); }
.sw-l { background: var(--w-l); } .sw-done { background: var(--accent); }

.gantt-wrap, .table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.gantt { display: grid; grid-template-columns: 200px repeat(var(--cols), minmax(150px, 1fr)); min-width: 900px; }
.g-head {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 9px 10px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.g-head small { display: block; font-weight: 400; color: var(--ink-faint); }
.g-corner { border-right: 1px solid var(--line); position: sticky; left: 0; z-index: 3; }
.g-lane {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px;
  border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line);
  background: var(--surface); position: sticky; left: 0; z-index: 1;
}
.g-lane-txt { display: flex; flex-direction: column; min-width: 0; }
.g-lane-txt strong { font-size: 13px; }
.g-lane-txt small { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.g-cell {
  border-bottom: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft);
  padding: 6px; min-height: 54px; display: flex; flex-direction: column; gap: 4px;
}
.g-cell.is-empty { background: var(--surface-2); }
.g-cell.is-hot { background: var(--crit-soft); }
.g-bar {
  display: block; text-align: left; font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-left: 3px solid var(--w-m);
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: 4px 7px; font-size: 11px; line-height: 1.3; color: var(--ink);
}
.g-bar:hover { border-color: var(--accent); }
.g-bar b { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); font-weight: 600; }
.g-bar.w-L { border-left-color: var(--w-l); }
.g-bar.w-M { border-left-color: var(--w-m); }
.g-bar.w-P { border-left-color: var(--w-p); background: var(--crit-soft); }
.g-bar.is-done { background: var(--accent-soft); border-left-color: var(--accent); }

/* ── Tabelas ─────────────────────────────────────────── */

.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th, .grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-faint); background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 600;
}
.grid .th-sub { font-weight: 400; text-transform: none; letter-spacing: 0; }
.grid tr:last-child td { border-bottom: 0; }
.td-code { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.td-person strong { font-size: 13.5px; }
.td-person small { color: var(--ink-faint); font-family: var(--mono); font-size: 10.5px; }
.td-load { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.td-load.is-hot { color: var(--crit-ink); font-weight: 700; background: var(--crit-soft); }
.dash { color: var(--ink-faint); }

/* ── Fluxo ───────────────────────────────────────────── */

.alert { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--r-md); padding: 13px 15px; margin-bottom: 14px; }
.alert-bad { border-left-color: var(--crit); }
.alert p { margin: 0; }
.alert p + p { margin-top: 5px; color: var(--ink-soft); font-size: 13.5px; }

.chain { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.node {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  border: 1px solid var(--crit); background: var(--crit-soft);
  border-radius: var(--r-md); padding: 8px 11px; min-width: 190px; max-width: 260px; font: inherit; color: var(--ink);
}
.node:hover { box-shadow: var(--sh-sm); }
.node.is-done { border-color: var(--accent); background: var(--accent-soft); }
.node-code { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--crit-ink); }
.node.is-done .node-code { color: var(--accent-ink); }
.node-title { font-size: 12.5px; line-height: 1.35; }
.node-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-day {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 20px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
.timeline-item { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.timeline-txt { flex: 1; }
.timeline-when { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* ── Painel lateral ──────────────────────────────────── */

.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10,14,16,.45); }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(560px, 100%);
  background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: var(--sh-lg); overflow-y: auto; padding: 22px 24px 60px;
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-close {
  position: absolute; top: 12px; right: 16px; background: none; border: 0;
  font-size: 26px; line-height: 1; color: var(--ink-faint); cursor: pointer;
}
.drawer-close:hover { color: var(--ink); }

.det-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 6px; }
.det-title { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 14px; text-wrap: balance; }
.det-alert { margin-bottom: 16px; }
.det-section { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.det-section h3 { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 10px; }
.det-danger { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }

.dep-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.dep-list li { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.dep-add { display: flex; gap: 8px; align-items: center; }
.dep-add select { flex: 1; min-width: 0; }

.comments { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.comments li { display: flex; gap: 9px; }
.comment-meta { margin: 0; font-size: 12px; }
.comment-body { margin: 2px 0 0; font-size: 13.5px; }
.comment-new { display: flex; gap: 8px; align-items: flex-start; }
.comment-new textarea { flex: 1; }

.mini-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 12.5px; }
.mini-log .muted { font-family: var(--mono); font-size: 11px; }

/* ── Modal e confirmação ─────────────────────────────── */

.modal {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px;
  background: var(--surface); color: var(--ink); width: min(520px, 92vw); box-shadow: var(--sh-lg);
}
.modal::backdrop { background: rgba(10,14,16,.45); }
.modal h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 0 0 6px; }

.confirm { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(10,14,16,.45); }
.confirm-box {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px 24px; width: min(460px, 92vw); box-shadow: var(--sh-lg);
}
.confirm-box h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0 0 10px; text-wrap: balance; }
.confirm-box ul { margin: 0 0 12px; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.confirm-box p { margin: 0 0 16px; font-size: 14px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Telas estreitas ─────────────────────────────────── */

@media (max-width: 1080px) {
  .home-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}
@media (max-width: 680px) {
  .shell { padding: 20px 14px 80px; }
  .board { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .head-stats { margin-left: 0; }
  .user-name { display: none; }
}

/* ── Tabela agrupada ─────────────────────────────────────
   Linha densa, célula editável no lugar. A cor do grupo vive na
   variável --g, aplicada na barra lateral do cabeçalho.
   ------------------------------------------------------- */

.tbl-wrap { display: grid; gap: 16px; }

.tbl-group {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.tbl-group-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px 9px 0; background: var(--surface-2);
  border-bottom: 1px solid var(--line); border-left: 3px solid var(--g, var(--accent));
}
.tbl-toggle {
  display: inline-flex; align-items: center; gap: 7px; background: none; border: 0;
  font: inherit; cursor: pointer; color: var(--ink); padding: 2px 0 2px 11px;
}
.tbl-caret { color: var(--ink-faint); font-size: 11px; transition: transform .15s; }
.tbl-toggle[aria-expanded="false"] .tbl-caret { transform: rotate(-90deg); }
.tbl-group-name { font-size: 14px; font-weight: 700; color: var(--g, var(--ink)); }
.tbl-group-count {
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-faint);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.tbl-group-note {
  font-size: 12px; color: var(--ink-faint); flex: 1 1 220px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tbl-group-progress { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.tbl-group-progress .progress { width: 96px; }
.tbl-group-progress b {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right;
}
.tbl-empty { padding: 14px; margin: 0; color: var(--ink-faint); font-size: 13px; }

.tbl-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 940px; }
.tbl th {
  text-align: left; padding: 7px 10px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
  font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 5px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr[data-status="done"] .c-title .cell-text { color: var(--ink-faint); text-decoration: line-through; }

.tbl .c-code   { width: 58px; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.tbl .c-title  { min-width: 300px; }
.tbl .c-status { width: 128px; }
.tbl .c-owners { width: 110px; }
.tbl .c-date   { width: 132px; }
.tbl .c-weight { width: 106px; }
.tbl .c-dep    { width: 108px; }

.cell-text {
  display: inline-block; padding: 3px 6px; margin: -3px -6px 0; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: text; max-width: 100%;
}
.cell-text:hover  { border-color: var(--line); background: var(--surface); }
.cell-text.editing { border-color: var(--accent); background: var(--surface); cursor: auto; }

.cell-date {
  font: inherit; font-family: var(--mono); font-size: 11.5px; color: var(--ink);
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 3px 5px; width: 100%; min-width: 118px;
}
.cell-date:hover { border-color: var(--line); background: var(--surface); }
.cell-date:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.c-date.is-late .cell-date { color: var(--crit-ink); font-weight: 600; }

.pill {
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 9px; width: 100%; appearance: none;
  background: var(--surface-2); color: var(--ink); text-align: center;
}
.pill:focus { outline: none; border-color: var(--accent); }
.pill-todo    { background: var(--surface-2);  color: var(--ink-soft);   border-color: var(--line); }
.pill-doing   { background: var(--gold-soft);  color: var(--gold);       border-color: var(--gold); }
.pill-blocked { background: var(--crit-soft);  color: var(--crit-ink);   border-color: var(--crit); }
.pill-done    { background: var(--accent-soft);color: var(--accent-ink); border-color: var(--accent); }
.pill-w-L     { background: var(--surface-2);  color: var(--ink-soft);   border-color: var(--line); }
.pill-w-M     { background: var(--gold-soft);  color: var(--gold);       border-color: var(--gold); }
.pill-w-P     { background: var(--crit-soft);  color: var(--crit-ink);   border-color: var(--crit); }
.pill.is-saving { opacity: .55; }

.owners-btn {
  background: none; border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 3px 6px; cursor: pointer; display: inline-flex; align-items: center;
}
.owners-btn:hover { border-color: var(--line); background: var(--surface); }
.owners-none { font-size: 11.5px; color: var(--ink-faint); font-style: italic; }

.dep-tag {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--crit-ink); background: var(--crit-soft);
  border: 1px solid var(--crit); border-radius: 4px; padding: 1px 5px;
}
.dep-tag:hover { text-decoration: none; filter: brightness(1.06); }

/* Escolha de responsáveis. Sem display no .pop para o hidden continuar valendo. */
.pop { position: fixed; inset: 0; z-index: 65; }
.pop-backdrop { position: absolute; inset: 0; background: rgba(10,14,16,.35); }
.pop-box {
  position: absolute; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-lg); padding: 14px;
  width: 268px; max-height: 60vh; overflow-y: auto;
}
.pop-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 9px;
}
.checks-col { flex-direction: column; gap: 8px; align-items: stretch; }
.checks-col .check { gap: 8px; }

@media (max-width: 680px) {
  .tbl-group-progress { margin-left: 0; }
  .tbl-group-note { display: none; }
}

/* Cabeçalho ordenável da tabela. A seta fica sempre no lugar, apagada
   enquanto a coluna não é a ativa, para o cabeçalho não pular de largura
   quando a ordenação muda de coluna. */
.tbl th { padding: 0; }
.th-sort {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 10px; text-decoration: none; color: inherit; white-space: nowrap;
}
.th-sort:hover { color: var(--ink); background: var(--surface); }
.th-arrow { font-size: 8px; color: var(--ink-faint); opacity: .35; }
.th-sort:hover .th-arrow { opacity: .7; }
.tbl th.is-sorted { background: var(--accent-soft); }
.tbl th.is-sorted .th-sort { color: var(--accent-ink); }
.tbl th.is-sorted .th-arrow { opacity: 1; color: var(--accent-ink); }

/* Esforço que cai na faixa, embaixo das letras que contam as atividades. */
.td-pontos { font-size: 10.5px; color: var(--ink-faint); font-weight: 400; }
.td-load.is-hot .td-pontos { color: var(--crit-ink); }

/* ── Motor modular ───────────────────────────────────────
   O quadro declara quantas colunas quiser, então nada aqui pode
   depender de haver exatamente quatro.
   ------------------------------------------------------- */

.board { grid-template-columns: repeat(var(--n, 4), minmax(240px, 1fr)); }
.column-head { border-top: 3px solid var(--c, var(--line)); }
.column-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ink-faint)); flex: none; }

/* Pastilha de situação: a cor vem do quadro, via variável na própria linha. */
.pill { border-color: var(--s, var(--line)); color: var(--s, var(--ink)); background: var(--surface-2); }
.pill-inline { display: inline-block; width: auto; padding: 2px 9px; font-size: 10.5px; }

.tabs-more { margin-left: auto; }
.tabs-more-btn {
  background: none; border: 0; font: inherit; font-size: 18px; line-height: 1;
  color: var(--ink-faint); cursor: pointer; padding: 6px 12px;
}
.tabs-more-btn:hover { color: var(--ink); }

.c-abrir { width: 34px; }
.abrir-btn {
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--ink-faint); cursor: pointer; font-size: 13px; line-height: 1; padding: 4px 6px;
}
.abrir-btn:hover { border-color: var(--line); background: var(--surface); color: var(--accent-ink); }

.c-periodo { width: 210px; }
.c-periodo .cell-date { min-width: 96px; display: inline-block; width: auto; }
.c-tags  { width: 150px; }
.c-livre { min-width: 140px; }

.tags-btn {
  background: none; border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 3px 6px; cursor: pointer; display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center;
}
.tags-btn:hover { border-color: var(--line); background: var(--surface); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Painel da atividade em leitura ─────────────────────── */

.det-campos {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px;
  margin: 0 0 22px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.det-campo-full { grid-column: 1 / -1; }
.det-campos dt {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px;
}
.det-campos dd { margin: 0; font-size: 13.5px; }

.det-editar {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
}
.det-editar > summary {
  cursor: pointer; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft); list-style: none;
}
.det-editar > summary::-webkit-details-marker { display: none; }
.det-editar > summary::before { content: '▸ '; color: var(--ink-faint); }
.det-editar[open] > summary::before { content: '▾ '; }
.det-editar > summary:hover { color: var(--ink); }
.det-editar > * + * { margin-top: 16px; }

/* ── Barra lateral ───────────────────────────────────────
   A navegação saiu do menu suspenso: com vários quadros por empresa,
   escondê-los fazia a pessoa cair sempre no mesmo e não saber dos outros.
   ------------------------------------------------------- */

.app-body { display: grid; grid-template-columns: 232px 1fr; align-items: start; }

.sidebar {
  position: sticky; top: 56px; align-self: start;
  height: calc(100vh - 56px); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 14px 10px 40px; display: flex; flex-direction: column; gap: 2px;
}
.side-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 18px 8px 6px;
}
.side-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink); font-size: 13.5px;
}
.side-item:hover { background: var(--surface-2); }
.side-item.is-current { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-destaque { font-weight: 600; }
.side-ico { color: var(--accent); font-size: 9px; }
.side-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.side-nome { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-n {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.side-team { margin: 0 4px; }
.side-team .team-pill { width: 100%; justify-content: flex-start; }
.side-team .dropdown-menu { width: 100%; }

.menu-btn {
  display: none; background: none; border: 0; font-size: 18px; line-height: 1;
  color: var(--ink-soft); cursor: pointer; padding: 6px 8px;
}

/* ── Painel geral ───────────────────────────────────────── */

.quadros { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.quadro-card {
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c);
  border-radius: var(--r-lg); padding: 15px 17px; display: flex; flex-direction: column; gap: 10px;
}
.quadro-topo { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: inherit; }
.quadro-topo h2 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.quadro-topo:hover h2 { color: var(--accent-ink); }
.quadro-sits { display: flex; flex-wrap: wrap; gap: 6px; }
.quadro-sit {
  font-size: 11px; color: var(--ink-soft);
  border: 1px solid var(--s, var(--line)); border-radius: var(--r-pill); padding: 1px 8px;
}
.quadro-sit b { color: var(--s, var(--ink)); font-family: var(--mono); }
.quadro-sit.is-late { border-color: var(--crit); color: var(--crit-ink); background: var(--crit-soft); }
.quadro-sit.is-late b { color: var(--crit-ink); }
.quadro-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 4px 0 0;
}
.quadro-prox { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.quadro-prox li { display: flex; align-items: baseline; gap: 8px; }
.quadro-prox li .linkish { flex: 1; text-align: left; font-weight: 400; color: var(--ink); }
.quadro-prox li .linkish:hover { color: var(--accent-ink); }
.quadro-views { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.quadro-views a {
  font-size: 11.5px; text-decoration: none; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 9px;
}
.quadro-views a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ── Minhas atividades ──────────────────────────────────── */

.minhas { display: grid; gap: 18px; }
.minhas-faixa {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--c); border-radius: var(--r-lg); overflow: hidden;
}
.minhas-head {
  display: flex; align-items: center; gap: 9px; padding: 10px 15px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.minhas-head h2 { font-size: 13.5px; font-weight: 700; margin: 0; color: var(--c); }
.minhas-lista { list-style: none; margin: 0; padding: 0; }
.minhas-lista li + li { border-top: 1px solid var(--line-soft); }
.minhas-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
  padding: 9px 15px; color: var(--ink);
}
.minhas-item:hover { background: var(--surface-2); }
.minhas-quadro {
  font-size: 10.5px; color: var(--q); border: 1px solid var(--q);
  border-radius: var(--r-pill); padding: 1px 8px; white-space: nowrap; flex: none;
}
.minhas-titulo { flex: 1; font-size: 13.5px; }
.minhas-prazo {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); white-space: nowrap;
}
.minhas-prazo.is-late { color: var(--crit-ink); font-weight: 700; }

@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 56px; left: 0; width: 232px; z-index: 45;
    transform: translateX(-100%); transition: transform .18s;
    box-shadow: var(--sh-lg);
  }
  .sidebar.is-open { transform: none; }
  .menu-btn { display: block; }
}

/* Painel geral: a tabela atravessando os quadros. */
.c-quadro { width: 150px; }
.quadro-tag {
  font-size: 10.5px; color: var(--q); border: 1px solid var(--q);
  border-radius: var(--r-pill); padding: 1px 8px; text-decoration: none;
  white-space: nowrap; display: inline-block;
}
.quadro-tag:hover { background: var(--q); color: #fff; }
.tbl-group-link { font-size: 11.5px; color: var(--ink-faint); text-decoration: none; }
.tbl-group-link:hover { color: var(--accent-ink); text-decoration: underline; }
.filter-check { align-self: center; margin-bottom: 4px; font-size: 13px; }
