/* =====================================================================
   Sponto · Área do Funcionário — "relógio de bater ponto"
   ===================================================================== */

:root {
    --bg: #0D1112;
    --panel: #141A1C;
    --panel-2: #192123;
    --line: #26302F;
    --line-soft: #1D2628;

    --paper: #ECE9E0;
    --muted: #8B969A;
    --faint: #5B6569;

    --amber: #FFB000;
    --amber-hi: #FFC233;
    --amber-soft: rgba(255, 176, 0, .13);

    --green: #3FD77C;
    --green-soft: rgba(63, 215, 124, .12);
    --red: #FF6B57;
    --red-soft: rgba(255, 107, 87, .12);

    --cond: 'Saira Condensed', 'Arial Narrow', sans-serif;
    --body: 'Saira', 'Segoe UI', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }

body {
    font-family: var(--body);
    font-size: 15px;
    color: var(--paper);
    min-height: 100vh;
    min-height: 100svh;
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 460px at 50% -10%, rgba(255, 176, 0, .06), transparent 65%),
        radial-gradient(circle at 1px 1px, rgba(236, 233, 224, .04) 1px, transparent 1.6px);
    background-size: auto, 22px 22px;
}

body.no-scroll { overflow: hidden; }
.hidden { display: none !important; }
::selection { background: var(--amber); color: #151005; }

@keyframes rise  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }
@keyframes fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { to { visibility: hidden; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes stampIn {
    0% { transform: scale(2.4) rotate(-14deg); opacity: 0; }
    60% { transform: scale(.92) rotate(-1.6deg); opacity: 1; }
    100% { transform: scale(1) rotate(-1.6deg); opacity: 1; }
}

/* ------------------------------------------------------------------ *
 * Relógio LED                                                         *
 * ------------------------------------------------------------------ */
.led-clock {
    font-family: var(--mono);
    font-weight: 500;
    color: var(--amber);
    letter-spacing: .04em;
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    text-shadow: 0 0 14px rgba(255, 176, 0, .35);
}
.led-clock .colon { animation: blink 1s steps(2, start) infinite; }
.led-clock.big { font-size: 1.5rem; }

/* ------------------------------------------------------------------ *
 * Login (mesmo cartão do admin)                                       *
 * ------------------------------------------------------------------ */
.login { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.login-inner { width: min(400px, 94vw); animation: rise .45s both; }
.login-clock { text-align: center; margin-bottom: 26px; }
.login-clock .led-clock { font-size: 2.6rem; }
.login-tag {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .34em;
    font-size: .68rem;
    color: var(--faint);
    margin-top: 6px;
}

.timecard {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 3px;
    position: relative;
    padding-top: 40px;
}
.timecard::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 24px;
    border-bottom: 1px dashed var(--line);
    background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 9px);
    opacity: .8;
}
.hole { position: absolute; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .8); }
.hole-l { left: 14px; }
.hole-r { right: 14px; }

.tc-head { text-align: center; padding: 0 24px 16px; }
.tc-head h1 { font-family: var(--cond); font-weight: 700; font-size: 2rem; letter-spacing: .06em; }
.tc-sub {
    display: block;
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .22em;
    font-size: .7rem;
    color: var(--amber);
    margin-top: 2px;
}
.tc-body { padding: 6px 26px 24px; display: grid; gap: 15px; }
.login-erro {
    color: var(--red);
    font-size: .84rem;
    border-left: 3px solid var(--red);
    background: var(--red-soft);
    padding: 8px 12px;
}
.tc-foot {
    border-top: 1px dashed var(--line);
    padding: 10px 26px;
    font-family: var(--mono);
    font-size: .66rem;
    color: var(--faint);
    text-align: center;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------ *
 * Campos / botões (base)                                              *
 * ------------------------------------------------------------------ */
.field { display: grid; gap: 6px; }
.field label {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .68rem;
    color: var(--muted);
}
.field input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--paper);
    font-family: var(--body);
    font-size: .95rem;
    padding: 10px 12px;
    border-radius: 2px;
}
.field input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.field input::placeholder { color: var(--faint); }

.btn {
    font-family: var(--cond);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .82rem;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--paper);
    padding: 9px 18px;
    border-radius: 2px;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #171105; }
.btn.primary:hover { background: var(--amber-hi); border-color: var(--amber-hi); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 11px; font-size: .72rem; }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #1B0C08; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ *
 * App do funcionário                                                  *
 * ------------------------------------------------------------------ */
.app { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }

.fx-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(13, 17, 18, .85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.who h1 {
    font-family: var(--cond);
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: .04em;
    line-height: 1.15;
}
.who span {
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted);
    letter-spacing: .06em;
}
.top-right { display: flex; align-items: center; gap: 14px; }

.fx-main {
    width: min(560px, 100%);
    margin: 0 auto;
    padding: 22px 18px 70px;
    display: grid;
    gap: 18px;
    flex: 1;
}

/* --- Cartão de batida --- */
.punch-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 18px 18px 20px;
    position: relative;
    overflow: hidden;
    animation: rise .4s both;
}
.punch-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(340px 170px at 50% 0%, rgba(255, 176, 0, .08), transparent 70%);
    pointer-events: none;
}
.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    min-height: 30px;
}

.stamp {
    display: inline-block;
    font-family: var(--cond);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .72rem;
    padding: 3px 11px;
    border: 2px solid currentColor;
    border-radius: 2px;
    transform: rotate(-1.6deg);
}
.stamp.big { font-size: .85rem; }
.stamp.on   { color: var(--green); background: var(--green-soft); }
.stamp.off  { color: var(--muted); }
.stamp.late { color: var(--amber); background: var(--amber-soft); }
.stamp.anim { animation: stampIn .5s cubic-bezier(.2, 1.4, .4, 1) both; }

.desde { font-size: .78rem; color: var(--muted); }
.mono { font-family: var(--mono); }

.punch-face {
    text-align: center;
    padding: 18px 10px 22px;
    border: 1px dashed var(--line);
    border-radius: 3px;
    background: var(--bg);
    margin-bottom: 18px;
    position: relative;
}
.p-label {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .3em;
    font-size: .64rem;
    color: var(--faint);
}
.p-time {
    display: block;
    font-family: var(--mono);
    font-weight: 600;
    font-size: clamp(3rem, 16vw, 4.2rem);
    line-height: 1.05;
    color: var(--amber);
    text-shadow: 0 0 26px rgba(255, 176, 0, .3);
    letter-spacing: .02em;
}
.p-sec { font-size: .38em; color: var(--amber); opacity: .55; margin-left: 8px; }
.p-data { font-family: var(--mono); font-size: .74rem; color: var(--muted); letter-spacing: .08em; }

/* Botão gigante de bater */
.punch-btn {
    width: 100%;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 20px 16px;
    display: grid;
    gap: 3px;
    font-family: var(--cond);
    transition: transform .16s, filter .16s, box-shadow .16s;
}
.punch-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.punch-btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.punch-btn:disabled { opacity: .55; cursor: wait; }

.pb-title {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.pb-sub { font-family: var(--body); font-size: .78rem; opacity: .75; letter-spacing: .04em; }

/* Estado INICIAR (verde) */
.punch-btn.iniciar {
    background: linear-gradient(180deg, #2BB367, #1F8A4E);
    color: #08150D;
    box-shadow: 0 6px 26px rgba(63, 215, 124, .25), inset 0 1px 0 rgba(255, 255, 255, .22);
}
/* Estado FINALIZAR (âmbar) */
.punch-btn.finalizar {
    background: linear-gradient(180deg, var(--amber), #D99400);
    color: #171105;
    box-shadow: 0 6px 26px rgba(255, 176, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.jornada-hint {
    text-align: center;
    color: var(--faint);
    font-size: .7rem;
    margin-top: 12px;
    letter-spacing: .04em;
}

/* --- Painéis Hoje / Histórico --- */
.painel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 16px 18px;
    animation: rise .4s both;
}
.painel:nth-of-type(2) { animation-delay: .08s; }
.painel:nth-of-type(3) { animation-delay: .16s; }
.painel h2 {
    font-family: var(--cond);
    font-weight: 600;
    font-size: .92rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--paper);
    margin-bottom: 12px;
}
.painel h2::before { content: '▸ '; color: var(--amber); }
.painel-head { display: flex; align-items: baseline; justify-content: space-between; }
.link-mais {
    font-family: var(--cond);
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--amber);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 176, 0, .4);
}

/* Linhas de batida do dia */
.batida {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 2px;
    border-bottom: 1px dashed var(--line-soft);
    font-size: .9rem;
}
.batida:last-child { border-bottom: none; }
.batida .bt {
    width: 58px;
    text-align: center;
    font-family: var(--mono);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--amber);
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 5px 0;
    background: var(--bg);
}
.batida.entrada .bt { color: var(--green); border-color: rgba(63, 215, 124, .3); }
.batida.saida .bt   { color: var(--red); border-color: rgba(255, 107, 87, .3); }
.batida .b-label {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .7rem;
    color: var(--muted);
    flex: 1;
}
.batida .b-extra { font-family: var(--mono); font-size: .7rem; color: var(--faint); }

.hoje-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.hoje-total .ht-l {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .7rem;
    color: var(--muted);
}
.hoje-total .ht-v {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--amber);
}

/* Dia do histórico */
.hist-dia {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 2px;
    border-bottom: 1px dashed var(--line-soft);
}
.hist-dia:last-child { border-bottom: none; }
.hist-dia .hd-data { min-width: 86px; }
.hist-dia .hd-data .d { font-family: var(--mono); font-size: .84rem; }
.hist-dia .hd-data .s { font-family: var(--cond); font-size: .64rem; text-transform: uppercase; color: var(--faint); letter-spacing: .1em; }
.hist-dia .hd-batidas {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-family: var(--mono);
    font-size: .78rem;
}
.hist-dia .hd-batidas .in  { color: var(--green); }
.hist-dia .hd-batidas .out { color: var(--red); }
.hist-dia .hd-total { font-family: var(--mono); font-weight: 600; color: var(--amber); font-size: .9rem; }
.hist-dia.vazio { color: var(--faint); font-size: .82rem; }
.hist-dia.vazio .hd-total { color: var(--faint); }

.loading {
    padding: 24px 10px;
    text-align: center;
    font-family: var(--mono);
    color: var(--amber);
    letter-spacing: .3em;
    text-transform: uppercase;
    font-size: .7rem;
    animation: pulse 1.1s ease-in-out infinite;
}
.vazio-msg { color: var(--faint); font-size: .84rem; padding: 8px 0; }

/* --- Modal / Toast (mesmos do admin, via core.js) --- */
.overlay {
    position: fixed; inset: 0;
    background: rgba(7, 10, 11, .74);
    display: flex; align-items: center; justify-content: center;
    z-index: 50; padding: 20px;
    animation: fade .18s;
}
.modal {
    width: min(540px, 94vw);
    max-height: 88vh;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--amber);
    border-radius: 3px;
    animation: rise .22s;
}
.modal.wide { width: min(760px, 94vw); }
.modal header { padding: 15px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.m-title { font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; font-size: .95rem; }
.m-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.m-close:hover { color: var(--red); }
.m-body { padding: 20px 22px; }
.m-footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.confirm-msg { color: var(--muted); line-height: 1.55; }

#toast-root {
    position: fixed; right: 14px; bottom: 14px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 80; max-width: min(360px, 90vw);
}
.toast {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    padding: 12px 16px;
    color: var(--paper);
    font-size: .87rem;
    border-radius: 2px;
    animation: rise .2s;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .22s; }

/* --- Confirm de saída --- */
.sair-confirm {
    position: fixed; inset: 0;
    background: rgba(7, 10, 11, .74);
    display: flex; align-items: center; justify-content: center;
    z-index: 60; padding: 20px;
    animation: fade .18s;
}
.sc-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid var(--red);
    border-radius: 3px;
    padding: 22px;
    width: min(380px, 94vw);
    animation: rise .2s;
}
.sc-box p { color: var(--muted); margin-bottom: 18px; line-height: 1.5; font-size: .92rem; }
.sc-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* --- Modal histórico completo --- */
.hist-filtro { display: flex; gap: 12px; align-items: end; margin-bottom: 14px; }
.hist-filtro .field { flex: 1; }
.hist-filtro input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--paper);
    font-family: var(--mono);
    padding: 8px 10px;
    border-radius: 2px;
    font-size: .85rem;
}
.hist-filtro input:focus { outline: none; border-color: var(--amber); }
