:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --dark: #111827;
    --green: #16a34a;
    --red: #dc2626;
    --yellow: #f59e0b;
    --blue: #2563eb;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #111827, #334155);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: white;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-card h1 { margin: 0 0 8px; font-size: 26px; }
.login-card p { color: var(--muted); margin: 0 0 20px; }

.topbar {
    background: var(--dark);
    color: white;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { font-weight: 700; letter-spacing: .3px; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a {
    padding: 9px 12px;
    border-radius: 10px;
    color: #e5e7eb;
    font-size: 14px;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); color: white; }

.container { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; }
.page-title h1 { margin: 0; font-size: 26px; }
.page-title p { margin: 5px 0 0; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(15,23,42,.05);
}
.stat h3 { margin: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.stat .num { margin-top: 8px; font-size: 34px; font-weight: 800; }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
input, select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    background: white;
}
input:focus, select:focus { outline: 2px solid rgba(37,99,235,.15); border-color: var(--blue); }

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    background: var(--dark);
    color: white;
}
.btn:hover { opacity: .9; }
.btn-blue { background: var(--blue); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-red { background: var(--red); color: white; }
.btn-gray { background: #e5e7eb; color: #111827; }
.btn-yellow { background: var(--yellow); color: #111827; }
.btn-small { padding: 7px 10px; font-size: 12px; border-radius: 8px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; background: #f9fafb; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-belum { background: #fef3c7; color: #92400e; }
.badge-sudah { background: #dcfce7; color: #166534; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 700; }
.alert-red { background: #fee2e2; color: #991b1b; }
.alert-green { background: #dcfce7; color: #166534; }
.alert-yellow { background: #fef3c7; color: #92400e; }
.muted { color: var(--muted); }
.center { text-align: center; }

.qr-box { display: flex; justify-content: center; padding: 18px; background: white; border: 1px dashed #cbd5e1; border-radius: 16px; }
#reader { width: 100%; max-width: 430px; margin: 0 auto; }
.scan-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-row strong { color: var(--muted); }

.ticket-page { background: white; }
.ticket {
    width: 80mm;
    margin: 0 auto;
    padding: 14px;
    font-family: Arial, Helvetica, sans-serif;
    color: #000;
}
.ticket h2 { text-align: center; margin: 0 0 4px; font-size: 18px; }
.ticket .sub { text-align: center; font-size: 12px; margin-bottom: 12px; }
.ticket .line { border-top: 1px dashed #000; margin: 10px 0; }
.ticket .trow { display: flex; justify-content: space-between; gap: 10px; margin: 7px 0; font-size: 13px; }
.ticket .trow span:first-child { font-weight: 700; }
.ticket-footer { text-align: center; font-size: 12px; margin-top: 12px; }
.print-actions { text-align: center; margin: 18px; }

@media (max-width: 860px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .grid, .form-row, .scan-layout { grid-template-columns: 1fr; }
    .container { padding: 16px; }
    .page-title { align-items: flex-start; flex-direction: column; }
}

@media print {
    body.ticket-page { background: white; }
    .print-actions { display: none; }
    .ticket { margin: 0; width: 80mm; }
}

@media print {
    .topbar,
    .page-title,
    .actions,
    .btn,
    .print-actions {
        display: none !important;
    }

    body {
        background: white !important;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none !important;
        border: 0 !important;
        margin: 0 auto !important;
    }
}