/* =====================================================================
   Sistem Absensi & Laporan Kerja Harian - stylesheet
   Mobile-first, mudah dibaca, tanpa dependensi eksternal.
   ===================================================================== */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --neutral-light: #f1f5f9;
    --bg: #f4f5f9;
    --surface: #ffffff;
    --text: #1f2330;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --nav-height: 64px;
    --topbar-height: 60px;
}

* { box-sizing: border-box; }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Layout shell ---------- */

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    padding-top: var(--topbar-height);
    padding-bottom: calc(var(--nav-height) + 16px);
}

.app-shell.no-nav {
    padding-bottom: 24px;
}

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    max-width: 480px;
    margin: 0 auto;
    height: var(--topbar-height);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(79,70,229,.25);
}

.topbar h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.topbar .topbar-sub {
    font-size: 12px;
    opacity: .85;
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-poin {
    background: rgba(255,255,255,.18);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.topbar-back {
    color: #fff;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px 4px 0;
}

main.content {
    padding: 16px;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-width: 480px;
    margin: 0 auto;
    height: var(--nav-height);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 50;
    box-shadow: 0 -2px 10px rgba(15,23,42,.06);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 2px;
}

.bottom-nav a .icon { font-size: 20px; line-height: 1; }

.bottom-nav a.active {
    color: var(--primary);
}

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

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title small a { font-size: 13px; font-weight: 600; }

/* Highlight card untuk total poin */
.poin-hero {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    border-radius: var(--radius);
    padding: 22px 20px;
    margin-bottom: 16px;
    box-shadow: 0 6px 16px rgba(79,70,229,.3);
}

.poin-hero .label {
    font-size: 13px;
    opacity: .9;
    font-weight: 600;
}

.poin-hero .value {
    font-size: 38px;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 4px;
}

/* ---------- Grid ringkasan (stat tiles) ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-tile {
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 14px;
    text-align: left;
}

.stat-tile .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-tile .stat-value {
    font-size: 22px;
    font-weight: 800;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 18px;
    text-align: center;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary { background: var(--neutral-light); color: var(--text); }

.btn-sm { min-height: 38px; font-size: 14px; width: auto; padding: 0 14px; }
.btn-block-group { display: flex; flex-direction: column; gap: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

input[type=text], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=file], input[type=time],
select, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 16px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

textarea { min-height: 120px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

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

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-neutral { background: var(--neutral-light); color: var(--text-muted); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ---------- List item (riwayat) ---------- */

.list-item {
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.list-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.list-item-title { font-weight: 700; font-size: 15px; }
.list-item-sub { font-size: 13px; color: var(--text-muted); }
.list-item-meta { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

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

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.alert-success { background: var(--success-light); color: #14532d; }
.alert-danger  { background: var(--danger-light); color: #7f1d1d; }
.alert-warning { background: var(--warning-light); color: #78350f; }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}
.empty-state .emoji { font-size: 40px; display: block; margin-bottom: 10px; }

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

.login-wrap {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo .emoji { font-size: 44px; }
.login-logo h1 { font-size: 20px; margin: 8px 0 2px; }
.login-logo p { color: var(--text-muted); font-size: 14px; margin: 0; }

.login-hint-box {
    margin-top: 18px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 12.5px;
    color: var(--primary-dark);
    line-height: 1.6;
}

/* ---------- Photo preview (absen) ---------- */

.photo-capture {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    padding: 18px;
    background: var(--neutral-light);
    margin-bottom: 14px;
}

.photo-capture img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    max-height: 260px;
    object-fit: cover;
}

.photo-capture .placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.gps-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--neutral-light);
    margin-bottom: 14px;
}
.gps-status.ok { background: var(--success-light); color: #14532d; }
.gps-status.err { background: var(--danger-light); color: #7f1d1d; }

/* ---------- Tables (dipakai halaman admin, tetap ramah HP) ---------- */

.table-responsive table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-responsive th, .table-responsive td {
    padding: 10px 12px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.table-responsive th {
    background: var(--neutral-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .table-responsive thead { display: none; }
    .table-responsive table, .table-responsive tbody, .table-responsive tr, .table-responsive td {
        display: block;
        width: 100%;
    }
    .table-responsive tr {
        margin-bottom: 12px;
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow);
        overflow: hidden;
    }
    .table-responsive td {
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        gap: 10px;
        text-align: right;
    }
    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        text-align: left;
    }
    .table-responsive td:last-child { border-bottom: none; }
}

/* ---------- Ranking ---------- */

.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.rank-number {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--neutral-light);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.rank-item.top1 .rank-number { background: #fde68a; color: #92400e; }
.rank-item.top2 .rank-number { background: #e5e7eb; color: #374151; }
.rank-item.top3 .rank-number { background: #fdba74; color: #9a3412; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 700; font-size: 14.5px; }
.rank-jabatan { font-size: 12px; color: var(--text-muted); }
.rank-poin { font-weight: 800; color: var(--primary); font-size: 16px; white-space: nowrap; }

/* ---------- Tabs (filter periode dsb) ---------- */

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.tabs a {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    background: var(--surface);
    color: var(--text-muted);
    box-shadow: var(--shadow);
    white-space: nowrap;
}
.tabs a.active { background: var(--primary); color: #fff; }

/* ---------- Section headers ---------- */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 10px;
}
.section-head h2 { font-size: 15px; margin: 0; }
.section-head a { font-size: 13px; font-weight: 700; }

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

@media (min-width: 481px) {
    body { background: #e5e7f0; }
}
