@import url('https://fonts.googleapis.com/css2?family=Alata&display=swap');

:root {
    --navy: #0B1C3D;
    --blue: #1A5FCC;
    --accent: #00C48C;
    --bg: #F5F7FB;
    --white: #ffffff;
    --border: #E2E8F4;
    --text: #0B1C3D;
    --text-muted: #6B7A8F;
    --shadow: 0 2px 12px rgba(11,28,61,0.08);
    --shadow-lg: 0 8px 32px rgba(11,28,61,0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Alata', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

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

h1, h2, h3, h4 { font-family: 'Alata', sans-serif; color: var(--navy); margin: 0 0 12px; }
p { margin: 0 0 12px; }

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--navy);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    padding: 24px 20px;
    font-size: 20px;
    font-weight: bold;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
    list-style: none;
    padding: 16px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: white;
    background: rgba(255,255,255,0.1);
    text-decoration: none;
}

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

.main-content {
    flex: 1;
    overflow: auto;
    padding: 32px;
}

.topbar {
    background: white;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar-title { font-size: 20px; font-weight: bold; color: var(--navy); }
.topbar-user { font-size: 14px; color: var(--text-muted); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 22px;
}
.stat-card-value { font-size: 32px; font-weight: bold; color: var(--navy); }
.stat-card-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.icon-blue   { background: rgba(26,95,204,0.1); color: var(--blue); }
.icon-green  { background: rgba(0,196,140,0.1); color: var(--accent); }
.icon-orange { background: rgba(255,165,0,0.12); color: #cc8800; }
.icon-red    { background: rgba(239,68,68,0.1); color: #dc2626; }

.table-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 24px;
}
.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.table-title { font-size: 16px; font-weight: bold; color: var(--navy); }
.table-card table { width: 100%; border-collapse: collapse; }
.table-card th {
    background: #F8FAFC;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.table-card td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.table-card tr:last-child td { border-bottom: none; }
.table-card tr:hover td { background: #FAFBFF; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: 'Alata', sans-serif;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: #132850; color: white; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #00a070; color: white; }
.btn-blue { background: var(--blue); color: white; }
.btn-blue:hover { background: #1449a0; color: white; }
.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--navy); }
.btn-ghost:hover { background: var(--bg); color: var(--navy); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Alata', sans-serif;
    outline: none;
    background: white;
    color: var(--text);
    transition: border 0.2s;
}
.form-control:focus { border-color: var(--blue); }
.form-error { color: #EF4444; font-size: 12px; margin-top: 4px; }
.form-success { background: rgba(0,196,140,0.1); color: #00a070; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.form-alert { background: rgba(239,68,68,0.1); color: #dc2626; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-present  { background: rgba(0,196,140,0.1); color: #00a070; }
.badge-late     { background: rgba(255,165,0,0.12); color: #cc8800; }
.badge-absent   { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-active   { background: rgba(0,196,140,0.1); color: #00a070; }
.badge-inactive { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-suspended { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-plan { background: rgba(26,95,204,0.1); color: var(--blue); text-transform: uppercase; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11,28,61,0.55);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal-box {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 18px; font-weight: bold; color: var(--navy); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }

/* Auth pages */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #F0F5FF 0%, #F5FBF8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    font-size: 22px;
    font-weight: bold;
    color: var(--navy);
    text-align: center;
    margin-bottom: 8px;
}
.auth-logo span { color: var(--blue); }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.auth-footer { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 13px; }

/* Checkin (mobile) */
.checkin-page {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--navy) 0%, #1a3a6b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.checkin-card {
    background: white;
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.checkin-company { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.checkin-name { font-size: 24px; font-weight: bold; color: var(--navy); margin-bottom: 24px; }
.checkin-time { font-size: 36px; font-weight: bold; color: var(--blue); font-variant-numeric: tabular-nums; }
.checkin-date { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.checkin-btn {
    width: 100%;
    padding: 18px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-family: 'Alata', sans-serif;
    color: white;
    margin-top: 12px;
}
.checkin-btn-in { background: var(--accent); }
.checkin-btn-out { background: var(--blue); }
.checkin-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.checkin-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0,196,140,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 8px;
}

/* QR display */
.qr-wrap {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: inline-block;
    text-align: center;
    margin: 0 auto;
}
.qr-canvas { display: inline-block; margin: 0 auto; }
.qr-canvas img, .qr-canvas canvas { display: block; margin: 0 auto; }
.qr-timer { font-size: 20px; font-weight: bold; color: var(--blue); margin-top: 16px; font-variant-numeric: tabular-nums; }
.qr-instructions { max-width: 500px; margin: 24px auto 0; color: var(--text-muted); }

/* Calendar */
.calendar { background: white; border-radius: 12px; padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-day-header { text-align: center; font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 8px 0; text-transform: uppercase; }
.calendar-day {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid var(--border);
    background: white;
}
.calendar-day.empty { background: transparent; border: none; }
.calendar-day.weekend { background: #f8f8f8; color: #aaa; }
.calendar-day.present { background: rgba(0,196,140,0.15); color: #00a070; border-color: var(--accent); font-weight: bold; }
.calendar-day.late { background: rgba(255,165,0,0.15); color: #cc8800; border-color: #ffa500; font-weight: bold; }
.calendar-day.absent { background: rgba(239,68,68,0.12); color: #dc2626; border-color: #ef4444; font-weight: bold; }
.calendar-day.today { box-shadow: 0 0 0 2px var(--blue); }

/* Section header */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: 18px; font-weight: bold; color: var(--navy); margin: 0; }

.filters {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.filters .form-group { margin: 0; }
.filters .form-control { padding: 8px 12px; font-size: 13px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

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

.hamburger {
    display: none;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--navy);
    cursor: pointer;
    padding: 4px 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 999;
    }
    .sidebar.is-open { left: 0; }
    .main-content { padding: 20px 16px; }
    .topbar { padding: 14px 16px; }
    .hamburger { display: inline-flex; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-card-value { font-size: 24px; }
    .form-row { grid-template-columns: 1fr; }
    .table-card { overflow-x: auto; }
    .table-card table { min-width: 600px; }
}

@media print {
    .sidebar, .topbar, .btn, .filters, .no-print { display: none !important; }
    body, .main-content { background: white !important; padding: 0 !important; }
    .qr-wrap { box-shadow: none; border: none; }
}
