/* ===================================================================
   Attendify — sistema de design
   Cores e tipografia inspiradas na maqueta do ecrã de início de sessão.
   =================================================================== */

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-soft: #EAF0FF;

    --ink: #16223A;          /* títulos / texto escuro (navy) */
    --text: #2B3550;         /* texto corrente */
    --muted: #8A94A6;        /* texto secundário / placeholders */
    --line: #E6E8EE;         /* limites / separadores */
    --field-bg: #FFFFFF;
    --bg: #F6F7F9;           /* fundo da app */
    --danger: #DC2626;
    --success: #16A34A;

    --radius: 14px;
    --radius-lg: 18px;
    --shadow-card: 0 1px 2px rgba(16, 34, 58, .04);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font);
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

#app { height: 100%; }

h1, h2, h3 { color: var(--ink); margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Ecrãs de autenticação (login / registo / recuperar) ------ */

.auth-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 32px 24px calc(24px + env(safe-area-inset-bottom));
    max-width: 520px;
    margin: 0 auto;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 8vh;
    margin-bottom: auto;
}

.brand-logo {
    width: 136px;
    height: 136px;
    border-radius: 18px;
    background: var(--primary);
    display: grid;
    place-items: center;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .32);
}
.brand-logo svg { width: 76px; height: 76px; }
.brand-img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }

.brand-name {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.5px;
    margin-top: 18px;
    color: var(--ink);
}

.brand-tagline {
    color: var(--muted);
    font-size: 14px;
    margin-top: 6px;
}

/* Logótipo em imagem (ex.: Time2Hit) em vez do quadrado com ícone. */
.brand-logo-img {
    width: 384px;
    max-width: 100%;
    height: 384px;
    object-fit: contain;
}

/* Logótipo Time2Hit por omissão no login (empresa sem logótipo próprio). */
.brand-logo-full {
    height: 132px;
    max-width: 100%;
    object-fit: contain;
}

/* Pergunta principal do ecrã de empresa (sem título — o logótipo é a marca). */
.brand-question {
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 20px;
    line-height: 1.25;
}

/* Fundo suave decorativo dos ecrãs de autenticação. */
.auth-decor { position: relative; overflow: hidden; }
.auth-decor::before,
.auth-decor::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.auth-decor::before {
    top: -140px; left: -90px; width: 340px; height: 340px;
    background: radial-gradient(circle, rgba(37, 99, 235, .12), transparent 70%);
}
.auth-decor::after {
    top: -60px; right: -110px; width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(37, 99, 235, .08), transparent 70%);
}
.auth-decor > * { position: relative; z-index: 1; }

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 40px;
    margin-bottom: 4vh;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

/* Etiqueta + dica de um campo (agrupadas, sem herdar o gap do formulário). */
.field-group { display: flex; flex-direction: column; }
.field-label { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.field-hint { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Cartão informativo (ex.: nota de segurança no ecrã de empresa). */
.info-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--primary-soft);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.info-icon { color: var(--primary); flex: none; display: grid; place-items: center; margin-top: 1px; }
.info-icon svg { width: 22px; height: 22px; }
.info-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.info-text { font-size: 13.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* Rodapé em duas colunas (copyright à esquerda, versão à direita). */
.auth-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    margin-top: 16px;
}

/* ---------- Campos de formulário ---------- */

.field {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--field-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 16px;
    height: 56px;
    transition: border-color .15s, box-shadow .15s;
}
.field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field .field-icon { color: var(--muted); display: grid; place-items: center; flex: none; }
.field .field-icon svg { width: 20px; height: 20px; }

.field input {
    border: 0;
    outline: 0;
    background: transparent;
    flex: 1;
    font-size: 15px;
    color: var(--ink);
    font-family: inherit;
    min-width: 0;
}
.field input::placeholder { color: var(--muted); }

.field-toggle {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 4px;
}
.field-toggle svg { width: 20px; height: 20px; }

/* ---------- Linha "lembrar-me" / "esqueceu-se" ---------- */

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox .box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    transition: all .15s;
}
.checkbox .box svg { width: 12px; height: 12px; opacity: 0; color: #fff; }
.checkbox input:checked + .box {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox input:checked + .box svg { opacity: 1; }
.checkbox input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }

.link-strong { color: var(--primary); font-weight: 600; }

/* ---------- Botões ---------- */

.btn {
    border: 0;
    border-radius: var(--radius);
    height: 54px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s, opacity .15s, transform .05s;
    width: 100%;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .6; cursor: default; }
.btn svg { width: 20px; height: 20px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .30);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-ghost { background: transparent; color: var(--primary); box-shadow: none; }

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 8px 20px rgba(220, 38, 38, .28); }

/* ---------- Rodapé dos ecrãs de autenticação ---------- */

.auth-footer {
    text-align: center;
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
}

/* ---------- Mensagens ---------- */

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13.5px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.alert-error { background: #FEF2F2; color: var(--danger); }
.alert-success { background: #F0FDF4; color: var(--success); }
.alert-warn { background: #FFFBEB; color: #B45309; }

/* ---------- Shell autenticado (Home / dashboard) ---------- */

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-topbar .brand-mini { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.app-topbar .brand-mini .dot {
    width: 32px; height: 32px; border-radius: 9px; background: var(--primary);
    display: grid; place-items: center;
}
.app-topbar .brand-mini .dot svg { width: 18px; height: 18px; }

.icon-btn {
    border: 0; background: transparent; color: var(--muted);
    width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
    display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }

.app-content { flex: 1; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-width: 720px; width: 100%; margin: 0 auto; }

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-card);
}

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .value { font-size: 26px; font-weight: 800; color: var(--ink); }
.stat .label { font-size: 13px; color: var(--muted); }

.greeting { font-size: 22px; font-weight: 800; color: var(--ink); }
.greeting-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

.muted { color: var(--muted); }
.mt-24 { margin-top: 24px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }

/* ===================================================================
   Blazor — infraestrutura (mantido do template)
   =================================================================== */

.validation-message { color: var(--danger); font-size: 13px; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 8px;
}

    .blazor-error-boundary::after {
        content: "Ocorreu um erro.";
    }

.status-bar-safe-area { display: none; }

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: #2456e6;
        width: 100%;
        z-index: 1;
    }
}

/* ===================================================================
   Shell autenticada — corpo + barra de navegação inferior
   =================================================================== */

.shell {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}
/* O corpo rola por dentro; a barra de abas fica fixa no fundo do ecrã (com
   min-height crescia com o conteúdo e empurrava a barra para fora da vista). */
.shell-body { flex: 1; min-height: 0; overflow-y: auto; }

.tabbar {
    display: flex;
    background: #fff;
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 0 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.tabbar button.tab { border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.tabbar .tab svg { width: 22px; height: 22px; }
.tabbar .tab.active { color: var(--primary); }

/* ===================================================================
   Ecrã de presença (Início)
   =================================================================== */

.att-header {
    background: linear-gradient(160deg, #2f6bff 0%, #1e4fd6 100%);
    color: #fff;
    padding: calc(16px + env(safe-area-inset-top)) 22px 40px;
}
.att-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.hicon {
    position: relative;
    border: 0;
    background: transparent;
    color: #fff;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    cursor: pointer;
}
.hicon svg { width: 24px; height: 24px; }
.hicon-dot {
    position: absolute; top: 7px; right: 7px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--danger);
    border: 2px solid #2f6bff;
}

.att-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.att-logo {
    width: 92px; height: 92px;
    border-radius: 12px;
    background: #fff;
    display: grid; place-items: center;
    flex: none;
}
.att-logo svg { width: 52px; height: 52px; color: var(--primary); }
.att-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.att-company { font-size: 16px; font-weight: 700; line-height: 1.15; }
.att-version { font-size: 12px; opacity: .85; margin-top: 1px; }
.att-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.att-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    border: 2px solid rgba(255, 255, 255, .6);
    display: grid; place-items: center;
    font-weight: 700; font-size: 16px; color: #fff;
    flex: none;
    cursor: pointer;
}

.att-greeting { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.att-sub { font-size: 14px; opacity: .85; margin-top: 3px; }

.att-body { padding: 0 20px 20px; margin-top: -26px; }

/* Cartão da hora */
.time-card { text-align: center; }
.time-date { color: var(--muted); font-size: 13px; }
.time-now {
    font-size: 44px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    line-height: 1.15;
    margin: 2px 0 10px;
}
.time-now .ampm { font-size: 18px; font-weight: 700; margin-left: 5px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--bg);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.is-active { color: var(--success); background: #F0FDF4; }
.status-pill.is-active .dot { background: var(--success); }

/* Localização */
.loc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 2px 0;
}
.loc { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; font-size: 14px; }
.loc svg { width: 18px; height: 18px; color: var(--muted); }

/* Projeto associado à presença */
.project-card {
    display: flex; align-items: center; gap: 14px;
    margin-top: 16px;
    padding: 14px 16px;
}
.proj-icon {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; flex: none;
}
.proj-icon svg { width: 22px; height: 22px; }
.proj-text { flex: 1; min-width: 0; }
.proj-label { color: var(--muted); font-size: 13px; }
.proj-name { color: var(--ink); font-weight: 700; font-size: 16px; margin-top: 2px; }
.proj-chevron { color: var(--muted); display: grid; place-items: center; flex: none; }
.proj-chevron svg { width: 20px; height: 20px; }

/* Botão central de registo */
.register-block { text-align: center; margin: 22px 0 8px; }
.register-btn {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(160deg, #2f6bff 0%, #1e4fd6 100%);
    color: #fff;
    display: grid;
    place-items: center;
    margin: 0 auto;
    cursor: pointer;
    box-shadow: 0 16px 34px rgba(37, 99, 235, .40);
    transition: transform .06s ease;
}
.register-btn:active { transform: scale(.97); }
.register-btn:disabled {
    background: #C7CDD6;
    box-shadow: none;
    cursor: not-allowed;
}
.register-btn:disabled:active { transform: none; }
.register-btn svg { width: 52px; height: 52px; }
.register-btn.exit {
    background: linear-gradient(160deg, #ff5d5d 0%, #e23b3b 100%);
    box-shadow: 0 16px 34px rgba(226, 59, 59, .38);
}
.register-label { color: var(--primary); font-weight: 700; font-size: 18px; margin-top: 16px; }
.register-btn.exit + .register-label { color: var(--danger); }
.register-note {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); font-size: 13px; margin-top: 7px;
}
.register-note svg { width: 15px; height: 15px; }

/* Resumo de hoje */
.summary {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    margin-top: 18px;
}
.summary-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.summary-grid { display: flex; align-items: stretch; margin-top: 4px; }
.summary-col {
    flex: 1;
    display: flex; align-items: center; gap: 11px;
    padding: 8px 0;
    min-width: 0;
}
.summary-col + .summary-col { border-left: 1px solid var(--line); padding-left: 18px; }
.summary-col > div { min-width: 0; }
.sicon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.sicon svg { width: 17px; height: 17px; }
.sicon.green { background: #E9F9EF; color: var(--success); }
.sicon.red { background: #FEECEC; color: var(--danger); }
.slabel { color: var(--ink); font-weight: 700; font-size: 14px; }
.stime { color: var(--muted); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Vários pares entrada/saída no mesmo dia (registos ilimitados). */
.punch-pair { padding: 6px 0; }
.punch-pair + .punch-pair { border-top: 1px solid var(--line); margin-top: 2px; padding-top: 10px; }
.punch-pair-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.punch-index { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.punch-tag {
    font-size: 11px; font-weight: 700; color: var(--success);
    background: #E9F9EF; border-radius: 999px; padding: 2px 8px;
}
.punch-notes { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 4px; padding-left: 2px; }
.punch-note { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.pn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 5px; }
.pn-dot.green { background: var(--success); }
.pn-dot.red { background: var(--danger); }

/* ---------- Histórico (Recentes + Calendário) ---------- */
.hist-loading { text-align: center; color: var(--muted); padding: 40px 0; font-weight: 600; }
.hist-month-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 4px 2px 12px; }

.hist-day {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 14px 16px; box-shadow: var(--shadow-card); margin-bottom: 14px;
}
.hist-day-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 8px; margin-bottom: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.hist-day-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.hist-day-count { font-size: 12px; font-weight: 600; color: var(--muted); flex: none; }
.punch-proj {
    font-size: 11px; font-weight: 700; color: var(--primary);
    background: var(--primary-soft); border-radius: 999px; padding: 2px 8px;
}

.cal { padding: 14px 14px 16px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.cal-nav {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
.cal-nav svg { width: 20px; height: 20px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { margin-bottom: 4px; }
.cal-dow-cell { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell {
    position: relative; aspect-ratio: 1 / 1; border: 0; background: transparent;
    border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 14px;
    display: grid; place-items: center; cursor: pointer;
}
.cal-cell.empty { visibility: hidden; cursor: default; }
.cal-cell.today { color: var(--primary); font-weight: 800; }
.cal-cell.sel { background: var(--primary); color: #fff; }
.cal-num { line-height: 1; }
.cal-dot {
    position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: var(--primary);
}
.cal-cell.sel .cal-dot { background: #fff; }
.cal-sel-label { margin: 18px 2px 10px; }
.cal-empty {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 20px 16px; text-align: center; color: var(--muted); font-weight: 600;
}

/* ---------- Páginas simples (Histórico / Calendário / Perfil) ---------- */

.plain-header {
    padding: calc(18px + env(safe-area-inset-top)) 20px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.plain-header h1 { font-size: 22px; font-weight: 800; }
.page-pad { padding: 20px; }

.empty-state { text-align: center; color: var(--muted); padding: 24px 20px 8px; }
.empty-state .ico {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; margin: 0 auto 14px;
}
.empty-state .ico svg { width: 28px; height: 28px; }
.empty-state h2 { font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.empty-state p { font-size: 15px; line-height: 1.5; }

/* Cabeçalho claro reutilizável (AppHeader): Histórico, Preferências, … */
.app-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
    background: #fff;
}
.app-header-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-header-logo {
    width: 92px; height: 92px; border-radius: 50%;
    background: #fff; color: var(--primary);
    display: grid; place-items: center; flex: none;
    overflow: hidden;
}
.app-header-logo svg { width: 52px; height: 52px; }
.app-header-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.app-header-company { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.15; }
.app-header-version { font-size: 12px; color: var(--muted); margin-top: 1px; }
.app-header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.app-header-bell {
    position: relative; border: 0; background: transparent; color: var(--ink);
    width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
}
.app-header-bell svg { width: 24px; height: 24px; }
.app-header-dot {
    position: absolute; top: 7px; right: 7px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--danger); border: 2px solid #fff;
}
.app-header-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none;
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
}

.page-title { font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -.3px; margin-bottom: 16px; }

/* Segmented control (abas Recentes / Calendário) */
.seg {
    display: flex; gap: 4px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 22px;
}
.seg-tab {
    flex: 1; text-align: center;
    padding: 11px 8px; border: 0; border-radius: 10px;
    background: transparent; color: var(--muted);
    font-family: inherit; font-weight: 700; font-size: 14px;
    cursor: pointer;
}
.seg-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-card); }

/* Ilustração do estado vazio */
.empty-illo { width: 190px; margin: 8px auto 22px; }
.empty-illo svg { width: 100%; height: auto; display: block; }

/* Cartão de dica */
.tip-card {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--primary-soft);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 8px;
}
.tip-icon {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; flex: none;
}
.tip-icon svg { width: 20px; height: 20px; }
.tip-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.tip-text { font-size: 13.5px; color: var(--text); margin-top: 3px; line-height: 1.45; }

.profile-card { display: flex; align-items: center; gap: 14px; }
.avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: none;
}
.profile-card .p-name { font-weight: 700; color: var(--ink); font-size: 16px; }
.profile-card .p-mail { color: var(--muted); font-size: 13.5px; }

.btn-outline { background: #fff; border: 1.5px solid var(--line); color: var(--danger); box-shadow: none; }
.btn-outline:hover:not(:disabled) { background: #FEF2F2; }

/* ---------- Ecrã Perfil / Preferências ---------- */

.page-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-title-row .page-title { margin-bottom: 0; }
.page-title-icon { color: var(--ink); display: grid; place-items: center; }
.page-title-icon svg { width: 26px; height: 26px; }

.profile-hero { display: flex; align-items: center; gap: 18px; }
.profile-hero-avatar {
    width: 92px; height: 92px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; font-weight: 800; font-size: 36px; flex: none;
}
.profile-hero-info { min-width: 0; }
.profile-hero-name { font-size: 22px; font-weight: 800; color: var(--ink); }
.profile-hero-role { color: var(--muted); font-size: 14px; margin: 3px 0 10px; overflow: hidden; text-overflow: ellipsis; }
.role-pill {
    display: inline-block; padding: 6px 15px; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary);
    font-size: 13px; font-weight: 700;
}

.menu-list { padding: 6px 18px; }
.menu-card-title { font-size: 18px; font-weight: 800; color: var(--ink); padding: 8px 0 2px; }
.menu-row {
    display: flex; align-items: center; gap: 14px;
    width: 100%; padding: 14px 0;
    border: 0; background: transparent; font-family: inherit; text-align: left; cursor: pointer;
}
.menu-icon {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; flex: none;
}
.menu-icon svg { width: 22px; height: 22px; }
.menu-text { flex: 1; min-width: 0; }
.menu-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.menu-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.menu-chevron { color: var(--muted); flex: none; display: grid; place-items: center; }
.menu-chevron svg { width: 20px; height: 20px; }
.menu-divider { height: 1px; background: var(--line); margin-left: 60px; }

.logout-card {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; background: #fff; cursor: pointer; font-family: inherit;
    color: var(--danger); font-weight: 800; font-size: 17px;
}
.logout-card svg { width: 22px; height: 22px; }

/* ---------- Folha de confirmação da selfie ---------- */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 34, 58, .45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
    animation: fade-in .15s ease;
}
.sheet {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 22px 22px 0 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 -8px 30px rgba(16, 34, 58, .25);
    animation: slide-up .2s ease;
}
.sheet-title { font-size: 18px; font-weight: 800; color: var(--ink); text-align: center; }

.confirm-sheet { gap: 10px; }
.confirm-message { color: var(--muted); font-size: 15px; text-align: center; margin: 0 0 4px; line-height: 1.4; }
.confirm-message strong { color: var(--ink); }
.sheet-icon {
    width: 52px; height: 52px; border-radius: 50%; margin: 2px auto 0;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center;
}
.sheet-icon svg { width: 26px; height: 26px; }

/* ---------- Páginas legais (Privacidade) ---------- */
.legal { padding: 18px 18px 20px; }
.legal p { color: var(--ink); font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.legal-updated { color: var(--muted); font-size: 13px; font-weight: 600; }
.legal-h { font-size: 15px; font-weight: 800; color: var(--ink); margin: 18px 0 6px; }
.legal-list { margin: 0 0 12px; padding-left: 20px; }
.legal-list li { color: var(--ink); font-size: 15px; line-height: 1.5; margin-bottom: 6px; }
.legal-note {
    margin-top: 16px !important; padding: 12px 14px; border-radius: var(--radius);
    background: var(--primary-soft); color: var(--muted) !important;
    font-size: 13px !important; line-height: 1.45 !important;
}

.selfie-preview {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    margin: 4px auto 2px;
    border: 4px solid var(--primary-soft);
    background: var(--bg);
}

.preview-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-bottom: 4px;
}
.preview-meta .coords { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.sheet-note {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    resize: none;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.sheet-note:focus { outline: none; border-color: var(--primary); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ==========================================================================
   Câmara (selfie) — overlay da app web. Não existe no telemóvel (lá é nativo);
   aqui é um <video>/<canvas> sobre um fundo escuro, gerido em js/interop.js.
   ========================================================================== */
.att-cam {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #000;
    display: flex;
    flex-direction: column;
}
.att-cam-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.att-cam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* espelho, como uma selfie */
}
.att-cam-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
    background: #000;
}
.att-cam-shutter {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #fff;
    border: 5px solid rgba(255, 255, 255, .35);
    cursor: pointer;
}
.att-cam-shutter:disabled { opacity: .4; cursor: default; }
.att-cam-cancel {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    min-width: 84px;
    text-align: left;
}
.att-cam-spacer { min-width: 84px; }
.att-cam-msg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 80%;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, .6);
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 15px;
}
