/* Pre-Attendance — design tokens follow the Y43 standard:
   Inter, navy ink, sky #4BBFE0, coral #E85D5D, gold #F0B84A, maroon, hairline dividers. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0; background-color: var(--bg); background-image: var(--bg-image); background-attachment: fixed; color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--chrome); color: var(--on-chrome);
  padding: env(safe-area-inset-top) 0 0;
}
.topbar-in { max-width: 1160px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.brandmark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 26px; height: 26px; flex: none; }
.brandmark i { border-radius: 3px; display: block; }
.brandmark i:nth-child(1) { background: var(--sky); } .brandmark i:nth-child(2) { background: var(--gold); }
.brandmark i:nth-child(3) { background: var(--slate); } .brandmark i:nth-child(4) { background: var(--coral); }
.region { font-weight: 700; letter-spacing: .02em; font-size: 16px; }
.rolepill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.14); }
.spacer { flex: 1; }
.todaychip { font-size: 13px; color: var(--chrome-muted); }
.todaychip b { color: var(--on-chrome); font-weight: 600; }
.syncdot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--chrome-muted); background: none; border: 0; padding: 4px 6px; border-radius: 8px; }
.syncdot:hover { background: rgba(255,255,255,.1); }
.syncdot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.syncdot[data-s='saving']::before { background: var(--gold); }
.syncdot[data-s='offline']::before { background: var(--coral); }
.syncdot[data-s='local']::before { background: var(--sky); }

.tabs { background: var(--card); border-bottom: 1px solid var(--line); }
.tabs-in { max-width: 1160px; margin: 0 auto; display: flex; gap: 4px; padding: 0 12px; }
.tab { display: flex; align-items: center; gap: 8px; padding: 13px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab svg { width: 18px; height: 18px; }
.tab[aria-current='page'] { color: var(--navy); border-bottom-color: var(--sky); }
.tab:hover { color: var(--navy); }

main.page { max-width: 1160px; margin: 0 auto; padding: 22px 16px 120px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
h1, h2, h3, .att-title, .pl-label { font-family: var(--font-display); }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: var(--h-track); margin: 0; font-weight: var(--h-weight); }
h2 { font-size: 17px; letter-spacing: -.01em; margin: 0; font-weight: 700; }
h3 { font-size: 15px; margin: 0; font-weight: 650; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.sechead { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 12px; gap: 12px; }
.sechead .sub { margin: 0; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-btn); border: 1px solid var(--line-strong); background: var(--card);
  font-weight: var(--btn-weight); font-size: 14.5px; min-height: 42px; color: var(--navy); transition: background .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); } .btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.sky { background: var(--sky); border-color: var(--sky); color: #0E1A33; }
.btn.sky:hover { filter: brightness(.94); }
.btn.danger { color: var(--coral-ink); }
.btn.danger.solid { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: var(--radius-btn); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--veil); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.iconbtn { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { background: var(--veil); color: var(--navy); }
.iconbtn svg { width: 20px; height: 20px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--navy-2); }
.hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); min-height: 44px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(75,191,224,.45); border-color: var(--sky); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238A96B3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }

.card { background: var(--card); border: var(--card-border-w) solid var(--card-line); border-radius: var(--radius); box-shadow: var(--card-shadow); -webkit-backdrop-filter: var(--card-blur); backdrop-filter: var(--card-blur); }
.num { font-family: var(--font-num); }
.pad { padding: 18px; }
.err { color: var(--coral-ink); background: var(--coral-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }
.note { color: var(--gold-ink); background: var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.empty { text-align: center; padding: 38px 20px; color: var(--muted); }
.empty h3 { color: var(--navy); margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; padding: 3px 10px; border-radius: var(--chip-radius); background: var(--slate-soft); color: var(--slate); white-space: nowrap; }
.chip.sky { background: var(--sky-soft); color: var(--sky-ink); }
.chip.gold { background: var(--gold-soft); color: var(--gold-ink); }
.chip.coral { background: var(--coral-soft); color: var(--coral-ink); }
.chip.navy { background: var(--primary); color: var(--on-primary); }
.chip.ok { background: var(--ok-soft); color: var(--ok-ink); }

/* ---------- gate ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--gate-bg); }
.gate-card { width: 100%; max-width: 420px; background: var(--card); border-radius: var(--radius-lg); padding: 30px 26px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.gate-card .brandmark { width: 38px; height: 38px; gap: 4px; margin-bottom: 18px; }
.gate-card h1 { font-size: 26px; }
.gate-card .sub { margin-bottom: 22px; }
.gate-foot { margin-top: 16px; text-align: center; font-size: 14px; }
.linkbtn { background: none; border: 0; color: var(--sky-ink); font-weight: 650; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
.banner-local { background: var(--sky-soft); color: var(--sky-ink); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 18px; }

/* ---------- weekend planner ---------- */
.weekends { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.wk { padding: 16px 18px; }
.wk-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.wk-code { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.wk-items { display: grid; gap: 8px; }
.wk-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--surface); text-align: left; width: 100%; }
.wk-item:hover { border-color: var(--sky); background: var(--sky-soft); }
.wk-item.have { border-style: solid; border-color: var(--line); background: var(--card); }
.wk-item.have:hover { border-color: var(--sky); }
.wk-item .nm { font-weight: 600; }
.wk-item .dt { font-size: 12.5px; color: var(--muted); }
.wk-item .act { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13px; color: var(--sky-ink); }
.wk-item .act svg { width: 16px; height: 16px; }

/* ---------- event cards ---------- */
.evlist { display: grid; gap: 10px; }
.ev { display: grid; grid-template-columns: 62px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; width: 100%; text-align: left; transition: border-color .12s, box-shadow .12s; }
.ev:hover { border-color: var(--sky); box-shadow: var(--shadow-hover); }
.ev-date { text-align: center; border-radius: 12px; background: var(--slate-soft); padding: 8px 0 7px; }
.ev-date .d { font-size: 22px; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.ev-date .w { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.ev.today .ev-date { background: var(--primary); color: var(--on-primary); } .ev.today .ev-date .w { color: var(--on-primary-2); }
.ev-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.ev-title .code { color: var(--sky-ink); margin-right: 6px; }
.ev-meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ev-count { text-align: right; }
.ev-count .big { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.ev-count .pc { font-size: 13px; color: var(--muted); }
.minibar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--slate-soft); margin-top: 8px; width: 100%; min-width: 120px; }
.minibar i { display: block; height: 100%; }
@media (max-width: 560px) {
  .ev { grid-template-columns: 54px 1fr; }
  .ev-count { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; justify-content: space-between; text-align: left; }
  .ev-count .minibar { margin: 0; flex: 1; }
}

/* ---------- attendance ---------- */
.att { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 1020px) { .att { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } .att-side { position: sticky; top: 118px; } }
.backlink { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; background: none; border: 0; padding: 4px 0; margin-bottom: 6px; }
.backlink:hover { color: var(--navy); } .backlink svg { width: 18px; height: 18px; }
.att-title { font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.att-title .code { color: var(--sky-ink); }
.hero { padding: 18px 18px 16px; margin: 16px 0 14px; }
.hero-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hero-num { font-size: 46px; font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.hero-num small { font-size: 22px; color: var(--muted); font-weight: 650; letter-spacing: -.01em; }
.hero-pc { font-size: 22px; font-weight: 700; color: var(--sky-ink); }
.hero-lbl { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.ribbon { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--slate-soft); margin: 16px 0 12px; }
.ribbon i { display: block; height: 100%; transition: width .25s ease; }
.c-ip { background: var(--sky); } .c-zon { background: var(--st-zon); } .c-zoff { background: var(--slate); } .c-abs { background: var(--coral); } .c-un { background: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.lg { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--navy-2); font-weight: 550; }
.lg b { font-weight: 750; }
.lg::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--slate-soft)); border: 1px solid var(--line-strong); }
.lg.ip { --c: var(--sky); } .lg.zon { --c: var(--st-zon); } .lg.zoff { --c: var(--slate); } .lg.abs { --c: var(--coral); } .lg.un { --c: var(--card); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.gchip { flex: none; display: inline-flex; align-items: center; gap: 9px; padding: 8px 8px 8px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; font-weight: 650; }
.gchip .cnt { font-size: 13px; font-weight: 750; padding: 3px 9px; border-radius: 99px; background: var(--slate-soft); color: var(--navy-2); }
.gchip[aria-pressed='true'] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.gchip[aria-pressed='true'] .cnt { background: rgba(127,127,127,.28); color: inherit; }
.gchip.full .cnt { background: var(--ok-soft); color: var(--ok-ink); }
.gchip[aria-pressed='true'].full .cnt { background: var(--sky); color: #0E1A33; }
.gchip.warn .cnt { background: var(--gold-soft); color: var(--gold-ink); }

.callout { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); margin-bottom: 14px; font-weight: 550; }
.callout.locked { background: var(--ok-soft); color: var(--ok-ink); }
.callout .btn { background: var(--card); }

.group { margin-top: 18px; }
.group-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 6px 4px 10px; }
.group-name { font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.group-cnt { font-size: 15px; font-weight: 800; padding: 3px 11px; border-radius: 99px; background: var(--sky-soft); color: var(--sky-ink); }
.group-cnt.full { background: var(--ok-soft); color: var(--ok-ink); }
.group-sub { color: var(--muted); font-size: 13px; }
.group-bar { flex: 1 1 90px; min-width: 70px; max-width: 160px; }
.group-sub { flex: 0 1 auto; }
.rows { overflow: hidden; }
.row { padding: 10px 12px 10px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-main { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13.5px; background: var(--slate-soft); color: var(--slate); flex: none; }
.row[data-s='IP'] .avatar { background: var(--sky-soft); color: var(--sky-ink); }
.row[data-s='ZON'] .avatar { background: var(--st-zon); color: var(--on-zon); }
.row[data-s='ZOFF'] .avatar { background: var(--slate); color: #fff; }
.row[data-s='ABS'] .avatar { background: var(--coral-soft); color: var(--coral-ink); }
.who { flex: 1; min-width: 0; }
.nm { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.row[data-s] .st { color: var(--navy-2); font-weight: 550; }
.seg { display: inline-grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--slate-soft); border-radius: 13px; flex: none; }
.sb { width: 44px; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--icon); display: grid; place-items: center; transition: background .1s, color .1s, transform .06s; }
.sb svg { width: 21px; height: 21px; }
.sb:hover { background: var(--card); color: var(--navy); }
.sb:active { transform: scale(.95); }
.sb[aria-pressed='true'] { color: #fff; box-shadow: 0 1px 2px rgba(14,26,51,.25); }
.sb[data-s='IP'][aria-pressed='true'] { background: var(--sky); color: #0E1A33; }
.sb[data-s='ZON'][aria-pressed='true'] { background: var(--st-zon); color: var(--on-zon); }
.sb[data-s='ZOFF'][aria-pressed='true'] { background: var(--slate); }
.sb[data-s='ABS'][aria-pressed='true'] { background: var(--coral); }
.locked .sb { pointer-events: none; opacity: .75; }
.locked .sb:not([aria-pressed='true']) { opacity: .3; }
@media (max-width: 420px) { .sb { width: 38px; height: 40px; } .avatar { width: 34px; height: 34px; } .row-main { gap: 9px; } }
.reason { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0 4px 50px; max-width: 420px; }
.reason select, .reason input { min-height: 40px; padding: 8px 10px; font-size: 14.5px; }
.reason.need select { border-color: var(--coral); background-color: var(--coral-soft); }
.reason .need-msg { font-size: 12.5px; color: var(--coral-ink); font-weight: 600; }
.group-tools { display: flex; gap: 6px; margin-left: auto; }
@media (max-width: 560px) { .group-bar { display: none; } .group-sub { flex: 1 1 100%; order: 3; } .group-tools { order: 2; } }

.out { padding: 16px; }
.out-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.out pre { margin: 0; padding: 14px; border-radius: 12px; background: var(--term-bg); color: var(--term-ink); font-size: 13px; line-height: 1.55; overflow: auto; max-height: 52vh; white-space: pre; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.out .actions { display: grid; gap: 10px; margin-top: 12px; }
.issues { display: grid; gap: 6px; margin-top: 12px; }
.issue { font-size: 13.5px; font-weight: 550; padding: 8px 10px; border-radius: 9px; background: var(--gold-soft); color: var(--gold-ink); }
.issue.ok { background: var(--ok-soft); color: var(--ok-ink); }
.mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--bar-bg); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.mobile-bar .btn { flex: 1; }
@media (min-width: 1020px) { .mobile-bar { display: none; } }
@media (max-width: 1019px) { .att-side .out { display: none; } }

/* ---------- roster / groups ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .nm { flex: 1; }
.glabel { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 8px; background: var(--slate-soft); color: var(--slate); }
.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.gcard { padding: 16px; display: grid; gap: 12px; }
.gcard-top { display: flex; align-items: center; justify-content: space-between; }
.gcard .big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.gcard .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.checklist { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.checklist label { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); font-weight: 550; min-height: 46px; }
.checklist label:first-child { border-top: 0; }
.checklist input { width: 20px; height: 20px; accent-color: var(--accent-ctl); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--scrim); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .14s ease; }
.modal { width: 100%; max-width: 560px; background: var(--card); border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; overflow: auto; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); animation: rise .18s ease; }
.modal.wide { max-width: 680px; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: var(--radius-lg); padding: 26px; max-height: 88vh; } }
.modal h2 { font-size: 20px; margin-bottom: 4px; }
.modal .mhead { margin-bottom: 18px; }
.modal .mfoot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.modal .mfoot .btn { flex: 0 1 auto; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(20px); opacity: .6 } to { transform: none; opacity: 1 } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.typecards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.typecard { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 650; }
.typecard small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; font-size: 12.5px; }
.typecard[aria-pressed='true'] { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--surface); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.qd { padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); text-align: left; line-height: 1.25; }
.qd b { display: block; font-size: 15px; letter-spacing: -.01em; }
.qd span { font-size: 12px; color: var(--muted); }
.qd[aria-pressed='true'] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); } .qd[aria-pressed='true'] span { color: var(--on-primary-2); }
.cal { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-weight: 700; } .cal-title small { color: var(--sky-ink); font-weight: 700; margin-left: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cd { aspect-ratio: 1 / .86; border: 0; border-radius: 10px; background: transparent; font-weight: 600; font-size: 15px; position: relative; }
.cd:hover { background: var(--slate-soft); }
.cd.wkend { color: var(--sky-ink); }
.cd.today { box-shadow: inset 0 0 0 2px var(--gold); }
.cd.sel { background: var(--primary); color: var(--on-primary); }
.cd.empty { visibility: hidden; }
.codebox { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.codebox input { max-width: 150px; font-weight: 700; letter-spacing: .08em; text-align: center; }
.preview { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--sky-soft); color: var(--navy); font-weight: 700; font-size: 15.5px; }
.yhelp { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(150px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; z-index: 90; pointer-events: none; padding: 0 16px; }
@media (min-width: 1020px) { #toasts { bottom: 28px; } }
.toast { background: var(--toast-bg); color: var(--toast-ink); padding: 11px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 480px; animation: rise .16s ease; }
.toast.bad { background: var(--maroon); color: #fff; }

/* ---------- mobile nav ---------- */
@media (max-width: 760px) {
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; border-top: 1px solid var(--line); border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .tabs-in { padding: 0; } .tab { flex: 1; flex-direction: column; gap: 3px; font-size: 11.5px; padding: 9px 4px 8px; border-bottom: 0; margin: 0; }
  .tab[aria-current='page'] { color: var(--navy); box-shadow: inset 0 3px 0 var(--sky); }
  main.page { padding-bottom: 140px; }
  .mobile-bar { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; } .todaychip { display: none; }
}

/* ---------- Wednesday + key services ---------- */
.typecard:last-child { grid-column: 1 / -1; }
.wk-item.key { border-left: 4px solid var(--c-wed); }
.wk-item.key[data-type="service"], .wk-item.key.have { }
.keytag { font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); background: var(--gold-soft); padding: 1px 6px; border-radius: 6px; vertical-align: 1px; }
.checkrow { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 8px; flex-wrap: wrap; }
.checkrow input { width: 20px; height: 20px; }
.checkrow .hint { font-weight: 500; }

/* ---------- calendar tab ---------- */
.cv { padding: 14px 14px 12px; }
.cv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cv-title { flex: 1; font-weight: 750; font-size: 20px; letter-spacing: -.01em; text-align: center; }
.cv-title small { color: var(--sky-ink); font-weight: 700; margin-left: 6px; font-size: 15px; }
.cv-sum { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; justify-content: center; }
.cv-sum b { color: var(--ink); } .cv-sum .warn { color: var(--gold-ink); font-weight: 600; } .cv-sum .okk { color: var(--ok-ink); font-weight: 600; }
.cv-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cv-dow { text-align: center; font-size: 12px; font-weight: 650; color: var(--muted); padding: 4px 0; }
.cv-day { min-height: 92px; padding: 6px 5px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-align: left; display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow: hidden; }
.cv-day:hover { border-color: var(--sky); background: var(--surface-2); }
.cv-day.keyday { background: var(--surface); }
.cv-day.past { opacity: .62; }
.cv-day.today { box-shadow: inset 0 0 0 2px var(--gold); opacity: 1; }
.cv-n { font-weight: 700; font-size: 14px; }
.cv-evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cv-chip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 5px; border-radius: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.cv-chip .cv-s { display: none; font-size: 10.5px; }
.cv-chip .cv-l { overflow: hidden; text-overflow: ellipsis; }
.cv-chip .cv-l i { font-style: normal; opacity: .85; margin-left: 2px; }
.cv-chip.s-open { background: var(--sky-soft); color: var(--sky-ink); }
.cv-chip.s-sub { background: var(--ok-soft); color: var(--ok-ink); }
.cv-chip.s-late { background: var(--coral-soft); color: var(--coral-ink); }
.cv-chip.gap { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); font-weight: 600; }
.cv-chip.key { box-shadow: inset 3px 0 0 var(--c-wed); }
.cv-chip.key.k-service { box-shadow: inset 3px 0 0 var(--c-sun); }
.cv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.cv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cv-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.cv-legend i.s-open { background: var(--sky-soft); border: 1px solid var(--sky); } .cv-legend i.s-sub { background: var(--ok-soft); border: 1px solid var(--ok); }
.cv-legend i.s-late { background: var(--coral-soft); border: 1px solid var(--coral); } .cv-legend i.gap { border: 1px dashed var(--muted); }
@media (max-width: 760px) {
  .cv { padding: 10px 8px; }
  .cv-grid { gap: 3px; }
  .cv-day { min-height: 62px; padding: 4px 3px; border-radius: 8px; }
  .cv-n { font-size: 13px; text-align: center; }
  .cv-evs { flex-direction: row; flex-wrap: wrap; gap: 2px; justify-content: center; }
  .cv-chip { padding: 1px 3px; font-size: 9.5px; gap: 0; border-radius: 4px; }
  .cv-chip .cv-l { display: none; } .cv-chip .cv-s { display: inline; }
  .cv-chip.key, .cv-chip.key.k-service { box-shadow: none; }
  .cv-dow { font-size: 10.5px; }
  .tab { font-size: 10.5px; } 
}
.timerow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.timerow .field { flex: 1 1 130px; }
.cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.modal { overflow-x: hidden; }
.modal > * { min-width: 0; }
.tagc { display: inline-block; font-size: 10.5px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.tagc.ld { background: var(--sky-soft); color: var(--sky-ink); } .tagc.nw { background: var(--gold-soft); color: var(--gold-ink); }

/* ---------- appearance ---------- */
.themebtn { color: var(--chrome-muted); } .themebtn:hover { background: rgba(255,255,255,.12); color: var(--on-chrome); }
.gate-theme { position: fixed; top: 14px; right: 14px; color: #fff; background: rgba(255,255,255,.14); }
.segpick { display: inline-flex; padding: 4px; gap: 4px; background: var(--slate-soft); border-radius: var(--radius-btn); flex-wrap: wrap; }
.segpick button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 16px; border-radius: calc(var(--radius-btn) - 2px); font-weight: 600; color: var(--muted); }
.segpick button svg { width: 17px; height: 17px; }
.segpick button[aria-pressed='true'] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.skincard { text-align: left; display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); }
.skincard small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.skincard .sw { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin-bottom: 6px; border: 1px solid var(--line); }
.skincard .sw i { flex: 1; }
.skincard[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--sky); border-color: var(--sky); }
.region { white-space: nowrap; }
@media (max-width: 560px) {
  .topbar-in { gap: 8px; padding: 9px 12px; }
  .syncdot[data-s='saved'], .syncdot[data-s='local'] { font-size: 0; padding: 8px; }
  .syncdot[data-s='saved']::before, .syncdot[data-s='local']::before { width: 10px; height: 10px; }
}

/* ---------- data safety ---------- */
.safety { font-size: 13.5px; color: var(--ok-ink); background: var(--ok-soft); border-radius: var(--radius-sm); padding: 12px 14px; line-height: 1.5; }
.vlist { display: grid; gap: 8px; max-height: 52vh; overflow: auto; }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.vnote { font-weight: 650; } .vmeta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Touch comfort: every tappable control is at least 44px on phones and tablets */
@media (pointer: coarse), (max-width: 700px) {
  .btn.small, .syncdot { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .syncdot { padding: 0 10px; }
}
@media (max-width: 700px) { input, select, textarea { font-size: 16px; } } /* stops iOS zoom-on-focus */

/* ---------- Printable report ---------- */
.rp-controls { display: grid; gap: 10px; padding: 18px; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rp-chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.rp-chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.rp-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rp-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; }
.rp-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
@media (max-width: 520px) { .rp-range { grid-template-columns: 1fr; } }

/* The paper: always light, in light or dark mode, so what you see is what prints. */
.report-sheet { --p-ink: #14172b; --p-mut: #5a6078; --p-line: #d8dbe8; --p-acc: #5b3df5; --p-soft: #f1f2fb;
  background: #fff; color: var(--p-ink); border-radius: 14px; padding: 28px 28px 20px; margin-top: 16px; box-shadow: 0 10px 40px rgba(10,10,40,.18);
  font-size: 14px; line-height: 1.45; overflow-x: auto; }
.report-sheet h1 { font-size: 26px; margin: 2px 0 6px; letter-spacing: -.01em; color: var(--p-ink); }
.report-sheet h2 { font-size: 16px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--p-acc); color: var(--p-ink); }
.rp-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 1px solid var(--p-line); padding-bottom: 14px; margin-bottom: 8px; }
.rp-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--p-acc); }
.rp-range-l { font-weight: 650; }
.rp-sub, .rp-note, .rp-foot { color: var(--p-mut); font-size: 12.5px; }
.rp-note { margin: -2px 0 8px; }
.rp-mark { display: grid; grid-template-columns: 14px 14px; gap: 3px; flex: none; }
.rp-mark i { width: 14px; height: 14px; border-radius: 4px; background: var(--p-acc); }
.rp-mark i:nth-child(2) { background: #18b4e8; } .rp-mark i:nth-child(3) { background: #f5b83d; } .rp-mark i:nth-child(4) { background: #f0627f; }
.rp-sec { margin-top: 20px; break-inside: auto; }
.rp-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 12px; }
.rp-kpis div { background: var(--p-soft); border-radius: 10px; padding: 10px 12px; display: grid; }
.rp-kpis b { font-size: 24px; letter-spacing: -.01em; color: var(--p-acc); }
.rp-kpis span { font-size: 12px; color: var(--p-mut); }
.rp-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 13px; }
.rp-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--p-mut); border-bottom: 1px solid var(--p-line); padding: 6px 8px; white-space: nowrap; }
.rp-table td { padding: 6px 8px; border-bottom: 1px solid #eceef6; vertical-align: middle; }
.rp-table tr { break-inside: avoid; }
.rp-table .n { text-align: right; white-space: nowrap; } .rp-table .v { width: 90px; }
.rp-tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--p-soft); color: var(--p-acc); margin-left: 4px; }
.rp-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: #eceef6; }
.rp-bar i { display: block; height: 100%; } .rp-bar .c-ip { background: #5b3df5; } .rp-bar .c-zon { background: #18b4e8; } .rp-bar .c-zoff { background: #9bd9f2; } .rp-bar .c-abs { background: #f0627f; }
.rp-empty { color: var(--p-mut); font-style: italic; margin: 8px 0; }
.rp-foot { margin-top: 22px; padding-top: 10px; border-top: 1px solid var(--p-line); }
@media (max-width: 600px) { .report-sheet { padding: 18px 14px; } .rp-kpis { grid-template-columns: repeat(2, 1fr); } .rp-table { font-size: 12.5px; } }

@media print {
  @page { margin: 14mm 12mm; }
  html, body { background: #fff !important; }
  .topbar, .tabs, #toasts, .no-print, .syncdot, .modal-back { display: none !important; }
  .page { padding: 0 !important; max-width: none !important; margin: 0 !important; }
  .report-sheet { box-shadow: none; border-radius: 0; margin: 0; padding: 0; overflow: visible; font-size: 11.5pt; }
  .rp-table { font-size: 10pt; }
  .rp-head, .rp-kpis div, .rp-tag, .rp-bar, .rp-bar i, .rp-mark i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rp-sec h2 { break-after: avoid; }
}
