:root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --accent: #38bdf8;
    --success: #22c55e;
    --danger: #ef4444;
    --muted: #94a3b8;
    --border: #334155;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 { color: var(--accent); margin-top: 0; }
h3 { margin-top: 0; }

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

.text-muted { color: var(--muted); }

/* Cards */
.card {
    background: var(--card);
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1rem 0;
}

/* Buttons */
button, .btn {
    background: var(--accent);
    color: #0f172a;
    border: 0;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 0.5rem;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
}

button:hover, .btn:hover { opacity: 0.9; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

.btn-link {
    background: none;
    color: var(--text);
    border: 0;
    padding: 0;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-link:hover { color: var(--accent); }

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group small {
    display: block;
    color: var(--muted);
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group input[type="file"] {
    padding: 0.4rem;
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Auth card */
.auth-card {
    max-width: 400px;
    margin: 3rem auto;
    background: var(--card);
    border-radius: 10px;
    padding: 2rem;
}

/* Admin nav */
.admin-nav {
    background: var(--card);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links a {
    color: var(--text);
    font-size: 0.9rem;
}
.nav-links a:hover { color: var(--accent); }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--card);
    font-weight: 600;
    white-space: nowrap;
}

td.actions {
    white-space: nowrap;
}

td.actions a {
    margin-right: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-draft { background: var(--border); color: var(--muted); }
.badge-dibuka { background: #166534; color: #bbf7d0; }
.badge-ditutup { background: #7f1d1d; color: #fecaca; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.alert-success {
    background: #166534;
    color: #bbf7d0;
}

.alert-error {
    background: #7f1d1d;
    color: #fecaca;
}

/* Signature pad */
.signature-container {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    display: inline-block;
    max-width: 100%;
}

.signature-container canvas {
    display: block;
    border-radius: 4px;
    cursor: crosshair;
    max-width: 100%;
    touch-action: none;
}

.signature-actions {
    margin-top: 0.5rem;
    text-align: right;
}

/* Peserta search list */
.peserta-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.peserta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.peserta-item:last-child { border-bottom: none; }
.peserta-item:hover { background: var(--border); }
.peserta-item.peserta-hadir { opacity: 0.6; }
.peserta-item.peserta-hadir:hover { background: var(--border); }

.peserta-nama { font-weight: 500; }
.peserta-kelas { font-size: 0.8rem; color: var(--muted); }

.selected-peserta {
    background: var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

/* Hadir list */
.hadir-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
}

.hadir-list li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.hadir-list li small {
    color: var(--muted);
}

/* Presensi page */
.presensi-page {
    max-width: 500px;
    margin: 0 auto;
}

/* Pre */
pre {
    background: #0b1220;
    padding: 1rem;
    border-radius: 6px;
    overflow: auto;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 600px) {
    .container { padding: 1rem 0.75rem; }
    .admin-nav { flex-direction: column; gap: 0.5rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .hadir-list { columns: 1; }
    .signature-container canvas { width: 100%; height: 150px; }
}
