:root {
    --bg: #0f172a; --panel: #1e293b; --line: #334155; --muted: #94a3b8; --text: #f1f5f9;
    --blue: #2563eb; --green: #16a34a; --red: #dc2626; --ok: #4ade80; --err: #f87171; --warn: #fbbf24;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: #93c5fd; }
nav { display: flex; gap: 16px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
nav .brand { font-weight: 600; margin-right: auto; color: var(--text); text-decoration: none; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }
main { max-width: 1100px; margin: 0 auto; padding: 28px 16px; }
.center { text-align: center; }
.narrow { max-width: 420px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: 12px; padding: 18px; margin: 16px 0; }
h2 { margin-top: 0; }
.muted { color: var(--muted); }
input, select { padding: 10px 12px; margin: 6px 0; width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #0b1220; color: var(--text); font-size: 15px; }
input[type=date] { width: auto; }
button, a.button { display: inline-block; padding: 12px 22px; margin: 8px 4px; font-size: 16px; border: none; border-radius: 8px;
    background: var(--blue); color: white; cursor: pointer; text-decoration: none; }
button:disabled { opacity: .5; cursor: wait; }
button.secondary, a.button.secondary { background: var(--line); }
button.green, a.button.green { background: var(--green); }
button.red { background: var(--red); }
button.small { padding: 6px 12px; font-size: 13px; margin: 2px; }
.camera { position: relative; width: 100%; max-width: 420px; margin: 12px auto; }
.camera video, .camera img { width: 100%; border-radius: 12px; background: #000; display: block; transform: scaleX(-1); }
.camera .guide { position: absolute; left: 50%; top: 46%; width: 46%; aspect-ratio: 3/4; transform: translate(-50%, -50%);
    border: 2px dashed rgba(255,255,255,.45); border-radius: 50%; pointer-events: none; }
.status { margin-top: 14px; min-height: 24px; font-size: 17px; }
.error { color: var(--err); }
.success { color: var(--ok); }
.warn { color: var(--warn); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; background: var(--line); }
.badge.in { background: #14532d; color: var(--ok); }
.badge.out { background: #3f1d1d; color: var(--err); }
.badge.warn { background: #422006; color: var(--warn); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }
.login { color: var(--ok); }
.logout { color: var(--err); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 28px; }
form.inline { display: inline; }
nav a.active { color: var(--text); border-bottom: 2px solid var(--blue); padding-bottom: 2px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--panel); border-left: 4px solid var(--blue); }
.flash.success { border-color: var(--green); }
.flash.error { border-color: var(--red); color: var(--err); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 2px; }
.filters input, .filters select { width: auto; min-width: 140px; margin: 0; padding: 8px 10px; }
.filters button, .filters a.button { margin: 0; padding: 9px 16px; font-size: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.tabs a { padding: 6px 14px; border-radius: 999px; background: var(--panel); color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a.active { background: var(--blue); color: white; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }
.actions form { display: inline; margin: 0; }
button.link { background: none; color: #93c5fd; padding: 6px 8px; margin: 2px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid label { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.check input { width: auto; margin: 0; }
.badge.admin { background: #1e3a8a; color: #bfdbfe; }
.badge.deleted { background: #3f1d1d; color: var(--err); }
.small-text { font-size: 12px; }
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu .menu-list { position: absolute; right: 0; z-index: 10; min-width: 190px; background: #0b1220;
    border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
details.menu .menu-list form, details.menu .menu-list button { display: block; width: 100%; text-align: left; margin: 0; }
details.menu .menu-list button:hover { background: var(--panel); }
button.link.danger { color: var(--err); }
td .actions { flex-wrap: nowrap; align-items: center; }
details.menu summary.button { display: inline-block; padding: 6px 12px; margin: 2px; font-size: 13px;
    border-radius: 8px; background: var(--line); color: white; cursor: pointer; white-space: nowrap; }
tr:nth-last-child(-n+2) details.menu .menu-list { bottom: 100%; }
td .actions a.button { white-space: nowrap; }
.ms-button { background: #2f2f2f; border: 1px solid #5e5e5e; }
