/* WorkBalance — folha de estilos
   Ideia central: cada pessoa-dia é um azulejo de cor (mosaico). Tudo o resto fica sóbrio. */

@font-face { font-family: "Bricolage"; src: url("fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --paper: #F4F5F1;
  --surface: #FFFFFF;
  --rail: #E8EBE5;
  --line: #D5DAD3;
  --ink: #1C2731;
  --ink-2: #4A5863;
  --ink-3: #7B8791;
  --office: #D9DED9;
  --remote: #3E6FE6;
  --remote-soft: #DCE5FB;
  --leave: #F2B53A;
  --leave-soft: #FCEFCF;
  --absence: #E0645F;
  --absence-soft: #F9DEDC;
  --ok: #2E8B57;
  --ok-soft: #DDF0E4;
  --test: #F2B53A;
  --focus: #3E6FE6;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 18px;
  --shadow: 0 1px 0 rgba(28, 39, 49, .06), 0 8px 24px -12px rgba(28, 39, 49, .18);
  --display: "Bricolage", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --rail-w: 14rem;
  --tile: 1.875rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12181E; --surface: #1A222A; --rail: #161D24; --line: #2B353E;
    --ink: #EEF1EC; --ink-2: #B5BFC6; --ink-3: #85919A;
    --office: #2E3943; --remote: #6E93F2; --remote-soft: #22304F; --leave: #F2B53A; --leave-soft: #3D3320;
    --absence: #EB7B76; --absence-soft: #43292A; --ok: #5BC48A; --ok-soft: #1F3A2A;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.35rem, 1.1rem + .7vw, 1.7rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- arranque ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mosaic { width: 48px; height: 48px; border-radius: 10px; background:
  conic-gradient(var(--remote) 0 25%, var(--leave) 0 50%, var(--absence) 0 75%, var(--office) 0); animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- botões e formulários ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid transparent; border-radius: 999px;
  padding: .62rem 1.15rem; font-weight: 700; cursor: pointer; background: var(--ink); color: var(--paper); text-decoration: none; min-height: 2.75rem; }
.btn:hover { filter: brightness(1.12); }
.btn svg { width: 1.125rem; height: 1.125rem; flex: none; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--rail); filter: none; }
.btn.danger { background: var(--absence); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.small { padding: .3rem .75rem; min-height: 2.125rem; font-size: .875rem; }
.btn.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--remote); text-decoration: underline; text-underline-offset: 3px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.field { display: grid; gap: .35rem; }
.field > span { font-weight: 700; font-size: .9rem; }
.field small { color: var(--ink-3); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); min-height: 2.75rem; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.form { display: grid; gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; align-items: start; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.days-pick { display: flex; gap: .4rem; flex-wrap: wrap; }
.days-pick label { position: relative; }
.days-pick input { position: absolute; opacity: 0; }
.days-pick span { display: inline-grid; place-items: center; min-width: 52px; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 700; }
.days-pick input:checked + span { background: var(--remote); border-color: var(--remote); color: #fff; }
.days-pick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.error { color: var(--absence); font-weight: 700; min-height: 1.5em; }

/* ---------- ecrãs de entrada ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.gate-art { position: relative; background: var(--ink); color: var(--paper); padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.wordmark { font-family: var(--display); font-weight: 750; font-size: 1.35rem; letter-spacing: -.02em; display: flex; align-items: center; gap: .55rem; }
.wordmark i { width: 22px; height: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.wordmark i b { border-radius: 2px; background: var(--office); }
.wordmark i b:nth-child(1) { background: var(--remote); } .wordmark i b:nth-child(4) { background: var(--leave); }
.gate-art h1 { font-size: clamp(2.4rem, 1.5rem + 3.4vw, 4.4rem); font-weight: 700; letter-spacing: -.03em; max-width: 11ch; line-height: 1.02; }
.gate-art p { color: #B9C3CB; max-width: 38ch; margin-top: 1rem; font-size: 1.05rem; }
.mosaic { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; max-width: 520px; margin: 2rem 0; }
.mosaic span { aspect-ratio: 1; border-radius: 6px; background: #2C3946; animation: tile-in .5s cubic-bezier(.2,.7,.3,1) both; }
.mosaic span.r { background: var(--remote); } .mosaic span.l { background: var(--leave); } .mosaic span.a { background: var(--absence); }
.mosaic span.o { background: #3A4856; }
@keyframes tile-in { from { transform: scale(.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mosaic span, .boot-mosaic { animation: none; } }
.legend-inline { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .9rem; color: #B9C3CB; }
.legend-inline span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .45rem; background: var(--c); }
.gate-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.gate-card { width: 100%; max-width: 400px; display: grid; gap: 1.4rem; }
.gate-card header p { margin-top: .4rem; }

.companies { display: grid; gap: 1rem; }
.co-list { display: grid; gap: .8rem; }
.co-card { display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left; padding: 1rem 1.1rem; border-radius: var(--radius-l);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.co-card:hover { border-color: var(--ink-3); box-shadow: var(--shadow); }
.co-card.test { background: repeating-linear-gradient(-45deg, var(--leave-soft) 0 12px, var(--surface) 12px 24px); }
.co-card.new { border-style: dashed; background: transparent; }
.co-text { display: grid; gap: .15rem; min-width: 0; }
.co-text b { font-family: var(--display); font-size: 1.15rem; font-weight: 650; }
.co-text small { color: var(--ink-2); }
.co-logo { width: 3.4rem; height: 3.4rem; flex: none; border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.co-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.co-logo.initials { background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 700; font-size: 1.15rem; border: 0; }
.co-logo.test { background: var(--leave); color: #2A2008; }
.co-logo.plus { background: transparent; color: var(--ink-2); border: 1px dashed var(--ink-3); font-size: 1.6rem; }
.co-logo.big { width: 4.5rem; height: 4.5rem; }
.co-head { display: flex; gap: 1rem; align-items: center; }
.logo-edit { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.pill-logo { width: 2rem; height: 2rem; object-fit: contain; border-radius: 6px; background: #fff; flex: none; }
.company-pill { justify-content: flex-start; }
.company-card { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-l); padding: 1.25rem 1.25rem 1.1rem; cursor: pointer; display: grid; gap: .35rem; position: relative; overflow: hidden; }
.company-card:hover { border-color: var(--ink-3); }
.company-card.test { background: repeating-linear-gradient(-45deg, var(--leave-soft) 0 12px, var(--surface) 12px 24px); }
.company-card h2 { font-size: 1.25rem; }
.company-card .meta { display: flex; gap: 1rem; color: var(--ink-2); font-size: .9rem; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 1.2rem .9rem; gap: 1.2rem; overflow-y: auto; }
.rail .wordmark { padding: 0 .5rem; color: var(--ink); }
.rail .wordmark i b { background: var(--office); } .rail .wordmark i b:nth-child(1) { background: var(--remote); } .rail .wordmark i b:nth-child(4) { background: var(--leave); }
.company-pill { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .75rem; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; }
.company-pill strong { display: block; font-size: .95rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-pill small { color: var(--ink-3); }
.company-pill.test { border-color: var(--leave); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .4rem .55rem; border-radius: var(--radius-m); text-decoration: none; color: var(--ink-2); font-weight: 600; }
.nav-ic { width: 1.85rem; height: 1.85rem; border-radius: 8px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--ic) 16%, transparent); color: var(--ic); }
.nav-ic svg { width: 1.1rem !important; height: 1.1rem !important; }
.nav a[aria-current="page"] .nav-ic { background: var(--ic); color: #fff; }
.nav a:hover { background: rgba(127,140,150,.12); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.nav svg { width: 1.25rem; height: 1.25rem; flex: none; }
.nav .count { margin-left: auto; background: var(--absence); color: #fff; border-radius: 999px; font-size: .75rem; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }
.rail-foot { margin-top: auto; display: grid; gap: .6rem; padding: .7rem; border-top: 1px solid var(--line); }
.rail-foot .who { font-weight: 700; line-height: 1.2; }
.rail-foot .who small { display: block; font-weight: 400; color: var(--ink-3); }

.main { min-width: 0; }
.banner { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .55rem clamp(1rem, 3vw, 2.2rem); font-weight: 700; font-size: .92rem; }
.banner.test { background: repeating-linear-gradient(-45deg, var(--leave) 0 10px, #F5C561 10px 20px); color: #2A2008; }
.banner.imp { background: var(--ink); color: var(--paper); }
.banner .btn { min-height: 32px; padding: .25rem .8rem; }
.page { padding: clamp(1.1rem, 2.4vw, 2rem) clamp(1rem, 2.6vw, 2rem) 5rem; max-width: 84rem; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head p { margin-top: .35rem; color: var(--ink-2); max-width: 60ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(.9rem, 1.6vw, 1.2rem); }
.panel > h2, .panel > header { margin-bottom: 1rem; }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.stack { display: grid; gap: 1.25rem; }
.stack > *, .cols > * { min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

/* ---------- saldo ---------- */
.balance { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; }
.balance .big { font-family: var(--display); font-size: clamp(3.4rem, 2.5rem + 3vw, 5rem); font-weight: 700; line-height: .9; letter-spacing: -.04em; }
.balance .big small { display: block; font-family: var(--body); font-size: .95rem; font-weight: 400; letter-spacing: 0; color: var(--ink-2); margin-top: .5rem; }
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--office); }
.bar span { background: var(--c); }
.bar-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .7rem; font-size: .88rem; color: var(--ink-2); }
.bar-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; background: var(--c); vertical-align: -1px; }

/* ---------- equipa hoje ---------- */
.today { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .6rem; }
.person { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: var(--radius-m); background: var(--paper); min-width: 0; }
.person .tile { width: 2.125rem; height: 2.125rem; border-radius: 8px; flex: none; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: .85rem; color: #fff; background: var(--office); }
.person .tile.office { color: var(--ink-2); }
.person .tile.remote { background: var(--remote); } .person .tile.leave { background: var(--leave); color: #2A2008; } .person .tile.absence { background: var(--absence); }
.person .tile.off { background: transparent; border: 1px dashed var(--line); color: var(--ink-3); }
.person b { display: block; font-size: .95rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { color: var(--ink-3); }
.person > div { min-width: 0; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stat { border-radius: var(--radius-m); padding: .7rem .8rem; background: var(--paper); border-left: 5px solid var(--c); }
.stat b { font-family: var(--display); font-size: 1.7rem; display: block; line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--ink-2); }

/* ---------- listas ---------- */
.list { display: grid; }
.item { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .grow b { display: block; }
.item .when { font-family: var(--display); font-weight: 650; }
.swatch { width: 8px; align-self: stretch; border-radius: 3px; background: var(--c); flex: none; min-height: 2rem; }
.empty { padding: 1.4rem; text-align: center; color: var(--ink-2); border: 1px dashed var(--line); border-radius: var(--radius-m); }
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--rail); color: var(--ink-2); white-space: nowrap; }
.badge.pending { background: repeating-linear-gradient(-45deg, var(--leave-soft) 0 5px, transparent 5px 10px); color: #7A5600; border: 1px solid var(--leave); }
.badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.rejected { background: var(--absence-soft); color: var(--absence); }
.badge.cancelled { text-decoration: line-through; }
.badge.remote { background: var(--remote-soft); color: var(--remote); }
.warn { background: var(--absence-soft); color: var(--ink); border-radius: var(--radius-m); padding: .6rem .8rem; font-size: .9rem; }
.note { background: var(--paper); border-radius: var(--radius-m); padding: .8rem 1rem; color: var(--ink-2); }
.rules-line { display: flex; gap: .5rem; flex-wrap: wrap; }
.rule-chip { display: inline-flex; gap: .4rem; align-items: baseline; padding: .4rem .75rem; border-radius: 999px; background: var(--remote-soft); color: var(--ink); font-size: .92rem; }
.rule-chip b { font-family: var(--display); font-size: 1.1rem; color: var(--remote); }

/* ---------- calendário (mosaico) ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.2rem; margin-bottom: 1rem; }
.month-nav { display: flex; align-items: center; gap: .3rem; }
.month-nav h2 { min-width: 11ch; text-align: center; text-transform: capitalize; }
.icon-btn { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.icon-btn:hover { background: var(--rail); }
.icon-btn svg { width: 18px; height: 18px; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .88rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; background: var(--c); }
.legend i.hatch { background: repeating-linear-gradient(-45deg, var(--c) 0 3px, var(--surface) 3px 6px); border: 1px solid var(--c); }

.cal-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); -webkit-overflow-scrolling: touch; }
.cal { display: grid; width: max-content; min-width: 100%; }
.cal .name, .cal .hd, .cal .c, .cal .ft { height: 2.5rem; display: flex; align-items: center; }
.cal .name { position: sticky; left: 0; z-index: 2; background: var(--surface); padding: 0 .8rem; gap: .55rem; border-right: 1px solid var(--line); min-width: 0; font-weight: 700; font-size: .92rem; }
.cal .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .name i { width: 8px; height: 22px; border-radius: 3px; background: var(--c, var(--office)); flex: none; }
.cal .name.me { background: var(--remote-soft); }
.cal .name.dim span { color: var(--ink-3); font-weight: 600; }
.cal .name .quota.none { color: var(--ink-3); background: var(--rail); }
.cal .c.dim .t { opacity: .45; }
.cal .name .quota { margin-left: auto; flex: none; font-size: .72rem; font-weight: 700; color: var(--remote); background: var(--remote-soft); border-radius: 999px; padding: 0 .4rem; }
.cal .hd { flex-direction: column; justify-content: center; font-size: .72rem; color: var(--ink-3); line-height: 1.1; height: 3rem; border-bottom: 1px solid var(--line); }
.cal .hd b { font-family: var(--display); font-size: .95rem; color: var(--ink); }
.cal .hd.we b, .cal .hd.hol b { color: var(--ink-3); }
.cal .hd.today b { background: var(--ink); color: var(--paper); border-radius: 999px; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; }
.cal .hd.hol { background: repeating-linear-gradient(-45deg, var(--rail) 0 4px, transparent 4px 8px); }
.cal .corner { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 3rem; padding: 0 .8rem; display: flex; align-items: center; font-size: .8rem; color: var(--ink-3); }
.cal .c { justify-content: center; padding: 3px; }
.cal .c.we { background: var(--paper); }
.cal .c.hol { background: repeating-linear-gradient(-45deg, var(--rail) 0 4px, transparent 4px 8px); }
.t { width: 100%; height: 100%; border-radius: 6px; border: 0; padding: 0; display: grid; place-items: center; font-size: .7rem; font-weight: 700; background: var(--office); color: transparent; cursor: default; }
button.t { cursor: pointer; }
button.t:hover { outline: 2px solid var(--ink-3); outline-offset: -2px; }
.t.none { background: transparent; }
.t.remote { background: var(--remote); color: #fff; }
.t.leave { background: var(--leave); color: #2A2008; }
.t.absence { background: var(--absence); color: #fff; }
.t.p.remote { background: repeating-linear-gradient(-45deg, var(--remote) 0 3px, var(--remote-soft) 3px 7px); }
.t.p.leave { background: repeating-linear-gradient(-45deg, var(--leave) 0 3px, var(--leave-soft) 3px 7px); }
.t.p.absence { background: repeating-linear-gradient(-45deg, var(--absence) 0 3px, var(--absence-soft) 3px 7px); }
.t.half-am { background: linear-gradient(135deg, var(--leave) 50%, var(--office) 50%); }
.t.half-pm { background: linear-gradient(135deg, var(--office) 50%, var(--leave) 50%); }
.t.manual::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.cal .ft { justify-content: center; font-size: .72rem; font-weight: 700; color: var(--ink-3); border-top: 1px solid var(--line); height: 1.875rem; }
.cal .ft.full { color: var(--remote); }
.cal .ft.over { color: var(--absence); }
.cal .ft-label { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); border-top: 1px solid var(--line); height: 1.875rem; display: flex; align-items: center; padding: 0 .8rem; font-size: .8rem; color: var(--ink-3); }
.cal-hint { margin-top: .7rem; font-size: .88rem; color: var(--ink-2); }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th { text-align: left; font-size: .82rem; color: var(--ink-3); font-weight: 600; padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.inactive td { color: var(--ink-3); }
.cell-person { display: flex; align-items: center; gap: .6rem; }
.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--office)); flex: none; }

/* ---------- modal e avisos ---------- */
dialog { border: 0; border-radius: var(--radius-l); padding: 0; width: min(520px, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(18, 24, 30, .55); }
.modal-body { padding: 1.4rem; display: grid; gap: 1.1rem; max-height: 85vh; overflow-y: auto; }
.modal-body header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.secret { font-family: var(--display); font-size: 1.6rem; letter-spacing: .04em; background: var(--paper); padding: .8rem 1rem; border-radius: var(--radius-m); text-align: center; user-select: all; }
#toasts { position: fixed; z-index: 50; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: grid; gap: .5rem; width: min(440px, calc(100vw - 2rem)); pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: .8rem 1rem; border-radius: var(--radius-m); box-shadow: var(--shadow); font-weight: 700; animation: toast .25s ease-out; }
.toast.err { background: var(--absence); color: #fff; }
@keyframes toast { from { transform: translateY(10px); opacity: 0; } }

/* ---------- barra inferior (telemóvel) ---------- */
.tabbar { display: none; }
.more-sheet .nav a { padding: .85rem .7rem; }

@media (max-width: 1020px) {
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 860px) {
  .gate { grid-template-columns: 1fr; }
  .gate-art { padding: 1.5rem 1.25rem 1.25rem; }
  .gate-art h1 { font-size: 2.2rem; }
  .gate-art .mosaic { grid-template-columns: repeat(14, 1fr); gap: 4px; margin: 1.2rem 0 .8rem; max-width: none; }
  .gate-art .mosaic span:nth-child(n+29) { display: none; }
  .gate-art p { display: none; }
  .gate-form { place-items: start center; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .page { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--ink-3); text-decoration: none; padding: .3rem 0; background: none; border: 0; position: relative; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { color: var(--ink); }
  .tabbar [aria-current="page"] svg { color: var(--ic, var(--remote)); }
  .tabbar .count { position: absolute; top: 0; right: calc(50% - 20px); background: var(--absence); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 .35rem; }
  .mobile-top { display: flex !important; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .balance { grid-template-columns: 1fr; gap: 1rem; }
  :root { --tile: 30px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-l) var(--radius-l) 0 0; }
  .modal-body { padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
  .hide-m { display: none; }
  .cal { --name-w: 112px; }
  .cal .name { padding: 0 .5rem; font-size: .85rem; }
  .cal .corner, .cal .ft-label { padding: 0 .5rem; }
  .today { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hide-desktop { display: none; }
@media (max-width: 860px) { .hide-desktop { display: block; } }
.mobile-top { display: none; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--rail); position: sticky; top: 0; z-index: 15; }
.mobile-top .wordmark { font-size: 1.1rem; }
.mobile-top .company-pill { width: auto; max-width: 55vw; padding: .35rem .6rem; }

@media print {
  .rail, .tabbar, .banner, .mobile-top, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .panel { border: 0; padding: 0; }
  .page { padding: 0; }
}

/* Densidade no computador: tudo o que está em rem fica ~12% mais compacto.
   Usa percentagem para respeitar o tamanho de letra escolhido no browser. */
@media (min-width: 861px) {
  html { font-size: 81.25%; }
}

.company-pill > span { min-width: 0; overflow: hidden; }
