/* AttendPro — Techmiary Technology Concepts */
:root {
  --ink: #0d1530;
  --ink-2: #1b2547;
  --ink-3: #2a3560;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e5e9f2;
  --text: #1a2036;
  --muted: #6b7489;
  --accent: #12b886;
  --accent-ink: #0b8a64;
  --accent-soft: #e3f8f0;
  --late: #f59f00;
  --late-soft: #fff4d6;
  --absent: #e8505b;
  --absent-soft: #fde7e8;
  --leave: #4c6ef5;
  --leave-soft: #e6ecff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 21, 48, .04), 0 6px 24px rgba(13, 21, 48, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.hide-sm { }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* ---------- Layout: admin shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #c8cfe4; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #38d9a9);
  display: grid; place-items: center; color: var(--ink); font-weight: 800; flex-shrink: 0; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand b { display: block; font-size: 1rem; }
.brand small { color: #8a93b2; font-size: .75rem; display: block; max-width: 170px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #66709a; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #c8cfe4;
  font-weight: 500; font-size: .93rem; }
.nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--ink-2); display: flex;
  align-items: center; gap: 10px; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { color: #fff; font-size: .88rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who small { color: #8a93b2; font-size: .75rem; }
.main { padding: 28px 34px 60px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar p { margin: 0; color: var(--muted); }
.mobile-head { display: none; }

/* ---------- Layout: member (mobile-first) ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 0 16px 100px; }
.app-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 12px; }
.app-head .brand { padding: 0; color: var(--ink); }
.app-head .brand small { color: var(--muted); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 50; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--muted);
  font-weight: 600; padding: 4px 14px; border-radius: 10px; }
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--accent-ink); }
.tabbar svg { width: 22px; height: 22px; }
.tabbar .scan-tab { background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 22px; margin-top: -26px;
  box-shadow: 0 8px 20px rgba(13,21,48,.25); }
.tabbar .scan-tab.active { color: #fff; background: var(--accent-ink); }

/* ---------- Components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 18px; }

.stat { position: relative; overflow: hidden; }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; }
.stat .sub { font-size: .85rem; color: var(--muted); }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%;
  background: var(--tint, var(--accent-soft)); }
.stat.t-green { --tint: var(--accent-soft); }
.stat.t-amber { --tint: var(--late-soft); }
.stat.t-red { --tint: var(--absent-soft); }
.stat.t-blue { --tint: var(--leave-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  background: var(--ink); color: #fff; transition: transform .05s, background .15s; white-space: nowrap; }
.btn:hover { background: var(--ink-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: #f1f3f9; }
.btn-danger { background: #fff; color: var(--absent); border-color: #f5c2c5; }
.btn-danger:hover { background: var(--absent-soft); }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 15px 22px; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border: 1px solid #d5dbe8; border-radius: 10px;
  font: inherit; background: #fff; color: var(--text); transition: border .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(18,184,134,.18); }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.field .err, .errorlist { color: var(--absent); font-size: .82rem; margin: 4px 0 0; padding: 0; list-style: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { font-weight: 500; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; background: #fff; margin: 0; }
.checks ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .input { width: auto; min-width: 150px; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfe; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table .num { text-align: center; font-variant-numeric: tabular-nums; }

.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person b { display: block; font-weight: 600; white-space: nowrap; }
.person small { display: block; font-size: .78rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #dfe5f5, #c9d2ea); color: var(--ink-3);
  display: grid; place-items: center; font-weight: 700; font-size: .78rem; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .76rem;
  font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-present { background: var(--accent-soft); color: var(--accent-ink); }
.b-late { background: var(--late-soft); color: #b06d00; }
.b-absent { background: var(--absent-soft); color: #c2313c; }
.b-leave { background: var(--leave-soft); color: #3b5bdb; }
.b-none, .b-muted { background: #eef0f5; color: var(--muted); }

.alerts { margin-bottom: 18px; display: grid; gap: 8px; }
.alert { padding: 12px 16px; border-radius: 12px; font-weight: 500; font-size: .92rem; border: 1px solid; }
.alert-success { background: var(--accent-soft); border-color: #b2ebd5; color: #08694c; }
.alert-error { background: var(--absent-soft); border-color: #f5c2c5; color: #a3222c; }
.alert-warning { background: var(--late-soft); border-color: #ffe08a; color: #8a5600; }
.alert-info { background: var(--leave-soft); border-color: #c5d2ff; color: #2c46b8; }

.empty { text-align: center; padding: 34px 10px; color: var(--muted); }

/* Bar chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar { width: 100%; max-width: 30px; flex: 1; display: flex; flex-direction: column-reverse; border-radius: 7px 7px 3px 3px;
  overflow: hidden; background: #f0f2f8; }
.bar .seg-on { background: var(--accent); }
.bar .seg-late { background: var(--late); }
.bar-col.off .bar { background: repeating-linear-gradient(45deg, #f3f4f8, #f3f4f8 4px, #eceef4 4px, #eceef4 8px); }
.bar-col small { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.progress { height: 8px; background: #eef0f6; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), #e9edf5 0); }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; }
.ring b { font-size: 1.7rem; display: block; line-height: 1; }
.ring small { font-size: .72rem; }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.feed li:last-child { border: 0; }
.feed .time { margin-left: auto; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed .new { animation: flash 1.6s ease; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(18,184,134,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(18,184,134,0); } 100% { box-shadow: 0 0 0 0 rgba(18,184,134,0); } }

/* Register / heatmap */
.register td.c { text-align: center; padding: 6px 2px; font-weight: 700; font-size: .75rem; min-width: 28px; }
.register th.c { text-align: center; padding: 6px 2px; font-size: .64rem; }
.c-P { color: var(--accent-ink); background: #effbf6; }
.c-L { color: #b06d00; background: #fff8e6; }
.c-A { color: #c2313c; background: #fff0f1; }
.c-E { color: #3b5bdb; background: #eef2ff; }
.c-x { color: #b9bfcc; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at 10% 10%, #1f3a72 0%, transparent 60%),
  radial-gradient(900px 500px at 90% 90%, #0b6b55 0%, transparent 55%), var(--ink); color: #fff; padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 2.6rem; max-width: 460px; letter-spacing: -.03em; margin-top: 40px; }
.auth-art p { color: #b9c2dd; max-width: 430px; font-size: 1.05rem; }
.auth-art .brand { padding: 0; }
.auth-art .brand small { color: #9aa4c4; }
.auth-points { display: grid; gap: 14px; margin-top: 28px; }
.auth-points div { display: flex; gap: 12px; align-items: center; color: #dfe4f3; }
.auth-points span { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.qr-deco { position: absolute; right: -40px; bottom: 80px; width: 260px; opacity: .08; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-form .inner { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 1.6rem; }

/* ---------- Scanner ---------- */
.scanner-box { position: relative; border-radius: 22px; overflow: hidden; background: #000; aspect-ratio: 1 / 1; }
#reader { width: 100%; height: 100%; }
#reader video { object-fit: cover !important; width: 100% !important; height: 100% !important; }
.scanner-frame { position: absolute; inset: 14%; border-radius: 18px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35); }
.scanner-frame::before, .scanner-frame::after { content: ""; position: absolute; inset: 0; border-radius: 18px;
  border: 3px solid transparent; border-top-color: var(--accent); border-bottom-color: var(--accent); }
.scan-line { position: absolute; left: 16%; right: 16%; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent);
  top: 16%; animation: sweep 2.2s ease-in-out infinite; pointer-events: none; }
@keyframes sweep { 50% { top: 82%; } }

.result { text-align: center; padding: 30px 22px; }
.result-icon { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; }
.result-icon svg { width: 46px; height: 46px; }
.result.ok .result-icon { background: var(--accent-soft); color: var(--accent-ink); animation: pop .4s ease; }
.result.out .result-icon { background: var(--leave-soft); color: var(--leave); animation: pop .4s ease; }
.result.warn .result-icon { background: var(--late-soft); color: #b06d00; }
.result.bad .result-icon { background: var(--absent-soft); color: var(--absent); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.result h1 { font-size: 1.5rem; }
.times { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 20px 0; }
.times div { background: #f6f8fc; border-radius: 12px; padding: 12px 6px; }
.times small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.times b { font-size: 1.05rem; }

/* Today card */
.today-card { background: linear-gradient(140deg, var(--ink) 0%, #1d3166 100%); color: #fff; border: 0; }
.today-card .muted, .today-card small { color: #aeb8d6; }
.today-card .times div { background: rgba(255,255,255,.08); }

/* ---------- Kiosk ---------- */
.kiosk { min-height: 100vh; background: radial-gradient(1000px 700px at 0% 0%, #1f3a72, transparent 60%),
  radial-gradient(900px 600px at 100% 100%, #0b6b55, transparent 55%), var(--ink); color: #fff;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; padding: 48px 56px; align-items: center; }
.kiosk h1 { font-size: clamp(2rem, 3.6vw, 3.4rem); letter-spacing: -.03em; }
.kiosk .lead { color: #b9c2dd; font-size: 1.2rem; max-width: 520px; }
.kiosk-qr { background: #fff; border-radius: 28px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.35); position: relative; }
.kiosk-qr svg { width: 100%; height: auto; display: block; }
.kiosk-qr .countdown { height: 6px; background: #edf0f6; border-radius: 9px; margin-top: 18px; overflow: hidden; }
.kiosk-qr .countdown span { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.kiosk-qr .cap { color: var(--muted); text-align: center; font-size: .9rem; margin-top: 10px; }
.kiosk-clock { font-size: clamp(3rem, 6vw, 5.5rem); font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.kiosk-steps { display: grid; gap: 14px; margin: 30px 0; }
.kiosk-steps div { display: flex; gap: 14px; align-items: center; font-size: 1.1rem; color: #dfe4f3; }
.kiosk-steps span { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.1); display: grid; place-items: center; font-weight: 700; }
.kiosk-feed { display: flex; gap: 10px; flex-wrap: wrap; }
.kiosk-feed div { background: rgba(255,255,255,.08); border-radius: 999px; padding: 6px 14px 6px 6px; display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.kiosk-feed .avatar { width: 28px; height: 28px; font-size: .68rem; }
.kiosk-stat { display: inline-flex; gap: 28px; margin-top: 8px; }
.kiosk-stat b { font-size: 2rem; display: block; }
.kiosk-stat small { color: #9aa4c4; }
.qr-fade { transition: opacity .25s; }

/* ---------- Credentials slip (printable) ---------- */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.slip { border: 1.5px dashed #c9d0e0; border-radius: 14px; padding: 16px; background: #fff; }
.slip .kv { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.slip .kv:last-child { border: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 100; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 9999px rgba(0,0,0,.4); }
  .mobile-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 40; }
  .mobile-head button { background: none; border: 0; color: #fff; padding: 4px; cursor: pointer; }
  .main { padding: 20px 16px 60px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 26px; }
  .auth-art h1 { font-size: 1.8rem; margin-top: 18px; }
  .auth-points, .qr-deco { display: none; }
  .kiosk { grid-template-columns: 1fr; padding: 28px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat .value { font-size: 1.6rem; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
}

@media print {
  .sidebar, .mobile-head, .no-print, .tabbar { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; }
}

/* fixes */
.grid > .card + .card, .grid > .card { margin-top: 0; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-width: 180px; }
