/* ============================================================ base */
:root {
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f5f7fb; --white: #fff;
  --primary: #4f46e5; --primary-d: #4338ca; --primary-l: #eef2ff;
  --green: #16a34a; --green-l: #dcfce7; --blue: #2563eb; --blue-l: #dbeafe;
  --amber: #d97706; --amber-l: #fef3c7; --red: #dc2626; --red-l: #fee2e2; --purple: #7c3aed; --purple-l: #ede9fe;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.06);
}
[ng-cloak], .ng-cloak { display: none !important; }
* { box-sizing: border-box; }
html { height: 100%; }
body { min-height: 100%; }   /* not height: a fixed-height body lets the sticky top bar scroll away */
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
       -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: .25rem 0 1rem; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.right { text-align: right; }
.text-red { color: var(--red); }
.m-0 { margin: 0; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 1rem 0; margin: 0; }
.panel-flush .empty { padding: 1.5rem; }

/* ============================================================ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem 1.1rem;
       border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem;
       cursor: pointer; white-space: nowrap; background: var(--white); color: var(--ink); transition: background .15s, transform .05s, box-shadow .15s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--primary-d); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,.35); }
.btn-success:hover { background: #15803d; }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-ghost-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.btn-ghost-light:hover { background: rgba(255,255,255,.2); }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: #fecaca; }
.btn-danger-ghost:hover { background: var(--red-l); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn-xl { padding: 1.1rem 2rem; font-size: 1.3rem; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { display: grid; place-items: center; background: rgba(255,255,255,.12); border: 0; color: #fff; width: 40px; height: 40px;
            border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.22); }

/* ============================================================ forms */
.field { display: block; flex: 1; margin-bottom: 1rem; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.field-sm { flex: 0 0 110px; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row > .field { min-width: 160px; }
input, select, textarea { font: inherit; color: var(--ink); width: 100%; padding: .6rem .75rem; border: 1px solid #cbd5e1;
                          border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
input[type=checkbox] { width: auto; accent-color: var(--primary); transform: scale(1.2); }
.input-lg { padding: .9rem 1rem; font-size: 1.2rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.self-end { align-self: flex-end; margin-bottom: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin: 1rem 0 3rem; }
.inline-form { display: flex; gap: .75rem; margin-bottom: 1rem; }
.inline-form input { max-width: 300px; }

/* ============================================================ tags, banners, alerts */
.tag { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 650;
       background: #f1f5f9; color: var(--ink-2); vertical-align: middle; white-space: nowrap; }
.tag-green { background: var(--green-l); color: #166534; }
.tag-blue { background: var(--blue-l); color: #1e40af; }
.tag-amber { background: var(--amber-l); color: #92400e; }
.tag-red { background: var(--red-l); color: #991b1b; }
.banner { padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-size: .95rem; }
.banner-warn { background: var(--amber-l); color: #78350f; }
.banner-ok { background: var(--green-l); color: #14532d; }
.alert-box { background: var(--red-l); color: #7f1d1d; border-left: 4px solid var(--red); padding: .75rem 1rem;
             border-radius: 10px; margin: .75rem 0; text-align: left; }
.alert-big { font-size: 1.2rem; padding: 1rem 1.25rem; }

/* ============================================================ admin layout */
.topbar { display: flex; align-items: center; gap: 2rem; padding: .75rem 2rem; background: var(--ink); color: #fff;
          position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; font-weight: 750; display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
              background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff; font-weight: 800; }
.brand-mark-lg { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 16px; margin-bottom: 1rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.topbar nav a { color: #cbd5e1; padding: .45rem .8rem; border-radius: 8px; font-weight: 550; font-size: .95rem; }
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topbar nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.topbar-right { margin-left: auto; display: flex; gap: .5rem; }
.topbar .btn-ghost { background: transparent; color: #e2e8f0; border-color: rgba(255,255,255,.2); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.1); }

.page { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.page-narrow { max-width: 820px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head > div:last-child { display: flex; gap: .5rem; }
.page-head p { margin: 0; }
.back-link { display: inline-block; margin-bottom: .75rem; color: var(--muted); font-weight: 550; }

.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.25rem; }
.panel-flush { padding: 0; overflow-x: auto; }
.panel-narrow { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
.grid-2 > * { min-width: 0; }   /* wide tables scroll inside their panel instead of widening the page */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }
.stat { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; border-top: 4px solid; }
.stat span { display: block; color: var(--muted); font-weight: 600; font-size: .9rem; }
.stat b { display: block; font-size: 2.4rem; letter-spacing: -.03em; margin-top: .25rem; }
.stat-red { border-color: var(--red); } .stat-blue { border-color: var(--blue); } .stat-green { border-color: var(--green); } .stat-purple { border-color: var(--purple); }

.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar select { width: auto; min-width: 180px; }
.search { max-width: 320px; }
.inline-field { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.inline-field input { width: auto; }
.segmented { display: inline-flex; background: #e2e8f0; border-radius: 10px; padding: 3px; }
.segmented button { border: 0; background: transparent; font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink-2);
                    padding: .45rem .8rem; border-radius: 8px; cursor: pointer; }
.segmented button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
            font-weight: 650; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: #f8fafc; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table th.right, .table td.right { text-align: right; }
.panel:not(.panel-flush) .table td, .panel:not(.panel-flush) .table th { padding-left: .25rem; padding-right: .25rem; }
.panel:not(.panel-flush) .table th { background: transparent; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 2px solid var(--line); }
.table-hover tbody tr:hover, .table-hover tr.clickable:hover { background: #f8fafc; }
.clickable { cursor: pointer; }
tr.inactive td { opacity: .55; }
.row-alert { color: var(--amber); font-size: .85rem; margin-top: .2rem; }

.list-row { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid #f1f5f9; }
.list-row:last-child { border-bottom: 0; }
.right-auto { margin-left: auto; font-size: .9rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 0 4px var(--green-l); }
.feed { max-height: 420px; overflow: auto; }
.feed-item { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; font-size: .92rem; border-bottom: 1px solid #f1f5f9; }
.feed-time { color: var(--muted); font-variant-numeric: tabular-nums; width: 68px; flex-shrink: 0; font-size: .85rem; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(3px); z-index: 50;
                  display: grid; place-items: center; padding: 1rem; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; padding: 1.75rem; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
         animation: pop .18s ease-out; max-height: 90vh; overflow: auto; }
.modal-actions { display: flex; gap: .6rem; margin-top: 1.25rem; align-items: center; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.chip-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .35rem .8rem; font: inherit;
            font-size: .88rem; cursor: pointer; }
.chip-btn.active { background: var(--primary-l); border-color: var(--primary); color: var(--primary-d); }
.chip-btn.chip-blocked { background: var(--red-l); border-color: #fecaca; color: #991b1b; cursor: not-allowed; }

/* card assign */
.card-assign { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.card-status { display: flex; align-items: center; gap: .8rem; margin-right: auto; }
.card-status-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #f1f5f9;
                    color: var(--muted); font-weight: 800; font-size: 1.1rem; }
.card-status.ok .card-status-icon { background: var(--green-l); color: var(--green); }

/* guardians */
.guardian { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1rem 0; margin-bottom: .75rem; border-left: 4px solid var(--green); }
.guardian-blocked { border-left-color: var(--red); background: #fffafa; }
.guardian-toggle { display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; margin-bottom: .75rem; }
.guardian-toggle button { border: 0; background: transparent; font: inherit; font-size: .85rem; font-weight: 600; padding: .35rem .75rem;
                          border-radius: 7px; cursor: pointer; color: var(--muted); }
.guardian-toggle button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.1); color: var(--green); }
.guardian-blocked .guardian-toggle button.on { color: var(--red); }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
              background: radial-gradient(circle at 20% 10%, #312e81, #0f172a 60%); }
.login-card { width: 100%; max-width: 400px; padding: 2.25rem; text-align: center; }
.login-card .field { text-align: left; }
.login-card .back-link { margin: 1.25rem 0 0; }

/* toast */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
         padding: .8rem 1.4rem; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 100;
         animation: pop .2s ease-out; }
.toast-success::before { content: "✓  "; color: #4ade80; }
.toast-error { background: var(--red); }

/* ============================================================ kiosk */
.kiosk { min-height: 100vh; color: #fff; user-select: none; -webkit-user-select: none;
         background: radial-gradient(1200px 600px at 10% -10%, #4338ca 0%, transparent 60%),
                     radial-gradient(900px 600px at 110% 110%, #0e7490 0%, transparent 55%), #0f172a; }
.kiosk-inner { min-height: 100vh; display: flex; flex-direction: column; padding: 1.5rem 2rem; }
.kiosk-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.kiosk-brand { font-weight: 750; font-size: 1.15rem; opacity: .9; }
.kiosk-top-right { display: flex; gap: .6rem; align-items: center; }
.chip { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); padding: .45rem .9rem; border-radius: 999px;
        font-weight: 500; font-size: .95rem; }
.chip b { font-weight: 800; }
.chip-click { color: inherit; font: inherit; cursor: pointer; }
.chip-click:hover { background: rgba(255,255,255,.2); }
.kiosk .banner { margin-top: 1rem; }
.kiosk-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
                padding: 2rem 0; min-height: 100vh; }
.kiosk-inner .kiosk-center { min-height: 0; }
.kiosk .panel { color: var(--ink); }

.clock { font-size: clamp(4rem, 12vw, 8rem); font-weight: 200; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ampm { font-size: .3em; font-weight: 500; margin-left: .3em; opacity: .7; letter-spacing: 0; }
.date { font-size: 1.4rem; opacity: .75; margin-top: .5rem; }
.scan-prompt { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; margin: 0; }
.scan-sub { opacity: .6; font-size: 1.1rem; margin-top: .6rem; }

.scan-target { position: relative; width: 200px; height: 200px; margin: 3rem auto 2rem; display: grid; place-items: center; }
.scan-target .pulse, .scan-target::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
                                             border: 2px solid rgba(129,140,248,.6); animation: ring 2.4s ease-out infinite; }
.scan-target::before { animation-delay: 1.2s; }
.scan-target::after { content: ""; position: absolute; inset: 30px; border-radius: 50%; background: rgba(99,102,241,.25);
                      box-shadow: 0 0 60px rgba(99,102,241,.5); }
.card-icon { position: relative; z-index: 1; width: 110px; height: 72px; border-radius: 12px;
             background: linear-gradient(135deg, #fff, #c7d2fe); box-shadow: 0 10px 30px rgba(0,0,0,.35);
             animation: float 3s ease-in-out infinite; padding: 12px; }
.card-chip { width: 22px; height: 17px; border-radius: 4px; background: linear-gradient(135deg, #fbbf24, #d97706); }
.card-lines span { display: block; height: 6px; border-radius: 3px; background: #a5b4fc; margin-top: 8px; }
.card-lines span + span { width: 60%; margin-top: 5px; }
.scan-target.busy .card-icon { animation: none; transform: scale(.94); }
.scan-target.busy::after { background: rgba(34,197,94,.35); box-shadow: 0 0 60px rgba(34,197,94,.6); }
.scan-target-sm { width: 140px; height: 140px; margin: .5rem auto 1.5rem; }
.scan-target-sm::after { inset: 20px; }
.modal .scan-target .pulse, .modal .scan-target::before { border-color: rgba(79,70,229,.5); }

.result-card { background: #fff; color: var(--ink); border-radius: 28px; padding: 3rem 3.5rem; width: min(640px, 100%);
               box-shadow: 0 30px 80px rgba(0,0,0,.4); animation: pop .25s ease-out; border-top: 10px solid; }
.result-in { border-color: var(--green); }
.result-out { border-color: var(--blue); }
.result-info { border-color: var(--amber); }
.result-error { border-color: var(--red); }
.badge { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 1rem; border-radius: 50%;
         font-size: 2.6rem; font-weight: 800; line-height: 1; color: #fff; background: var(--primary); }
.result-in .badge, .badge-green { background: var(--green); box-shadow: 0 0 0 10px var(--green-l); }
.result-out .badge { background: var(--blue); box-shadow: 0 0 0 10px var(--blue-l); }
.result-info .badge, .badge-amber { background: var(--amber); box-shadow: 0 0 0 10px var(--amber-l); }
.result-error .badge { background: var(--red); box-shadow: 0 0 0 10px var(--red-l); }
.result-kicker { color: var(--muted); font-size: 1.3rem; font-weight: 600; }
.result-card h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin: .4rem 0; }
.result-time { font-size: 2rem; font-weight: 300; color: var(--ink-2); }
.result-sub { font-size: 1.3rem; color: var(--ink-2); }
.result-stats { display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.result-stats div { background: #f1f5f9; border-radius: 14px; padding: .8rem 1.4rem; }
.result-stats span { display: block; color: var(--muted); font-size: .9rem; font-weight: 600; }
.result-stats b { font-size: 1.5rem; }
.result-note { margin-top: 1.25rem; color: var(--amber); font-weight: 600; }
.tap-hint { opacity: .5; margin-top: 1.5rem; }

.kiosk-flow { flex: 1; width: 100%; max-width: 1000px; margin: 1.5rem auto 0; animation: fade .2s; }
.flow-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.flow-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: .2rem 0; }
.flow-head h1 small { font-size: .45em; font-weight: 600; opacity: .6; margin-left: .4rem; }
.flow-head .muted { color: #94a3b8; font-size: 1.1rem; }
.flow-kicker { text-transform: uppercase; letter-spacing: .1em; font-size: .85rem; font-weight: 700; color: #a5b4fc; }
.flow-q { font-size: 1.4rem; font-weight: 600; opacity: .85; margin: 1.5rem 0 1rem; }

.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.person-btn { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; padding: 1.5rem 1rem;
              border-radius: 20px; border: 2px solid transparent; background: #fff; color: var(--ink); font: inherit; cursor: pointer;
              box-shadow: 0 6px 20px rgba(0,0,0,.2); transition: transform .1s, border-color .15s; }
.person-btn:hover { border-color: var(--primary); }
.person-btn:active { transform: scale(.97); }
.avatar { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 1.7rem; font-weight: 700;
          background: var(--green-l); color: var(--green); margin-bottom: .5rem; }
.person-name { font-size: 1.3rem; font-weight: 700; }
.person-rel { color: var(--muted); font-weight: 600; }
.person-note { font-size: .85rem; color: var(--amber); }
.person-other { background: rgba(255,255,255,.08); color: #fff; border: 2px dashed rgba(255,255,255,.3); box-shadow: none; }
.person-other .avatar { background: rgba(255,255,255,.12); color: #fff; }
.person-other .person-rel { color: #cbd5e1; }
.person-other:hover { border-color: #fff; }

.blocked-list { margin-top: 1.5rem; background: rgba(220,38,38,.15); border: 2px solid rgba(248,113,113,.6); border-radius: 16px;
                padding: 1rem 1.25rem; }
.blocked-list h3 { color: #fca5a5; letter-spacing: .05em; }
.blocked-item { font-size: 1.15rem; padding: .25rem 0; }
.blocked-item .muted { color: #fca5a5; }

.sibling { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .9rem 1rem; border: 1px solid var(--line);
           border-radius: 12px; margin-bottom: .6rem; cursor: pointer; font-size: 1.15rem; }
.sibling input { transform: scale(1.6); margin: 0 .3rem; }
.sibling-name { font-weight: 700; }
.sibling-alert { width: 100%; font-size: .9rem; color: var(--amber); }
.sibling.disabled { opacity: .6; cursor: not-allowed; }
.kiosk .panel h3 { margin-bottom: .8rem; }
.kiosk .panel .btn-xl { margin-top: .75rem; }
.kiosk-center > .btn { margin-top: 1.5rem; }

.kiosk-admin-link { position: fixed; bottom: 10px; right: 14px; color: rgba(255,255,255,.25); font-size: .8rem; }
.kiosk-admin-link:hover { color: rgba(255,255,255,.7); }

/* ============================================================ animation & responsive */
@keyframes ring { 0% { transform: scale(.55); opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(-6deg); } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toast { animation: none; }

@media (max-width: 900px) {
  .grid-2, .stats { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: .75rem; padding: .75rem 1rem; }
  .page { padding: 1.25rem; }
  .result-card { padding: 2rem 1.5rem; }
}

/* kiosk: students-here list + manual sign in/out (testing) */
.here-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .75rem; }
.here-item { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; border-radius: 16px;
             background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.here-item .avatar { width: 48px; height: 48px; font-size: 1.3rem; flex-shrink: 0; }
.here-item .muted, .kiosk-flow > .muted { color: #94a3b8; }
/* HERE-SIGNOUT (optional): tappable "students here" cards */
.here-click { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: transform .1s, border-color .15s; }
.here-click:hover { border-color: var(--primary); }
.here-click:active { transform: scale(.98); }
.here-tap { margin-top: .25rem; font-size: .85rem; font-weight: 600; color: #93c5fd; }
.manual-search { width: 100%; max-width: 420px; }
.manual-approve { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; margin-top: 1.25rem; }

/* ============================================================ calendar (roster + parent booking) */
.small { font-size: .85rem; }
.topbar-user { color: #cbd5e1; font-weight: 550; align-self: center; margin-right: .25rem; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.cal-head h2 { margin: 0; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .25rem 0; }
.cal-day { min-height: 74px; border: 1px solid var(--line); border-radius: 10px; padding: .35rem .4rem; background: #fff;
           display: flex; flex-direction: column; gap: .25rem; font: inherit; color: inherit; text-align: left; min-width: 0; }
.cal-day.out { background: transparent; border-color: transparent; }
.cal-day.past:not(.out) { background: #f8fafc; color: var(--muted); }
.cal-day.today .cal-num { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 .4rem; }
.cal-day.closed:not(.out) { background: repeating-linear-gradient(135deg, #f8fafc, #f8fafc 6px, #f1f5f9 6px, #f1f5f9 12px); }
.cal-num { font-weight: 700; font-size: .9rem; align-self: flex-start; }
.cal-closed { font-size: .72rem; font-weight: 650; color: var(--muted); line-height: 1.25; overflow-wrap: anywhere;
              display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cal-counts { display: flex; flex-wrap: wrap; gap: .25rem; font-size: .75rem; font-weight: 650; }
.cal-counts span { background: var(--primary-l); color: var(--primary-d); border-radius: 6px; padding: 0 .3rem; }
.cal-day-btn { cursor: pointer; }
.cal-day-btn:hover { border-color: var(--primary); }
.cal-day-btn.selected { border: 2px solid var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .75rem; font-size: .82rem; color: var(--muted); }
.cal-legend .sess { display: inline-block; width: 14px; height: 14px; padding: 0; vertical-align: -2px; }
.cal-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .9rem; }
.child-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.child-tabs .chip-btn { font-weight: 650; padding: .45rem 1rem; }

/* Before / After toggles in each booking day */
.cal-sessions { display: flex; flex-direction: column; gap: 4px; }
.sess { border: 1px solid var(--line); background: #fff; border-radius: 7px; font: inherit; font-size: .78rem; font-weight: 650;
        padding: .3rem .2rem; cursor: pointer; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-open:hover { border-color: var(--primary); color: var(--primary-d); }
.sess-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.sess-booked { background: var(--green-l); border-color: #86efac; color: #166534; cursor: default; }
.sess-full { background: var(--red-l); border-color: #fecaca; color: #991b1b; cursor: default; }
.sess-off { background: transparent; border-color: transparent; color: #cbd5e1; cursor: default; }
.sess[disabled] { opacity: 1; }

.cart-total { font-size: 1.3rem; }
.pay-or { text-align: center; color: var(--muted); margin: .6rem 0; font-size: .9rem; }
paypal-buttons { display: block; margin-top: .5rem; }
.parent-page .panel .btn-block + .muted, .parent-page paypal-buttons + .muted { margin-top: .75rem; }
/* parent home: upcoming care — date | child name | before | after, one grid so every column lines up across days */
.upcoming { display: grid; grid-template-columns: max-content minmax(0, max-content) max-content max-content; column-gap: 1.25rem; }
.upcoming-row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; row-gap: .4rem;
                padding: .65rem 0; border-bottom: 1px solid var(--line); }
.upcoming-row:last-child { border-bottom: 0; }
.upcoming-day { grid-column: 1; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.upcoming-kid { display: grid; grid-column: 2 / -1; grid-template-columns: subgrid; align-items: center; }
.upcoming-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-kid .tag { display: block; text-align: center; }
@media (max-width: 420px) { .upcoming { column-gap: .6rem; } .tag-long { display: none; } }

/* admin: parents, invites */
.child-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem 1rem; margin-top: .75rem;
              max-height: 320px; overflow: auto; }
.invite-box { margin-top: 1rem; }
.invite-link { display: flex; gap: .5rem; margin-top: .5rem; }
.invite-link input { font-size: .85rem; }
.settings-status { margin-top: 1rem; }

/* teacher sign-in by card */
.card-login { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.kiosk-roster-link { right: 70px; }

@media (max-width: 600px) {
  .page { padding: 1rem; }
  .cal { gap: 3px; }
  .cal-day { min-height: 64px; padding: .25rem; }
  .sess { font-size: .68rem; padding: .3rem 0; }
  .page-head > div:last-child { flex-wrap: wrap; }
  .topbar .brand { font-size: .95rem; }
}

@media print {
  .topbar, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .grid-2 { display: block; }
  .panel { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
.page-head > div:only-child { display: block; }

/* serial card reader connect button */
.reader-connect { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.reader-error { color: #f87171; font-size: .85rem; max-width: 320px; }

/* roster: Book care window + card payment by QR code */
.modal-wide { max-width: 760px; max-height: calc(100vh - 32px); overflow-y: auto; }
.book-window .cal-head h3 { margin: 0; }
.bk-kids { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 1rem; }
.bk-find { position: relative; min-width: 260px; }
.bk-find .search { width: 100%; max-width: none; }
.bk-matches { margin: .4rem 0 0; }
.bk-matches .pick-row { padding: .55rem .8rem; }
.bk-kid { display: inline-flex; align-items: center; gap: .25rem; background: var(--primary-l); color: var(--primary-d);
          border-radius: 999px; padding: .3rem .4rem .3rem .8rem; font-weight: 650; }
.bk-kid-x { border: 0; background: transparent; color: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.bk-total { margin-top: 1rem; padding: .75rem 1rem; background: #f8fafc; border-radius: 10px; font-size: 1.05rem; }
.sess-part { border-color: #86efac; box-shadow: inset 3px 0 0 #22c55e; }
.sess-part-name { display: block; font-size: .64rem; font-weight: 600; opacity: .8; line-height: 1.1; }
.sess-selected .sess-part-name { opacity: .9; }
.pay-title { margin: 1.25rem 0 .6rem; font-size: 1rem; }
.pay-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.pay-opt { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: left;
           padding: .8rem .85rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit;
           color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; }
.pay-opt:hover { border-color: var(--primary); }
.pay-opt:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,.25); }
.pay-opt svg { width: 26px; height: 26px; margin-bottom: .35rem; fill: none; stroke: var(--muted); stroke-width: 1.8;
               stroke-linecap: round; stroke-linejoin: round; }
.pay-opt b { font-size: .95rem; }
.pay-opt span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.pay-opt.on { border-color: var(--primary); background: var(--primary-l); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.pay-opt.on svg { stroke: var(--primary); }
.pay-opt.on::after { content: '✓'; position: absolute; top: .55rem; right: .6rem; width: 20px; height: 20px; border-radius: 50%;
                     background: var(--primary); color: #fff; font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
.pay-hint { margin: .7rem 0 0; padding: .55rem .8rem; border-radius: 8px; background: #f8fafc; color: var(--ink-2); font-size: .88rem; }
@media (max-width: 640px) { .pay-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pay-opt:last-child:nth-child(odd) { grid-column: 1 / -1; } }

/* balances / family accounts */
.balance-box { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .75rem; padding: 1rem 1.25rem; margin-bottom: 1.25rem;
               background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 5px solid var(--line); }
.balance-box > span { font-weight: 700; color: var(--ink-2); }
.balance-box b { font-size: 2rem; letter-spacing: -.02em; }
.balance-box small { flex-basis: 100%; }
.balance-box.owes { border-left-color: var(--red); } .balance-box.owes b { color: #b91c1c; }
.balance-box.credit { border-left-color: var(--green); } .balance-box.credit b { color: #15803d; }
.panel-flush-title { padding: 1.1rem 1.25rem 0; margin: 0; }
.row-payment td { background: #f8fafc; }
.panel-flush-title.panel-head { padding-bottom: .5rem; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button { flex: 1 1 auto; padding: .55rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
              font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button.on { border-color: var(--primary); background: var(--primary-l); color: var(--primary-d); }
.bk-received { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; margin-top: .75rem; }
.bk-received .field { margin-bottom: 0; flex: 0 1 160px; }
.bk-received .seg { flex: 1 1 260px; }

/* roster: no-care days */
.nc-quick { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .25rem; }
.nc-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .25rem; }
.nc-actions .muted { margin-right: auto; }
.book-window .modal-actions { justify-content: flex-end; }
.qr-code { display: inline-block; padding: 12px; background: #fff; border-radius: 12px; margin: .5rem 0; }
.qr-code img, .qr-code canvas { display: block; max-width: 100%; height: auto; }
.modal.text-center .modal-actions { justify-content: center; }

/* roster on narrow screens: who's booked first, then the calendar and office tools */
@media (max-width: 900px) { .roster-grid { display: flex; flex-direction: column; align-items: stretch; } .roster-lists { order: -1; } }

/* roster: teacher check in / out */
.unbooked { margin-top: .75rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.unbooked h3 { font-size: .9rem; color: var(--muted); margin: .25rem 0; }
.checkin-other { margin-top: .75rem; }
.pick-list { display: grid; gap: .4rem; margin: .5rem 0 .75rem; max-height: 50vh; overflow: auto; }
.pick-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; text-align: left; padding: .8rem .9rem; border: 1.5px solid var(--line);
            border-radius: 12px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; }
.pick-row:hover { border-color: var(--primary); }
.pick-row.on { border-color: var(--primary); background: var(--primary-l); }
.pick-other { border-style: dashed; }
.blocked-box { background: var(--red-l); color: #7f1d1d; border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; font-size: .92rem; }
.sib-row { display: flex; padding: .45rem 0; }
.sib-row.disabled { opacity: .55; }
.flow-kicker-dark { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--primary); }

/* staff profile + timesheets */
.field-rate { max-width: 200px; }

/* teacher shift bar (roster) + sign-in */
.shift-bar { padding: 1rem 1.25rem; }
.shift-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.shift-text { flex: 1; min-width: 180px; }
.shift-undo { margin-top: .6rem; color: var(--muted); }
.dot-grey { background: #94a3b8; box-shadow: 0 0 0 4px #f1f5f9; }
.home-tip { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.home-tip span { flex: 1; min-width: 220px; }
.remember { align-items: flex-start; text-align: left; margin: 0 0 1rem; line-height: 1.35; }
.remember input { margin-top: .25rem; }
.auto-signin { padding: 1rem 0; }
.spinner { width: 36px; height: 36px; margin: 0 auto .75rem; border-radius: 50%; border: 4px solid var(--primary-l);
           border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* parent sign-up + admin import */
.signup-cta { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); display: grid; gap: .5rem; }
.share-link { padding: 1rem 1.25rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.table-scroll { overflow-x: auto; }
tr.row-error td { background: #fffafa; }
.row-problem { color: var(--red); font-size: .85rem; margin-top: .2rem; }
.nav-toggle { display: none; }

/* ============================================================ phones */
@media (max-width: 900px) {
  .topbar-admin .nav-toggle { display: grid; place-items: center; margin-left: auto; width: 40px; height: 40px; border-radius: 10px;
                              border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; cursor: pointer; }
  .topbar-admin nav, .topbar-admin .topbar-right { display: none; width: 100%; }
  .topbar-admin nav.open { display: flex; flex-direction: column; gap: 2px; }
  .topbar-admin nav.open a { padding: .75rem .8rem; font-size: 1rem; }
  .topbar-admin .topbar-right.open { display: flex; margin-left: 0; padding: .25rem 0 .5rem; }
  .topbar-admin .topbar-right.open .btn { flex: 1; padding: .6rem; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.45rem; }
  .page { padding: 1rem .75rem 2rem; }
  .panel { padding: 1.1rem; border-radius: 12px; }
  .panel-flush { padding: 0; }
  .panel-flush .table { min-width: 560px; }
  .table td, .table th { padding: .65rem .75rem; }
  input, select, textarea, .invite-link input { font-size: 16px; }   /* stops iOS zooming into fields */
  .search, .toolbar select { max-width: none; width: 100%; min-width: 0; }
  .field-row { gap: 0 .75rem; }
  .field-row > .field { min-width: 140px; }
  .page-head { align-items: stretch; margin-bottom: 1rem; }
  .page-head > div:last-child:not(:only-child) { width: 100%; }
  .page-head > div:last-child .btn, .page-head > .btn { flex: 1 1 auto; }
  .page-head > .btn { width: 100%; }
  .form-actions { flex-wrap: wrap; margin-bottom: 2rem; }
  .form-actions .btn { flex: 1 1 auto; }
  .inline-form { flex-direction: column; }
  .inline-form input { max-width: none; }
  .list-row { flex-wrap: wrap; }
  .modal-backdrop { padding: .5rem; }
  .modal { padding: 1.25rem 1rem; border-radius: 14px; max-height: calc(100vh - 1rem); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
  .topbar { padding: .6rem .75rem; gap: .5rem; }
  .topbar-user { display: none; }
  .login-card { padding: 1.75rem 1.25rem; }
  .login-page { align-items: start; padding-top: 2rem; }
  .stats { gap: .6rem; grid-template-columns: repeat(3, 1fr); }
  .stat { padding: .8rem; }
  .stat b { font-size: 1.7rem; }
  .stat span { font-size: .78rem; }
  .stats-money .stat { padding: .7rem .6rem; }
  .stats-money .stat b { font-size: 1.1rem; }
  .sess { padding: .45rem 0; }
  .cal-day { min-height: 70px; }
  .cal-head h2 { font-size: 1rem; }
  .shift-row .btn { width: 100%; }
  .bk-find { min-width: 0; flex: 1; }
  .kiosk-inner { padding: 1rem; }
  .kiosk-top { flex-wrap: wrap; }
  .kiosk-top-right { flex-wrap: wrap; }
  .result-card { padding: 1.75rem 1.25rem; border-radius: 20px; }
  .result-time { font-size: 1.5rem; }
  .person-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
  .here-list { grid-template-columns: 1fr; }
  .toast { left: .75rem; right: .75rem; transform: none; text-align: center; bottom: 1rem; }
}

/* Which account is signed in (admin / teacher / parent) */
.account-badge { align-self: center; padding: .2rem .6rem; border-radius: 999px; background: rgba(255,255,255,.14);
  color: #fff; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .topbar .brand { gap: .4rem; min-width: 0; }
  .account-badge { font-size: .68rem; padding: .15rem .45rem; }
}
.preview-banner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
