:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --sidebar: #1e293b;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --hover: #f1f5f9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --sidebar: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --hover: #2d3748;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text);
    overflow: hidden;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

/* Sidebar */
aside {
    background-color: var(--sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
}

aside .logo {
    padding: 0 2rem;
    margin-bottom: 3rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--primary);
}

aside nav {
    flex: 1;
}

aside nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 2rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

aside nav a:hover, aside nav a.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-left-color: var(--primary);
}

/* Main Content */
main {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

header {
    background: var(--surface);
    padding: 1rem 3rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.content-area {
    padding: 3rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Components */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* Charts */
.card canvas {
    max-height: 250px;
    width: 100% !important;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Calendar */
.calendar {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.calendar th {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.calendar td {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid var(--border);
    font-size: 0.875rem;
    position: relative;
    cursor: default;
}

.calendar .today {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: bold;
}

.calendar .present {
    border-bottom: 3px solid var(--success);
}

.calendar .absent {
    border-bottom: 3px solid var(--danger);
}

.calendar .half-day {
    border-bottom: 3px solid var(--warning);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--hover);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #475569; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-present { background: #dcfce7; color: #166534; }
.badge-absent { background: #fee2e2; color: #991b1b; }
.badge-half { background: #fef3c7; color: #92400e; }

/* Modal Placeholder */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
}

/* Utils */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.mt-4 { margin-top: 1rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-1 { gap: 0.25rem; }
/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.toast {
    background: var(--sidebar);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.hidden { display: none !important; }

/* Standalone Kiosk Mode Layout Modifiers */
.app-container.kiosk-mode {
    grid-template-columns: 1fr;
}
.app-container.kiosk-mode aside {
    display: none !important;
}
.app-container.kiosk-mode header {
    display: none !important;
}
.app-container.kiosk-mode #premium-banner {
    display: none !important;
}
.app-container.kiosk-mode .content-area {
    padding: 0;
    max-width: 100vw;
    margin: 0;
}
.app-container.kiosk-mode #view-kiosk {
    min-height: 100vh !important;
    padding: 0 !important;
    background: var(--background);
}

