:root {
  color-scheme: dark;
  --bg: #0c0d0f;
  --bg2: rgba(25, 27, 30, .84);
  --card: rgba(36, 38, 42, .62);
  --card2: rgba(255, 255, 255, .045);
  --border: rgba(255, 255, 255, .10);
  --edge: rgba(255, 255, 255, .20);
  --text: #f1f2f4;
  --muted: #a6a9b0;
  --accent: #d9dfe7;
  --accent2: #64758a;
  --grad: linear-gradient(165deg, #f5f7fa, #bcc4ce);
  --on-accent: #1c2026;
  --glass: linear-gradient(155deg, rgba(255,255,255,.075), rgba(255,255,255,0) 48%);
  --sheet: rgba(32, 34, 38, .94);
  --field: rgba(0, 0, 0, .18);
  --ambient: rgba(160, 170, 185, .14);
  --reflection: rgba(255, 255, 255, .10);
  --hadir: #22c55e;
  --sakit: #d7dbe7;
  --izin: #60a5fa;
  --alpa: #eab308;
  --cabut: #f87171;
  --shadow: 0 16px 40px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.08);
  --radius: 24px;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #e9ebee;
  --bg2: rgba(249, 250, 252, .84);
  --card: rgba(255, 255, 255, .65);
  --card2: rgba(45, 52, 64, .045);
  --border: rgba(30, 38, 50, .10);
  --edge: rgba(255, 255, 255, .95);
  --text: #23272e;
  --muted: #606771;
  --accent: #344458;
  --accent2: #536b85;
  --grad: linear-gradient(165deg, #3e4856, #242c37);
  --on-accent: #fff;
  --glass: linear-gradient(155deg, rgba(255,255,255,.6), rgba(255,255,255,0) 52%);
  --sheet: rgba(250, 251, 253, .96);
  --field: rgba(255, 255, 255, .68);
  --ambient: rgba(137, 153, 177, .20);
  --reflection: rgba(255, 255, 255, .48);
  --hadir: #15803d;
  --sakit: #59616e;
  --izin: #1d4ed8;
  --alpa: #8a6500;
  --cabut: #c62e2e;
  --shadow: 0 12px 32px rgba(39,49,65,.06), inset 0 1px 0 rgba(255,255,255,.9);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
html { scrollbar-color: #70747c transparent; scrollbar-width: thin; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.55; isolation: isolate;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(ellipse at 70% -12%, var(--ambient), transparent 58%),
    radial-gradient(ellipse at 0% 80%, var(--ambient), transparent 48%);
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea { touch-action: manipulation; }
button:focus-visible, a:focus-visible, .row-click:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
input, select, textarea {
  font: inherit; font-size: 14px; min-width: 0;
  background: var(--field); color: var(--text);
  border: 1px solid var(--border); border-radius: 13px;
  padding: 11px 14px; outline: none; width: 100%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--card2);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input[type="checkbox"] { accent-color: var(--accent2); }
select option { background: var(--bg); color: var(--text); }
textarea { resize: vertical; }
label { font-size: 12px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 7px; }

.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 256px; flex-shrink: 0; background: var(--glass), var(--bg2);
  border: 1px solid var(--border); border-top-color: var(--edge); border-radius: 26px;
  box-shadow: var(--shadow); backdrop-filter: blur(28px) saturate(115%);
  -webkit-backdrop-filter: blur(28px) saturate(115%);
  display: flex; flex-direction: column;
  position: fixed; top: 14px; bottom: 14px; left: 14px; z-index: 50;
  transition: transform .25s; overflow: hidden;
}
.main { flex: 1; margin-left: 284px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 22px; margin: 14px 24px 0 0;
  border: 1px solid var(--border); border-top-color: var(--edge); border-radius: 22px;
  background: var(--glass), var(--bg2); box-shadow: var(--shadow);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  position: sticky; top: 14px; z-index: 40;
}
.content { padding: 24px 24px 32px 0; max-width: 1440px; width: 100%; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: fadein .22s; }
@keyframes fadein { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.brand { padding: 24px 20px 20px; display: flex; align-items: center; gap: 11px; }
.brand-logo, .login-logo {
  border: 1px solid var(--edge); background: var(--glass), var(--card2);
  box-shadow: inset 0 1px 0 var(--edge), 0 6px 16px rgba(0,0,0,.08);
  color: var(--text); display: flex; align-items: center; justify-content: center;
}
.brand-logo { width: 40px; height: 40px; border-radius: 13px; font-weight: 600; font-size: 18px; flex-shrink: 0; }
.brand-name { font-weight: 650; font-size: 14px; letter-spacing: -.25px; line-height: 1.4; }
.brand-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
.user-card {
  margin: 0 12px 20px; padding: 14px; border-radius: 18px;
  background: var(--glass), var(--card2); border: 1px solid var(--border);
}
.user-row { display: flex; gap: 10px; align-items: center; }
.user-row > :last-child { min-width: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--glass), var(--card2);
  border: 1px solid var(--edge); box-shadow: inset 0 1px 0 var(--edge);
  color: var(--text); font-weight: 600; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 13px;
}
.user-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.user-role { font-size: 11px; color: var(--muted); margin-top: 2px; }
.user-badge {
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--muted); line-height: 1.7;
}
.user-badge b { color: var(--text); font-weight: 500; }
.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 45px;
  padding: 11px 14px; border-radius: 14px; border: 1px solid transparent; background: none;
  color: var(--muted); font-size: 13px; font-weight: 500; text-align: left;
  margin-bottom: 5px; transition: background .15s, color .15s; position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.7; }
.nav-item:hover { background: var(--card2); color: var(--text); }
.nav-item.active {
  background: var(--glass), var(--card2); color: var(--text);
  border-color: var(--border); border-top-color: var(--edge);
  box-shadow: inset 0 1px 0 var(--border), 0 4px 8px rgba(0,0,0,.04);
}
.nav-item.active::after {
  content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--text);
  position: absolute; right: 10px; opacity: .65;
}
.nav-badge {
  margin-left: auto; background: var(--accent2); color: #fff; font-size: 10px;
  min-width: 19px; height: 19px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; padding: 0 5px;
}
.nav-item.active .nav-badge { margin-right: 7px; }
.sidebar-foot { padding: 14px 12px; border-top: 1px solid var(--border); display: flex; gap: 5px; }
.sidebar-foot .btn { flex: 1; padding: 9px 7px; min-height: 38px; font-size: 11px; gap: 4px; }
.sidebar-foot .btn svg { width: 14px; height: 14px; }
.hamburger {
  display: none; background: var(--card2); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); padding: 9px; min-width: 42px; min-height: 42px;
}
.hamburger svg { width: 20px; height: 20px; display: block; }
.page-title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.clock-box { text-align: right; flex-shrink: 0; }
.clock { font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: .6px; }
.clock-date { font-size: 10px; color: var(--muted); margin-top: 2px; }

.card, .hero, .stat, .login-card, .qr-card {
  background: var(--glass), var(--card);
  border: 1px solid var(--border); border-top-color: var(--edge);
  box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.card { min-width: 0; border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 18px; }
.card-title {
  font-size: 14px; font-weight: 600; letter-spacing: -.15px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.hero {
  border-radius: var(--radius); padding: 34px 30px; min-height: 155px;
  color: var(--text); margin-bottom: 22px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(118deg, var(--reflection), transparent 40%);
}
.hero::after {
  content: ''; position: absolute; right: -28px; top: -72px; width: 270px; height: 270px;
  border-radius: 50%; border: 1px solid var(--edge); transform: rotate(-22deg); pointer-events: none;
  background: linear-gradient(145deg, var(--reflection), transparent 55%);
  box-shadow: inset 12px 8px 28px var(--reflection), 0 0 0 26px var(--card2), 0 0 0 27px var(--border);
}
.hero h1 { font-size: clamp(22px, 2.3vw, 30px); font-weight: 600; letter-spacing: -1px; position: relative; z-index: 1; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 12px; position: relative; z-index: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { border-radius: 20px; padding: 20px 18px 16px; position: relative; overflow: hidden; }
.stat::before {
  content: ''; position: absolute; right: 16px; top: 19px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--sc, var(--accent)); box-shadow: 0 0 10px var(--sc, var(--accent));
}
.stat-num { font-size: 31px; font-weight: 500; letter-spacing: -1.4px; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: capitalize; margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 10px 17px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--glass), var(--card2); color: var(--text); font-size: 12px; font-weight: 600;
  box-shadow: inset 0 1px 0 var(--border); transition: border-color .15s, filter .15s, transform .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--edge); filter: brightness(1.08); }
.btn:active:not(:disabled), .chip:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.8; }
.btn-primary {
  background: var(--grad); border: 1px solid var(--edge); color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 12px rgba(0,0,0,.1);
}
.btn-danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.18); color: var(--cabut); }
.card.danger { border-color: rgba(239,68,68,.30); background: rgba(239,68,68,.045), var(--card); }
.card.danger .card-title { color: var(--cabut); }
.warn-box {
  padding: 14px 16px; border-radius: 16px; margin-bottom: 16px; font-size: 12px; line-height: 1.6;
  background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.2); color: var(--text);
}
.warn-box b { color: var(--cabut); }
.count-note { font-size: 12px; color: var(--muted); margin: 14px 0; }
.count-note b { font-size: 17px; color: var(--text); font-weight: 700; letter-spacing: -.3px; }
.keep-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.keep-list span { font-size: 10px; padding: 3px 9px; border-radius: 999px; background: var(--card2); border: 1px solid var(--border); color: var(--muted); }
.btn-sm { padding: 7px 11px; min-height: 34px; font-size: 11px; border-radius: 10px; }
.btn-icon { padding: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 10.5px;
  font-weight: 600; text-transform: capitalize; white-space: nowrap;
}
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-hadir { background: rgba(34,197,94,.10); color: var(--hadir); }
.pill-sakit { background: rgba(150,160,190,.10); color: var(--sakit); }
.pill-izin { background: rgba(59,130,246,.10); color: var(--izin); }
.pill-alpa { background: rgba(234,179,8,.10); color: var(--alpa); }
.pill-cabut { background: rgba(239,68,68,.10); color: var(--cabut); }
.pill-belum { background: var(--card2); color: var(--muted); }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 37px; padding: 8px 14px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--card2); color: var(--muted); font-size: 10.5px; font-weight: 600;
  letter-spacing: .15px; transition: background .15s, color .15s;
}
.chip:hover { border-color: var(--edge); color: var(--text); }
.chip.active { background: var(--grad); color: var(--on-accent); border-color: var(--edge); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }

.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--border); overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; padding: 13px 14px; background: var(--card2); color: var(--muted);
  font-size: 9px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 14px; border-bottom: 1px solid var(--border); }
td b { font-weight: 550; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--card2); }
.row-click { cursor: pointer; }

.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.52);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 18px;
}
.modal-back.open { display: flex; }
.modal {
  background: var(--glass), var(--sheet); border: 1px solid var(--border); border-top-color: var(--edge);
  box-shadow: var(--shadow); border-radius: 28px;
  width: 100%; max-width: 480px; max-height: 90vh; max-height: 90dvh;
  overflow-y: auto; padding: 28px; animation: fadein .2s;
}
.modal h3 { font-size: 18px; font-weight: 600; letter-spacing: -.5px; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid > * { min-width: 0; }
.status-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.status-opt {
  min-height: 43px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text); font-size: 11px; font-weight: 500;
  text-transform: capitalize; transition: background .12s, border-color .12s;
}
.status-opt.sel-hadir { border-color: var(--hadir); background: rgba(34,197,94,.12); }
.status-opt.sel-sakit { border-color: var(--sakit); background: rgba(150,160,190,.12); }
.status-opt.sel-izin { border-color: var(--izin); background: rgba(59,130,246,.12); }
.status-opt.sel-alpa { border-color: var(--alpa); background: rgba(234,179,8,.12); }
.status-opt.sel-cabut { border-color: var(--cabut); background: rgba(239,68,68,.12); }
.toast-box {
  position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column;
  gap: 10px; width: max-content; max-width: min(360px, calc(100vw - 32px));
}
.toast {
  background: var(--glass), var(--sheet); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-radius: 16px; padding: 14px 18px; font-size: 12px; box-shadow: var(--shadow); animation: fadein .2s;
}
.toast.ok { border-left-color: var(--hadir); }
.toast.err { border-left-color: var(--cabut); }

.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 420px; min-width: 0; overflow: hidden; }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--field); }
.msg { max-width: 75%; padding: 10px 15px; border-radius: 18px; font-size: 13px; position: relative; overflow-wrap: anywhere; flex-shrink: 0; }
.msg-them { background: var(--glass), var(--card); border: 1px solid var(--border); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg-me { background: var(--grad); color: var(--on-accent); border: 1px solid var(--edge); border-bottom-right-radius: 5px; align-self: flex-end; }
.msg-meta { font-size: 10px; opacity: .8; margin-top: 5px; text-align: right; }
.msg img { width: 240px; max-width: 100%; border-radius: 12px; display: block; margin-bottom: 6px; cursor: pointer; }
.chat-input { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--border); align-items: center; }
.chat-input input { flex: 1; }
.thread-list { display: flex; flex-direction: column; }
.thread { display: flex; gap: 12px; align-items: center; padding: 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .12s; }
.thread:hover, .thread.active { background: var(--glass), var(--card2); }
.thread-name { font-weight: 600; font-size: 13px; }
.thread-preview { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; margin-top: 3px; }
.chat-cols { display: grid; grid-template-columns: 280px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.chat-threads { border-right: 1px solid var(--border); overflow-y: auto; max-height: calc(100vh - 170px); }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 18px; }
.qr-card { color: var(--text); border-radius: 26px; padding: 0 14px 16px; text-align: center; position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.qr-card:hover { transform: translateY(-3px); box-shadow: 0 22px 46px rgba(0, 0, 0, .26); }

.qr-band {
  position: relative; margin: 0 -14px; padding: 15px 12px 44px; overflow: hidden;
  background: linear-gradient(135deg, #1b2a63 0%, #2f6bff 54%, #17c8c0 100%);
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 460 150' preserveAspectRatio='none'><path d='M0 0H460V126C383 150 306 116 230 132C153 148 77 118 0 134Z' fill='%23000'/></svg>") no-repeat center / 100% 100%;
          mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 460 150' preserveAspectRatio='none'><path d='M0 0H460V126C383 150 306 116 230 132C153 148 77 118 0 134Z' fill='%23000'/></svg>") no-repeat center / 100% 100%;
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.qr-band::before, .qr-band::after {
  content: ''; position: absolute; left: -25%; right: -25%;
  background-repeat: repeat-x; pointer-events: none;
}
.qr-band::before {
  bottom: 7px; height: 26px; opacity: .30; background-size: 150px 26px; animation: qrWave 9s linear infinite;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 48' preserveAspectRatio='none'><path d='M0 26Q50 -2 100 26T200 26V48H0Z' fill='%23ffffff'/></svg>");
}
.qr-band::after {
  bottom: 5px; height: 18px; opacity: .15; background-size: 210px 18px; animation: qrWave2 6s linear infinite reverse;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 48' preserveAspectRatio='none'><path d='M0 26Q50 -2 100 26T200 26V48H0Z' fill='%23ffffff'/></svg>");
}
@keyframes qrWave { from { background-position-x: 0; } to { background-position-x: -300px; } }
@keyframes qrWave2 { from { background-position-x: 0; } to { background-position-x: -420px; } }

.qr-school { font-size: 9px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: #f3f7ff; position: relative; z-index: 1; }
.qr-kicker { font-size: 8px; letter-spacing: 2.2px; text-transform: uppercase; color: rgba(233, 241, 255, .72); margin-top: 3px; position: relative; z-index: 1; }
.qr-box { display: flex; justify-content: center; margin: -32px auto 14px; position: relative; z-index: 2; }
.qr-box img, .qr-box canvas {
  border: 20px solid #fff; box-sizing: content-box; background: #fff; border-radius: 16px;
  box-shadow: 0 12px 26px rgba(12, 20, 50, .22), 0 0 0 1px rgba(47, 107, 255, .30);
}
.qr-name { font-weight: 700; font-size: 12.5px; line-height: 1.45; }
.qr-meta { font-size: 10px; color: var(--muted); margin-top: 5px; letter-spacing: .4px; }
.qr-class-badge {
  display: inline-block; margin-top: 12px; padding: 5px 14px; border-radius: 999px;
  background: linear-gradient(135deg, #2f6bff, #17c8c0); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .6px;
}
.qr-card .btn {
  background: var(--glass), var(--card2) !important;
  color: var(--text) !important; border-color: var(--border) !important;
}
.scan-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.scan-cols > .card { margin-top: 0; }
#qr-reader { width: 100%; border-radius: 16px; overflow: hidden; }
#qr-reader video { border-radius: 16px; }
.scan-feed { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow-y: auto; }
.scan-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--border); font-size: 12px; animation: fadein .2s; }
.scan-item > div { min-width: 0; overflow-wrap: anywhere; }
.scan-item.rej { border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.06); }
.scan-time { margin-left: auto; font-size: 10px; color: var(--muted); white-space: nowrap; }

.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, var(--ambient), transparent 60%);
}
.login-bg::before, .login-bg::after {
  content: ''; position: absolute; width: min(80vw, 620px); height: min(80vw, 620px);
  border-radius: 50%; border: 1px solid var(--edge);
  background: linear-gradient(155deg, var(--reflection), transparent 60%);
  box-shadow: inset 12px 16px 50px var(--reflection), 0 0 0 30px var(--card2), 0 0 0 31px var(--border);
}
.login-bg::before { left: -10%; top: -25%; }
.login-bg::after { right: -12%; bottom: -40%; width: min(65vw, 520px); height: min(65vw, 520px); }
.login-card { position: relative; width: 100%; max-width: 420px; border-radius: 32px; padding: 42px 34px 30px; }
.login-logo { width: 58px; height: 58px; border-radius: 19px; font-size: 24px; font-weight: 500; margin: 0 auto 24px; }
.login-title { text-align: center; font-size: 23px; font-weight: 600; letter-spacing: -.8px; }
.login-sub { text-align: center; color: var(--muted); font-size: 12px; line-height: 1.8; margin: 8px 0 28px; }
.login-err { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); color: var(--cabut); border-radius: 13px; padding: 11px 14px; font-size: 12px; margin-bottom: 16px; }
.login-card .btn-primary { min-height: 46px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar input, .toolbar select { width: auto; flex: 1; min-width: 140px; }
.toolbar .spacer { flex: 999; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.mt { margin-top: 18px; }
.empty { text-align: center; color: var(--muted); padding: 38px 12px; font-size: 12px; }
.progress { height: 6px; border-radius: 4px; background: var(--card2); overflow: hidden; margin-top: 16px; }
.progress-bar { height: 100%; background: var(--grad); width: 0%; transition: width .2s; }
.overlay-nav { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.52); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 45; }
.audit-info { font-size: 10px; color: var(--muted); line-height: 1.7; }
.img-preview { max-width: 100%; max-height: 80vh; border-radius: 16px; }

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: 1fr; }
  .chat-cols { grid-template-columns: 230px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(calc(-100% - 20px)); top: 10px; bottom: 10px; left: 10px; }
  .sidebar.open { transform: none; }
  .overlay-nav.open { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .topbar { margin: 12px 16px 0; top: 12px; padding: 11px 15px; }
  .content { padding: 20px 16px 28px; }
  .scan-cols { grid-template-columns: 1fr; }
  .chat-cols { grid-template-columns: minmax(0, 1fr); }
  .chat-threads { max-height: 230px; border-right: none; border-bottom: 1px solid var(--border); }
  .clock { font-size: 16px; }
  .msg { max-width: 88%; }
  .hero { padding: 28px; }
}
@media (max-width: 540px) {
  :root { --radius: 22px; }
  .topbar { margin: 10px 10px 0; top: 10px; border-radius: 18px; padding: 10px; gap: 8px; }
  .page-title { font-size: 12px; }
  .clock { font-size: 14px; }
  .clock-date { font-size: 9px; }
  .content { padding: 16px 10px 24px; }
  .card { padding: 18px 16px; }
  .card-title { font-size: 13px; gap: 8px; }
  .card, .hero, .stat, .qr-card { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .hero { min-height: 150px; padding: 26px 20px; margin-bottom: 16px; }
  .hero h1 { font-size: 22px; letter-spacing: -.7px; line-height: 1.35; }
  .hero p { font-size: 11px; max-width: 85%; }
  .hero::after { right: -90px; top: -80px; opacity: .5; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .stat { padding: 17px; border-radius: 18px; }
  .stat-num { font-size: 29px; }
  .chip { font-size: 10px; min-height: 40px; padding: 8px 11px; }
  .chip-grid { gap: 7px; }
  .btn-sm { min-height: 40px; }
  .sidebar-foot .btn { min-height: 40px; }
  input, select, textarea { font-size: 16px; }
  .toolbar input, .toolbar select { flex: 1 1 100%; width: 100%; }
  .toolbar .btn { flex: 1; }
  .status-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .status-opt { min-height: 44px; }
  .modal { padding: 24px 18px; border-radius: 24px; }
  .modal h3 { font-size: 17px; }
  .modal-actions .btn { flex: 1; }
  .modal-back { padding: 12px; }
  .login-wrap { padding: 16px; }
  .login-card { padding: 34px 24px 26px; border-radius: 28px; }
  .login-title { font-size: 22px; }
  .qr-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-input { padding: 10px; gap: 6px; }
  .chat-body { padding: 14px; }
  .toast-box { bottom: 14px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .toolbar, .btn, .overlay-nav { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; color: #111; }
  body::before { display: none; }
  .card, .hero, .stat, .qr-card { background: #fff; color: #111; box-shadow: none; backdrop-filter: none; }
}
