/* Course Teaching Tracker — mobile-first styles.
   Design tokens live here in one place (Section 11). */
:root {
  --primary: #C8102E;
  --primary-dark: #9E0B22;
  --primary-soft: #FDECEF;
  --bg: #FFFFFF;
  --surface: #F7F7F8;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --status-conducted: #16A34A;
  --status-scheduled: #6B7280;
  --status-missed: #DC2626;
  --status-covered: #2563EB;
  --warn: #B45309;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 1px 3px rgba(17, 24, 39, .08);
  --tap: 44px;
  --topbar-h: 56px;
  --bottombar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: rgba(200, 16, 46, .12);
  overflow-x: hidden; min-height: 100vh;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.45rem; font-weight: 750; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
button { font: inherit; }
:focus-visible { outline: 3px solid rgba(200, 16, 46, .45); outline-offset: 2px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip-link:focus { left: 8px; }

.ico { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.ico-sm { width: 16px; height: 16px; }
.ico-xl { width: 40px; height: 40px; color: #D1D5DB; }
.flip { transform: rotate(180deg); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.min0 { min-width: 0; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 24px; }
.mb { margin-bottom: 16px; }
.lg { font-size: 1.15rem; }
.sep { color: #CBD5E1; margin: 0 6px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--primary); color: #fff;
  padding-top: var(--safe-top);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.topbar-inner {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  max-width: 1120px; margin: 0 auto;
  padding: 0 calc(8px + var(--safe-right)) 0 calc(14px + var(--safe-left));
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; text-decoration: none !important; }
.brand-mark {
  flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: #fff; color: var(--primary); font-weight: 800; font-size: .78rem; letter-spacing: .04em;
}
.brand-mark-lg { width: 64px; height: 64px; font-size: 1.15rem; border-radius: 16px; background: var(--primary); color: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: .78rem; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: var(--tap); height: var(--tap); border-radius: 10px; border: 0; background: transparent;
  color: inherit; cursor: pointer; touch-action: manipulation;
}
.icon-btn:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.icon-btn .ico { width: 22px; height: 22px; }
.icon-btn-dark { color: var(--text); }
.icon-btn-dark:hover { background: var(--surface); }
.dot-badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #fff; color: var(--primary);
  font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--primary);
}

/* desktop nav row */
.deskbar { display: none; background: #fff; border-bottom: 1px solid var(--border); }
.deskbar-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.deskbar-inner::-webkit-scrollbar { display: none; }
.deskbar a {
  display: flex; align-items: center; gap: 6px; padding: 12px 12px; color: var(--muted);
  font-weight: 600; font-size: .92rem; white-space: nowrap; border-bottom: 3px solid transparent;
}
.deskbar a:hover { color: var(--text); text-decoration: none; }
.deskbar a.active { color: var(--primary); border-bottom-color: var(--primary); }
.deskbar .ico { width: 18px; height: 18px; }

.count {
  display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--surface); color: var(--muted); font-size: .75rem; font-weight: 700; line-height: 22px; text-align: center;
  border: 1px solid var(--border);
}
.count-red, .deskbar .count, .drawer-nav .count { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- bottom bar (phones/tablets) ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  box-shadow: 0 -2px 10px rgba(17,24,39,.05);
}
.bottombar a, .bottombar button {
  flex: 1 1 0; min-width: 0; height: var(--bottombar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--muted); cursor: pointer; touch-action: manipulation;
  font-size: .7rem; font-weight: 600; text-decoration: none !important; padding: 0 2px;
}
.bottombar .active { color: var(--primary); }
.bottombar .active .bb-icon::after {
  content: ""; position: absolute; top: -9px; left: 50%; width: 28px; height: 3px; margin-left: -14px;
  border-radius: 0 0 3px 3px; background: var(--primary);
}
.bb-icon { position: relative; display: inline-flex; }
.bb-icon .ico { width: 24px; height: 24px; }
.bb-icon .dot-badge { top: -6px; right: -12px; background: var(--primary); color: #fff; box-shadow: 0 0 0 2px #fff; }
.bb-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(17,24,39,.45);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(320px, 86vw); background: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  transform: translateX(105%); transition: transform .22s ease; visibility: hidden;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) 0;
  box-shadow: -8px 0 24px rgba(17,24,39,.18);
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
body.drawer-open .drawer { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.drawer-user { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer-user strong, .drawer-user small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-user small { color: var(--muted); }
.drawer-nav { padding: 8px; display: flex; flex-direction: column; }
.drawer-nav a, .drawer-link {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px;
  color: var(--text); font-weight: 550; text-decoration: none !important; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left; font-size: 1rem;
}
.drawer-nav a span:first-of-type, .drawer-link span { flex: 1; }
.drawer-nav a:hover, .drawer-link:hover { background: var(--surface); }
.drawer-nav a.active { background: var(--primary-soft); color: var(--primary); }
.drawer-nav .ico { color: var(--muted); }
.drawer-nav a.active .ico { color: var(--primary); }

.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: .95rem;
}
.avatar-sm { width: 36px; height: 36px; font-size: .8rem; }

/* ---------- layout ---------- */
.main {
  max-width: 1120px; margin: 0 auto;
  padding: 16px calc(16px + var(--safe-right)) 24px calc(16px + var(--safe-left));
}
body.authed .main { padding-bottom: calc(var(--bottombar-h) + var(--safe-bottom) + 24px); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head > div { min-width: 0; flex: 1 1 220px; }
.page-head p { margin-top: 4px; font-size: .92rem; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; font-weight: 600; min-height: 36px; }

.section { margin-top: 24px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 1.08rem; margin-bottom: 10px; }
.section-head .section-title { margin-bottom: 0; }
.sub-title { font-size: .92rem; color: var(--muted); font-weight: 650; margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .03em; }
.link-sm { display: inline-flex; align-items: center; font-weight: 600; font-size: .9rem; min-height: 36px; }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  min-width: 0;
}
.card-title { font-size: 1.05rem; margin-bottom: 12px; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: #F3B5C0; box-shadow: 0 4px 14px rgba(200,16,46,.10); }
.callout { border-left: 4px solid var(--primary); }
section.callout:not(.card) { background: var(--primary-soft); border-radius: var(--radius); padding: 14px; border-left-width: 4px; border-left-style: solid; }
section.callout .section-title { color: var(--primary-dark); margin-bottom: 4px; }
section.callout > p { margin-bottom: 12px; }

.grid-2, .grid-cards { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 650; font-size: .95rem; line-height: 1.2; cursor: pointer; text-decoration: none !important;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background .15s, border-color .15s;
  background: var(--surface); color: var(--text); text-align: center;
}
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { background: var(--primary-dark); transform: translateY(1px); }
.btn-success { background: var(--status-conducted); color: #fff; }
.btn-success:hover { background: #15803D; }
.btn-outline { background: #fff; border-color: #D1D5DB; color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: var(--status-missed); color: #fff; }
.btn-ghost-danger { background: transparent; color: var(--status-missed); }
.btn-ghost-danger:hover { background: #FEF2F2; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .875rem; }
.btn-lg { min-height: 50px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.is-busy { opacity: .7; pointer-events: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 600; font-size: .9rem; }
input[type=text], input:not([type]), input[type=password], input[type=email], input[type=url],
input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; min-width: 0; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid #D1D5DB; border-radius: 10px; background: #fff; color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zoom on focus */
  -webkit-appearance: none; appearance: none;
}
input[type=date], input[type=time] { display: block; line-height: 1.3; min-height: var(--tap); }
input::-webkit-date-and-time-value { text-align: left; }
select {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(200,16,46,.15); }
.select-sm { min-height: 38px; padding-top: 6px; padding-bottom: 6px; width: auto; }
.help { color: var(--muted); font-size: .8rem; }
.form-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 10px;
  border: 0; background: none; color: var(--primary); font-weight: 650; font-size: .85rem; cursor: pointer;
}

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; width: 48px; height: 28px; border-radius: 14px; background: #D1D5DB; position: relative; transition: background .15s; margin-top: 2px; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--status-conducted); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid rgba(200,16,46,.45); outline-offset: 2px; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

details.add-card > summary, details.danger-zone > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-weight: 700; color: var(--primary); min-height: 28px;
}
details > summary::-webkit-details-marker { display: none; }
details.add-card[open] > summary { color: var(--text); }
details.danger-zone > summary { color: var(--status-missed); }
details.danger-zone { border-color: #FECACA; }

.filters { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
.filters .field label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.filters:not(.filters-4) { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- flash ---------- */
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: var(--radius);
  margin-bottom: 16px; font-weight: 550; font-size: .95rem; border: 1px solid;
}
.flash > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.flash .ico { margin-top: 1px; }
.flash-success { background: #F0FDF4; border-color: #BBF7D0; color: #14532D; }
.flash-error { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }
.flash-close { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; padding: 0; width: 28px; height: 28px; display: grid; place-items: center; margin: -3px -2px 0 0; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; line-height: 1.35; white-space: nowrap; border: 1px solid transparent;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.badge .ico { width: 13px; height: 13px; stroke-width: 2.6; }
.b-conducted { background: #DCFCE7; color: #166534; border-color: #BBF7D0; }
.b-scheduled { background: #F3F4F6; color: #374151; border-color: #E5E7EB; }
.b-missed { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.b-covered { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }
.b-warn { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.b-type { background: var(--primary-soft); color: var(--primary-dark); border-color: #F8C9D1; }
.b-plain { background: #fff; color: var(--muted); border-color: var(--border); }

/* ---------- stats ---------- */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; border-top: 3px solid var(--status-scheduled);
}
.stat-n { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-l { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-conducted { border-top-color: var(--status-conducted); }
.stat-conducted .stat-n { color: var(--status-conducted); }
.stat-missed { border-top-color: var(--status-missed); }
.stat-missed .stat-n { color: var(--status-missed); }
.stat-covered { border-top-color: var(--status-covered); }
.stat-covered .stat-n { color: var(--status-covered); }

.n { font-weight: 800; font-size: 1.05rem; }
.n-conducted { color: var(--status-conducted); }
.n-missed { color: var(--status-missed); }
.n-covered { color: var(--status-covered); }

.person-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; text-align: center; }
.mini-stats > div { background: var(--surface); border-radius: var(--radius-sm); padding: 8px 2px; display: flex; flex-direction: column; min-width: 0; }
.mini-stats small { font-size: .68rem; color: var(--muted); line-height: 1.2; font-weight: 600; }

.progress-mini { display: flex; align-items: center; gap: 10px; font-size: .85rem; margin: 10px 0 6px; }
.progress-mini > span { white-space: nowrap; }
.progress-mini .bar { flex: 1; min-width: 60px; height: 8px; background: #EEF0F3; border-radius: 4px; overflow: hidden; }
.progress-mini .bar span { display: block; height: 100%; background: var(--status-conducted); border-radius: 4px; }
.section-head .progress-mini { margin: 0; min-width: 160px; }

.group-card .group-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-link { display: inline-flex; align-items: center; gap: 2px; margin-top: 8px; color: var(--primary); font-weight: 650; font-size: .9rem; }
.slot-chips { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chips li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; font-size: .8rem; white-space: nowrap; }
.slot-chips .warn-chip { background: #FEF3C7; border-color: #FDE68A; color: #92400E; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- session cards ---------- */
.sess-list { display: flex; flex-direction: column; gap: 10px; }
.date-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 10px 0 -2px; }
.date-head:first-child { margin-top: 0; }
.sess {
  display: flex; gap: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); border-left: 4px solid var(--status-scheduled); min-width: 0;
}
.sess.st-conducted { border-left-color: var(--status-conducted); }
.sess.st-missed { border-left-color: var(--status-missed); }
.sess.is-today { box-shadow: 0 0 0 2px rgba(200,16,46,.18), var(--shadow); }
.sess-num {
  flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; color: var(--text); grid-auto-flow: column; align-content: center;
}
.sess-num small { font-size: .7rem; color: var(--muted); font-weight: 700; margin-right: 1px; }
.sess-body { flex: 1; min-width: 0; }
.sess-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sess-name { font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.sess-meta { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.sess-meta strong { color: var(--text); }
.today-pill { display: inline-block; margin-left: 6px; background: var(--primary); color: #fff; border-radius: 6px; padding: 0 6px; font-size: .72rem; font-weight: 700; vertical-align: 1px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tags:empty { display: none; }
.sess-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.sess-actions form { margin: 0; }

/* ---------- cover cards ---------- */
.card-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.cover-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cover-main { display: flex; gap: 12px; min-width: 0; }
.cover-main > div:last-child { min-width: 0; }
.cover-actions form { margin: 0; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.conflict { display: flex; gap: 6px; align-items: flex-start; color: var(--status-missed); font-size: .85rem; font-weight: 600; margin-top: 8px; }
.conflict .ico { margin-top: 2px; }

/* ---------- simple lists ---------- */
.simple-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.simple-list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; min-height: 56px; }
.simple-list > li + li { border-top: 1px solid var(--border); }
.simple-list > li > div:first-child { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.simple-list.compact > li { padding: 8px 4px 8px 12px; min-height: 48px; }
.simple-list .inactive { opacity: .6; }
.li-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.li-actions form { margin: 0; }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 600; }

.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.checklist .check-dot { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #D1D5DB; display: grid; place-items: center; }
.checklist .done .check-dot { background: var(--status-conducted); border-color: var(--status-conducted); color: #fff; }
.checklist .done .check-dot .ico { width: 14px; height: 14px; stroke-width: 3; }
.checklist .done a { color: var(--muted); text-decoration: line-through; }
.checklist a { font-weight: 600; }

.names-list, .names-form { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.names-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.names-form li { display: flex; align-items: center; gap: 10px; }
.num-chip {
  flex: none; display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; font-size: .9rem;
}
.sticky-save {
  position: sticky; bottom: calc(var(--bottombar-h) + var(--safe-bottom) + 8px); z-index: 5;
  background: linear-gradient(rgba(255,255,255,0), #fff 30%); padding-top: 12px;
}

/* ---------- notifications ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.notif-list li + li { border-top: 1px solid var(--border); }
.notif { display: flex; gap: 12px; align-items: center; padding: 14px; color: var(--text); text-decoration: none !important; min-height: 64px; }
.notif:hover { background: var(--surface); }
.notif-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.notif.unread { background: #FFF8F9; }
.notif.unread .notif-dot { background: var(--primary); }
.notif.unread .notif-msg { font-weight: 650; }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.notif-msg { font-size: .95rem; }

/* ---------- tabs ---------- */
.tabs { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin: 20px 0 14px; gap: 4px; }
.tabs a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 9px; color: var(--muted); font-weight: 650; font-size: .95rem; text-decoration: none !important; }
.tabs a.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); border: 1px dashed #D1D5DB; border-radius: var(--radius); background: #FCFCFD; }
.empty .ico-xl { margin-bottom: 6px; }
.empty.small { padding: 20px 16px; }
.empty-lg { border: 0; background: none; padding: 64px 16px; }
.empty-lg h1 { margin: 8px 0; color: var(--text); }
.empty-lg .btn { margin-top: 16px; }

/* ---------- responsive tables (cards on phones) ---------- */
.table-wrap { width: 100%; }
.rtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.rtable th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; }
.rtable td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rtable tbody tr:nth-child(even) td { background: #FCFCFD; }
.rtable .num { text-align: center; }
.rtable .rt-title { display: none; }

@media (max-width: 759.98px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .rtable tr.row-conducted { border-left: 4px solid var(--status-conducted); }
  .rtable tr.row-missed { border-left: 4px solid var(--status-missed); }
  .rtable tr.row-scheduled { border-left: 4px solid var(--status-scheduled); }
  .rtable tbody tr:nth-child(even) td { background: transparent; }
  .rtable tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; }
  .rtable td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 0; border-bottom: 0; text-align: left !important; min-width: 0; overflow-wrap: anywhere; }
  .rtable td > * { min-width: 0; max-width: 100%; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  .rtable td.rt-head { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; font-size: 1rem; padding: 8px 0 10px; border-bottom: 1px solid #F1F2F4; margin-bottom: 4px; }
  .rtable td.rt-head::before { display: none; }
  .rtable td.num { align-items: flex-start; }
  .rtable .rt-title { display: inline; font-weight: 700; overflow-wrap: anywhere; }
  .rtable .hide-card { display: none; }
  .rtable td .badge { white-space: normal; text-align: left; }
}

/* ---------- login ---------- */
.login-wrap { min-height: calc(100vh - 48px); min-height: calc(100dvh - 48px); display: grid; place-items: center; padding: 16px 0; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 28px 22px; box-shadow: 0 10px 30px rgba(17,24,39,.08); border-top: 5px solid var(--primary); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { margin-top: 14px; font-size: 1.35rem; }
.login-brand p { margin-top: 4px; }

/* ---------- breakpoints ---------- */
@media (max-width: 379.98px) {
  /* very small phones (iPhone SE 1st gen, small Androids) */
  .main { padding-left: calc(12px + var(--safe-left)); padding-right: calc(12px + var(--safe-right)); }
  h1 { font-size: 1.28rem; }
  .topbar .brand-mark { width: 34px; height: 34px; }
  .sess { padding: 12px; gap: 10px; }
  .sess-num { width: 40px; height: 40px; font-size: 1rem; }
  .sess-top { flex-direction: column; gap: 6px; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-n { font-size: 1.35rem; }
  .bottombar a, .bottombar button { font-size: .64rem; }
  .simple-list > li { flex-wrap: wrap; }
}
@media (max-width: 339.98px) {
  .filters { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 519.98px) {
  .hide-sm { display: none; }
  .sess-actions .btn, .sess-actions form { flex: 1 1 auto; }
  .sess-actions .inline-form { flex: 1 1 100%; }
  .sess-actions .inline-form select { flex: 1; }
  .sess-actions .inline-form .btn { flex: none; }
  .btn-block-sm { width: 100%; }
  .simple-list > li { align-items: flex-start; }
  .page-head .btn { margin-top: 2px; }
}
@media (min-width: 520px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-3 { grid-template-columns: 1.2fr 1fr 1fr; }
  .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .names-form, .names-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-card { flex-direction: row; align-items: center; justify-content: space-between; }
  .cover-actions { flex: none; width: 220px; }
  .filters-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 760px) {
  h1 { font-size: 1.65rem; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-4 { grid-template-columns: 1.3fr 1fr 1fr 1.4fr; }
  .card { padding: 20px; }
  .rtable { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .rtable tbody tr:last-child td { border-bottom: 0; }
  .report-table td:first-child .num-chip { min-width: 30px; height: 28px; }
}
@media (min-width: 1000px) {
  /* desktop: show nav row, hide bottom bar */
  .deskbar { display: block; }
  .bottombar { display: none; }
  body.authed .main { padding-bottom: 40px; padding-top: 24px; }
  .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sticky-save { bottom: 0; }
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-list .cover-card { flex-direction: column; align-items: stretch; }
  .card-list .cover-actions { width: auto; }
}
@media (hover: none) {
  a:hover { text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media print {
  .topbar, .bottombar, .drawer, .drawer-backdrop, .filters, .sess-actions { display: none !important; }
  body.authed .main { padding: 0; }
}

/* ---------- list / calendar toggle ---------- */
.view-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.view-toggle a { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 8px; color: var(--muted); font-weight: 650; font-size: .88rem; text-decoration: none !important; }
.view-toggle a .ico { width: 17px; height: 17px; }
.view-toggle a.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 4px; margin: 4px 0 10px; }
.cal-month { flex: 1; text-align: center; font-size: 1.15rem; }
.cal-today { margin-left: 4px; }
.cal-totals { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.cal { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--border); }
.cal-head { background: var(--surface); }
.cal-dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 8px 0; }
.cal-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 58px; padding: 6px 2px; color: var(--text); text-decoration: none !important; min-width: 0;
  touch-action: manipulation;
}
.cal-cell + .cal-cell { border-left: 1px solid #F1F2F4; }
.cal-cell:hover { background: #FFF8F9; }
.cal-cell.out { background: #FAFAFB; }
.cal-cell.out .cal-day { color: #C0C4CC; }
.cal-cell.holiday { background: repeating-linear-gradient(135deg, #FFF5F6, #FFF5F6 6px, #fff 6px, #fff 12px); }
.cal-day {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-size: .88rem; font-weight: 650; line-height: 1;
}
.cal-cell.today .cal-day { background: var(--primary); color: #fff; }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--primary); background: #FFF5F6; }
.cal-hol { font-size: .6rem; font-weight: 700; color: var(--primary-dark); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: none; }
.cal-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; }
.cal-dots em { font-style: normal; font-size: .62rem; font-weight: 700; color: var(--muted); line-height: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--status-scheduled); flex: none; }
.dot-conducted { background: var(--status-conducted); }
.dot-missed { background: var(--status-missed); }
.dot-scheduled { background: #fff; box-shadow: inset 0 0 0 2px var(--status-scheduled); }
.dot-cov { box-shadow: 0 0 0 2px var(--status-covered); }
.dot-scheduled.dot-cov { box-shadow: inset 0 0 0 2px var(--status-scheduled), 0 0 0 2px var(--status-covered); }
.cal-chips { display: none; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .78rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .leg-hol::before { content: ""; width: 14px; height: 10px; border-radius: 3px; border: 1px solid #F8C9D1; background: repeating-linear-gradient(135deg, #FDE2E6, #FDE2E6 3px, #fff 3px, #fff 6px); }
.hol-note { display: flex; align-items: center; gap: 6px; color: var(--primary-dark); background: var(--primary-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; font-weight: 600; font-size: .9rem; }
#day { scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 8px); }

@media (max-width: 379.98px) {
  .cal-cell { min-height: 50px; }
  .cal-day { width: 24px; height: 24px; font-size: .8rem; }
  .dot { width: 6px; height: 6px; }
  .view-toggle a { padding: 0 9px; }
}
@media (min-width: 760px) {
  .cal-cell { align-items: stretch; min-height: 112px; padding: 6px; gap: 4px; }
  .cal-day { width: 26px; height: 26px; font-size: .82rem; align-self: flex-end; }
  .cal-hol { display: block; }
  .cal-dots { display: none; }
  .cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .chip {
    display: block; padding: 3px 6px; border-radius: 6px; font-size: .72rem; line-height: 1.3; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--status-scheduled);
    background: #F3F4F6; color: #374151;
  }
  .chip small { display: block; font-size: .66rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; }
  .chip-conducted { background: #DCFCE7; color: #166534; border-left-color: var(--status-conducted); }
  .chip-missed { background: #FEE2E2; color: #991B1B; border-left-color: var(--status-missed); }
  .chip-cov { box-shadow: inset 0 0 0 1px var(--status-covered); }
  .chip-more { font-size: .7rem; color: var(--muted); font-weight: 650; padding-left: 4px; }
  .cal-dow { font-size: .76rem; padding: 10px 0; }
}

