/* =====================================================================
   FaceINOUT Admin — corporate HR styling
   Single stylesheet, no build step, no external font or CDN request
   (the CSP forbids third-party origins).
   ===================================================================== */

:root {
    --bg:            #f4f6fb;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    --text:       #0f172a;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    --brand:       #1f3a93;
    --brand-dark:  #16296a;
    --brand-light: #e8edfb;

    --success:  #0f9d58;
    --success-bg: #e6f6ee;
    --warning:  #b45309;
    --warning-bg: #fef3c7;
    --danger:   #c0392b;
    --danger-bg: #fdecea;

    --radius:    12px;
    --radius-sm: 8px;
    --shadow:    0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);

    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Shell ---------------------------------------------------------- */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--brand);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 8px 22px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .16);
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: .04em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: .01em; }
.brand-text span { font-size: 11px; color: rgba(255, 255, 255, .62); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .78);
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(255, 255, 255, .17); color: #fff; }
.nav-icon { width: 18px; text-align: center; opacity: .9; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 14px; }

.user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: grid; place-items: center;
    font-weight: 700;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: rgba(255, 255, 255, .6); text-transform: capitalize; }

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

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.topbar-meta { color: var(--text-muted); font-size: 13px; }

.content { padding: 24px 28px 40px; flex: 1; }

.foot {
    padding: 16px 28px 24px;
    color: var(--text-faint);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

/* ---- Cards ---------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head p  { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---- Stat tiles ----------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat-hint  { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.stat.accent { border-left: 3px solid var(--brand); }
.stat.good   { border-left: 3px solid var(--success); }
.stat.warn   { border-left: 3px solid var(--warning); }
.stat.bad    { border-left: 3px solid var(--danger); }

/* ---- Tables --------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    text-align: left;
    padding: 11px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

table.data td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ---- Badges --------------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-neutral { background: #eef2f7; color: var(--text-muted); }
.badge-brand   { background: var(--brand-light); color: var(--brand); }

/* ---- Forms ---------------------------------------------------------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }

.field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .01em;
}

.field small { font-size: 11px; color: var(--text-faint); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="number"], input[type="month"], input[type="search"], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(31, 58, 147, .12);
}

.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkline input { width: auto; }

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters .field { min-width: 150px; }

/* ---- Buttons -------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .08s ease;
    text-decoration: none;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }

.btn-secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a03024; }

.btn-ghost {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-color: rgba(255, 255, 255, .22);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .2); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---- Alerts --------------------------------------------------------- */

.alert {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-bg); color: #08663a; border-color: #bfe8d4; }
.alert-error   { background: var(--danger-bg);  color: #8c2318; border-color: #f4c7c1; }
.alert-info    { background: var(--brand-light); color: var(--brand-dark); border-color: #c9d5f5; }
.alert-warning { background: var(--warning-bg); color: #7c4a06; border-color: #f2ddab; }

/* ---- Login ---------------------------------------------------------- */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, #16296a 0%, #1f3a93 45%, #2a4fc4 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 34px 30px;
    box-shadow: 0 24px 60px rgba(8, 15, 45, .35);
}

.login-brand { text-align: center; margin-bottom: 24px; }

.login-brand .mark {
    width: 54px; height: 54px;
    border-radius: 14px;
    background: var(--brand);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 19px;
    margin: 0 auto 12px;
}

.login-brand h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.login-brand p  { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.login-card .field { margin-bottom: 14px; }

/* ---- Trend bars ----------------------------------------------------- */

.trend { display: flex; align-items: flex-end; gap: 10px; height: 110px; padding: 6px 2px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }

.trend-bar {
    width: 100%;
    max-width: 38px;
    background: var(--brand-light);
    border-radius: 6px 6px 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 3px;
}

.trend-bar span { display: block; width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; }
.trend-bar .late { background: var(--warning); border-radius: 0; }
.trend-label { font-size: 11px; color: var(--text-muted); }
.trend-value { font-size: 12px; font-weight: 600; }

/* ---- Misc ----------------------------------------------------------- */

.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon { font-size: 32px; opacity: .35; margin-bottom: 10px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.pagination { display: flex; gap: 6px; align-items: center; padding: 14px 18px; flex-wrap: wrap; }
.pagination .page { padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; }
.pagination .page.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .info { margin-left: auto; color: var(--text-muted); font-size: 12px; }

.cols-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; }

.tab {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
}

.tab:hover { text-decoration: none; color: var(--brand); }
.tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.note {
    background: var(--brand-light);
    border-left: 3px solid var(--brand);
    padding: 11px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 12.5px;
    color: var(--brand-dark);
    margin-bottom: 16px;
}

.error-page { display: grid; place-items: center; min-height: 100vh; text-align: center; padding: 24px; }
.error-page h1 { font-size: 56px; margin: 0; color: var(--brand); letter-spacing: -.03em; }
.error-page p  { color: var(--text-muted); max-width: 440px; }

@media (max-width: 960px) {
    .cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; }
    .nav { flex-direction: row; overflow-x: auto; }
    .nav-item { white-space: nowrap; }
    .sidebar-foot { display: flex; align-items: center; gap: 12px; }
    .sidebar-foot form { margin-left: auto; }
    .content { padding: 16px; }
    .topbar { padding: 14px 16px; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 10px; }
}
