/* ============ Tokens ============ */
:root {
  --bg: #f5f2ee; --surface: #ffffff; --surface-2: #faf8f5; --surface-3: #f1ede8;
  --line: #e7e1da; --line-strong: #d6cec5;
  --text: #1f1a17; --muted: #78706a; --faint: #a79f97;
  --accent-h: 22; --accent: hsl(22 94% 50%); --accent-strong: hsl(22 94% 43%); --accent-soft: hsl(22 100% 95%); --accent-ink: #fff;
  --shadow-sm: 0 1px 2px rgb(40 25 10 / .06), 0 1px 1px rgb(40 25 10 / .04);
  --shadow-md: 0 6px 18px -6px rgb(40 25 10 / .18), 0 2px 6px rgb(40 25 10 / .06);
  --shadow-lg: 0 24px 60px -16px rgb(40 25 10 / .35), 0 6px 16px rgb(40 25 10 / .10);
  --fgl: 31%; --radius: 14px; --radius-sm: 9px;
  --nav-w: 244px; --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #12100f; --surface: #1b1816; --surface-2: #211d1b; --surface-3: #2a2522;
  --line: #2f2a27; --line-strong: #433c37;
  --text: #f4efe9; --muted: #a59d95; --faint: #6f6861;
  --accent: hsl(24 100% 56%); --accent-strong: hsl(24 100% 63%); --accent-soft: hsl(24 60% 16%); --accent-ink: #1a0d03;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4); --shadow-md: 0 8px 22px -8px rgb(0 0 0 / .6); --shadow-lg: 0 28px 70px -18px rgb(0 0 0 / .8);
  --fgl: 76%; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #12100f; --surface: #1b1816; --surface-2: #211d1b; --surface-3: #2a2522;
    --line: #2f2a27; --line-strong: #433c37;
    --text: #f4efe9; --muted: #a59d95; --faint: #6f6861;
    --accent: hsl(24 100% 56%); --accent-strong: hsl(24 100% 63%); --accent-soft: hsl(24 60% 16%); --accent-ink: #1a0d03;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4); --shadow-md: 0 8px 22px -8px rgb(0 0 0 / .6); --shadow-lg: 0 28px 70px -18px rgb(0 0 0 / .8);
    --fgl: 76%; color-scheme: dark;
  }
}

/* tons (estados, etiquetas) */
.tone-neutral { --h: 28; --s: 8%; } .tone-blue { --h: 214; --s: 80%; } .tone-violet { --h: 262; --s: 66%; }
.tone-amber { --h: 38; --s: 94%; } .tone-orange { --h: 20; --s: 92%; } .tone-rose { --h: 338; --s: 74%; }
.tone-teal { --h: 172; --s: 70%; } .tone-green { --h: 142; --s: 58%; } .tone-red { --h: 4; --s: 76%; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before { /* brilho suave de marca no canto */
  content: ''; position: fixed; inset: -20% auto auto -10%; width: 60vw; height: 60vw; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, hsl(var(--accent-h) 100% 55% / .10), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-strong); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: hsl(var(--accent-h) 100% 55% / .25); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; } svg.i.lg { width: 22px; height: 22px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ Estrutura ============ */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 14px;
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 10px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent), hsl(8 90% 52%)); box-shadow: 0 6px 16px -6px hsl(var(--accent-h) 100% 45% / .7), inset 0 1px 0 rgb(255 255 255 / .35);
  transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(90deg) scale(1.06); }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; } .brand small { color: var(--muted); font-size: 11.5px; }
.nav-list { position: relative; display: flex; flex-direction: column; gap: 2px; }
.nav-pill { position: absolute; left: 0; right: 0; top: 0; height: 42px; border-radius: 11px; background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px hsl(var(--accent-h) 100% 50% / .18); transform: translateY(var(--y, 0)); opacity: var(--o, 0);
  transition: transform .35s var(--ease), opacity .2s; pointer-events: none; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 11px; border: 0; background: none;
  color: var(--muted); font-weight: 550; text-align: left; transition: color .2s; }
.nav-item:hover, .nav-item.on { color: var(--text); } .nav-item.on svg { color: var(--accent); }
.nav-item svg { transition: transform .35s var(--ease); } .nav-item:hover svg { transform: translateX(2px) scale(1.12); }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
  background: hsl(var(--h, 24) 70% 50% / .16); color: hsl(var(--h, 24) 65% var(--fgl)); box-shadow: inset 0 0 0 1px hsl(var(--h, 24) 70% 50% / .3); }
.mode-badge { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: hsl(var(--h) var(--s) 50% / .14); color: hsl(var(--h) var(--s) var(--fgl)); width: fit-content; }
.main { min-width: 0; padding: 0 clamp(16px, 3vw, 40px) 60px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 16px 0 14px; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 70%, transparent); }
.topbar h1 { font-size: 22px; letter-spacing: -.02em; margin: 0; font-weight: 750; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.search { position: relative; width: min(340px, 36vw); }
.search input { width: 100%; height: 40px; padding: 0 44px 0 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .2s; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px hsl(var(--accent-h) 100% 50% / .15); }
.search svg { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.kbd { font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; color: var(--muted); background: var(--surface-2); }
.search .kbd { position: absolute; right: 10px; top: 9px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); min-width: 92px; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: hsl(142 58% 45%); transition: background .3s; }
.sync[data-s='saving'] i { background: hsl(38 94% 50%); animation: pulse 1s infinite; } .sync[data-s='error'] i { background: hsl(4 76% 52%); }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .5; } }
#view { animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ============ Componentes ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 11px; border: 1px solid var(--line-strong);
  background: var(--surface); font-weight: 600; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s, background .2s, border-color .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--accent); } .btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 6px 16px -6px hsl(var(--accent-h) 100% 45% / .65), inset 0 1px 0 rgb(255 255 255 / .3); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 22px -8px hsl(var(--accent-h) 100% 45% / .75), inset 0 1px 0 rgb(255 255 255 / .3); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; }
.btn.danger:hover { border-color: hsl(4 76% 52%); color: hsl(4 70% 48%); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; } .btn.icon { width: 38px; padding: 0; } .btn.icon.sm { width: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.spot { overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s, border-color .35s; }
.spot::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), hsl(var(--accent-h) 100% 55% / .13), transparent 65%); }
.spot:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); } .spot:hover::before { opacity: 1; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap;
  background: hsl(var(--h) var(--s) 50% / .13); color: hsl(var(--h) var(--s) var(--fgl)); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--h) var(--s) 50%); }
.badge.plain::before { display: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.chip { --h: 210; display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 700; letter-spacing: .01em;
  background: hsl(var(--h) 72% 50% / .13); color: hsl(var(--h) 62% var(--fgl)); box-shadow: inset 0 0 0 1px hsl(var(--h) 72% 50% / .28); white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .2s, opacity .25s, filter .25s; }
.chip.note { --h: 28; font-weight: 550; background: var(--surface-3); color: var(--muted); box-shadow: none; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.chip[draggable='true'] { cursor: grab; } .chip:hover { transform: translateY(-1px) scale(1.04); box-shadow: inset 0 0 0 1px hsl(var(--h) 72% 50% / .6), 0 4px 10px -4px hsl(var(--h) 72% 40% / .5); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; } .field > label { font-size: 12px; font-weight: 650; color: var(--muted); }
.inp, select.inp, textarea.inp { width: 100%; height: 38px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2);
  transition: border-color .2s, box-shadow .2s, background .2s; }
textarea.inp { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.inp:hover { border-color: var(--faint); } .inp:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px hsl(var(--accent-h) 100% 50% / .15); }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); position: relative; gap: 2px; }
.seg button { position: relative; z-index: 1; height: 30px; padding: 0 13px; border: 0; background: none; border-radius: 8px; font-weight: 600; color: var(--muted); transition: color .2s; }
.seg button.on { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); } .seg button:hover:not(.on) { color: var(--text); }
.yn { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; }
.yn button { height: 30px; min-width: 48px; border: 0; background: none; border-radius: 8px; font-weight: 650; color: var(--muted); transition: all .2s var(--ease); }
.yn button:hover { color: var(--text); } .yn button.on[data-v='Sim'] { background: hsl(142 58% 42%); color: #fff; box-shadow: 0 4px 10px -4px hsl(142 58% 30%); }
.yn button.on[data-v='Não'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); } .yn button.on[data-v='Parcial'] { background: hsl(38 94% 48%); color: #1a1100; }
.empty { display: grid; place-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { color: var(--text); font-size: 15px; }

/* ============ Painel ============ */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi { padding: 18px 18px 16px; cursor: pointer; text-align: left; border: 1px solid var(--line); font: inherit; color: inherit; }
.kpi:hover { transform: translateY(-3px); }
.kpi .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; transition: transform .45s var(--ease);
  background: hsl(var(--h) var(--s) 50% / .14); color: hsl(var(--h) var(--s) var(--fgl)); }
.kpi:hover .ico { transform: rotate(-8deg) scale(1.12); }
.kpi .num { font-size: 36px; font-weight: 780; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-weight: 600; margin-top: 6px; }
.kpi .go { position: absolute; right: 16px; top: 18px; opacity: 0; transform: translateX(-6px); transition: all .3s var(--ease); color: var(--muted); }
.kpi:hover .go { opacity: 1; transform: none; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; } .panel-h h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.two { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } @media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
.week-bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; padding: 12px 18px 18px; align-items: end; height: 190px; }
.wb { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; border: 0; background: none; padding: 0; }
.wb .bar { width: 100%; max-width: 54px; border-radius: 10px 10px 4px 4px; min-height: 6px; background: linear-gradient(180deg, var(--accent), hsl(8 90% 52%)); opacity: .9;
  height: calc(var(--v) * 1%); transform-origin: bottom; animation: grow .8s var(--ease) both; animation-delay: calc(var(--i) * 60ms); transition: filter .25s, transform .3s var(--ease); }
@keyframes grow { from { transform: scaleY(0); } }
.wb:hover .bar { filter: brightness(1.12) saturate(1.1); transform: scaleY(1.04); } .wb.today .bar { box-shadow: 0 0 0 3px hsl(var(--accent-h) 100% 50% / .25); }
.wb.zero .bar { background: var(--surface-3); opacity: 1; }
.wb .n { font-weight: 750; font-variant-numeric: tabular-nums; } .wb .d { font-size: 12px; color: var(--muted); font-weight: 600; } .wb.today .d { color: var(--accent-strong); }
.wb .tip { position: absolute; bottom: calc(100% - 6px); left: 50%; transform: translate(-50%, 6px); background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 9px; font-size: 12px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: all .2s var(--ease); z-index: 3; }
.wb:hover .tip { opacity: 1; transform: translate(-50%, -2px); }
.matrix { width: 100%; border-collapse: separate; border-spacing: 3px; padding: 0 12px 14px; display: table; }
.matrix th { font-size: 11px; font-weight: 650; color: var(--muted); padding: 4px 4px; text-align: center; line-height: 1.2; vertical-align: bottom; }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: 8px; font-weight: 650; white-space: nowrap; }
.matrix td { text-align: center; padding: 0; height: 38px; }
.mcell { display: grid; place-items: center; width: 100%; height: 100%; border: 0; border-radius: 9px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
  background: hsl(var(--h) var(--s) 50% / calc(var(--a) * .38)); color: var(--text); transition: transform .2s var(--ease), box-shadow .2s; }
.mcell.zero { background: transparent; color: var(--faint); font-weight: 500; cursor: default; }
.mcell:not(.zero):hover { transform: scale(1.12); box-shadow: var(--shadow-md); z-index: 2; position: relative; }
.matrix tr:hover th:first-child, .matrix td.hot, .matrix th.hot { color: var(--accent-strong); }
.stack { display: flex; height: 16px; border-radius: 99px; overflow: hidden; margin: 8px 18px 4px; background: var(--surface-3); gap: 2px; }
.stack i { flex: var(--n) 1 0; background: hsl(var(--h) var(--s) 52%); transition: filter .25s, flex-grow .5s var(--ease), opacity .25s; min-width: 3px; cursor: pointer; border-radius: 4px; }
.stack:hover i { opacity: .35; } .stack i:hover { opacity: 1; filter: saturate(1.3); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 18px 16px; }
.legend button { display: inline-flex; gap: 7px; align-items: center; border: 0; background: none; padding: 2px 4px; border-radius: 6px; color: var(--muted); font-size: 12.5px; transition: color .2s, background .2s; }
.legend button:hover { color: var(--text); background: var(--surface-3); } .legend i { width: 9px; height: 9px; border-radius: 3px; background: hsl(var(--h) var(--s) 52%); } .legend b { color: var(--text); }
.attn { list-style: none; margin: 0; padding: 6px 8px 10px; }
.attn li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 11px; cursor: pointer; position: relative; transition: background .2s, transform .25s var(--ease); }
.attn li:hover { background: var(--surface-2); transform: translateX(4px); } .attn li .go { margin-left: auto; opacity: 0; transition: opacity .2s; color: var(--accent); } .attn li:hover .go { opacity: 1; }
.attn .cod { font: 650 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }

/* ============ Tabelas (obras) ============ */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 12.5px;
  color: var(--muted); transition: all .2s var(--ease); }
.pill:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); } .pill b { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 700; }
.pill.on { background: hsl(var(--h, 22) var(--s, 90%) 50% / .14); border-color: hsl(var(--h, 22) var(--s, 90%) 50% / .55); color: hsl(var(--h, 22) var(--s, 90%) var(--fgl)); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h) var(--s) 52%); }
.table-wrap { overflow: auto; border-radius: var(--radius); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
table.t th { position: sticky; top: 0; z-index: 2; text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 11px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.t th.sortable { cursor: pointer; } table.t th.sortable:hover { color: var(--text); } table.t th .arr { display: inline-block; margin-left: 4px; opacity: 0; transition: all .2s; } table.t th.sorted .arr { opacity: 1; color: var(--accent); }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr { cursor: pointer; transition: background .2s, box-shadow .25s var(--ease), transform .25s var(--ease); animation: rowIn .5s var(--ease) both; animation-delay: calc(min(var(--r, 0), 14) * 24ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
table.t tbody tr:hover { background: var(--surface-2); box-shadow: inset 4px 0 0 var(--accent); }
table.t tbody tr:hover .site-cod { color: var(--accent-strong); }
.site-cod { font: 700 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; transition: color .2s; } .site-name { font-weight: 600; }
.weeks { display: flex; gap: 4px; flex-wrap: wrap; } .wk { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.wk.now { background: var(--accent-soft); color: var(--accent-strong); }
.next { color: var(--muted); font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; } tr:hover .next { color: var(--text); }
.more { display: grid; place-items: center; padding: 14px; }

/* ============ Planeamento ============ */
.wk-nav { display: flex; align-items: center; gap: 6px; }
.wk-title { min-width: 210px; text-align: center; line-height: 1.15; cursor: pointer; border: 0; background: none; padding: 4px 12px; border-radius: 10px; transition: background .2s; position: relative; }
.wk-title:hover { background: var(--surface-3); } .wk-title b { font-size: 18px; letter-spacing: -.02em; } .wk-title small { display: block; color: var(--muted); font-weight: 550; }
.plan { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 980px; }
.plan th, .plan td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.plan th:last-child, .plan td:last-child { border-right: 0; }
.plan thead th { position: sticky; top: 0; z-index: 4; background: var(--surface-2); padding: 10px 8px; font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; transition: background .2s, color .2s; }
.plan thead th.today { color: var(--accent-strong); background: var(--accent-soft); }
.plan thead th.col-hot, .plan td.col-hot { background-image: linear-gradient(hsl(var(--accent-h) 100% 50% / .06), hsl(var(--accent-h) 100% 50% / .06)); }
.plan thead th .dn { display: block; font-size: 18px; color: var(--text); font-weight: 760; letter-spacing: -.02em; line-height: 1.1; } .plan thead th.today .dn { color: var(--accent-strong); }
.plan thead th .cp { position: absolute; right: 4px; top: 4px; opacity: 0; transition: opacity .2s; } .plan thead th { position: sticky; } .plan thead th:hover .cp { opacity: 1; }
.plan th.site, .plan td.site { width: 290px; text-align: left; position: sticky; left: 0; z-index: 3; background: var(--surface); } .plan thead th.site { z-index: 6; background: var(--surface-2); }
.plan td.site { padding: 9px 12px; z-index: 3; }
.plan th.est, .plan td.est { width: 138px; } .plan td.est { padding: 6px 8px; }
.plan td.cell { height: 66px; padding: 5px; vertical-align: top; cursor: pointer; position: relative; transition: background .2s; }
.plan td.cell::after { content: '+'; position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; color: var(--faint); font-size: 22px; font-weight: 300; opacity: 0; transition: opacity .2s, transform .3s var(--ease); transform: scale(.6); }
.plan td.cell.empty-c:hover::after { opacity: 1; transform: none; } .plan td.cell:hover { background: var(--surface-2); }
.plan td.cell.drop { background: hsl(var(--accent-h) 100% 50% / .10); box-shadow: inset 0 0 0 2px var(--accent); border-radius: 6px; }
.plan td.cell .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.plan tbody tr { transition: background .2s; animation: rowIn .45s var(--ease) both; animation-delay: calc(min(var(--r, 0), 16) * 20ms); } .plan tbody tr:hover td.site, .plan tbody tr:hover td.est { background: var(--surface-2); }
.plan tbody tr:hover td.site { box-shadow: inset 4px 0 0 var(--accent); }
.plan .acts { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; margin-left: auto; } .plan tbody tr:hover .acts { opacity: 1; }
.plan tfoot td { background: var(--surface-2); padding: 8px; text-align: center; font-weight: 700; font-size: 12.5px; color: var(--muted); position: sticky; bottom: 0; z-index: 3; }
.plan tfoot td.site { text-align: left; } .plan .dim { opacity: .9; }
body[data-hot] .chip:not(.hot) { opacity: .28; filter: grayscale(.6); } body[data-hot] .chip.hot { transform: translateY(-1px) scale(1.07); box-shadow: inset 0 0 0 1px hsl(var(--h) 72% 50% / .8), 0 6px 14px -4px hsl(var(--h) 72% 40% / .6); }
.est select { width: 100%; height: 30px; border-radius: 99px; border: 0; padding: 0 10px; font-weight: 650; font-size: 12px; appearance: none; text-align: center; cursor: pointer;
  background: hsl(var(--h) var(--s) 50% / .14); color: hsl(var(--h) var(--s) var(--fgl)); transition: filter .2s, transform .2s var(--ease); } .est select:hover { filter: brightness(1.08); transform: scale(1.03); }
.est select.empty { background: var(--surface-3); color: var(--faint); font-weight: 500; }
.team-row th { text-align: left !important; }
.obra-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 9px 2px 7px; border-radius: 8px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; margin: 2px 3px 2px 0; transition: all .2s var(--ease); }
.obra-chip:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); } .obra-chip code { font: 700 11.5px ui-monospace, monospace; color: var(--accent-strong); }

/* ============ Equipas ============ */
.teams { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.team { padding: 18px; cursor: pointer; --h: 210; perspective: 800px; }
.team:hover { transform: translateY(-4px); }
.team .code { display: inline-flex; font-size: 18px; font-weight: 780; letter-spacing: -.02em; padding: 3px 11px; border-radius: 10px; background: hsl(var(--h) 72% 50% / .13); color: hsl(var(--h) 62% var(--fgl)); box-shadow: inset 0 0 0 1px hsl(var(--h) 72% 50% / .3); }
.plate { font: 650 11.5px ui-monospace, monospace; border: 1.5px solid var(--line-strong); border-radius: 6px; padding: 1px 7px; color: var(--muted); background: var(--surface-2); }
.avs { display: flex; margin-top: 16px; min-height: 36px; } .avs .avatar { margin-left: -9px; border: 2px solid var(--surface); transition: transform .35s var(--ease), margin .35s var(--ease); width: 36px; height: 36px; }
.avs .avatar:first-child { margin-left: 0; } .team:hover .avs .avatar { margin-left: 4px; transform: translateY(-3px); transition-delay: calc(var(--i) * 30ms); }
.team ul { list-style: none; padding: 0; margin: 10px 0 0; color: var(--muted); font-size: 13px; } .team li { padding: 1px 0; }
.load { height: 6px; border-radius: 9px; background: var(--surface-3); overflow: hidden; margin-top: 14px; } .load i { display: block; height: 100%; width: calc(var(--v) * 1%); background: hsl(var(--h) 72% 52%); border-radius: 9px; transition: width .8s var(--ease); }

/* ============ Overlays ============ */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgb(15 10 6 / .45); backdrop-filter: blur(3px); animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 61; background: var(--surface); box-shadow: var(--shadow-lg); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; animation: slideIn .4s var(--ease) both; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer.closing { animation: slideOut .25s ease-in both; } @keyframes slideOut { to { transform: translateX(40px); opacity: 0; } }
.drawer header { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); } .drawer .body { overflow: auto; padding: 8px 22px 28px; flex: 1; }
.drawer h3 { margin: 22px 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .form .full { grid-column: 1 / -1; } @media (max-width: 520px) { .form { grid-template-columns: 1fr; } }
.stepper { display: flex; align-items: flex-start; position: relative; margin: 16px 0 6px; }
.stepper::before { content: ''; position: absolute; left: 11px; right: 11px; top: 10px; height: 3px; border-radius: 3px; background: var(--surface-3); }
.stepper::after { content: ''; position: absolute; left: 11px; top: 10px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), hsl(142 58% 45%)); width: calc((100% - 22px) * var(--p)); transition: width .8s var(--ease); }
.step { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10.5px; color: var(--faint); text-align: center; line-height: 1.15; padding: 0 1px; font-weight: 600; }
.step i { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 3px solid var(--surface-3); transition: all .4s var(--ease); }
.step.done i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .step.done { color: var(--muted); }
.step.cur i { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 5px hsl(var(--accent-h) 100% 50% / .2); animation: ring 2s infinite; } .step.cur { color: var(--text); }
@keyframes ring { 50% { box-shadow: 0 0 0 8px hsl(var(--accent-h) 100% 50% / .06); } }
.step:hover { color: var(--text); } .step:hover i { transform: scale(1.18); }
.modal { position: fixed; left: 50%; top: 14vh; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); max-height: 78vh; z-index: 62; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: pop .35s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 14px) scale(.97); } }
.modal header { padding: 18px 20px 6px; display: flex; align-items: center; gap: 10px; } .modal header h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; flex: 1; }
.modal .mbody { padding: 10px 20px 8px; overflow: auto; } .modal footer { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }
.cmdk { top: 12vh; } .cmdk input { width: 100%; height: 54px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 0 20px; font-size: 16px; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 8px; overflow: auto; } .cmdk li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.cmdk li.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.pop { position: fixed; z-index: 70; width: 290px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px; animation: pop2 .22s var(--ease) both; transform-origin: top left; }
@keyframes pop2 { from { opacity: 0; transform: scale(.92) translateY(-4px); } }
.pop .picks { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; } .pop .picks .chip { cursor: pointer; border: 0; font: inherit; font-size: 12px; font-weight: 700; }
.pop .picks .chip.on { background: hsl(var(--h) 72% 50%); color: #fff; box-shadow: none; }
.toasts { position: fixed; z-index: 90; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 550; position: relative; overflow: hidden; animation: toastIn .4s var(--ease) both; }
.toast.err { background: hsl(4 70% 42%); color: #fff; } .toast button { background: none; border: 0; color: inherit; font-weight: 750; text-decoration: underline; padding: 0 2px; }
.toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); animation: tbar var(--ms, 4s) linear both; } @keyframes tbar { from { width: 100%; } to { width: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } } .toast.out { animation: toastOut .25s both; } @keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
.drop-zone { border: 2px dashed var(--line-strong); border-radius: 16px; padding: 28px; text-align: center; transition: all .25s var(--ease); cursor: pointer; background: var(--surface-2); }
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); } .drop-zone svg { color: var(--accent); }
.prog { height: 8px; border-radius: 9px; background: var(--surface-3); overflow: hidden; } .prog i { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: linear-gradient(90deg, var(--accent), hsl(8 90% 52%)); transition: width .3s; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 6px; } .opt-chips .tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; font-size: 12.5px; } .opt-chips .tag button { border: 0; background: none; color: var(--faint); border-radius: 50%; width: 18px; height: 18px; line-height: 1; padding: 0; } .opt-chips .tag button:hover { background: hsl(4 76% 52% / .18); color: hsl(4 70% 45%); }
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: s; } .steps-list li { display: flex; gap: 12px; align-items: center; padding: 11px 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); counter-increment: s; }
.steps-list li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 12px; background: var(--surface-3); color: var(--muted); flex: none; } .steps-list li.ok::before { content: '✓'; background: hsl(142 58% 42%); color: #fff; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }

/* ============ Responsivo ============ */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; padding-bottom: 72px; }
  .nav { position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); gap: 0; }
  .brand, .nav-foot, .nav-pill { display: none; } .nav-list { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 2px; height: 54px; font-size: 11px; padding: 0 10px; justify-content: center; border-radius: 12px; } .nav-item.on { background: var(--accent-soft); } .nav-item .count { display: none; }
  .search { width: auto; flex: 1; } .search .kbd { display: none; } .topbar { flex-wrap: wrap; } .topbar h1 { font-size: 19px; }
  .plan th.site, .plan td.site { width: 170px; } .plan td.site .acts { display: none; } .wk-title { min-width: 150px; }
  .modal, .cmdk { top: 6vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; } }

/* ============ Impressão (plano semanal) ============ */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; color: #000; } body::before, .nav, .topbar .search, .sync, .toolbar, .acts, .toasts, .cp, .btn { display: none !important; }
  .app { display: block; padding: 0; } .main { padding: 0; } .card { box-shadow: none; border-color: #bbb; } .plan { min-width: 0; font-size: 10px; } .plan th.site, .plan td.site { position: static; width: 200px; }
  .plan thead th { position: static; } .plan tfoot td { position: static; } .chip { box-shadow: inset 0 0 0 1px #888; color: #000; background: #eee; } .est select { appearance: none; background: none; border: 1px solid #ccc; }
}

/* repintar sem repetir animações de entrada */
#view[data-static='1'] *, #view[data-static='1'] { animation: none !important; }
@media (max-width: 700px) { .hide-sm { display: none; } }

/* afinações */
.kpi { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
.kpi .lbl { text-align: left; }
.card.col { display: flex; flex-direction: column; } .card.col .week-bars { flex: 1; height: auto; min-height: 220px; max-height: 300px; margin-bottom: auto; }
.est select.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.est select.empty:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.attn .cod { white-space: nowrap; min-width: 74px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
table.t td .next { white-space: nowrap; }

@media (max-width: 860px) {
  .topbar { padding: 12px 0 10px; gap: 10px; } .topbar h1 { font-size: 18px; } .topbar .sub { font-size: 12px; }
  .sync { min-width: 0; } .sync span { display: none; }
  #gs { width: 40px; flex: none; } #gs input { width: 40px; padding: 0; color: transparent; cursor: pointer; } #gs svg { left: 11px; }
  .toolbar .search { width: auto !important; flex: 1 1 150px; }
}
@media (max-width: 860px) { #gs input::placeholder { color: transparent; } }
@media print { .topbar { background: none !important; position: static; } #view { animation: none; } }

/* ============ Mudar a ordem (pega de arrastar) ============ */
.grip { flex: none; width: 24px; height: 32px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--muted); cursor: grab; padding: 0; margin-left: -6px;
  opacity: .55; touch-action: none; transition: opacity .2s, color .2s, background .2s, transform .3s cubic-bezier(.34, 1.56, .64, 1); }
tr:hover .grip, .grip:focus-visible { opacity: 1; color: var(--accent-strong); }
.grip:hover { background: var(--accent-soft); transform: scale(1.15); }
.grip:active { cursor: grabbing; transform: scale(.92); }
.grip svg { transition: transform .35s var(--ease); } .grip:hover svg { transform: rotate(90deg) scale(1.1); }
table.t .grip-col { width: 40px; padding-left: 10px; padding-right: 0; }
.manual-hint { margin: -4px 4px 10px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn.on-manual { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
tr.rd-before > td { box-shadow: inset 0 3px 0 var(--accent) !important; }
tr.rd-after > td { box-shadow: inset 0 -3px 0 var(--accent) !important; }
tr.rd-src { opacity: .4; } tr.rd-src > td { background: var(--accent-soft) !important; }
body.row-dragging, body.row-dragging * { cursor: grabbing !important; }
tr.rd-landed > td { animation: landed 1.3s var(--ease); }
@keyframes landed { from { background-color: hsl(var(--accent-h) 100% 55% / .38); } }

/* ============ Alertas por dia (PPO verde · acesso amarelo · corte laranja) ============ */
.plan td.cell .chips { padding-right: 22px; }
.plan td.cell .al-btn { position: absolute; top: 4px; right: 4px; z-index: 2; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 7px; cursor: pointer;
  color: var(--muted); background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
  opacity: 0; transform: scale(.55) rotate(-16deg); transition: opacity .2s, transform .4s cubic-bezier(.34, 1.56, .64, 1), color .2s, box-shadow .2s, background .2s; }
.plan td.cell:hover .al-btn, .plan td.cell .al-btn:focus-visible, .plan td.cell.has-al .al-btn { opacity: 1; transform: none; }
.plan td.cell.has-al .al-btn { opacity: .55; } .plan td.cell.has-al:hover .al-btn { opacity: 1; }
.plan td.cell .al-btn:hover { color: var(--accent-strong); background: var(--accent-soft); transform: scale(1.2) rotate(8deg); box-shadow: 0 6px 14px -6px hsl(var(--accent-h) 100% 45% / .6), inset 0 0 0 1px var(--accent); }
@media (hover: none) { .plan td.cell .al-btn { opacity: .6; transform: none; } }
.al-btn-demo { display: inline-grid; vertical-align: middle; color: var(--accent-strong); }
.alerts { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.al { display: block; padding: 3px 8px; border-radius: 7px; font-size: 11.5px; line-height: 1.35; cursor: pointer;
  background: hsl(var(--h) 90% 50% / .2); color: hsl(var(--h) 85% var(--fgl)); box-shadow: inset 3px 0 0 hsl(var(--h) 90% 47%);
  animation: alIn .4s var(--ease) both; transition: transform .25s var(--ease), filter .2s, box-shadow .2s; }
.al b { margin-right: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.al span { font-weight: 560; overflow-wrap: anywhere; }
.plan td.cell.no-chips .alerts { margin-top: 24px; } /* deixa o botão da bandeira livre */
.al:hover { transform: translateX(3px); filter: saturate(1.25) brightness(1.03); box-shadow: inset 4px 0 0 hsl(var(--h) 90% 47%), 0 4px 12px -6px hsl(var(--h) 90% 40% / .7); }
@keyframes alIn { from { opacity: 0; transform: translateY(-5px) scale(.95); } }
.al-types { display: flex; gap: 6px; }
.al-type { flex: 1; height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 11px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 750;
  border: 1px solid hsl(var(--h) 70% 50% / .38); background: hsl(var(--h) 90% 50% / .11); color: hsl(var(--h) 85% var(--fgl));
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s, background .2s, color .2s; }
.al-type i { width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--h) 90% 48%); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.al-type:hover { transform: translateY(-2px); box-shadow: 0 8px 16px -8px hsl(var(--h) 90% 40% / .7); } .al-type:hover i { transform: scale(1.6); }
.al-type.on { background: hsl(var(--h) 90% 52%); color: hsl(var(--h) 90% 10%); border-color: transparent; box-shadow: 0 8px 18px -8px hsl(var(--h) 90% 40% / .8); } .al-type.on i { background: hsl(var(--h) 90% 10%); }
#al-m { flex: 1; min-width: 0; }
.al-list { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.al-item { display: flex; align-items: center; gap: 6px; }
.al-item .al-tag { flex: none; min-width: 60px; text-align: center; padding: 6px 0; border-radius: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  background: hsl(var(--h) 90% 50% / .2); color: hsl(var(--h) 85% var(--fgl)); box-shadow: inset 3px 0 0 hsl(var(--h) 90% 47%); }
.al-item .inp { height: 30px; font-size: 12.5px; min-width: 0; }
@media print { .grip, .al-btn { display: none !important; } .al { print-color-adjust: exact; -webkit-print-color-adjust: exact; } .plan td.cell .chips { padding-right: 0; } }

/* ============ Cartão da obra: separadores + FPS ============ */
.d-tabs { position: relative; flex: none; display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.d-tabs button { border: 0; background: none; padding: 11px 14px 12px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; border-radius: 10px 10px 0 0; transition: color .2s, background .2s; }
.d-tabs button:hover { color: var(--text); background: var(--surface-2); } .d-tabs button.on { color: var(--accent-strong); }
.d-tabs .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px hsl(var(--accent-h) 100% 50% / .2); animation: ring 2.4s infinite; } .d-tabs .dot[hidden] { display: none; }
.d-tabs .ink { position: absolute; left: 0; bottom: -1px; height: 3px; width: var(--w, 0); border-radius: 3px 3px 0 0; background: var(--accent); transform: translateX(var(--x, 0)); transition: transform .4s var(--ease), width .4s var(--ease); }
.pane[hidden] { display: none; } .pane { animation: paneIn .35s var(--ease) both; } @keyframes paneIn { from { opacity: 0; transform: translateY(8px); } }
.fps-tag { background: var(--accent-soft); color: var(--accent-strong); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sit-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.sit { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), background .2s, color .2s, border-color .2s, box-shadow .25s; }
.sit:hover { transform: translateY(-2px) scale(1.03); border-color: var(--accent); color: var(--text); box-shadow: var(--shadow-md); }
.sit:active { transform: scale(.96); }
.sit.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 18px -8px hsl(var(--accent-h) 100% 45% / .8); }
.sit.on svg { animation: pop2 .35s var(--ease); }
.sit.free { cursor: default; padding-right: 5px; } .sit.free:hover { transform: none; }
.sit.free button { border: 0; background: rgb(0 0 0 / .16); color: inherit; width: 22px; height: 22px; border-radius: 50%; line-height: 1; padding: 0; cursor: pointer; transition: transform .25s var(--ease), background .2s; } .sit.free button:hover { background: rgb(0 0 0 / .32); transform: rotate(90deg) scale(1.1); }

/* ============ Semana selecionada (canto superior esquerdo) ============ */
.wk-chip { position: relative; overflow: hidden; display: flex; align-items: baseline; gap: 9px; width: 100%; margin: 0 0 12px; padding: 8px 12px; border-radius: 12px; cursor: pointer; text-align: left; font: inherit;
  border: 1px solid hsl(var(--accent-h) 100% 50% / .28); background: var(--accent-soft); color: var(--accent-strong);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s, border-color .2s; }
.wk-chip b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wk-chip small { color: var(--muted); font-size: 11.5px; font-weight: 650; }
.wk-chip .now-dot { position: absolute; right: 11px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: hsl(142 58% 45%); box-shadow: 0 0 0 3px hsl(142 58% 45% / .25); opacity: 0; transform: scale(.4); transition: opacity .25s, transform .35s var(--ease); }
.wk-chip.now .now-dot { opacity: 1; transform: none; }
.wk-chip::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .55) 50%, transparent 65%); transform: translateX(-120%); transition: transform .7s var(--ease); pointer-events: none; }
.wk-chip:hover { transform: translateY(-2px) scale(1.02); border-color: var(--accent); box-shadow: 0 10px 22px -12px hsl(var(--accent-h) 100% 45% / .7); } .wk-chip:hover::after { transform: translateX(120%); }
.wk-chip.bump b { animation: wkbump .55s cubic-bezier(.34, 1.56, .64, 1); } @keyframes wkbump { 0% { transform: translateY(8px) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (max-width: 860px) { .wk-chip { display: none; } }
@media print { .wk-chip { display: none !important; } }

/* ============ Copiar o plano de uma equipa ============ */
.cp-team { gap: 6px; opacity: .7; padding: 0 10px; height: 28px; font-size: 12px; }
tr:hover .cp-team, .cp-team:focus-visible { opacity: 1; }
.cp-team:hover { color: var(--accent-strong); }
.cp-team.done { opacity: 1; background: hsl(142 58% 42%); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -6px hsl(142 58% 30%); }
.cp-team.done svg { animation: pop2 .35s var(--ease); }
@media print { .cp-team { display: none !important; } }

/* ============ Obras: colunas apertadas, validade FPS, cartão largo ============ */
.drawer.wide { width: min(820px, 100vw); }
.form.f3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } @media (max-width: 700px) { .form.f3 { grid-template-columns: 1fr; } }
.obras-t { table-layout: fixed; min-width: 1060px; width: 100%; }
.obras-t th, .obras-t td { padding-left: 10px; padding-right: 10px; } .obras-t td { padding-top: 9px; padding-bottom: 9px; }
.obras-t .ellipsis, .obras-t td.ellipsis-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obras-t .site-name, .obras-t td .ellipsis { display: block; }
.obras-t th { white-space: normal; line-height: 1.15; vertical-align: bottom; padding-top: 10px; padding-bottom: 8px; }
.obras-t .fps-badge { padding: 0 8px; font-size: 11.5px; gap: 5px; }
.obras-t .wk { margin-right: 2px; }
.wk.prev { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); }
.wk.prev.now { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent); }
.wk.rm { display: inline-flex; align-items: center; gap: 4px; padding-right: 3px; }
.wk.rm button { border: 0; background: none; color: var(--faint); width: 16px; height: 16px; border-radius: 50%; line-height: 1; padding: 0; cursor: pointer; transition: transform .25s var(--ease), background .2s, color .2s; }
.wk.rm button:hover { background: hsl(4 76% 52% / .18); color: hsl(4 70% 45%); transform: rotate(90deg) scale(1.15); }
.wk-edit { align-items: center; gap: 6px; }
.fps-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fps-badge i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--h) var(--s) 48%); }
.fps-stat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 -6px; }
.wk-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.wk-btn { height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; position: relative;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background .2s, color .2s, border-color .2s, box-shadow .2s; }
.wk-btn:hover:not([disabled]) { transform: translateY(-2px) scale(1.08); border-color: var(--accent); box-shadow: var(--shadow-md); }
.wk-btn.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 14px -6px hsl(var(--accent-h) 100% 45% / .8); }
.wk-btn.now { box-shadow: inset 0 0 0 2px hsl(142 58% 45%); } .wk-btn.cur:not(.on) { background: var(--accent-soft); color: var(--accent-strong); }
.wk-btn.locked { text-decoration: line-through; color: var(--faint); background: var(--surface-3); cursor: not-allowed; }
.wk-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: -1px; } .wk-dot.now { box-shadow: inset 0 0 0 2px hsl(142 58% 45%); } .wk-dot.cur { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---- Lista de FPS ---- */
.fps-t { table-layout: fixed; min-width: 1000px; width: 100%; }
.fps-t th { white-space: normal; line-height: 1.15; }
.fps-t td, .fps-t th { padding-left: 8px; padding-right: 8px; }
.fps-t .fps-badge { padding: 0 8px; font-size: 11.5px; }
.fps-t .cell-inp { height: 34px; padding: 0 10px; font-size: 13px; background: transparent; border-color: transparent; border-radius: 9px; transition: background .2s, border-color .2s, box-shadow .25s; }
.fps-t tbody tr:hover .cell-inp { border-color: var(--line-strong); background: var(--surface); }
.fps-t .cell-inp:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.fps-t td.open-card { cursor: pointer; }
.fps-t td.open-card:hover .site-cod { color: var(--accent-strong); }
.fps-t .sits { white-space: normal; }
.sit-tag { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--accent-soft); color: var(--accent-strong); transition: transform .25s var(--ease), box-shadow .25s; }
.fps-t tr:hover .sit-tag { transform: translateY(-1px); box-shadow: var(--shadow-sm, 0 2px 6px rgb(0 0 0 / .12)); }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }

.obras-t th, .fps-t th { letter-spacing: .03em; font-size: 11px; }
.obras-t .fps-badge, .fps-t .fps-badge { overflow: visible; text-overflow: clip; }
.fps-badge i { display: none; }
.fps-t .cell-inp { padding: 0 6px; font-size: 12.5px; }

.info-cell { white-space: normal; vertical-align: middle; }
.info-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.35; color: var(--muted); transition: color .2s; }
.obras-t tbody tr:hover .info-clamp { color: var(--text); }
.obras-t { min-width: 1180px; }
.obras-t .badge { white-space: nowrap; }

.inp.flt { width: auto; min-width: 128px; max-width: 190px; transition: border-color .2s, box-shadow .25s, transform .2s; }
.inp.flt:hover { transform: translateY(-1px); border-color: var(--accent); }
.inp.flt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }

/* ---- Estado de obra por definir ---- */
.nav-item .count.warn { background: hsl(4 78% 54%); color: #fff; animation: pdPulse 2.4s ease-in-out infinite; }
@keyframes pdPulse { 0%,100% { box-shadow: 0 0 0 0 hsl(4 78% 54% / .5); } 60% { box-shadow: 0 0 0 7px hsl(4 78% 54% / 0); } }
.est select.need { border-color: hsl(4 78% 54%); background: hsl(4 78% 54% / .09); animation: pdPulse 2.4s ease-in-out infinite; }
.pend-btn { border-color: hsl(4 78% 54% / .55); color: hsl(4 70% 44%); }
.pend-btn:hover { background: hsl(4 78% 54% / .1); transform: translateY(-1px); }
.pw-intro { margin: -2px 18px 8px; font-size: 12.5px; }
table.pw { width: 100%; border-collapse: collapse; font-size: 13px; }
table.pw th { text-align: left; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; font-weight: 650; }
table.pw td { padding: 9px 10px; border-top: 1px solid var(--line); }
table.pw tbody tr { cursor: pointer; transition: background .2s, transform .25s var(--ease); animation: viewIn .45s calc(var(--r) * 45ms) var(--ease) both; }
table.pw tbody tr:hover { background: var(--accent-soft); transform: translateX(3px); }
table.pw tr.cur td:first-child em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
table.pw tr.late td:first-child { box-shadow: inset 3px 0 0 hsl(4 78% 54%); }
.pw-n { text-align: center; } table.pw th:nth-child(n+2):not(.pw-bar-h) { text-align: center; }
.pw-pill { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 8px; border-radius: 99px; font-weight: 750; font-size: 12px; background: hsl(var(--h) var(--s) 50% / .16); color: hsl(var(--h) var(--s) 34%); transition: transform .25s var(--ease); }
table.pw tr:hover .pw-pill { transform: scale(1.12); }
.pw-bar-c { display: flex; align-items: center; gap: 8px; min-width: 110px; } .pw-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .pw-bar i { display: block; height: 100%; width: var(--p); border-radius: inherit; background: linear-gradient(90deg, hsl(142 58% 42%), hsl(160 60% 45%)); transition: width .8s var(--ease); }
.pw-fix { animation: pdPulse 2.4s ease-in-out infinite; }
.pd-modal { width: min(720px, 94vw); } .pd-modal .mbody { max-height: 62vh; overflow: auto; }
.pd-intro { margin: 0 0 12px; } .pd-week h3 { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 8px; font-size: 14px; } .pd-week h3 small { color: var(--muted); font-weight: 500; } .pd-n { margin-left: auto; font-size: 12px; color: hsl(4 70% 44%); font-weight: 700; }
.pd-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; background: var(--surface); transition: transform .25s var(--ease), opacity .25s, border-color .2s, box-shadow .25s; }
.pd-row:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); } .pd-row.pd-done { opacity: 0; transform: translateX(24px); }
.pd-site { max-width: 260px; font-size: 13.5px; } .pd-btns { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 330px; }
.pd-b { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 3px 11px; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; color: var(--muted); transition: transform .2s var(--ease), background .2s, color .2s, border-color .2s; }
.pd-b:hover { transform: translateY(-2px) scale(1.05); background: hsl(var(--h) var(--s) 50% / .16); color: hsl(var(--h) var(--s) 32%); border-color: hsl(var(--h) var(--s) 50%); } .pd-b:active { transform: scale(.94); }
.flt-row { margin: -4px 0 12px; gap: 8px; } .flt-lbl { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; margin-right: 2px; }
.pw-wk { white-space: nowrap; } .pw-wk .muted { font-size: 11.5px; }

.fps-alert { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 16px; padding: 14px 18px; text-align: left; cursor: pointer; border: 1px solid hsl(38 94% 50% / .5); background: linear-gradient(90deg, hsl(38 94% 50% / .13), transparent); font: inherit; color: inherit; transition: transform .25s var(--ease), box-shadow .25s; }
.fps-alert:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); } .fps-alert .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: hsl(38 94% 50% / .2); color: hsl(32 90% 38%); animation: pdPulse 2.4s ease-in-out infinite; }
.fps-alert .go { transition: transform .25s var(--ease); } .fps-alert:hover .go { transform: translateX(4px); }

.d-mod { margin-top: 22px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

/* Alertas da semana */
.wk-alert { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 2px 12px; margin: 0 0 12px; padding: 8px 14px; border: 1px dashed var(--line, #d9d4cf); border-radius: 12px; background: transparent; transition: background .25s, border-color .25s, box-shadow .25s, transform .25s; }
.wk-alert:hover { border-color: #e3b04b; box-shadow: 0 4px 14px -8px rgba(228,160,20,.55); }
.wk-alert:focus-within { border-style: solid; border-color: #e3a21a; box-shadow: 0 0 0 4px rgba(244,190,60,.22); }
.wk-al-ic { grid-row: 1 / span 2; display: grid; place-items: center; width: 30px; height: 30px; margin-top: 2px; border-radius: 50%; color: #a8a29e; background: rgba(0,0,0,.04); transition: all .3s; }
.wk-al-ic svg { width: 18px; height: 18px; }
.wk-al-lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9a948e; grid-column: 2; transition: color .25s; }
.wk-alert textarea { grid-column: 2; width: 100%; resize: none; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; line-height: 1.4; height: 2.8em; color: inherit; padding: 0; }
.wk-alert textarea::placeholder { color: #aaa49e; }
.wk-al-n { grid-column: 3; grid-row: 1 / span 2; align-self: end; font-size: 11px; color: #b5afa9; opacity: 0; transition: opacity .2s; }
.wk-alert:focus-within .wk-al-n { opacity: 1; }
.wk-alert.has { border: 1px solid #f0c24b; border-left: 5px solid #f0a500; background: linear-gradient(100deg, #fff6d6, #fffbea 70%); }
.wk-alert.has .wk-al-ic { color: #fff; background: #f0a500; animation: wkpop .5s cubic-bezier(.3,1.6,.5,1), wkring 2.6s 1s ease-in-out 2; }
.wk-alert.has .wk-al-lbl { color: #9a6a00; }
.wk-alert.has textarea { font-weight: 600; color: #5b4300; }
@keyframes wkpop { from { transform: scale(.4) rotate(-25deg); } to { transform: none; } }
@keyframes wkring { 0%,100% { transform: none; } 6%,18% { transform: rotate(-14deg); } 12%,24% { transform: rotate(14deg); } 30% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .wk-alert.has .wk-al-ic { animation: none; } }
:root[data-theme=dark] .wk-alert.has, [data-theme=dark] .wk-alert.has { background: linear-gradient(100deg, #3a2f10, #2f2810 70%); border-color: #8a6a14; }
[data-theme=dark] .wk-alert.has textarea { color: #ffe9a8; }
@media print { .wk-alert:not(.has) { display: none !important; } .wk-alert textarea { overflow: visible; } }
