/* =====================================================================
   Sponto · Administrativo — estética "cartão de ponto industrial"
   ===================================================================== */

: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;
    background-color: var(--bg);
    background-image:
        radial-gradient(1100px 520px at 85% -12%, rgba(255, 176, 0, .05), transparent 60%),
        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; }

/* ------------------------------------------------------------------ *
 * Animações                                                           *
 * ------------------------------------------------------------------ */
@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; } }

/* ------------------------------------------------------------------ *
 * Relógio LED                                                         *
 * ------------------------------------------------------------------ */
.led-clock {
    font-family: var(--mono);
    font-weight: 500;
    font-size: 1.15rem;
    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; }

/* ------------------------------------------------------------------ *
 * Login — cartão de ponto                                              *
 * ------------------------------------------------------------------ */
.login {
    min-height: 100vh;
    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;
}
/* faixa superior perfurada */
.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;
    color: var(--paper);
}
.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;
}

/* ------------------------------------------------------------------ *
 * Estrutura do app                                                    *
 * ------------------------------------------------------------------ */
.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 236px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 10;
}
.brand { padding: 24px 20px 18px; border-bottom: 1px dashed var(--line); }
.brand h1 { font-family: var(--cond); font-weight: 700; font-size: 1.6rem; letter-spacing: .05em; }
.brand .sub {
    font-family: var(--mono);
    font-size: .6rem;
    color: var(--faint);
    letter-spacing: .2em;
    text-transform: uppercase;
}

#nav { padding: 14px 0; flex: 1; }
#nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 20px;
    color: var(--muted);
    text-decoration: none;
    font-family: var(--cond);
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s;
}
#nav a .num {
    font-family: var(--mono);
    font-size: .64rem;
    color: var(--faint);
    letter-spacing: 0;
}
#nav a:hover { color: var(--paper); }
#nav a.active {
    color: var(--amber);
    border-left-color: var(--amber);
    background: linear-gradient(90deg, var(--amber-soft), transparent 75%);
}
#nav a.active .num { color: var(--amber); }

.side-foot { padding: 16px; border-top: 1px dashed var(--line); }
.admin-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .84rem;
    color: var(--muted);
    padding: 4px 6px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chip-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(63, 215, 124, .7);
    flex: none;
}

.main { margin-left: 236px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: rgba(13, 17, 18, .82);
    backdrop-filter: blur(8px);
    z-index: 5;
}
.topbar h2 {
    font-family: var(--cond);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.topbar h2::before {
    content: '//';
    color: var(--amber);
    margin-right: 10px;
    font-family: var(--mono);
    font-weight: 400;
}

.view { padding: 28px 30px 60px; max-width: 1240px; width: 100%; }
.view > * { animation: rise .38s both; }
.view > *:nth-child(2) { animation-delay: .07s; }
.view > *:nth-child(3) { animation-delay: .14s; }
.view > *:nth-child(4) { animation-delay: .21s; }

/* ------------------------------------------------------------------ *
 * Componentes                                                         *
 * ------------------------------------------------------------------ */
.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; transform: none; }
.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.danger { color: var(--red); border-color: rgba(255, 107, 87, .45); background: transparent; }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #1B0C08; }
.btn.sm { padding: 5px 11px; font-size: .72rem; }
.btn-block { width: 100%; }

.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, .field select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--paper);
    font-family: var(--body);
    font-size: .92rem;
    padding: 9px 12px;
    border-radius: 2px;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-soft);
}
.field .hint { font-size: .74rem; color: var(--faint); }
.field input::placeholder { color: var(--faint); }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 18px;
}
.toolbar .field { min-width: 170px; }
.toolbar .spacer { flex: 1; }

/* KPIs */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.kpi {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 16px 18px 14px;
    position: relative;
    overflow: hidden;
}
.kpi::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--amber);
}
.kpi.green::before { background: var(--green); }
.kpi.red::before { background: var(--red); }
.kpi.dim::before { background: var(--faint); }
.kpi .v {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 2rem;
    color: var(--paper);
    line-height: 1.1;
}
.kpi .v small { font-size: 1rem; color: var(--muted); }
.kpi .l {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .11em;
    font-size: .7rem;
    color: var(--muted);
    margin-top: 4px;
}

/* Painéis */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
}
.panel > header {
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.panel > header h3 {
    font-family: var(--cond);
    font-weight: 600;
    font-size: .92rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--paper);
}
.panel > header h3::before { content: '▸ '; color: var(--amber); }
.panel .p-body { padding: 16px 18px; }
.panel .p-body.flush { padding: 0; }

/* Tabela ledger */
.ledger { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ledger th {
    font-family: var(--cond);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .13em;
    font-size: .66rem;
    color: var(--faint);
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.ledger td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--paper);
    vertical-align: middle;
}
.ledger tbody tr:last-child td { border-bottom: none; }
.ledger tbody tr { transition: background .12s; }
.ledger tbody tr:hover { background: rgba(255, 176, 0, .035); }
.ledger .num, .ledger td.mono { font-family: var(--mono); font-size: .84rem; }
.ledger td.r, .ledger th.r { text-align: right; }
.ledger td.c, .ledger th.c { text-align: center; }
.ledger .sub { display: block; font-size: .76rem; color: var(--faint); margin-top: 1px; }
.ledger .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Carimbos */
.stamp {
    display: inline-block;
    font-family: var(--cond);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .68rem;
    padding: 2px 9px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    transform: rotate(-1.6deg);
    white-space: nowrap;
}
.stamp.on   { color: var(--green); background: var(--green-soft); }
.stamp.off  { color: var(--muted); }
.stamp.late { color: var(--amber); background: var(--amber-soft); }
.stamp.miss { color: var(--red); background: var(--red-soft); }
.stamp.ok   { color: var(--green); }

/* Estados vazios / carregando */
.empty {
    border: 1px dashed var(--line);
    border-radius: 3px;
    padding: 38px 20px;
    text-align: center;
    color: var(--muted);
    font-family: var(--cond);
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .82rem;
}
.loading {
    padding: 38px 20px;
    text-align: center;
    font-family: var(--mono);
    color: var(--amber);
    letter-spacing: .3em;
    text-transform: uppercase;
    font-size: .72rem;
    animation: pulse 1.1s ease-in-out infinite;
}

/* Paginação */
.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    padding: 12px 14px;
    border-top: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: .76rem;
    color: var(--muted);
}

/* Feed últimos registros */
.feed { list-style: none; }
.feed li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line-soft);
    font-size: .88rem;
}
.feed li:last-child { border-bottom: none; }
.feed .t {
    font-family: var(--mono);
    color: var(--amber);
    font-size: .82rem;
    min-width: 52px;
}
.feed .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .tag {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .66rem;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 1px 8px;
    border-radius: 2px;
}
.feed .tag.in { color: var(--green); border-color: rgba(63, 215, 124, .35); }
.feed .tag.out { color: var(--red); border-color: rgba(255, 107, 87, .35); }

/* Abas */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
    font-family: var(--cond);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 9px 16px;
    cursor: pointer;
}
.tabs button.active { color: var(--amber); border-bottom-color: var(--amber); }
.tabs button:hover { color: var(--paper); }

/* Modal */
.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;
}
.m-body .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.confirm-msg { color: var(--muted); line-height: 1.55; }

/* Senha gerada */
.senha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg);
    border: 1px dashed var(--amber);
    padding: 12px 16px;
    margin-top: 14px;
}
.senha-box code {
    font-family: var(--mono);
    font-size: 1.05rem;
    color: var(--amber);
    letter-spacing: .14em;
}

/* Toasts */
#toast-root {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 80;
    max-width: min(380px, 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; }

/* ------------------------------------------------------------------ *
 * Responsivo                                                          *
 * ------------------------------------------------------------------ */
@media (max-width: 940px) {
    .sidebar {
        position: static;
        width: auto;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    .brand { border-bottom: none; padding: 14px 16px; }
    #nav { display: flex; padding: 0; flex: 1; overflow-x: auto; }
    #nav a { border-left: none; border-bottom: 3px solid transparent; padding: 14px 12px; white-space: nowrap; }
    #nav a.active { border-bottom-color: var(--amber); background: none; }
    .side-foot { border-top: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
    .admin-chip { padding: 0; }
    .main { margin-left: 0; }
    .view { padding: 20px 16px 50px; }
    .m-body .grid-2 { grid-template-columns: 1fr; }
    .ledger th:nth-child(n+5), .ledger td:nth-child(n+5) { display: none; }
}
