/* SubForce — folha de estilos única, sem build (compatível com cPanel). */
/* Fontes alojadas localmente (Barlow, SIL Open Font License). */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/barlow-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: #10262e;          /* azul-petróleo profundo: navegação, faixas "on" */
  --ink-2: #1d3a44;
  --steel: #5d7178;        /* texto secundário */
  --paper: #eef1f2;        /* fundo cinzento-aço */
  --surface: #ffffff;
  --line: #d7dee0;
  --line-soft: #e6ebec;
  --text: #13201f;
  --signal: #ff6a13;       /* laranja fato de sobrevivência: marcadores, acção principal */
  --signal-text: #b8430a;  /* versão legível em texto sobre claro */
  --ok: #17734a;   --ok-bg: #dff1e7;
  --warn: #8a5200; --warn-bg: #fbedcf;
  --bad: #b3261e;  --bad-bg: #fbe2df;
  --radius: 6px;
  --font: "Barlow", system-ui, sans-serif;
  --font-cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 400 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-cond); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
[x-cloak] { display: none !important; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.nav {
  background: var(--ink); color: #c9d6da; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 2px 8px 18px; }
.brand svg { flex: none; }
.brand b { font-family: var(--font-cond); font-size: 1.3rem; font-weight: 700; letter-spacing: .01em; }
.brand small { display: block; font-size: .72rem; color: #8fa6ad; font-weight: 400; margin-top: -2px; }
.nav-group { font-size: .74rem; color: #7f979e; padding: 14px 10px 4px; }
.nav a.item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 4px;
  text-decoration: none; font-family: var(--font-cond); font-size: 1rem; font-weight: 500; color: #c9d6da;
}
.nav a.item:hover { background: var(--ink-2); color: #fff; }
.nav a.item.active { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--signal); }
.nav a.item .count { margin-left: auto; background: var(--bad); color: #fff; font-size: .72rem; padding: 0 6px; border-radius: 9px; font-family: var(--font); }
.nav-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--ink-2); font-size: .85rem; }
.nav-foot .who { color: #fff; font-weight: 500; }
.nav-foot .tenant { color: #8fa6ad; font-size: .8rem; }
.nav-foot button { background: none; border: 0; color: #8fa6ad; padding: 0; margin-top: 8px; cursor: pointer; font: inherit; text-decoration: underline; }
.topbar { display: none; }

.main { padding: 28px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p.sub { color: var(--steel); margin: 4px 0 0; }
.crumbs { font-size: .85rem; color: var(--steel); margin-bottom: 6px; }
.crumbs a { color: var(--steel); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions select, .actions input[type=month] { width: auto; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel, .stack > * + * { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; color: var(--steel); font-size: .88rem; }
.panel-body { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------- Números do painel: faixa contínua, não cartões soltos ---------- */
.readout { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.readout > div { padding: 14px 18px; border-left: 1px solid var(--line-soft); }
.readout > div:first-child { border-left: 0; }
.readout .n { font-family: var(--font-cond); font-size: 2rem; font-weight: 600; line-height: 1; }
.readout .l { color: var(--steel); font-size: .86rem; margin-top: 4px; }
.readout .bad .n { color: var(--bad); }
.readout .warn .n { color: var(--warn); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-weight: 500; color: var(--steel); font-size: .82rem; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #f7f9f9; }
.t .num { text-align: right; white-space: nowrap; }
.t .muted, .muted { color: var(--steel); }
.t a.row-link { text-decoration: none; font-weight: 500; }
.t a.row-link:hover { color: var(--signal-text); text-decoration: underline; }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.empty { padding: 36px 18px; text-align: center; color: var(--steel); }
.empty strong { display: block; color: var(--text); font-family: var(--font-cond); font-size: 1.1rem; margin-bottom: 4px; }

/* ---------- Estado ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 3px; font-size: .8rem; font-weight: 500; white-space: nowrap; background: var(--line-soft); color: var(--steel); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.ink { background: var(--ink); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--steel); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: #d08a00; } .dot.bad { background: var(--bad); }
.reason { color: var(--bad); font-size: .86rem; }
.reason.warn { color: var(--warn); }

/* ---------- Quadro de embarques (elemento-assinatura) ---------- */
.board-row { display: grid; grid-template-columns: 74px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: 14px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.board-row:last-child { border-bottom: 0; }
.board-row.blocked { background: linear-gradient(90deg, var(--bad-bg) 0 4px, transparent 4px); }
.when { font-family: var(--font-cond); line-height: 1.05; }
.when .d { font-size: 1.55rem; font-weight: 600; }
.when .m { font-size: .8rem; color: var(--steel); }
.when.onsite .d { color: var(--ink); }
.who-line { font-weight: 600; }
.who-line a { text-decoration: none; }
.who-sub { color: var(--steel); font-size: .86rem; }

/* Faixa de rotação: dias on (tinta), off (vazio), hoje (laranja), caducidade (vermelho) */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(3px, 1fr); gap: 1px; height: 14px; }
.strip i { display: block; background: var(--line-soft); }
.strip i.on { background: var(--ink); }
.strip i.today { box-shadow: 0 0 0 1px var(--signal); position: relative; z-index: 1; background: var(--signal); }
.strip i.on.exp, .strip i.exp { background: var(--bad); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--steel); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { width: 14px; height: 10px; display: inline-block; background: var(--line-soft); }
.legend b.on { background: var(--ink); } .legend b.today { background: var(--signal); } .legend b.exp { background: var(--bad); }

.rot-board { overflow-x: auto; }
.rot-board table { border-collapse: separate; border-spacing: 0; font-size: .85rem; min-width: 100%; }
.rot-board th, .rot-board td { padding: 0; }
.rot-board .name { position: sticky; left: 0; background: var(--surface); padding: 6px 12px 6px 18px; min-width: 220px; max-width: 260px; border-bottom: 1px solid var(--line-soft); z-index: 2; }
.rot-board .day { width: 22px; min-width: 22px; height: 30px; border-bottom: 1px solid var(--line-soft); border-left: 1px solid #f1f4f4; }
.rot-board .day.on { background: var(--ink); }
.rot-board .day.on.blocked { background: var(--bad); }
.rot-board .day.wk { background-color: #f7f9f9; }
.rot-board .day.on.wk { background: var(--ink-2); }
.rot-board .day.on.blocked.wk { background: #c43a32; }
.rot-board .day.today { box-shadow: inset 2px 0 0 var(--signal), inset -2px 0 0 var(--signal); }
.rot-board thead th { font-weight: 500; color: var(--steel); font-size: .72rem; text-align: center; padding: 4px 0; background: var(--surface); }
.rot-board thead th.month { white-space: nowrap; text-align: left; padding-left: 4px; color: var(--text); font-size: .8rem; }
.rot-board thead th.is-today { color: var(--signal-text); font-weight: 700; }

/* ---------- Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: .86rem; font-weight: 500; margin-bottom: 4px; }
.field .hint { font-size: .8rem; color: var(--steel); margin-top: 3px; }
.field .err, .err { color: var(--bad); font-size: .82rem; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid #c3ccce; border-radius: 4px; padding: 7px 10px; min-height: 38px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(16, 38, 46, .12); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: .92rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; font: 500 .95rem var(--font-cond);
  padding: 7px 14px; min-height: 38px; border-radius: 4px; border: 1px solid #c3ccce; background: #fff; color: var(--text);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.go { background: var(--signal); border-color: var(--signal); color: #1b0d03; font-weight: 600; }
.btn.go:hover { background: #ff7d33; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: .88rem; }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--signal-text); text-decoration: underline; font-family: var(--font); font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.alert { padding: 11px 14px; border-radius: 4px; margin-bottom: 16px; font-size: .93rem; border: 1px solid; }
.alert.ok { background: var(--ok-bg); border-color: #b5dcc6; color: #0f4d31; }
.alert.bad { background: var(--bad-bg); border-color: #f0bdb7; color: #7d1a14; }
.alert.warn { background: var(--warn-bg); border-color: #efd29a; color: #5e3800; }
.alert.info { background: #e5eef1; border-color: #c4d6dc; color: var(--ink); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font: 500 1rem var(--font-cond); color: var(--steel); cursor: pointer; text-decoration: none; white-space: nowrap; margin-bottom: -1px; }
.tabs .active { color: var(--text); border-bottom-color: var(--signal); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: .93rem; }
dl.facts dt { color: var(--steel); }
dl.facts dd { margin: 0; }

/* Medidor de PO */
.meter { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.meter.warn > span { background: #d08a00; }
.meter.bad > span { background: var(--bad); }

/* Grelha de timesheet */
.ts-grid { overflow-x: auto; }
.ts-grid table { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.ts-grid th, .ts-grid td { border-bottom: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); text-align: center; }
.ts-grid th { color: var(--steel); font-weight: 500; padding: 4px 0; min-width: 40px; background: var(--surface); }
.ts-grid th.wk, .ts-grid td.wk { background: #f6f8f8; }
.ts-grid .name { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 210px; z-index: 2; border-left: 0; }
.ts-grid .tot { font-weight: 600; padding: 0 10px; white-space: nowrap; }
.ts-cell { width: 40px; height: 34px; border: 0; background: transparent; font: inherit; text-align: center; cursor: pointer; color: var(--text); }
.ts-cell.has { background: #dfe8ea; font-weight: 600; }
.ts-cell.ot { box-shadow: inset 0 -3px 0 var(--signal); }
.ts-cell:hover { outline: 1px solid var(--ink); }
.ts-cell[disabled] { cursor: default; }
.ts-cell.night { background: var(--ink-2); color: #fff; }
.ts-cell.hol { background: #fde3cf; color: #6b2a00; }
.ts-grid th.hol { color: var(--signal-text); font-weight: 700; background: #fff4ec; }
.legend b.cell-n { background: #dfe8ea; } .legend b.cell-night { background: var(--ink-2); }
.legend b.cell-hol { background: #fde3cf; } .legend b.cell-ot { background: #dfe8ea; box-shadow: inset 0 -3px 0 var(--signal); }
.ts-cell[disabled]:hover { outline: none; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(16, 38, 46, .45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: 0 18px 50px rgba(16, 38, 46, .3); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--steel); }

/* Paginação */
.pager { display: flex; gap: 4px; justify-content: flex-end; padding: 12px 18px; flex-wrap: wrap; }
.pager a, .pager span { padding: 3px 10px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; font-size: .88rem; background: #fff; }
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .disabled { color: #a7b3b6; }

/* Páginas públicas (entrar, registar, aprovação) */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.gate-side { background: var(--ink); color: #c9d6da; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.gate-side h2 { color: #fff; font-size: 2.3rem; max-width: 15ch; font-weight: 600; }
.gate-side p { max-width: 42ch; }
.gate-side .strip { height: 22px; margin: 28px 0 10px; max-width: 460px; }
.gate-side .strip i { background: #213f49; }
.gate-side .strip i.on { background: #c9d6da; }
.gate-side .strip i.exp { background: var(--bad); }
.gate-side .strip i.today { background: var(--signal); }
.gate-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.gate-card { width: 100%; max-width: 420px; }
.gate-card h1 { margin-bottom: 6px; }
.gate-card form > * + * { margin-top: 14px; }
.public { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.public-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }

/* Impressão */
@media print {
  .nav, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .panel { border: 0; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .split, .grid-3 { grid-template-columns: 1fr; }
  .readout { grid-template-columns: repeat(2, 1fr); }
  .readout > div:nth-child(3) { border-left: 0; }
  .readout > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  .nav.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 1px solid #3a5963; color: #fff; border-radius: 4px; padding: 5px 10px; font: inherit; }
  .main { padding: 20px 16px 48px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .board-row { grid-template-columns: 58px minmax(0, 1fr); }
  .board-row > :nth-child(3), .board-row > :nth-child(4) { grid-column: 2; }
  .gate { grid-template-columns: 1fr; }
  .gate-side { padding: 28px 20px; }
  .gate-side h2 { font-size: 1.6rem; }
  h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Fotografia / iniciais do trabalhador */
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--line-soft); color: var(--steel); font: 600 .78rem var(--font-cond); vertical-align: middle; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }
.who-cell { display: flex; gap: 10px; align-items: center; }
