@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@500;600;700&family=Poppins:wght@400;500;600&display=swap');

/* Paleta do Gearloft — RAWfilmes: papel, preto, azul Klein, lima e laranja */
:root {
  --night: #0C0C0C; --night-2: #171717; --night-line: #2C2C2B; --night-ink: #F2F2F0; --night-muted: #9A9A96;
  --bg: #F2F2F0; --surface: #FFFFFF; --surface-2: #E9E9E6; --ink: #0C0C0C; --muted: #5C5C5C; --faint: #8A8A86;
  --line: #DCDCD8; --accent: #002FA7; --accent-ink: #FFFFFF; --accent-soft: #E1E7F5; --peri: #E5FF00; --hi: #E5FF00; --hi-ink: #0C0C0C;
  --out: #FF5F1F; --out-ink: #FFFFFF;
  --ok: #1F8A3C; --ok-soft: #E2F1E6; --warn: #B7791F; --warn-soft: #F8EEDC; --bad: #D9281E; --bad-soft: #FBE5E3;
  --display: 'Kanit', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 14px; --r-sm: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0C0C; --surface: #171717; --surface-2: #1F1F1F; --ink: #F2F2F0; --muted: #9A9A96; --faint: #74746F;
    --line: #2C2C2B; --accent: #E5FF00; --accent-ink: #0C0C0C; --accent-soft: #262A0A; --out-ink: #0C0C0C;
    --ok: #51CF66; --ok-soft: #16281A; --warn: #FCC419; --warn-soft: #2E2611; --bad: #FF6B6B; --bad-soft: #33191A;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; line-height: 1.15; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.eyebrow { font: 600 11px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--night); color: var(--night-ink); display: flex; flex-direction: column; gap: 4px; padding: 28px 16px 20px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: baseline; gap: 10px; padding: 0 10px 28px; }
.brand b { font: 700 26px/1 var(--display); letter-spacing: -0.02em; }
.brand span { font-size: 13px; color: var(--night-muted); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side .group { font: 600 10.5px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--night-muted); padding: 20px 12px 8px; }
.navlink { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--night-ink); text-decoration: none; font-weight: 500; font-size: 14px; opacity: .78; }
.navlink:hover { background: var(--night-2); opacity: 1; }
.navlink.on { background: var(--night-2); opacity: 1; box-shadow: inset 3px 0 0 var(--peri); }
.navlink svg { width: 18px; height: 18px; flex: none; }
.navlink .badge { margin-left: auto; background: var(--hi); color: var(--hi-ink); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; }
.side .me { margin-top: auto; border-top: 1px solid var(--night-line); padding: 16px 10px 0; display: flex; align-items: center; gap: 10px; }
.side .me .who { min-width: 0; flex: 1; } .side .me .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me button { background: none; border: 1px solid var(--night-line); color: var(--night-muted); border-radius: var(--r-sm); padding: 6px 10px; cursor: pointer; font-size: 12px; }
.main { min-width: 0; padding-block: 32px 48px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head .eyebrow { margin-bottom: 10px; display: block; }
.topbar, .tabbar { display: none; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--display); background: var(--accent-soft); color: var(--accent); flex: none; }
.side .avatar { background: var(--hi); color: var(--hi-ink); }

/* ---------- cartões ---------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; } .span-12 { grid-column: span 12; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-8 { grid-column: span 8; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: var(--r-sm); padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font: 600 24px/1.2 var(--display); font-variant-numeric: tabular-nums; margin-top: 4px; }

/* ---------- picar o ponto ---------- */
.clock-card { container-type: inline-size; }
.clock { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
@container (max-width: 600px) { .clock { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } .clock > div { width: 100%; } .clock .geo { text-align: left; } }
.clock .timer { font: 600 clamp(40px, 12cqi, 68px)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; margin: 14px 0 8px; }
.punch { width: 176px; height: 176px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-ink); font: 600 17px/1.15 var(--display); transition: transform .12s ease, box-shadow .2s ease; box-shadow: 0 0 0 10px var(--accent-soft); }
.punch:hover { transform: scale(1.03); } .punch:active { transform: scale(.97); }
.punch.out { background: var(--out); color: var(--out-ink); box-shadow: 0 0 0 10px color-mix(in srgb, var(--out) 18%, transparent); }
.punch[aria-busy="true"] { opacity: .6; pointer-events: none; }
.punch svg { width: 30px; height: 30px; }
.geo { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13.5px; margin-top: 18px; }
.geo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.geo.ok { background: var(--ok-soft); } .geo.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.geo.bad { background: var(--bad-soft); } .geo.bad .dot { background: var(--bad); }
.geo button { margin-left: auto; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.acc { background: var(--accent-soft); color: var(--accent); }
.pill.plain::before { display: none; }

.timeline { display: flex; flex-direction: column; }
.timeline .row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.timeline .row:last-child { border-bottom: 0; }
.timeline .tick { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); }
.timeline .tick.live { background: var(--accent); }

/* barras */
.bars { display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 1fr)); gap: 10px; align-items: end; height: 170px; position: relative; padding-top: 8px; }
.bars .col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .bar { width: 100%; max-width: 36px; border-radius: 6px 6px 3px 3px; background: var(--accent); min-height: 2px; position: relative; }
.bars .bar.under { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.bars .bar.empty { background: var(--line); }
.bars .bar.today { outline: 2px solid var(--peri); outline-offset: 2px; }
.bars .v { font: 500 11px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.bars .d { font-size: 11.5px; color: var(--muted); }
.bars .target { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--faint); pointer-events: none; }
.bars .target span { position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--faint); background: var(--surface); padding: 0 4px; }

/* ---------- tabelas e listas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.n { font-family: var(--display); }
tfoot td { font-weight: 600; border-top: 1.5px solid var(--ink); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person div { min-width: 0; } .person b { font-weight: 600; display: block; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

/* ---------- formulários ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; }
.btn svg { width: 16px; height: 16px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); font-size: 15px; min-width: 0; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error { color: var(--bad); font-size: 13.5px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.copy { display: flex; gap: 8px; }
.copy input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.cal-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.cal-btns .btn { justify-content: flex-start; padding: 12px 14px; }
.note { background: var(--accent-soft); border-radius: var(--r-sm); padding: 12px 14px; font-size: 13.5px; }
.note.warn { background: var(--warn-soft); }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--night); color: var(--night-ink); padding: 12px 18px; border-radius: 12px; font-size: 14px; transition: all .25s ease; z-index: 50; max-width: calc(100vw - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); padding: 24px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(16 19 26 / .55); }

/* ---------- telemóvel ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--night); color: var(--night-ink); position: sticky; top: 0; z-index: 20;
    padding-block: calc(12px + env(safe-area-inset-top, 0px)) 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .topbar b { font: 700 22px/1 var(--display); }
  .topbar button { background: none; border: 1px solid var(--night-line); color: var(--night-ink); border-radius: var(--r-sm); padding: 6px 10px; font-size: 12px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: 11px; color: var(--muted); text-decoration: none; font-weight: 500; }
  .tabbar a.on { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .main { padding-block: 20px calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .grid > * { grid-column: span 12 !important; }
  .clock { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .clock .geo { text-align: left; }
  .punch { width: 200px; height: 200px; }
  h1 { font-size: 24px; }
  .card { padding: 18px; }
}

/* ---------- páginas de entrada ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth .poster { background: var(--night); color: var(--night-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .poster b { font: 700 34px/1 var(--display); }
.auth .poster .rule { width: 72px; height: 4px; background: var(--peri); margin-bottom: 22px; }
.auth .poster h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.02; letter-spacing: -0.03em; }
.auth .poster p { color: var(--night-muted); font-size: 16px; margin: 14px 0 0; max-width: 34ch; }
.auth .panel { display: grid; place-items: center; padding-block: 40px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.auth form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; } .auth .poster { padding: 32px 20px; min-height: 0; gap: 40px; } }

/* ---------- calendário mensal ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.month-card { padding: 14px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month .wd { font: 600 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 6px 8px; }
.month .cell { min-height: 104px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; font: inherit; color: inherit; }
.month .cell.blank { border: 0; background: none; cursor: default; }
.month .cell.we { background: var(--surface-2); }
.month .cell:hover { border-color: var(--faint); }
.month .cell.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.month .dn { font: 600 13px/1 var(--display); font-variant-numeric: tabular-nums; }
.month .cell.today .dn { background: var(--hi); color: var(--hi-ink); border-radius: 99px; padding: 3px 7px; align-self: flex-start; }
.month .items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.month .it { display: flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1.3; min-width: 0; white-space: nowrap; overflow: hidden; }
.month .it i { width: 3px; align-self: stretch; border-radius: 2px; background: var(--c); flex: none; }
.month .it b { font-weight: 600; } .month .it em { font-style: normal; color: var(--muted); overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.month .it.me { background: var(--accent-soft); border-radius: 4px; }
.month .it.abs em { text-decoration: line-through; text-decoration-color: var(--faint); }
.month .it.abs i { background: repeating-linear-gradient(180deg, var(--c) 0 2px, transparent 2px 4px); }
.month .it.pend { opacity: .65; }
.month .dots { display: none; }
@media (max-width: 1100px) { .month .cell { min-height: 64px; } .month .items { display: none; } .month .dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; } .month .dots i { width: 7px; height: 7px; border-radius: 50%; } .month .dots i.off { background: none; border: 1.5px solid; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px 5px 8px; font-size: 13px; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c); }
.chip:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.chip:has(input:checked) i { background: var(--c); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- documentos ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 14px; border: 1.5px dashed var(--line); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; font: inherit; color: var(--ink); text-align: center; }
.drop:hover, .drop.has { border-color: var(--accent); }
.drop svg { width: 26px; height: 26px; color: var(--accent); }
.doc-ico { width: 40px; height: 46px; border-radius: 6px; display: grid; place-items: center; font: 600 10px/1 var(--display); letter-spacing: .05em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.doc-ico.pdf { background: color-mix(in srgb, var(--out) 14%, var(--surface)); color: var(--out); border-color: color-mix(in srgb, var(--out) 30%, transparent); }
.status-select { width: auto; padding: 6px 8px; font-size: 13px; }
.row.doc a:hover { text-decoration: underline; }
