/* ═══════════════════════════════════════════════════════════════
   Registo de Horas — folha de estilos
   Tokens → base → componentes → ecrãs → responsivo
   ═══════════════════════════════════════════════════════════════ */

/* ---------- tokens ---------- */

:root {
  color-scheme: light;

  --bg: #eff2f5;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --surface-3: #eaeef2;
  --border: #e0e6ec;
  --border-strong: #cdd6de;

  --ink: #0d1519;
  --ink-2: #45555f;
  --ink-3: #74848f;

  --brand: #0d7d72;
  --brand-strong: #0a635b;
  --brand-ink: #ffffff;
  --brand-soft: #e2f2ef;
  --brand-line: #b6ded7;

  --good: #12794a;
  --good-soft: #e2f4ea;
  --warn: #9a5b06;
  --warn-soft: #fdf0da;
  --bad: #b32020;
  --bad-soft: #fce9e9;

  --side-bg: #0d1a20;
  --side-ink: #cfdbe2;
  --side-ink-dim: #7d919d;
  --side-active: #10403c;
  --side-line: #1d2f38;

  --r-xs: 7px;
  --r-sm: 10px;
  --r: 13px;
  --r-lg: 18px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(13, 21, 25, .05);
  --sh-2: 0 1px 3px rgba(13, 21, 25, .07), 0 8px 20px -6px rgba(13, 21, 25, .09);
  --sh-3: 0 20px 48px -12px rgba(13, 21, 25, .22);

  --side-w: 16.1rem;
  --content-max: 1240px;
  --ease: cubic-bezier(.34, .8, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #080d10;
    --surface: #111a1f;
    --surface-2: #162127;
    --surface-3: #1d2a32;
    --border: #22323b;
    --border-strong: #32454f;

    --ink: #e8eef2;
    --ink-2: #a9bac4;
    --ink-3: #7d919d;

    --brand: #34d3bf;
    --brand-strong: #5ee3d1;
    --brand-ink: #04211e;
    --brand-soft: #0e2b2a;
    --brand-line: #1c4a45;

    --good: #46d98a;
    --good-soft: #102b1d;
    --warn: #f0b352;
    --warn-soft: #2e2312;
    --bad: #f47272;
    --bad-soft: #2e1717;

    --side-bg: #0a1216;
    --side-ink: #c3d2da;
    --side-ink-dim: #6f838f;
    --side-active: #10312e;
    --side-line: #1a262d;

    --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
    --sh-2: 0 1px 3px rgba(0, 0, 0, .5), 0 10px 24px -8px rgba(0, 0, 0, .6);
    --sh-3: 0 24px 56px -14px rgba(0, 0, 0, .8);
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

/* O atributo hidden tem de vencer qualquer display definido depois. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  /* Escala base. Tudo o resto usa rem, por isso cresce a partir daqui. */
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: .94rem/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-feature-settings: "cv05", "ss01";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.22; letter-spacing: -.011em; font-weight: 620; }
h1 { font-size: 1.32rem; }
h2 { font-size: 1.02rem; }
h3 { font-size: .93rem; }
p { margin: 0; }
small { font-size: .8rem; }

.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

::selection { background: var(--brand-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* barras de deslocamento discretas */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- botões ---------- */

.btn {
  --btn-bg: transparent;
  --btn-ink: var(--ink-2);
  --btn-line: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font: inherit;
  font-weight: 550;
  line-height: 1;
  padding: .62rem .95rem;
  min-height: 2.5rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-ink);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .1s var(--ease), box-shadow .16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.primary { --btn-bg: var(--brand); --btn-ink: var(--brand-ink); box-shadow: var(--sh-1); font-weight: 600; }
.btn.primary:hover:not(:disabled) { --btn-bg: var(--brand-strong); box-shadow: var(--sh-2); }

.btn.ghost { --btn-line: var(--border); --btn-bg: var(--surface); }
.btn.ghost:hover:not(:disabled) { --btn-bg: var(--surface-2); --btn-line: var(--border-strong); --btn-ink: var(--ink); }

.btn.quiet { --btn-ink: var(--ink-3); }
.btn.quiet:hover:not(:disabled) { --btn-bg: var(--surface-2); --btn-ink: var(--ink); }

.btn.danger { --btn-ink: var(--bad); --btn-line: var(--border); --btn-bg: var(--surface); }
.btn.danger:hover:not(:disabled) { --btn-bg: var(--bad-soft); --btn-line: var(--bad); }

.btn.solid-danger { --btn-bg: var(--bad); --btn-ink: #fff; }

.btn.sm { min-height: 2rem; padding: .35rem .68rem; font-size: .84rem; border-radius: var(--r-xs); }
.btn.lg { min-height: 3.13rem; padding: .9rem 1.4rem; font-size: 1rem; border-radius: var(--r); }
.btn.block { width: 100%; }
.btn.icon { padding: .4rem; min-width: 2.15rem; min-height: 2.15rem; }
.btn svg { flex: none; }

.btn.loading .btn-label { opacity: .35; }
.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn.loading { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- campos ---------- */

.input-group { display: grid; gap: .34rem; }
.input-group + .input-group { margin-top: .95rem; }

label {
  font-size: .82rem;
  font-weight: 550;
  color: var(--ink-2);
  letter-spacing: .002em;
}

input, select, textarea {
  font: inherit;
  width: 100%;
  min-height: 2.63rem;
  padding: .58rem .72rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .75; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px color-mix(in oklab, var(--brand) 16%, transparent);
}
textarea { min-height: 5.13rem; resize: vertical; line-height: 1.5; }

select {
  appearance: none;
  padding-right: 2.1rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input-affix { position: relative; display: flex; }
.input-affix input { padding-right: 2.8rem; }
.affix-btn {
  position: absolute;
  right: 5px; top: 50%;
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  border: 0; border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.affix-btn:hover { background: var(--surface-3); color: var(--ink); }

.search {
  position: relative;
}
.search input { padding-left: 2.25rem; }
.search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }

/* ---------- avisos ---------- */

.alert {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  margin-top: .95rem;
  padding: .7rem .8rem;
  border-radius: var(--r-sm);
  font-size: .88rem;
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid color-mix(in oklab, var(--bad) 28%, transparent);
  animation: pop .22s var(--ease);
}
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 28%, transparent); }
.alert.info { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-line); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* ═══════════════ AUTENTICAÇÃO ═══════════════ */

.auth { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100dvh; }

.auth-art {
  position: relative;
  background:
    radial-gradient(120% 100% at 12% 8%, #14514a 0%, transparent 55%),
    radial-gradient(100% 90% at 88% 92%, #0f3f52 0%, transparent 55%),
    var(--side-bg);
  color: #e8f2f0;
  overflow: hidden;
  display: grid;
  align-items: center;
}
.auth-art::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(120% 90% at 30% 30%, #000 20%, transparent 78%);
}
.auth-art-inner { position: relative; z-index: 1; padding: clamp(2rem, 6vw, 4.5rem); max-width: 35rem; }
.auth-logo { display: flex; align-items: center; gap: .6rem; font-weight: 600; letter-spacing: -.01em; }
.logo-mark {
  display: grid; place-items: center;
  width: 2.4rem; height: 2.4rem;
  border-radius: 11px;
  background: linear-gradient(150deg, #2ec4b0, #0d7d72);
  color: #04211e;
  font-size: 1.05rem;
  box-shadow: 0 6px 16px -6px rgba(46, 196, 176, .7);
  flex: none;
}
.logo-mark.small { width: 1.9rem; height: 1.9rem; border-radius: 9px; font-size: .9rem; }
.auth-tagline { font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.16; margin: 2.2rem 0 1.6rem; font-weight: 640; letter-spacing: -.025em; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; color: #b8ccc9; }
.auth-points li { display: flex; gap: .6rem; align-items: center; font-size: .95rem; }
.tick {
  display: grid; place-items: center;
  width: 21px; height: 21px; flex: none;
  border-radius: 50%;
  background: rgba(46, 196, 176, .16);
  color: #4bdcc6;
  font-size: .68rem;
}
.auth-foot { margin-top: 2.6rem; font-size: .82rem; color: #6f8b88; }

.auth-panel { display: grid; place-items: center; padding: 1.5rem; background: var(--surface); }
.auth-card { width: min(23.8rem, 100%); animation: rise .4s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.auth-card-head { margin-bottom: 1.6rem; }
.auth-card-head .logo-mark { display: none; }
.auth-card-head h1 { font-size: 1.6rem; letter-spacing: -.025em; margin-bottom: .3rem; }
.auth-card-head .sub { color: var(--ink-3); font-size: .91rem; }
.auth-card .btn.primary { margin-top: 1.5rem; }
.auth-help { margin-top: 1.4rem; font-size: .82rem; text-align: center; }

/* ═══════════════ ESTRUTURA ═══════════════ */

.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-ink);
  padding: 1.1rem .8rem;
  gap: 1.2rem;
}
.side-brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .45rem; font-weight: 600; font-size: .95rem; color: #fff; letter-spacing: -.01em; }
.side-nav { display: grid; gap: .18rem; flex: 1; align-content: start; }
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .7rem;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--side-ink-dim);
  font: inherit; font-weight: 520;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item svg { flex: none; opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--side-ink); }
.nav-item[aria-current="true"] { background: var(--side-active); color: #fff; font-weight: 600; }
.nav-item[aria-current="true"] svg { color: var(--brand-strong); opacity: 1; }
.nav-badge { margin-left: auto; font-size: .72rem; background: rgba(255,255,255,.1); padding: .05rem .42rem; border-radius: var(--r-pill); }

.side-foot { border-top: 1px solid var(--side-line); padding-top: .9rem; display: grid; gap: .6rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: 0 .45rem; min-width: 0; }
.user-meta { display: grid; min-width: 0; }
.user-meta strong { font-size: .88rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--side-ink-dim); font-size: .74rem; }
.side-actions { display: grid; gap: .3rem; }
.sidebar .btn.ghost { --btn-bg: transparent; --btn-line: var(--side-line); --btn-ink: var(--side-ink-dim); }
.sidebar .btn.ghost:hover { --btn-bg: rgba(255,255,255,.05); --btn-ink: #fff; --btn-line: #2c414c; }

.avatar {
  display: grid; place-items: center;
  width: 2.15rem; height: 2.15rem; flex: none;
  border-radius: 50%;
  background: linear-gradient(150deg, #2ec4b0, #0d7d72);
  color: #04211e;
  font-size: .8rem; font-weight: 700;
  letter-spacing: .01em;
}
.avatar.sm { width: 1.7rem; height: 1.7rem; font-size: .7rem; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 1rem;
  padding: 1.05rem clamp(1rem, 3vw, 2rem);
  padding-top: calc(1.05rem + env(safe-area-inset-top));
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: none; }
.page-title { flex: 1; min-width: 0; }
.page-title h1 { font-size: 1.34rem; }
.page-title p { font-size: .87rem; margin-top: .12rem; }
.topbar-actions { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.content {
  padding: clamp(1rem, 3vw, 1.9rem);
  padding-bottom: 4rem;
  display: grid;
  gap: 1.1rem;
  align-content: start;
  max-width: var(--content-max);
  width: 100%;
}
.content > * { animation: fade .28s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.bottom-nav { display: none; }

/* ═══════════════ CARTÕES ═══════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; flex-wrap: wrap;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.card-head .head-sub { font-size: .82rem; color: var(--ink-3); margin-top: .1rem; }
.card-body { padding: 1.15rem; }
.card-body.tight { padding: .55rem .5rem; }
.card-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- indicadores ---------- */

.stats { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(11.9rem, 1fr)); }
.stat {
  position: relative;
  overflow: hidden;
  padding: 1.05rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.stat:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; gap: .5rem; }
.stat-ico {
  display: grid; place-items: center;
  width: 1.9rem; height: 1.9rem; flex: none;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
}
.stat-ico.good { background: var(--good-soft); color: var(--good); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-ico.bad  { background: var(--bad-soft);  color: var(--bad); }
.stat .label { font-size: .78rem; font-weight: 560; letter-spacing: .015em; color: var(--ink-3); text-transform: uppercase; }
.stat .value { font-size: 2rem; font-weight: 650; letter-spacing: -.03em; margin-top: .5rem; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat .value .unit { font-size: 1.05rem; font-weight: 550; color: var(--ink-3); margin-left: .12rem; }
.stat .sub { font-size: .82rem; color: var(--ink-3); margin-top: .22rem; }

/* ---------- turno / check-in ---------- */

.shift {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.6rem;
  align-items: center;
  padding: 1.4rem 1.5rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--sh-1);
}
.shift.live { border-color: var(--brand-line); background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 62%); }

.ring { position: relative; width: 8.25rem; height: 8.25rem; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; width: 100%; height: 100%; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease); }
.ring .ring-mid {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
}
.ring .t { font-size: 1.34rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring .l { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-top: .12rem; }

.shift-info { display: grid; gap: .55rem; min-width: 0; }
.shift-state { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: 1.05rem; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: none; }
.pulse.on { background: var(--good); box-shadow: 0 0 0 0 color-mix(in oklab, var(--good) 60%, transparent); animation: beat 2.1s infinite; }
@keyframes beat {
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.shift-meta { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.shift-meta div { display: grid; }
.shift-meta dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.shift-meta dd { margin: .1rem 0 0; font-weight: 550; font-variant-numeric: tabular-nums; }
.shift-cta { margin-top: .35rem; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- barras / gráfico ---------- */

.chart { display: grid; gap: .28rem; }
.chart-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr 5rem;
  align-items: center;
  gap: .7rem;
  padding: .2rem .35rem;
  border-radius: var(--r-xs);
  transition: background .14s var(--ease);
}
.chart-row:hover { background: var(--surface-2); }
.chart-row.current .m { color: var(--brand); font-weight: 650; }
.chart-row .m { font-size: .8rem; color: var(--ink-3); font-weight: 520; }
.chart-track { position: relative; height: 1.25rem; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.chart-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 5px;
  transform-origin: left;
  animation: grow .5s var(--ease) both;
}
@keyframes grow { from { transform: scaleX(0); } }
.chart-row .v { text-align: right; font-size: .84rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-row .v.zero { color: var(--ink-3); opacity: .6; }

/* ---------- barra de progresso simples ---------- */

.meter { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 60px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---------- distintivos ---------- */

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .73rem; font-weight: 560;
  padding: .16rem .52rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.good { background: var(--good-soft); color: var(--good); border-color: color-mix(in oklab, var(--good) 25%, transparent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in oklab, var(--warn) 25%, transparent); }
.badge.bad  { background: var(--bad-soft);  color: var(--bad);  border-color: color-mix(in oklab, var(--bad) 25%, transparent); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand-line); }
.badge.off { color: var(--ink-3); }
.badge .dotlet { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- filtros ---------- */

.filters { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.filters .f { display: grid; gap: .3rem; flex: 1 1 165px; min-width: 145px; }
.filters .f.grow { flex: 2 1 240px; }
.filters .spacer { flex: 1 1 auto; }
.filters .btn-row { display: flex; gap: .45rem; align-items: center; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.segmented button {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: .84rem; font-weight: 540;
  color: var(--ink-3);
  padding: .3rem .7rem;
  border-radius: var(--r-xs);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); font-weight: 600; }

/* ---------- tabelas ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .045em;
  color: var(--ink-3);
  text-align: left;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--ink); }
thead th .arrow { opacity: .45; font-size: .68rem; }
tbody td {
  padding: .68rem .8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.cell-main .stack { display: grid; min-width: 0; }
.cell-main strong { font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main small { color: var(--ink-3); }
.row-actions { display: flex; gap: .3rem; justify-content: flex-end; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }

/* ---------- estados vazios / carregamento ---------- */

.empty { display: grid; justify-items: center; gap: .5rem; padding: 3rem 1.5rem; text-align: center; }
.empty .ico {
  display: grid; place-items: center;
  width: 3.4rem; height: 3.4rem;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--ink-3);
  margin-bottom: .3rem;
}
.empty h3 { font-size: 1rem; }
.empty p { color: var(--ink-3); font-size: .88rem; max-width: 42ch; }
.empty .btn { margin-top: .7rem; }

.skeleton { display: grid; gap: .9rem; }
.sk {
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.sk.row { height: 46px; }
.sk.big { height: 150px; }
.sk.stats { height: 104px; }

/* ---------- modal ---------- */

.modal {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(29.5rem, calc(100vw - 1.6rem));
  max-height: calc(100dvh - 3rem);
  box-shadow: var(--sh-3);
  overflow: visible;
}
.modal::backdrop { background: rgba(6, 12, 15, .55); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.modal[open] { animation: modalIn .24s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } }
#modal-form { display: flex; flex-direction: column; max-height: calc(100dvh - 3rem); }
.modal-head { padding: 1.15rem 1.3rem .3rem; }
.modal-head h2 { font-size: 1.12rem; }
.modal-head p { color: var(--ink-3); font-size: .87rem; margin-top: .28rem; }
.modal-body { padding: .9rem 1.3rem 1.1rem; overflow-y: auto; }
.modal-actions {
  display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap;
  padding: .9rem 1.3rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.code-out {
  display: grid; gap: .3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  padding: 1rem;
  margin: .8rem 0;
}
.code-out .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-family: inherit; }
.code-out .v { font-size: 1.5rem; font-weight: 650; letter-spacing: .14em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

/* ---------- notificações ---------- */

.toast-stack {
  position: fixed; z-index: 60;
  left: 50%; bottom: calc(1.1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid; gap: .5rem;
  width: min(26.5rem, calc(100vw - 1.6rem));
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: .6rem;
  padding: .72rem .95rem;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--sh-3);
  font-size: .9rem;
  animation: toastIn .26s var(--ease);
  pointer-events: auto;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
.toast .t-ico { flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ═══════════════ RESPONSIVO ═══════════════ */

@media (max-width: 1080px) {
  :root { --side-w: 13.8rem; }
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { background: var(--bg); align-items: start; padding-top: clamp(2rem, 12vh, 5rem); }
  .auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-2);
    padding: 1.5rem 1.35rem 1.6rem;
  }
  .auth-card-head { text-align: center; }
  .auth-card-head .logo-mark { display: grid; margin: 0 auto .9rem; }

  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar-brand { display: grid; }
  .topbar { padding: .8rem 1rem; padding-top: calc(.8rem + env(safe-area-inset-top)); gap: .75rem; }
  .page-title h1 { font-size: 1.12rem; }
  .page-title p { display: none; }
  .content { padding-bottom: calc(5.4rem + env(safe-area-inset-bottom)); }

  .bottom-nav {
    position: fixed; z-index: 30;
    left: 0; right: 0; bottom: 0;
    display: flex;
    background: color-mix(in oklab, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-item {
    flex: 1;
    flex-direction: column;
    gap: .18rem;
    padding: .4rem .2rem;
    font-size: .69rem;
    font-weight: 550;
    color: var(--ink-3);
    text-align: center;
    align-items: center;
  }
  .bottom-nav .nav-item[aria-current="true"] { background: transparent; color: var(--brand); }
  .bottom-nav .nav-item[aria-current="true"] svg { color: var(--brand); }
  .bottom-nav .nav-badge { display: none; }

  .shift { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 1.1rem; padding: 1.4rem 1.1rem; }
  .shift-info { justify-items: center; }
  .shift-meta { justify-content: center; }
  .shift-cta { width: 100%; }
  .shift-cta .btn { width: 100%; }

  /* 16px evita que o Safari do iPhone dê zoom ao focar um campo. */
  input, select, textarea { font-size: 16px; }
}

/* Tabelas viram cartões no telemóvel */
@media (max-width: 680px) {
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .65rem; }
  .stat { padding: .85rem .9rem; }
  .stat .value { font-size: 1.55rem; }

  .grid-2 { grid-template-columns: 1fr; }

  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive thead { display: none; }
  table.responsive tr {
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: .6rem;
    padding: .3rem .1rem;
    background: var(--surface);
  }
  table.responsive tr:hover { background: var(--surface); }
  table.responsive td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: .42rem .8rem;
    text-align: right;
  }
  table.responsive td::before {
    content: attr(data-label);
    font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ink-3);
    text-align: left;
    flex: none;
  }
  table.responsive td:empty { display: none; }
  table.responsive td[data-label=""] { justify-content: flex-end; }
  table.responsive td .cell-main { justify-content: flex-end; }
  table.responsive .row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .card-body.tight { padding: .6rem; }
  .table-wrap { overflow: visible; }
}


/* ═══════════════ ECRÃS GRANDES ═══════════════ */
/*
   Abaixo de 1500px NADA muda: a escala base fica nos 16px e todo o
   comportamento responsivo já existente mantém-se intacto. Acima disso a raiz
   cresce e, como o resto da folha está em rem, tudo acompanha em proporção —
   texto, botões, alturas de campo, avatares, anel do turno e espaçamentos.
*/
@media (min-width: 1500px) {
  html { font-size: clamp(16px, .55vw + 7.75px, 19px); }
  :root { --content-max: 1560px; }
  .ring { width: 9.4rem; height: 9.4rem; }
  .chart-row { grid-template-columns: 3rem 1fr 6rem; }
}

@media (min-width: 1800px) {
  :root { --content-max: 1800px; }
}

@media (min-width: 2200px) {
  :root { --content-max: 2060px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
