/* Member Helix — staff app layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px; border-right: 1px solid var(--line); background: #f7f8f8;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-top: -2px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 550; font-size: 14.5px; text-decoration: none; position: relative;
}
.nav a svg { width: 19px; height: 19px; color: var(--faint); }
.nav a:hover { background: var(--sunk); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24,32,43,.08), 0 0 0 1px var(--line); }
.nav a[aria-current="page"] svg { color: var(--violet); }
.nav a .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--present); }
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; }
.me div { min-width: 0; flex: 1; }
.me b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--faint); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: rgba(242, 244, 243, 0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.top.scrolled { border-bottom-color: var(--line); }
.searchbtn {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; width: min(420px, 100%);
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--faint); cursor: pointer; font-size: 14px;
}
.searchbtn svg { width: 17px; height: 17px; }
.searchbtn .kbd { margin-left: auto; }
.menu-btn { display: none; }
.view { padding: 22px 28px 60px; max-width: 1280px; width: 100%; }
.view:focus { outline: none; }
.view-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head .titles { flex: 1; min-width: 240px; }
.view-head p { color: var(--muted); margin-top: 6px; }

/* ---------- Today ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; }
.stat .v { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -0.03em; line-height: 1.1; }
.stat .k { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat .trend { font-size: 12px; font-weight: 600; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
.now-card { padding: 18px 20px; display: grid; gap: 12px; border-left: 4px solid var(--cyan); }
.now-card + .now-card { margin-top: 12px; }
.now-card h3 { font-size: 18px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--present); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--present); box-shadow: 0 0 0 0 rgba(14,159,110,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(14,159,110,0); } 100% { box-shadow: 0 0 0 0 rgba(14,159,110,0); } }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: grid; grid-template-columns: 86px 4px 1fr auto; gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); cursor: pointer; }
.agenda li:last-child { border-bottom: 0; }
.agenda li:hover { background: #f8f9fa; }
.agenda .t { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.agenda .bar { width: 4px; height: 34px; border-radius: 4px; }
.agenda .ttl b { display: block; font-weight: 600; }
.agenda .ttl small { color: var(--faint); font-size: 12.5px; }
.agenda li.past { opacity: 0.6; }
.feed { list-style: none; margin: 0; padding: 6px 0; max-height: 440px; overflow: auto; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 9px 20px; animation: feed-in 0.4s var(--ease); }
.feed li div { flex: 1; min-width: 0; }
.feed li b { font-weight: 600; font-size: 14px; }
.feed li small { display: block; color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes feed-in { from { background: var(--present-soft); } }

/* ---------- Calendar ---------- */
.cal-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-tools h2 { min-width: 200px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--line); gap: 1px; }
.month .dow { background: #fafbfb; padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.month .day { background: var(--surface); min-width: 0; min-height: 118px; padding: 6px 6px 8px; display: flex; flex-direction: column; gap: 3px; }
.month .day.other { background: #f9fafa; }
.month .day.other .d { color: #b3bac4; }
.month .day .d { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 2px 4px; display: flex; align-items: center; justify-content: space-between; }
.month .day.today .d span { background: var(--violet); color: #fff; border-radius: 99px; padding: 0 7px; }
.month .day .add { opacity: 0; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 1; }
.month .day:hover .add { opacity: 1; }
.ev {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 6px; border-radius: 6px;
  cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 0; text-align: left; width: 100%;
}
.ev:hover { filter: brightness(0.96); }
.ev .tm { font-weight: 500; opacity: 0.8; }
.ev.cancelled { text-decoration: line-through; opacity: 0.55; }
.more { font-size: 12px; color: var(--muted); padding: 0 6px; cursor: pointer; border: 0; background: none; text-align: left; }
.week { display: grid; grid-template-columns: 56px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.week .wh { padding: 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); text-align: center; }
.week .wh b { display: block; font-family: var(--display); font-size: 20px; color: var(--ink); }
.week .wh.today b { color: var(--violet); }
.week .hours { position: relative; }
.week .hours div { height: 52px; font-size: 11px; color: var(--faint); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.week .col { position: relative; border-left: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0 51px, var(--line) 51px 52px); }
.week .blk { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 5px 7px; font-size: 12px; overflow: hidden; cursor: pointer; border: 0; text-align: left; }
.week .blk b { display: block; font-weight: 650; }
.week .nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--absent); z-index: 2; }
.week .nowline::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--absent); }

/* ---------- Session check-in ---------- */
.session-hero { padding: 22px 24px; display: grid; gap: 18px; margin-bottom: 18px; overflow: hidden; position: relative; }
.session-hero .meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.session-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.session-hero .meta svg { width: 16px; height: 16px; }
.tally { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-end; }
.tally div { display: grid; }
.tally .v { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: -0.03em; line-height: 1; }
.tally .k { font-size: 13px; color: var(--muted); margin-top: 4px; }
.strand { width: 100%; height: 86px; display: block; }
.strand .rung { transition: stroke 0.4s, stroke-width 0.4s, opacity 0.4s; cursor: default; }
.strand .rung.new { animation: rung-in 0.9s var(--ease); }
@keyframes rung-in { 0% { stroke-width: 9; } 100% { } }
.roster-tools { display: flex; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.roster-tools .input { max-width: 300px; }
.roster { list-style: none; margin: 0; padding: 0; }
.roster li { display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--line); transition: background 0.3s; }
.roster li:last-child { border-bottom: 0; }
.roster li.flash { background: var(--present-soft); }
.roster .who { flex: 1; min-width: 0; }
.roster .who b { font-weight: 600; }
.roster .who small { display: block; color: var(--faint); font-size: 12.5px; }
.status-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; flex: none; }
.status-seg button { border: 0; background: var(--surface); height: 34px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.status-seg button + button { border-left: 1px solid var(--line-2); }
.status-seg button:hover { background: #f6f7f8; }
.status-seg button[aria-pressed="true"][data-s="present"] { background: var(--present); color: #fff; }
.status-seg button[aria-pressed="true"][data-s="absent"] { background: var(--absent); color: #fff; }
.status-seg button[aria-pressed="true"][data-s="excused"] { background: var(--excused); color: #fff; }
.status-seg svg { width: 15px; height: 15px; }
.scan-dock { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 18px; padding: 18px; border-bottom: 1px solid var(--line); background: #fafbfb; }
.scan-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.scan-log li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); animation: feed-in .5s var(--ease); }
.scan-log li.bad { border-color: #f1c4c9; background: var(--absent-soft); }

/* ---------- Members / classes ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .input { max-width: 320px; }
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.class-card { padding: 0; overflow: hidden; cursor: pointer; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); transition: border-color .15s, transform .15s; display: flex; flex-direction: column; }
.class-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.class-card .cbar { height: 6px; }
.class-card .cbody { padding: 16px 18px 18px; display: grid; gap: 10px; }
.class-card .cfoot { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.member-head { display: flex; gap: 18px; align-items: center; padding: 22px 24px; flex-wrap: wrap; }
.member-head .info { flex: 1; min-width: 220px; }
.member-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.qr-card { padding: 20px; display: grid; justify-items: center; gap: 10px; text-align: center; }
.qr-card .mnum { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: 0.02em; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; }
.tabs button { border: 0; background: none; padding: 13px 10px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--violet); }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history li div { flex: 1; }
.history li small { display: block; color: var(--faint); font-size: 12.5px; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; }
.dots i { width: 12px; height: 12px; border-radius: 3px; background: var(--sunk); }
.dots i.present { background: var(--present); }
.dots i.absent { background: var(--absent); opacity: .75; }
.dots i.excused { background: var(--excused); }
.picker { border: 1px solid var(--line-2); border-radius: 12px; max-height: 300px; overflow: auto; }
.picker label { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker label:last-child { border-bottom: 0; }
.picker label:hover { background: #f8f9fa; }
.picker input { width: 17px; height: 17px; accent-color: var(--violet); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row label { position: relative; }
.color-row input { position: absolute; opacity: 0; }
.color-row span { display: block; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.8); }
.color-row input:checked + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.color-row input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label input { position: absolute; opacity: 0; }
.days label span { display: grid; place-items: center; width: 44px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.days label input:checked + span { background: var(--violet); color: #fff; border-color: var(--violet); }
.days label input:focus-visible + span { outline: 2.5px solid var(--violet); outline-offset: 2px; }

/* ---------- Messages ---------- */
.compose { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.preview { background: var(--paper); border-radius: var(--r-lg); padding: 18px; }
.preview .mail { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.preview .mail .bar { height: 5px; background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.preview .mail .inner { padding: 20px 22px; font-size: 14px; }
.preview .mail .inner p { margin-bottom: 12px; line-height: 1.6; }
.merge { display: flex; gap: 6px; flex-wrap: wrap; }
.merge button { border: 1px dashed var(--line-2); background: #fff; border-radius: 8px; padding: 3px 8px; font-size: 12px; cursor: pointer; color: var(--ink-2); }

/* ---------- Reports ---------- */
.chart { width: 100%; height: 240px; display: block; }
.chart .b { fill: var(--violet); transition: fill .15s; }
.chart .b:hover { fill: var(--cyan); }
.chart text { font-size: 11px; fill: var(--faint); font-family: var(--ui); }
.bars-h { display: grid; gap: 12px; }
.bars-h .r { display: grid; grid-template-columns: 160px 1fr 60px; gap: 12px; align-items: center; font-size: 14px; }
.bars-h .track { height: 10px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.bars-h .fill { height: 100%; border-radius: 99px; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.settings nav { position: sticky; top: 80px; display: grid; gap: 2px; }
.settings nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 550; font-size: 14px; }
.settings nav a:hover { background: var(--sunk); text-decoration: none; }
.settings section { scroll-margin-top: 80px; }
.settings section + section { margin-top: 18px; }
.codebox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: #0f1520; color: #d9e1ec; border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; background: #121a26; color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .copy { position: relative; max-width: 440px; }
.auth-art h1 { font-size: clamp(34px, 4.2vw, 54px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; }
.auth-art p { color: #b8c2d1; font-size: 16px; margin-top: 14px; line-height: 1.55; }
.auth-art .brand { color: #fff; position: relative; padding: 0; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.auth-form h2 { font-size: 26px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col, .member-grid, .compose { grid-template-columns: 1fr; }
  .scan-dock { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 400; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-pop); }
  .app.nav-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .top { gap: 8px; }
  .top .searchbtn { flex: 1; min-width: 0; }
  .top .searchbtn span:not(.kbd) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top .searchbtn .kbd { display: none; }
  .top #quickScan span, .top #quickAdd span { display: none; }
  .top #quickScan, .top #quickAdd { width: 40px; padding: 0; flex: none; }
  .seg { max-width: 100%; overflow-x: auto; }
  .seg button { white-space: nowrap; }
  .roster-tools .input, .toolbar .input { max-width: none; }
  .top, .view { padding-left: 16px; padding-right: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; }
  .settings { grid-template-columns: 1fr; }
  .settings nav { position: static; display: flex; overflow: auto; }
  .month .day { min-height: 74px; }
  .month .ev .tm { display: none; }
  .bars-h .r { grid-template-columns: 110px 1fr 48px; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .roster li { flex-wrap: wrap; }
  .status-seg { width: 100%; }
  .status-seg button { flex: 1; justify-content: center; }
  .agenda li { grid-template-columns: 64px 4px 1fr; }
  .agenda li > :last-child { display: none; }
}
@media print {
  .side, .top, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
