/* ISCA DIGITAL 360 — identidade preservada do MVP: azul-marinho quase preto, amarelo vibrante, branco, cards escuros. */
:root {
  color-scheme: dark;
  --bg: #040c18;
  --bg-2: #071428;
  --card: #0a1a33;
  --card-2: #0e2142;
  --navy: #051140;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .62);
  --faint: rgba(255, 255, 255, .42);
  --gold: #fff000;
  --amber: #ffb323;
  --orange: #df800d;
  --teal: #2fa3ae;
  --green: #3db54a;
  --red: #ff6b6b;
  --g-gold: linear-gradient(135deg, #fff000 0%, #ffb323 60%, #df800d 100%);
  --g-brand: linear-gradient(90deg, #ffc727 0%, #f1b21e 45%, #2fa3ae 100%);
  --r-s: 8px;
  --r: 14px;
  --r-l: 22px;
  --display: 'Syne', 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side: 264px;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
body { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.noscript { padding: 2rem; text-align: center; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Botões e campos ───────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); font: 600 .9rem var(--body); cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { border-color: rgba(255, 179, 35, .5); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--g-gold); color: var(--navy); border: 0; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255, 107, 107, .45); color: #ffb0b0; background: transparent; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: .82rem; }
.btn.icon { width: 40px; padding: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
label.f { display: block; }
label.f > span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
label.f > span em { color: var(--amber); font-style: normal; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: #06122a; color: var(--text); font: 400 .95rem var(--body); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 179, 35, .18); }
input[type=checkbox], input[type=radio] { width: 18px; min-height: 18px; accent-color: var(--amber); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.hint { font-size: .8rem; color: var(--faint); margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.span2 { grid-column: span 2; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0; }
legend { font-family: var(--display); font-weight: 700; padding: 0 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-s); overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 9px 16px; font: 600 .88rem var(--body); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--amber); color: var(--navy); }

/* ── Telas públicas (login, cadastro) ─────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); }
.auth-aside { position: relative; padding: 48px; background: radial-gradient(120% 80% at 0% 0%, #0b2a5c 0%, var(--navy) 45%, var(--bg) 100%); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border-right: 1px solid var(--line); }
.auth-aside img.logo { width: 170px; }
.auth-aside h1 { font-size: clamp(2rem, 4vw, 3.2rem); max-width: 12ch; margin: 40px 0 18px; }
.auth-aside p { color: var(--muted); max-width: 42ch; }
.journey { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 0; max-width: 360px; counter-reset: s; }
.journey li { position: relative; padding: 0 0 18px 34px; color: var(--muted); font-size: .92rem; counter-increment: s; }
.journey li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--amber); color: var(--amber); font: 700 .72rem var(--body); display: grid; place-items: center; }
.journey li::after { content: ''; position: absolute; left: 11px; top: 24px; bottom: 2px; width: 1px; background: var(--line-2); }
.journey li:last-child::after { display: none; }
.auth-main { padding: 48px clamp(20px, 5vw, 56px); display: flex; flex-direction: column; justify-content: center; background: var(--bg-2); }
.auth-main.wide { justify-content: flex-start; }
.auth-main h2 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-main .sub { color: var(--muted); margin-bottom: 26px; }
.auth-foot { margin-top: 22px; font-size: .9rem; color: var(--muted); }
.legal { font-size: .78rem; color: var(--faint); margin-top: 28px; }
.qr { background: #fff; padding: 10px; border-radius: var(--r-s); width: 200px; }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .08em; background: #06122a; border: 1px dashed var(--line-2); padding: 8px 10px; border-radius: var(--r-s); word-break: break-all; font-size: .85rem; }

/* ── Estrutura do app ─────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; }
.side .logo { width: 132px; margin: 0 8px 22px; }
.ctx { margin: 0 6px 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); font-size: .82rem; color: var(--muted); }
.ctx b { display: block; color: var(--text); font-size: .9rem; }
.ctx select { min-height: 34px; padding: 4px 8px; margin-top: 6px; font-size: .82rem; }
.nav-group { margin: 14px 8px 6px; font-size: .72rem; font-weight: 600; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-s); color: var(--muted); font-weight: 500; font-size: .92rem; }
.nav a:hover { background: rgba(255, 255, 255, .04); color: var(--text); text-decoration: none; }
.nav a[aria-current=page] { background: rgba(255, 179, 35, .1); color: var(--text); box-shadow: inset 3px 0 0 var(--amber); }
.nav a[aria-current=page] svg { color: var(--amber); }
.nav a svg { color: var(--amber); opacity: .85; }
.badge-n { margin-left: auto; background: var(--amber); color: var(--navy); font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.side-foot b { display: block; }
.side-foot span { color: var(--faint); font-size: .78rem; word-break: break-all; }
.top { display: none; }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin: 6px 0 0; }
.crumb { font-size: .82rem; color: var(--faint); margin-bottom: 8px; }
.crumb a { color: var(--muted); }
.scrim { display: none; }

/* ── Cards, tabelas, estados ─────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.flat { background: transparent; }
.card > h2, .card > h3 { margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat b { display: block; font: 800 1.9rem/1.1 var(--display); }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.alert b { color: var(--amber); }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .76rem; font-weight: 600; color: var(--faint); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, .025); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: .82rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.amber { color: var(--amber); border-color: rgba(255, 179, 35, .35); }
.pill.teal { color: #6fd3dc; border-color: rgba(47, 163, 174, .45); }
.pill.green { color: #7fdc88; border-color: rgba(61, 181, 74, .4); }
.pill.red { color: #ffa3a3; border-color: rgba(255, 107, 107, .4); }
.pill.gray { color: var(--faint); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--g-brand); }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 8px 16px; font-size: .9rem; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ── Trilha do projeto (elemento-assinatura) ─────────────────── */
.track { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; margin: 4px 0 22px; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: rgba(255, 255, 255, .1); }
.track .fill { position: absolute; left: 0; top: 9px; height: 2px; background: var(--g-brand); transition: width .6s ease; }
.track .st { position: relative; padding-top: 28px; font-size: .74rem; color: var(--faint); text-align: center; line-height: 1.25; }
.track .st::before { content: ''; position: absolute; top: 3px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--bg-2); border: 2px solid rgba(255, 255, 255, .2); }
.track .st.done { color: var(--muted); }
.track .st.done::before { background: var(--teal); border-color: var(--teal); }
.track .st.skip { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.25); }
.track .st.skip::before { background: var(--bg-2); border-color: var(--teal); border-style: dashed; }
.track .st.now { color: var(--text); font-weight: 600; }
.track .st.now::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 5px rgba(255, 240, 0, .15); }
.track-note { margin: -10px 0 18px; }

/* ── Abas ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; font: 600 .9rem var(--body); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--amber); }
.tabs button span { color: var(--faint); font-weight: 500; margin-left: 4px; }

/* ── Kanban ──────────────────────────────────────────────────── */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-height: 160px; }
.col.over { border-color: var(--amber); }
.col h3 { font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; padding: 4px 6px 10px; }
.task { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px; margin-bottom: 8px; cursor: pointer; }
.task[draggable=true] { cursor: grab; }
.task:hover { border-color: var(--line-2); }
.task b { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: .76rem; color: var(--faint); }
.task .late { color: var(--red); }
.tag-int { font-size: .7rem; color: var(--amber); border: 1px solid rgba(255, 179, 35, .35); border-radius: 4px; padding: 0 5px; }

/* ── Arquivos e upload ───────────────────────────────────────── */
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--amber); background: rgba(255, 179, 35, .05); }
.drop input { display: none; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.file { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-s); min-width: 0; }
.file .ext { width: 40px; height: 40px; flex: none; border-radius: 8px; background: rgba(255, 179, 35, .1); color: var(--amber); display: grid; place-items: center; font: 700 .7rem var(--body); text-transform: uppercase; }
.file .nm { min-width: 0; flex: 1; }
.file .nm b { display: block; font-size: .86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Linha do tempo ──────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: .88rem; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.timeline li::after { content: ''; position: absolute; left: 3.5px; top: 18px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; font-size: .76rem; color: var(--faint); }

/* ── Comentários ─────────────────────────────────────────────── */
.comment { padding: 10px 12px; border-radius: var(--r-s); background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 8px; font-size: .88rem; }
.comment.internal { border-color: rgba(255, 179, 35, .3); }
.comment header { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; color: var(--faint); margin-bottom: 4px; }

/* ── Modal e avisos ──────────────────────────────────────────── */
dialog { border: 1px solid var(--line-2); border-radius: var(--r-l); background: var(--bg-2); color: var(--text); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(2, 6, 14, .78); }
dialog .dh { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); z-index: 1; }
dialog .db { padding: 20px; }
dialog .df { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--bg-2); }
#toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--card-2); border: 1px solid var(--line-2); border-left: 3px solid var(--teal); padding: 12px 16px; border-radius: var(--r-s); max-width: 380px; font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.err { border-left-color: var(--red); }
.notice { padding: 12px 14px; border-radius: var(--r-s); border: 1px solid rgba(255, 179, 35, .35); background: rgba(255, 179, 35, .07); font-size: .9rem; margin-bottom: 16px; }
.notice.err { border-color: rgba(255, 107, 107, .4); background: rgba(255, 107, 107, .07); }
.notice.ok { border-color: rgba(61, 181, 74, .4); background: rgba(61, 181, 74, .07); }
.perm-grid td, .perm-grid th { text-align: center; padding: 8px; font-size: .76rem; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
.perm-grid .yes { color: var(--amber); font-weight: 700; }

/* ── Responsivo: menu lateral vira gaveta opaca ─────────────── */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .top { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); margin-top: calc(-1 * env(safe-area-inset-top, 0px)); background: var(--bg-2); border-bottom: 1px solid var(--line); }
  .top img { width: 96px; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; transform: translateX(-102%); transition: transform .22s ease; background: #071428; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); padding-top: calc(22px + env(safe-area-inset-top, 0px)); }
  .side.open { transform: none; }
  .side .close { display: inline-flex; position: absolute; right: 12px; top: calc(14px + env(safe-area-inset-top, 0px)); }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(2, 6, 14, .82); }
  .cols { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { padding: 28px 20px; }
  .auth-aside h1 { margin: 22px 0 10px; font-size: 1.8rem; }
  .auth-aside .journey { display: none; }
  .track { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; }
  .track::before, .track .fill { display: none; }
}
@media (min-width: 961px) { .side .close { display: none; } }
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .main { padding-top: 20px; }
  .btn { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
