/* FaceTrack – ops console theme */
:root {
    --bg: #060a0f;
    --bg-2: #0a1118;
    --panel: #0d151e;
    --panel-2: #111c27;
    --line: #1b2836;
    --line-2: #26384a;
    --text: #e6edf3;
    --muted: #7f92a6;
    --dim: #4f6274;
    --accent: #2ee6d0;
    --accent-ink: #032b27;
    --known: #34d399;
    --unknown: #fbbf24;
    --pending: #7dd3fc;
    --staff: #60a5fa;
    --vip: #f5c451;
    --watch: #ff4d5e;
    --radius: 10px;
    --display: "Chakra Petch", system-ui, sans-serif;
    --body: "IBM Plex Sans", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: radial-gradient(1200px 600px at 80% -10%, #0e2230 0%, transparent 60%), var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .02em; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
h1:focus { outline: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }

/* ---------- shell ---------- */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 28px;
    padding: 0 22px; height: 56px;
    background: rgba(6, 10, 15, .85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: 22px; height: 22px; position: relative; border: 2px solid var(--accent); border-radius: 4px;
    clip-path: polygon(0 0, 35% 0, 35% 12%, 65% 12%, 65% 0, 100% 0, 100% 35%, 88% 35%, 88% 65%, 100% 65%, 100% 100%, 65% 100%, 65% 88%, 35% 88%, 35% 100%, 0 100%, 0 65%, 12% 65%, 12% 35%, 0 35%); }
.brand-mark span { position: absolute; inset: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-text { font-family: var(--display); font-size: 17px; letter-spacing: .18em; font-weight: 500; }
.brand-text b { color: var(--accent); font-weight: 700; }
.nav { display: flex; gap: 4px; }
.nav a {
    color: var(--muted); padding: 7px 14px; border-radius: 7px; font-family: var(--display);
    font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--accent); background: rgba(46, 230, 208, .08); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar-clock { margin-left: auto; color: var(--dim); font-size: 12px; }
.content { flex: 1; padding: 20px 22px 32px; width: 100%; max-width: 1680px; margin: 0 auto; }

/* ---------- controls ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2);
    background: var(--panel-2); color: var(--text); font: 600 13px var(--body); cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { color: #ffb4bb; border-color: #5b2530; background: #1d0e12; }
.btn.danger:hover:not(:disabled) { border-color: var(--watch); }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 36px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600;
}
.input, select.input, textarea.input {
    height: 36px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line-2);
    background: var(--bg-2); color: var(--text); font: 14px var(--body); outline: none; width: 100%;
}
textarea.input { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 230, 208, .12); }
.input.invalid, .invalid { border-color: var(--watch) !important; }
.validation-message { color: #ff8f99; font-size: 12px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }

/* ---------- panels ---------- */
.panel {
    background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 12px; }
.panel-body { padding: 14px; }
.count {
    font-family: var(--mono); font-size: 11px; color: var(--accent); background: rgba(46, 230, 208, .1);
    padding: 1px 7px; border-radius: 99px;
}

.badge {
    display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 4px;
    font: 600 10.5px var(--display); text-transform: uppercase; letter-spacing: .1em;
    border: 1px solid currentColor; background: color-mix(in srgb, currentColor 12%, transparent);
}
.c-visitor { color: var(--known); }
.c-staff { color: var(--staff); }
.c-vip { color: var(--vip); }
.c-watchlist { color: var(--watch); }
.c-unknown { color: var(--unknown); }
.c-pending { color: var(--pending); }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.empty { padding: 28px 16px; text-align: center; color: var(--dim); font-size: 13px; }
.empty b { display: block; color: var(--muted); font-family: var(--display); letter-spacing: .08em; margin-bottom: 4px; }

.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid; font-size: 13px; }
.alert.err { color: #ffb4bb; border-color: #5b2530; background: #1d0e12; }
.alert.warn { color: #fde68a; border-color: #5b4a1c; background: #1c160a; }
.alert.ok { color: #a7f3d0; border-color: #1d4d3c; background: #0a1a14; }

/* ---------- live ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.viewport {
    position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
    background: #000; aspect-ratio: 16 / 9;
}
.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewport .scanlines { position: absolute; inset: 0; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px); }
.hud { position: absolute; left: 0; right: 0; display: flex; gap: 8px; padding: 12px; pointer-events: none;
    font-family: var(--mono); font-size: 11.5px; }
.hud.top { top: 0; }
.hud.bottom { bottom: 0; }
.hud-chip { background: rgba(4, 8, 12, .72); border: 1px solid rgba(255,255,255,.08); padding: 4px 9px; border-radius: 5px; color: #cbd5e1; }
.hud-chip b { color: var(--accent); font-weight: 500; }
.rec { display: inline-flex; align-items: center; gap: 6px; color: #fecaca; }
.rec::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--watch); box-shadow: 0 0 8px var(--watch); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.viewport-idle { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px;
    background: radial-gradient(circle at 50% 45%, #0d1c26 0%, #000 70%); }
.viewport-idle .reticle { width: 120px; height: 120px; margin: 0 auto 16px; position: relative; opacity: .7; }
.viewport-idle .reticle::before, .viewport-idle .reticle::after { content: ""; position: absolute; inset: 0; border: 2px solid var(--accent);
    clip-path: polygon(0 0, 30% 0, 30% 4%, 4% 4%, 4% 30%, 0 30%, 0 70%, 4% 70%, 4% 96%, 30% 96%, 30% 100%, 0 100%, 0 0, 100% 0, 100% 30%, 96% 30%, 96% 4%, 70% 4%, 70% 0, 100% 0, 100% 100%, 70% 100%, 70% 96%, 96% 96%, 96% 70%, 100% 70%, 100% 100%, 0 100%); }
.viewport-idle .reticle::after { inset: 34px; border-radius: 50%; clip-path: none; border-width: 1px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); opacity: .3; } }
.viewport-idle h3 { color: var(--text); font-size: 16px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 14px; margin-top: 12px; }
.controls .field { min-width: 120px; }
.controls .field.wide { min-width: 220px; flex: 1; }
.controls .field.slider { min-width: 170px; }
.slider-val { font-family: var(--mono); color: var(--accent); font-size: 11px; margin-left: 6px; text-transform: none; letter-spacing: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 2px 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; margin-right: 6px; vertical-align: -1px; }

.side { display: flex; flex-direction: column; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 11px 12px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat .v { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.1; }
.stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.match-card { padding: 14px; position: relative; overflow: hidden; }
.match-card.watchlist { box-shadow: inset 0 0 0 1px var(--watch), 0 0 30px rgba(255, 77, 94, .15); animation: alarm 1.4s infinite; }
@keyframes alarm { 50% { box-shadow: inset 0 0 0 1px var(--watch), 0 0 0 rgba(255,77,94,0); } }
.match-title { font: 700 12px var(--display); letter-spacing: .3em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.match-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }
.match-faces { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.face { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line-2); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face .tag { position: absolute; left: 6px; bottom: 6px; font: 600 9.5px var(--display); letter-spacing: .14em; text-transform: uppercase;
    background: rgba(4,8,12,.8); padding: 2px 6px; border-radius: 3px; color: var(--muted); }
.face .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font: 600 28px var(--display); }
.kv { display: grid; grid-template-columns: 74px 1fr; gap: 5px 10px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; padding-top: 2px; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }
.kv dd.name { font-family: var(--display); font-size: 17px; font-weight: 600; }
.scorebar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.scorebar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--known)); }

.list { max-height: 300px; overflow: auto; }
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.faded { opacity: .45; }
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--bg-2); border: 1px solid var(--line-2); flex: none; }
.thumb.lg { width: 56px; height: 56px; }
.item .t1 { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t2 { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { min-width: 0; flex: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; box-shadow: 0 0 6px currentColor; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal .panel-body { display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); }

/* ---------- people ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.toolbar .input { width: 260px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.person { overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.person:hover { border-color: var(--line-2); transform: translateY(-2px); }
.person-photo { aspect-ratio: 4 / 3; background: var(--bg-2); position: relative; overflow: hidden; }
.person-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person-photo .noimg { position: absolute; inset: 0; display: grid; place-items: center; font: 600 44px var(--display); color: var(--dim); }
.person-photo .badge { position: absolute; top: 10px; left: 10px; background: rgba(4,8,12,.8); }
.person-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.person-body .name { font: 600 16px var(--display); }
.person-body .sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.person-foot { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: center; }
.stat-strip { display: flex; gap: 22px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-strip div { font-size: 12px; color: var(--muted); }
.stat-strip b { display: block; font: 600 22px var(--display); color: var(--text); }

/* ---------- enroll ---------- */
.enroll { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.cam { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.cam canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam .hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(4,8,12,.8);
    padding: 5px 12px; border-radius: 99px; font-size: 12px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: 9px; border: 1px solid var(--line); width: fit-content; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 6px 14px; border-radius: 6px; font: 600 12.5px var(--body); cursor: pointer; }
.tabs button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.sample { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg-2); }
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sample .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(4,8,12,.8); color: #fff; font-size: 13px; line-height: 22px; padding: 0; }
.sample .x:hover { background: var(--watch); }
.sample .s { position: absolute; left: 4px; bottom: 4px; font: 500 10px var(--mono); background: rgba(4,8,12,.8); padding: 1px 5px; border-radius: 3px; }
.sample.new { border-color: var(--accent); }
.sample.primary-photo::after { content: "FOTO UTAMA"; position: absolute; top: 4px; left: 4px; font: 600 8.5px var(--display); letter-spacing: .1em;
    background: var(--accent); color: var(--accent-ink); padding: 1px 5px; border-radius: 3px; }
.file-drop { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 26px; text-align: center; color: var(--muted); position: relative; }
.file-drop:hover { border-color: var(--accent); color: var(--text); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font: 600 10.5px var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
    padding: 10px 12px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:hover td { background: rgba(255,255,255,.015); }
table.grid .faces { display: flex; gap: 6px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; }
.filters .field { min-width: 160px; }

/* ---------- loading ---------- */
.loader { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- blazor ---------- */
#blazor-error-ui { background: #3b0d13; color: #fecdd3; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
#blazor-error-ui a { color: #fff; text-decoration: underline; margin-left: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
    .live { grid-template-columns: 1fr; }
    .enroll { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .topbar { gap: 12px; padding: 0 12px; }
    .topbar-clock { display: none; }
    .nav a { padding: 7px 9px; letter-spacing: .04em; }
    .brand-text { display: none; }
    .controls .field, .controls .field.wide { min-width: 0; flex: 1 1 100%; }
    .controls .btn { flex: 1 1 100%; height: 44px; }
    .content { padding: 14px 12px 24px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar .input { width: 100%; }
}
