/* ==========================================================================
   ClockMeIn — dark & modern design system (single file, no build step).
   Deep indigo surfaces, one teal accent, soft glows, rounded cards.
   ========================================================================== */

:root {
    --bg: #0b0d1a;
    --bg-2: #11142a;
    --card: #171b36;
    --card-2: #1e2346;
    --line: #2a3057;
    --txt: #e9ebf7;
    --muted: #9aa1c7;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-ink: #05261f;
    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #fb7185;
    --radius: 14px;
    --shadow: 0 12px 32px rgba(0, 0, 0, .38);
    --glow: 0 0 22px rgba(45, 212, 191, .35);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: radial-gradient(1200px 700px at 80% -10%, #1b2150 0%, var(--bg) 55%) fixed, var(--bg);
    color: var(--txt);
    font-family: var(--font);
    font-size: 15.5px;
    line-height: 1.55;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.7rem; }
code { background: var(--card-2); padding: .1rem .4rem; border-radius: 6px; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------------- buttons ---------------- */

.btn {
    display: inline-block; padding: .55rem 1rem; border-radius: 10px;
    border: 1px solid var(--line); background: var(--card-2); color: var(--txt);
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: filter .15s, transform .05s, box-shadow .2s;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #06251f; }
.btn-primary:hover { box-shadow: var(--glow); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(251, 113, 133, .16); border-color: rgba(251, 113, 133, .45); color: #ffc2ce; }
.btn-warn { background: rgba(251, 191, 36, .14); border-color: rgba(251, 191, 36, .4); color: #ffe3a3; }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.02rem; border-radius: 12px; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-tiny { padding: .18rem .55rem; font-size: .8rem; border-radius: 8px; }

/* ---------------- forms ---------------- */

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .7rem; }
label > input, label > select, label > textarea { margin-top: .3rem; width: 100%; }
input, select, textarea {
    background: var(--bg-2); border: 1px solid var(--line); color: var(--txt);
    border-radius: 10px; padding: .55rem .7rem; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(45, 212, 191, .5); border-color: transparent; }
label.check { display: flex; gap: .55rem; font-weight: 500; align-items: flex-start; }
label.check input { width: auto; margin-top: .25rem; accent-color: var(--accent-strong); }
label.inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
label.inline input, label.inline select { width: auto; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.errs { background: rgba(251, 113, 133, .12); border: 1px solid rgba(251, 113, 133, .4); border-radius: 10px; margin: .6rem 0; padding: .5rem 1.2rem; }
.errs li { margin: .15rem 0; }
.slug-wrap { display: flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .85rem; }
.slug-wrap input { flex: 1; }
.emp-add { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.emp-add input, .emp-add select { width: auto; }
.form-group { display: block; }

/* ---------------- top nav / landing ---------------- */

.site-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: .9rem 1.4rem; border-bottom: 1px solid var(--line);
    backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 10;
    background: rgba(11, 13, 26, .75);
}
.site-nav nav { display: flex; gap: .5rem; align-items: center; }
.site-nav .btn-ghost.active { color: var(--accent); border-color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--txt); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); }
.brand-lg { font-size: 1.5rem; margin-bottom: 1rem; justify-content: center; }
.brand-tag { color: var(--accent); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.notice-top { padding: .6rem 1.2rem; text-align: center; background: rgba(251, 191, 36, .12); border-bottom: 1px solid rgba(251, 191, 36, .35); }
.notice-top.ok { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .3); }

.landing { max-width: 1020px; margin: 0 auto; padding: 0 1.4rem 4rem; }
.hero { text-align: center; padding: 5rem 0 3.5rem; }
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 800; letter-spacing: -.5px; }
.hero .glow { color: var(--accent); text-shadow: var(--glow); }
.hero .sub { max-width: 560px; margin: 1rem auto 1.8rem; color: var(--muted); font-size: 1.08rem; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.hero-points { display: flex; gap: 1.4rem; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin-top: 2.2rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem; margin: 1.5rem 0 3rem; }
.card {
    background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 140%);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.1rem;
}
.cards .card { margin-bottom: 0; }
.card h3 { margin: .4rem 0 .3rem; }
.card p { color: var(--muted); margin: .2rem 0 0; font-size: .93rem; }
.card-ic { font-size: 1.6rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1.15rem; }

.pricing { text-align: center; margin: 3rem 0; }
.price-card {
    display: inline-flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center;
    background: var(--card); border: 1px solid var(--line); border-radius: 18px;
    padding: 1.6rem 2.2rem; box-shadow: var(--shadow);
}
.price-card .price-line { font-size: 1.05rem; color: var(--muted); }
.price-card .big { font-size: 2.4rem; font-weight: 800; color: var(--txt); }
.price-card .price-plus { font-size: 1.4rem; color: var(--accent); font-weight: 800; }
.price-card .price-foot { flex-basis: 100%; color: var(--muted); font-size: .85rem; }
.pricing-note { max-width: 620px; margin: 1.2rem auto 0; color: var(--muted); font-size: .92rem; }
.popia { max-width: 720px; margin: 2.5rem auto; text-align: center; color: var(--muted); }
.site-foot {
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    border-top: 1px solid var(--line); padding: 1.4rem; color: var(--muted); font-size: .9rem;
    max-width: 1020px; margin: 0 auto;
}

/* ---------------- auth cards ---------------- */

.auth-wrap { display: flex; justify-content: center; padding: 4rem 1rem; }
.auth-card {
    width: 100%; max-width: 460px; background: var(--card);
    border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 2rem;
}
.auth-card h1 { margin-bottom: .3rem; }
.auth-card .btn { width: 100%; margin-top: .6rem; }
.big-ic { font-size: 2.6rem; margin-bottom: .4rem; }

/* ---------------- status badges / banners ---------------- */

.status-badge {
    display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .75rem;
    font-weight: 700; text-transform: capitalize; border: 1px solid var(--line); color: var(--muted);
}
.st-trial    { color: #93c5fd; border-color: rgba(147, 197, 253, .4); background: rgba(147, 197, 253, .08); }
.st-active   { color: var(--ok); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }
.st-grace    { color: var(--warn); border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); }
.st-suspended{ color: var(--danger); border-color: rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .08); }
.st-closed   { color: var(--muted); }
.banner { padding: .65rem 1.2rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.banner.warn { background: rgba(251, 191, 36, .09); }
.banner.danger { background: rgba(251, 113, 133, .09); }
.banner.info { background: rgba(147, 197, 253, .07); }

/* ---------------- tenant app shell ---------------- */

.app-shell { min-height: 100vh; }
.app-head {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .8rem 1.4rem; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10; background: rgba(11, 13, 26, .82); backdrop-filter: blur(6px);
}
.app-head .brand { font-size: 1.05rem; }
.app-head-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.user-badge { color: var(--muted); font-size: .88rem; }
.tabs { display: flex; gap: .4rem; padding: .7rem 1.4rem 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button {
    background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted);
    font: inherit; font-weight: 600; padding: .5rem .8rem; white-space: nowrap;
    cursor: pointer;
}
.tabs button:hover { color: var(--txt); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
main { padding: 1.3rem 1.4rem 3rem; max-width: 1100px; margin: 0 auto; }

.range { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: 1rem; }
.range label { margin: 0; }
.range input, .range select { min-width: 8rem; }

.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .5rem; border-bottom: 1px solid rgba(42, 48, 87, .5); vertical-align: top; }
.tbl tr.voided td { opacity: .45; text-decoration: line-through; }
.tbl tr.voided .tag { text-decoration: none; }
.tbl tr.total td { border-top: 2px solid var(--line); font-weight: 800; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); padding: .8rem 0; }

.tag {
    display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem;
    border-radius: 999px; border: 1px solid var(--line);
}
.tag.in { color: var(--ok); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }
.tag.out { color: #93c5fd; border-color: rgba(147, 197, 253, .4); background: rgba(147, 197, 253, .08); }
.tag.late { color: var(--warn); border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .08); }
.tag.issue { color: var(--danger); border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .08); }
.tag.warn { color: var(--warn); border-color: rgba(251, 191, 36, .45); }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; gap: .6rem; align-items: baseline; padding: .45rem 0; border-bottom: 1px solid rgba(42, 48, 87, .5); }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.dot.in { background: var(--ok); box-shadow: 0 0 10px rgba(52, 211, 153, .6); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .2rem 1rem; }
.settings-grid .btn { grid-column: 1 / -1; width: max-content; }

.billing-lines div { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid rgba(42, 48, 87, .5); }
.billing-lines .total { font-weight: 800; font-size: 1.05rem; border-bottom: none; }
.billing-request { display: flex; gap: .5rem; margin: .8rem 0; }
.billing-request input { flex: 1; }

/* ---------------- modals & toast ---------------- */

.modal { position: fixed; inset: 0; background: rgba(5, 6, 14, .72); display: flex; align-items: center; justify-content: center; z-index: 60; backdrop-filter: blur(3px); padding: 1rem; }
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 1.5rem; width: 100%; max-width: 420px; max-height: 92vh; overflow: auto; }
.modal-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; }
.spacer { flex: 1; }
.snap-box { max-width: 540px; }
.snap-box img { width: 100%; border-radius: 10px; }
.snap-caption { color: var(--muted); font-size: .9rem; margin: .5rem 0; }

.enrol-cam { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 4 / 3; }
.enrol-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.enrol-progress { height: 8px; background: var(--bg-2); border-radius: 999px; margin: .8rem 0 .4rem; overflow: hidden; }
#enrol-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); box-shadow: var(--glow); transition: width .3s; }
.enrol-status { color: var(--muted); min-height: 1.4em; font-size: .92rem; margin-bottom: .6rem; }

.toast { position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--line); box-shadow: var(--shadow); padding: .65rem 1.1rem; border-radius: 12px; z-index: 80; max-width: min(90vw, 480px); }
.toast.error { border-color: rgba(251, 113, 133, .55); color: #ffd7de; }

/* ---------------- kiosk ---------------- */

body.kiosk-body { overflow: hidden; }
#kiosk { position: fixed; inset: 0; background: #05060e; }
#kiosk video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.kiosk-top {
    position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between;
    align-items: center; padding: 1rem 1.4rem; z-index: 5;
    background: linear-gradient(180deg, rgba(5, 6, 14, .75), transparent);
}
.kiosk-brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; user-select: none; -webkit-user-select: none; border-radius: 10px; padding: .2rem .4rem; }
.kiosk-brand.holding { outline: 2px solid var(--accent); box-shadow: var(--glow); }
.kiosk-site { color: var(--muted); font-weight: 600; font-size: .95rem; }
.kiosk-clock { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kiosk-guide {
    position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
    width: min(46vh, 60vw); height: min(60vh, 78vw);
    border: 3px dashed rgba(233, 235, 247, .35); border-radius: 50%;
    pointer-events: none; z-index: 4; transition: border-color .2s, box-shadow .3s;
}
.kiosk-guide.active { border: 3px solid rgba(45, 212, 191, .8); box-shadow: var(--glow); }
.kiosk-guide.warn { border: 3px dashed rgba(251, 191, 36, .85); }
.kiosk-guide.good { border: 3px solid var(--accent); box-shadow: 0 0 40px rgba(45, 212, 191, .55); }
.kiosk-panel {
    position: absolute; left: 50%; bottom: 7vh; transform: translateX(-50%);
    z-index: 6; text-align: center; min-width: min(340px, 86vw);
    background: rgba(17, 20, 42, .88); border: 1px solid var(--line); border-radius: 18px;
    padding: 1.1rem 1.6rem; box-shadow: var(--shadow); backdrop-filter: blur(8px);
    transition: border-color .2s, box-shadow .3s;
}
.kiosk-panel.ok { border-color: rgba(52, 211, 153, .6); box-shadow: 0 0 30px rgba(52, 211, 153, .35); }
.kiosk-panel.repeat { border-color: rgba(147, 197, 253, .6); }
.kiosk-panel.fail { border-color: rgba(251, 113, 133, .6); box-shadow: 0 0 26px rgba(251, 113, 133, .3); }
.kiosk-icon { font-size: 1.6rem; line-height: 1; }
.kiosk-title { font-size: 1.5rem; font-weight: 800; margin-top: .2rem; }
.kiosk-sub { color: var(--muted); margin-top: .15rem; }
.kiosk-exit { position: absolute; bottom: 1rem; right: 1.2rem; z-index: 7; color: var(--muted); }

/* pairing screen */
#pairing { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.pair-card {
    width: 100%; max-width: 420px; text-align: center; background: var(--card);
    border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 2.2rem 2rem;
}
.pair-card h1 { margin: .2rem 0 .4rem; }
#pair-form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.pair-input {
    text-align: center; font-size: 1.7rem; font-weight: 800; letter-spacing: .35em; text-transform: uppercase;
    background: var(--bg-2); border: 2px solid var(--line); border-radius: 14px; padding: .7rem .4rem .7rem .8rem;
}
.pair-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.pair-msg { min-height: 1.4em; color: var(--warn); margin-top: .8rem; font-size: .95rem; }

/* ---------------- super-admin ---------------- */

.admin-main { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.4rem 3.5rem; }
.admin-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.admin-head h1 { margin: 0; display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.admin-head-actions { margin-left: auto; display: flex; gap: .6rem; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.1rem; align-items: start; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; display: flex; flex-direction: column; }
.stat .stat-n { font-size: 1.7rem; font-weight: 800; }
.stat .stat-l { color: var(--muted); font-size: .85rem; }
.stat.st-grace .stat-n { color: var(--warn); }
.stat.st-suspended .stat-n { color: var(--danger); }
.stat-line { color: var(--muted); }
.pay-form { border: 1px dashed var(--line); border-radius: 12px; padding: .9rem 1rem; margin: .9rem 0; }
.pay-form h3, .danger-zone h3 { font-size: 1rem; margin-bottom: .5rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .8rem 0; }
.btn-row form { margin: 0; }
.danger-zone { border: 1px solid rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .05); border-radius: 12px; padding: .9rem 1rem; margin-top: 1rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details[open] summary { margin-bottom: .8rem; }

@media (max-width: 720px) {
    .row2 { grid-template-columns: 1fr; }
    main, .admin-main { padding: 1rem .8rem 3rem; }
}
