:root {
  --ink: #18132f;
  --muted: #77718a;
  --line: #ddd9e8;
  --line-strong: #29205d;
  --primary: #4b2694;
  --primary-dark: #32176d;
  --primary-soft: #f1edfa;
  --surface: #ffffff;
  --surface-soft: #faf9fd;
  --canvas: #f7f7fa;
  --hover: #faf8ff;
  --green: #237a4b;
  --green-soft: #eaf7ef;
  --red: #c23d3d;
  --red-soft: #fff0ef;
  --amber: #a66b08;
  --amber-soft: #fff7df;
  --priority-low: #d1a000;
  --priority-low-soft: #fff8cf;
  --priority-normal: #d76816;
  --priority-normal-soft: #fff0e4;
  --priority-high: #d23b3b;
  --priority-high-soft: #fff0ef;
  --blue: #2166a8;
  --blue-soft: #edf6ff;
  --shadow: 0 12px 35px rgba(34, 25, 69, .08);
  --interactive-radius: 14px;
  --interactive-gutter: 16px;
  font-family: Inter, Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; margin: 0; min-height: 100%; overflow-x: hidden; }
body { min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; stroke-width: 1.8; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.15fr);
  background: #fff;
}
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 52px;
  color: white;
  background: #21134d;
}
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 30% -18% -35% 12%;
  border: 1px solid rgba(255,255,255,.22);
  transform: rotate(-10deg);
  background: linear-gradient(135deg, rgba(111, 72, 190, .25), rgba(255,255,255,.03));
}
.auth-brand strong, .sidebar-brand strong { display: block; font-size: 18px; }
.auth-brand span, .sidebar-brand span { display: block; margin-top: 2px; text-transform: uppercase; font-size: 11px; font-weight: 700; }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid currentColor; }
.brand-mark svg { width: 31px; height: 31px; }
.brand-mark.small { width: 42px; height: 42px; color: var(--primary); }
.brand-mark.small svg { width: 24px; height: 24px; }
.auth-panel { width: min(470px, calc(100% - 64px)); margin: auto; }
.auth-heading { margin-bottom: 34px; }
.eyebrow { display: block; margin-bottom: 10px; color: var(--primary); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.auth-heading h1 { margin: 0 0 12px; font-size: 34px; line-height: 1.15; }
.auth-heading p, .page-heading p { margin: 0; color: var(--muted); }
.auth-portal-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: -14px 0 24px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--canvas);
}
.auth-portal-switch button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.auth-portal-switch button:hover { color: var(--primary); background: var(--hover); }
.auth-portal-switch button.active { color: var(--primary); background: var(--surface); box-shadow: 0 3px 12px rgba(46, 26, 120, .08); }
.auth-portal-switch svg { width: 18px; height: 18px; }
.auth-form { display: grid; gap: 18px; }
.auth-confirm-fields { display: grid; gap: 18px; }
.auth-form label, .create-dialog label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; }
.input-wrap { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 15px; border: 1px solid var(--line); background: white; }
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-wrap svg { color: var(--muted); }
.input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; font-weight: 600; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; }
.auth-links button, .auth-back { border: 0; padding: 6px 0; color: var(--primary); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.auth-links button:hover, .auth-back:hover { text-decoration: underline; }
.primary-button, .secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--primary);
  padding: 0 20px;
  cursor: pointer;
}
.primary-button { color: white; background: var(--primary); }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.primary-button.compact { min-height: 42px; }
.secondary-button { background: white; }

.app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 216px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: white; }
.sidebar-brand { height: 86px; display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.side-nav { flex: 1; overflow-y: auto; padding: 14px 12px; scrollbar-width: thin; }
.nav-item { width: 100%; min-height: 42px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; margin-bottom: 2px; padding: 0 12px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.nav-item svg { width: 19px; }
.nav-item:hover { background: var(--primary-soft); }
.nav-item.active { color: white; background: var(--primary); }
.nav-count { min-width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid currentColor; font-size: 12px; }
.mark-nav { height: 48px; display: grid; grid-template-columns: 25px 1fr 20px; align-items: center; gap: 8px; margin: 12px; padding: 0 12px; border: 1px solid var(--line-strong); background: white; cursor: pointer; text-align: left; }
.workspace { grid-column: 2; min-width: 0; min-height: 0; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.topbar { height: 86px; position: sticky; z-index: 20; top: 0; display: flex; align-items: center; gap: 20px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.global-search { position: relative; flex: 1; max-width: 720px; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border: 1px solid var(--line-strong); background: white; }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
.global-search kbd { padding: 4px 6px; border: 1px solid var(--line); color: var(--muted); background: var(--canvas); font-size: 11px; }
.search-results { position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; right: 0; max-height: min(520px, calc(100vh - 120px)); overflow: auto; padding: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); background: white; }
.search-result { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover { background: var(--primary-soft); }
.search-result.active { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--line); }
.search-result span:first-child { width: 32px; height: 32px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.search-result > svg { width: 17px; color: var(--muted); }
.search-result > b { padding: 4px 7px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 10px; }
.search-result small { display: block; margin-top: 3px; color: var(--muted); }
.ai-search-result { margin-top: 6px; border-top: 1px solid var(--line); }
.search-loading, .search-empty { min-height: 68px; display: flex; align-items: center; gap: 10px; padding: 14px; color: var(--muted); font-size: 13px; }
.search-loading svg { color: var(--primary); }
.top-actions { position: relative; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-button { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--primary-soft); }
.notification-badge { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 4px; border: 2px solid white; border-radius: 9px; background: var(--red); color: white; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; }
.profile-button { min-width: 150px; display: grid; grid-template-columns: 42px 1fr 18px; align-items: center; gap: 10px; padding: 0 4px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.profile-avatar { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-weight: 800; }
.profile-copy strong, .profile-copy small { display: block; }
.profile-copy small { margin-top: 3px; color: var(--muted); }
.profile-menu { position: absolute; top: 56px; right: 0; min-width: 180px; padding: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); background: white; }
.profile-menu button { width: 100%; display: flex; gap: 10px; align-items: center; padding: 10px; border: 0; background: transparent; cursor: pointer; }
.profile-menu button:hover { background: var(--red-soft); color: var(--red); }

.main-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overflow-anchor: none; padding: 24px 28px 100px; }
.view { display: none; }
.view.active-view { display: block; }
.page-heading { min-height: 64px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading h1 { margin: 0 0 7px; font-size: 27px; line-height: 1.2; }
.date-control { height: 44px; display: flex; align-items: center; border: 1px solid var(--line-strong); background: white; }
.date-control label { height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-inline: 1px solid var(--line); }
.date-control input { border: 0; outline: 0; color: var(--ink); background: transparent; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 132px; position: relative; overflow: hidden; padding: 16px; border: 1px solid var(--line); background: white; cursor: pointer; text-align: left; }
.metric-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.metric-card h3 { min-height: 34px; margin: 0; font-size: 13px; font-weight: 600; }
.metric-value { display: block; margin-top: 9px; font-size: 31px; font-weight: 750; line-height: 1; }
.metric-meta { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }
.metric-card > svg { position: absolute; right: 14px; bottom: 14px; width: 30px; height: 30px; color: var(--primary); }
.metric-card.unavailable .metric-value { font-size: 16px; color: var(--muted); }
.crm-sync-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -6px 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  color: var(--muted);
}
.crm-sync-status.ready { border-color: rgba(31, 131, 73, .18); background: var(--green-soft); color: var(--green); }
.crm-sync-status.muted { background: rgba(244, 241, 250, .72); }
.crm-sync-status > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .75);
  color: inherit;
  flex: 0 0 auto;
}
.crm-sync-status strong, .crm-sync-status small { display: block; }
.crm-sync-status strong { color: var(--ink); font-size: 13px; }
.crm-sync-status small { margin-top: 3px; color: currentColor; font-size: 12px; }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .95fr); gap: 18px; }
.dashboard-primary, .dashboard-secondary { display: grid; align-content: start; gap: 18px; }
.dashboard-lower { display: grid; grid-template-columns: 1.25fr .9fr; gap: 18px; }
.panel { border: 1px solid var(--line); background: white; }
.panel-header { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 14px; }
.text-button { border: 0; padding: 8px; color: var(--primary); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }
.loading-block { min-height: 120px; position: relative; }
.loading-block.is-loading::after { content: ""; position: absolute; inset: 16px; background: linear-gradient(90deg, #f3f1f7 25%, #faf9fc 40%, #f3f1f7 60%); background-size: 300% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.empty-state { min-height: 110px; display: grid; place-items: center; padding: 24px; color: var(--muted); text-align: center; }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 8px; }
.task-row { min-height: 58px; display: grid; grid-template-columns: 28px 58px minmax(150px, 1fr) minmax(90px, .3fr) 82px minmax(80px, .35fr); align-items: center; gap: 8px; padding: 7px 16px; border-bottom: 1px solid #eeecf3; font-size: 12px; }
.task-row:last-child { border-bottom: 0; }
.task-check { width: 18px; height: 18px; border: 1px solid var(--line-strong); accent-color: var(--primary); cursor: pointer; }
.task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.task-scope, .task-assignee { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.priority { width: fit-content; padding: 4px 7px; border: 1px solid; border-radius: 3px; font-size: 10px; }
.priority.high { color: var(--priority-high); background: var(--priority-high-soft); }
.priority.normal { color: var(--priority-normal); background: var(--priority-normal-soft); }
.priority.low { color: #876800; background: var(--priority-low-soft); }
.task-priority-low, .task-priority-normal, .task-priority-high { position: relative; }
.task-priority-low::before, .task-priority-normal::before, .task-priority-high::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  pointer-events: none;
}
.task-priority-low::before { background: var(--priority-low); }
.task-priority-normal::before { background: var(--priority-normal); }
.task-priority-high::before { background: var(--priority-high); }
.task-catalog-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.task-catalog-status .priority { font-size: 9px; }
.list-footer { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.plan-list { padding: 10px 16px; }
.plan-row { width: 100%; display: grid; grid-template-columns: minmax(120px, 1fr) 55px 90px; align-items: center; gap: 10px; min-height: 47px; font-size: 12px; }
.plan-row-button { padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.plan-row-button:hover { color: var(--primary); }
.plan-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 7px; overflow: hidden; background: #e8e4f1; }
.progress span { display: block; height: 100%; background: var(--primary); }
.finance-summary { padding: 14px 16px; }
.finance-line { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #eeecf3; font-size: 12px; }
.finance-line:last-child { border: 0; font-size: 15px; font-weight: 800; }
.finance-line.finance-warning { color: #9b4f00; }
.debtor-report-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; background: #f7f4ff; border: 1px solid #e1d9f5; }
.debtor-report-summary div { display: grid; gap: 4px; }
.debtor-report-summary span { color: var(--muted); font-size: 12px; }
.debtor-report-summary strong { font-size: 18px; }
.debtor-report-row { grid-template-columns: auto minmax(0, 1fr) minmax(170px, auto); align-items: start; }
.debtor-report-copy { display: grid; gap: 5px; min-width: 0; text-align: left; }
.debtor-report-copy small { display: block; }
.debtor-report-copy b { color: var(--ink); }
.debtor-recommendation { color: #4b2a91; }
.debtor-expected { display: grid; gap: 4px; justify-items: end; text-align: right; }
.debtor-expected small { color: var(--muted); }
.debtor-expected strong { max-width: 210px; }
@media (max-width: 820px) {
  .debtor-report-summary { grid-template-columns: 1fr; }
  .debtor-report-row { grid-template-columns: auto minmax(0, 1fr); }
  .debtor-expected { grid-column: 2; justify-items: start; text-align: left; }
}
.schedule-list, .notification-list { padding: 9px 16px; }
.schedule-row { min-height: 58px; display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid #eeecf3; font-size: 12px; }
.schedule-row:last-of-type { border-bottom: 0; }
.schedule-row time { color: var(--primary); font-weight: 800; }
.schedule-copy { min-width: 0; }
.schedule-copy strong, .schedule-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-copy small { margin-top: 4px; color: var(--muted); }
.schedule-more { width: 100%; margin-top: 4px; text-align: center; }
.status-chip { padding: 5px 7px; border: 1px solid var(--primary); border-radius: 4px; color: var(--primary) !important; background: var(--primary-soft); font-size: 10px; }
.notification-row { min-height: 52px; display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid #eeecf3; font-size: 12px; }
.notification-row:last-child { border: 0; }
.notification-row-button { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.notification-row-button:hover { background: #faf9fd; }
.notification-row strong, .notification-row small { display: block; }
.notification-row small { max-width: 34ch; margin-top: 3px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-dot { width: 7px; height: 7px; border: 1px solid var(--primary); border-radius: 50%; }
.notification-row time { color: var(--muted); font-size: 10px; }

.collection-panel { min-height: 420px; }
.planner-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.planner-tabs, .planner-scope { display: inline-flex; align-items: center; border: 1px solid var(--line); background: white; }
.planner-tabs button, .planner-scope button { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; }
.planner-tabs button:last-child, .planner-scope button:last-child { border-right: 0; }
.planner-tabs button.active, .planner-scope button.active { color: white; background: var(--primary); }
.planner-tabs svg { width: 17px; }
.planner-tabs b { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 10px; }
.planner-tabs button.active b { color: var(--primary); background: white; }
.planner-scope-filter { display: none !important; }
.collection-toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); background: white; }
.collection-toolbar label { min-width: 170px; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.collection-toolbar select { height: 38px; padding: 0 10px; border: 1px solid var(--line); outline: 0; background: white; }
.collection-toolbar select:focus { border-color: var(--primary); }
.collection-table { min-width: 720px; }
.collection-view { overflow-x: auto; }
.collection-head, .collection-row { display: grid; grid-template-columns: 56px minmax(220px, 1fr) 130px 130px 140px; gap: 12px; align-items: center; padding: 0 18px; }
.collection-head { min-height: 46px; color: var(--muted); background: var(--canvas); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.collection-row { min-height: 62px; border-bottom: 1px solid #eeecf3; font-size: 13px; }
.collection-row-button { width: 100%; border: 0; background: white; text-align: left; cursor: pointer; }
.collection-row-button:hover, .interactive-row:hover { background: var(--primary-soft); }
.collection-head.selectable { grid-template-columns: 34px 56px minmax(220px, 1fr) 130px 130px 140px; }
.selectable-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; padding-left: 18px; border-bottom: 1px solid #eeecf3; background: white; }
.selectable-row > input, .selectable-plan > input { width: 18px; height: 18px; accent-color: var(--primary); }
.selectable-row .collection-row { border-bottom: 0; padding-left: 0; }
.interactive-row { cursor: pointer; }
.collection-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-label { color: var(--muted); }
.plan-catalog { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; padding: 16px; }
.plan-card { min-height: 170px; padding: 16px; border: 1px solid var(--line); background: white; text-align: left; cursor: pointer; }
.plan-card:hover { border-color: var(--primary); box-shadow: 0 8px 22px rgba(34, 25, 69, .08); }
.selectable-plan { position: relative; }
.selectable-plan > input { position: absolute; z-index: 2; top: 14px; left: 14px; }
.selectable-plan .plan-card { width: 100%; padding-left: 46px; }
.plan-card header { display: flex; justify-content: space-between; gap: 10px; }
.plan-card h3 { margin: 0; font-size: 15px; }
.plan-card p { min-height: 38px; color: var(--muted); font-size: 12px; }
.plan-card footer { display: flex; justify-content: space-between; margin-top: 14px; color: var(--muted); font-size: 11px; }
.pagination { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid var(--line); }
.pagination button { min-width: 38px; height: 34px; border: 1px solid var(--line); background: white; cursor: pointer; }
.pagination button.active { color: white; border-color: var(--primary); background: var(--primary); }

.mark-composer { position: fixed; z-index: 18; left: 244px; right: 28px; bottom: 14px; height: 54px; display: grid; grid-template-columns: 42px 1fr 44px; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid var(--line-strong); box-shadow: var(--shadow); background: white; }
.mark-composer input { min-width: 0; border: 0; outline: 0; }
.mark-avatar, .send-button { width: 42px; height: 42px; display: grid; place-items: center; border: 0; cursor: pointer; }
.mark-avatar { color: var(--primary); background: var(--primary-soft); }
.send-button { color: white; background: var(--primary); }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 86px; width: min(520px, calc(100% - 48px)); max-width: 520px; min-height: 56px; display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 12px; align-items: start; padding: 16px 16px 18px; overflow: hidden; color: white; box-shadow: var(--shadow); background: var(--ink); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.toast.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.toast-message { min-width: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.toast-close { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; color: white; background: rgba(255,255,255,.08); cursor: pointer; }
.toast-close:hover { background: rgba(255,255,255,.16); }
.toast-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.72); transform-origin: left center; animation: toast-countdown linear forwards; }
@keyframes toast-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.create-dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; box-shadow: 0 30px 100px rgba(20,15,45,.3); }
.create-dialog::backdrop { background: rgba(25,19,47,.42); backdrop-filter: blur(2px); }
.create-dialog form, .create-dialog .dialog-shell { padding: 20px; }
.create-dialog header, .create-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.create-dialog header { margin-bottom: 20px; }
.create-dialog h2 { margin: 0; }
.create-dialog input, .create-dialog select, .create-dialog textarea { width: 100%; border: 1px solid var(--line); padding: 11px; outline: 0; background: white; }
.create-dialog input:focus, .create-dialog select:focus, .create-dialog textarea:focus { border-color: var(--primary); }
.form-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.finance-form-explainer { margin: 0 0 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--canvas); font-size: 13px; line-height: 1.55; }
.create-dialog label > small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.student-create-dialog { width: min(760px, calc(100% - 32px)); }
.student-phone-editor { display: grid; gap: 12px; margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--canvas); }
.student-phone-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.student-phone-editor-heading h3, .student-phone-editor-heading p { margin: 0; }
.student-phone-editor-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.student-phone-rows { display: grid; gap: 10px; }
.student-phone-row { display: grid; grid-template-columns: minmax(140px, .75fr) minmax(190px, 1fr) 44px; gap: 10px; align-items: end; }
.student-phone-row .icon-button { width: 44px; height: 44px; margin-bottom: 1px; }
.student-staff-comment { margin-top: 16px; }
.student-create-large-family { margin-top: 16px; }
.certificate-preview-section { display: grid; gap: 7px; margin-top: 14px; }
.certificate-preview-section > div { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); background: white; }
.certificate-preview-section span, .certificate-preview-section small { min-width: 0; overflow-wrap: anywhere; }
.certificate-preview-section small { color: var(--muted); }
.create-dialog footer { margin-top: 18px; justify-content: flex-end; }
.detail-dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; box-shadow: 0 30px 100px rgba(20,15,45,.3); }
.detail-dialog::backdrop { background: rgba(25,19,47,.42); backdrop-filter: blur(2px); }
.detail-dialog > article { min-height: 300px; background: white; }
.detail-dialog > article.task-priority-low::before,
.detail-dialog > article.task-priority-normal::before,
.detail-dialog > article.task-priority-high::before { left: 0; top: 22px; bottom: 22px; width: 5px; }
.detail-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.detail-header h2 { margin: 0; font-size: 22px; }
.detail-header .eyebrow { margin-bottom: 5px; }
.detail-content { padding: 20px 22px; }
.detail-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.detail-summary div { min-width: 0; padding: 13px; background: white; }
.detail-summary span, .detail-summary strong { display: block; }
.detail-summary span { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.detail-summary strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.detail-section { margin-top: 20px; }
.detail-section h3 { margin: 0 0 9px; font-size: 14px; }
.detail-section p { margin: 0; color: var(--muted); line-height: 1.55; }
.task-guidance { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--canvas); }
.task-guidance-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.task-guidance-heading h3 { margin: 4px 0 0; font-size: 17px; }
.task-guidance-body { display: grid; gap: 16px; margin-top: 16px; }
.task-guidance-actions { display: grid; gap: 9px; }
.task-action-button { width: 100%; min-height: 64px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 20px; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; text-align: left; cursor: pointer; }
.task-action-button:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.task-action-button > span:first-child { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--primary); background: var(--accent-soft); }
.task-action-button strong, .task-action-button small { display: block; }
.task-action-button small { margin-top: 3px; color: var(--muted); line-height: 1.4; }
.task-action-button svg { width: 18px; height: 18px; }
.task-solution { display: grid; gap: 10px; padding: 16px; border-radius: 14px; background: white; }
.task-solution-steps { display: grid; gap: 8px; margin: 0; padding-left: 22px; color: var(--muted); line-height: 1.5; }
.task-solution-steps li::marker { color: var(--primary); font-weight: 700; }
.task-guidance-caveats { display: grid; gap: 5px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.task-guidance-caveats strong { color: var(--ink); }
.task-research-sources { display: grid; gap: 7px; padding-top: 8px; border-top: 1px solid var(--line); }
.task-research-sources summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.task-research-sources a { display: block; margin-top: 6px; color: var(--primary); overflow-wrap: anywhere; }
.task-guidance-note { padding: 12px 14px; border-radius: 12px; background: white; }
.task-research-button { justify-self: start; }
.detail-section-title { display: flex; align-items: center; justify-content: space-between; }
.detail-task-list { display: grid; border: 1px solid var(--line); }
.detail-task-list button { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 54px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; cursor: pointer; }
.detail-task-list button:last-child { border-bottom: 0; }
.detail-task-list button:hover { background: var(--primary-soft); }
.detail-task-list small { color: var(--muted); }
.detail-task-list .compact-empty { min-height: 64px; padding: 18px; }
.completed-task-list button { background: #fafafa; }
.completed-task-list button strong, .completed-task-list button span { color: var(--muted); }
.completed-task-list button span { text-decoration: line-through; }
.detail-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.detail-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.detail-form select, .detail-form input { min-width: 0; height: 42px; padding: 0 10px; border: 1px solid var(--line); background: white; }
.detail-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.danger-button { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--red); color: var(--red); background: white; cursor: pointer; }
.danger-button:hover { background: var(--red-soft); }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-select-control { min-width: auto !important; display: flex; align-items: end; }
.bulk-selection-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-selection-actions[hidden] { display: none; }
.financial-calendar-toolbar { display: flex; align-items: end; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); background: white; }
.financial-calendar-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.financial-calendar-toolbar input { height: 40px; padding: 0 10px; border: 1px solid var(--line); }
.financial-calendar-summary { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.financial-calendar-summary span, .financial-calendar-summary strong { display: block; }
.financial-calendar-summary span { color: var(--muted); font-size: 11px; }
.financial-calendar-summary strong { margin-top: 3px; color: var(--ink); font-size: 14px; }
.financial-entry-row { min-height: 66px; display: grid; grid-template-columns: 100px 110px minmax(0, 1fr) 150px; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.financial-entry-row time { color: var(--muted); }
.financial-entry-row small { display: block; margin-top: 4px; color: var(--muted); }
.financial-amount { text-align: right; color: var(--red); }
.financial-entry-row.income .financial-amount { color: var(--green); }

.finance-section-tabs { display: flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 6px; overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); scrollbar-width: thin; }
.finance-section-tab { min-height: 46px; display: inline-flex; flex: 1 0 auto; align-items: center; justify-content: center; gap: 9px; padding: 0 16px; border: 0; border-radius: 13px; color: var(--muted); background: transparent; font: inherit; font-size: 12px; font-weight: 750; white-space: nowrap; cursor: pointer; transition: color .16s ease, background .16s ease, box-shadow .16s ease; }
.finance-section-tab:hover { color: var(--primary); background: var(--primary-soft); }
.finance-section-tab.active { color: white; background: var(--primary); box-shadow: 0 7px 18px rgba(55, 31, 137, .18); }
.finance-section-tab svg { width: 18px; height: 18px; }
.finance-section-panel { display: none; }
.finance-section-panel.active { display: block; }
.finance-section-panel > :last-child { margin-bottom: 0; }

.finance-foundation-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.finance-summary-tile { min-height: 118px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-align: left; cursor: pointer; }
.finance-summary-tile:hover { border-color: #cfc5ee; transform: translateY(-1px); }
.finance-summary-tile span { display: block; color: var(--muted); font-size: 13px; }
.finance-summary-tile strong { display: block; margin-top: 16px; font-size: clamp(22px, 2vw, 30px); line-height: 1; }
.finance-summary-tile small { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.finance-summary-tile.warning strong { color: var(--red); }
.finance-unallocated-workspace { margin-top: -2px; }
.finance-unallocated-activity { display: grid; gap: 16px; min-height: 76px; }
.finance-unallocated-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.finance-unallocated-totals > div { display: grid; gap: 5px; padding: 15px 17px; border-radius: 14px; background: var(--surface-soft, #faf9fd); }
.finance-unallocated-totals span, .finance-unallocated-totals small { color: var(--muted); }
.finance-unallocated-totals strong { font-size: 22px; }
.finance-unallocated-list { display: grid; gap: 7px; }
.finance-unallocated-row { width: 100%; display: grid; grid-template-columns: 105px 100px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: white; text-align: left; }
.finance-unallocated-row[data-edit-financial-entry]:hover { border-color: #d8d1ed; background: var(--primary-soft); }
.finance-unallocated-row time, .finance-unallocated-row small { color: var(--muted); }
.finance-unallocated-row small { display: block; margin-top: 3px; }
.finance-unallocated-row .financial-amount.income { color: var(--green); }
.financial-entry-impact { display: flex; align-items: center; gap: 9px; min-height: 48px; margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: #eef9f2; color: var(--green); font-size: 13px; font-weight: 700; }
.financial-entry-impact.planned { background: #fff7e8; color: #9b6400; }
.financial-entry-impact svg { width: 19px; height: 19px; flex: 0 0 auto; }
@media (max-width: 760px) {
  .finance-unallocated-totals { grid-template-columns: 1fr; }
  .finance-unallocated-row { grid-template-columns: 90px minmax(0, 1fr) auto; }
  .finance-unallocated-row .status-pill { grid-column: 2; grid-row: 2; justify-self: start; }
  .finance-unallocated-row > div { grid-column: 2; grid-row: 1; }
  .finance-unallocated-row .financial-amount { grid-column: 3; grid-row: 1 / span 2; }
}
.finance-decision-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 20px; margin-bottom: 20px; }
.finance-policy-layout { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr); gap: 20px; margin-bottom: 20px; }
.finance-policy-layout .finance-workspace { margin-bottom: 0; }
.finance-policy-card .portal-section-heading > i { width: 23px; height: 23px; color: var(--primary); }
.finance-tax-position { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.finance-tax-metric { min-height: 82px; display: grid; align-content: center; gap: 5px; padding: 14px 16px; border-radius: 14px; background: var(--surface-soft, #faf9fd); }
.finance-tax-metric span, .finance-tax-metric small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.finance-tax-metric strong { font-size: 19px; }
.finance-tax-warning { grid-column: 1 / -1; padding: 12px 14px; border-radius: 14px; color: #8a5700; background: #fff7e8; font-size: 12px; line-height: 1.5; }
.finance-allocation-state { margin-bottom: 12px; padding: 12px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--muted); font-size: 12px; line-height: 1.5; }
.finance-allocation-state.critical { color: var(--red); background: #fff0f0; }
.finance-allocation-list { display: grid; gap: 8px; }
.finance-allocation-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; }
.finance-allocation-row > b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 11px; }
.finance-allocation-row span, .finance-allocation-row small { display: block; }
.finance-allocation-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.finance-allocation-row > strong { white-space: nowrap; }
.finance-allocation-row.blocked { opacity: .62; }
.finance-priority-preview { display: grid; gap: 9px; margin: 14px 0; }
.finance-priority-preview > header { display: flex; justify-content: space-between; gap: 18px; padding: 14px 16px; border-radius: 14px; background: var(--primary-soft); }
.finance-priority-preview > header span, .finance-priority-preview > header strong { display: block; }
.finance-priority-preview > header span { color: var(--muted); font-size: 11px; }
.finance-priority-preview > header strong { margin-top: 4px; font-size: 19px; }
.finance-priority-preview .finance-allocation-row { background: var(--surface); }
.finance-decision-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.finance-decision-kpi { min-height: 116px; display: grid; align-content: center; gap: 7px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.finance-decision-kpi:first-child { grid-column: span 2; }
.finance-decision-kpi span, .finance-decision-kpi small { color: var(--muted); }
.finance-decision-kpi span { font-size: 12px; font-weight: 700; }
.finance-decision-kpi strong { font-size: clamp(22px, 2vw, 28px); }
.finance-advisor-panel, .finance-trend-section { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.finance-advisor-panel .portal-section-heading > div,
.finance-trend-section .portal-section-heading > div { min-width: 0; display: grid; gap: 5px; }
.finance-advisor-panel .portal-section-heading strong,
.finance-trend-section .portal-section-heading strong { line-height: 1.25; }
.finance-advisor-panel .portal-section-heading span,
.finance-trend-section .portal-section-heading span { display: block; line-height: 1.45; }
.finance-advisor-panel .portal-section-heading svg { width: 22px; height: 22px; color: var(--primary); }
.finance-insight-list { display: grid; gap: 9px; }
.finance-insight { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 12px 13px; border-radius: 14px; background: var(--primary-soft); }
.finance-insight svg { width: 19px; height: 19px; margin-top: 1px; color: var(--primary); }
.finance-insight p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.finance-insight.critical { background: #fff0f0; }
.finance-insight.critical svg, .finance-insight.critical strong { color: var(--red); }
.finance-insight.warning { background: #fff7e8; }
.finance-insight.warning svg, .finance-insight.warning strong { color: #9b6400; }
.finance-insight.success { background: #eef9f2; }
.finance-insight.success svg, .finance-insight.success strong { color: var(--green); }
.finance-explanations { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.finance-explanations summary { color: var(--primary); font-weight: 700; cursor: pointer; }
.finance-explanation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.finance-explanation-row:last-child { border-bottom: 0; }
.finance-explanation-row span, .finance-explanation-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.finance-explanation-row b { white-space: nowrap; }
.finance-trend-section { margin-bottom: 20px; }
.finance-trend { min-height: 190px; display: grid; grid-template-columns: repeat(6, minmax(80px, 1fr)); align-items: end; gap: 12px; overflow-x: auto; }
.finance-trend-month { min-width: 80px; display: grid; gap: 5px; text-align: center; }
.finance-trend-bars { height: 120px; display: flex; align-items: end; justify-content: center; gap: 7px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.finance-trend-bars i { width: 15px; min-height: 3px; border-radius: 5px 5px 0 0; }
.finance-trend-bars .income { background: var(--green); }
.finance-trend-bars .expense { background: var(--red); }
.finance-trend-month small { color: var(--muted); font-size: 10px; line-height: 1.55; text-align: left; }
.income-dot, .expense-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--green); }
.expense-dot { background: var(--red); }
.finance-foundation-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 20px; margin-bottom: 20px; }
.finance-workspace { margin-bottom: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.finance-workspace .portal-section-heading > div { display: grid; gap: 4px; }
.finance-workspace .portal-section-heading > div > span { display: block; }
.finance-bank-status { display: grid; gap: 14px; min-height: 72px; }
.parent-payment-fulfillment-list { display: grid; gap: 12px; min-height: 72px; }
.parent-payment-fulfillment-row { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.25fr); gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft, #faf9fd); }
.parent-payment-fulfillment-main { display: grid; align-content: start; gap: 6px; }
.parent-payment-fulfillment-main > div { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.parent-payment-fulfillment-main p { margin: 0; font-weight: 700; }
.parent-payment-fulfillment-main small, .parent-payment-fulfillment-result span, .parent-payment-fulfillment-result small { color: var(--muted); }
.parent-payment-fulfillment-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.parent-payment-fulfillment-actions label { display: grid; gap: 5px; min-width: 0; }
.parent-payment-fulfillment-actions label span { color: var(--muted); font-size: 12px; }
.parent-payment-fulfillment-actions input { width: 100%; }
.parent-payment-fulfillment-actions button { min-height: 44px; justify-content: center; }
.parent-payment-fulfillment-result { display: grid; align-content: center; justify-items: end; gap: 4px; text-align: right; }
.parent-payment-fulfillment-result.danger { color: var(--red); }
.parent-payment-fulfillment-result.danger small { max-width: 520px; color: var(--red); overflow-wrap: anywhere; }
.bank-account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.bank-account-card { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft, #faf9fd); }
.bank-account-card span, .bank-account-card small, .bank-run-summary span, .bank-run-summary small, .bank-setup-state span { color: var(--muted); }
.bank-account-card b { font-size: 21px; }
.bank-run-summary, .bank-setup-state { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 14px 16px; border-radius: 14px; background: var(--primary-soft); }
.bank-run-summary.failed { background: #fff0f0; color: #a12b32; }
.bank-setup-state svg { width: 24px; height: 24px; color: var(--primary); }
.bank-setup-state > div { display: grid; gap: 3px; }
.finance-foundation-layout .finance-workspace { margin-bottom: 0; }
.finance-fund-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.finance-fund-card { position: relative; min-height: 150px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.finance-fund-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.finance-fund-card h3 { margin: 0; font-size: 16px; }
.finance-fund-card p { min-height: 34px; margin: 8px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.finance-fund-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; font-size: 12px; }
.finance-fund-values span { color: var(--muted); }
.finance-fund-values strong { display: block; margin-top: 3px; color: var(--ink); font-size: 15px; }
.finance-progress { height: 7px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: #efedf6; }
.finance-progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.finance-fund-shortfall { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.finance-obligation-list { display: grid; gap: 10px; }
.finance-obligation { width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 14px; text-align: left; background: white; }
.finance-obligation:hover, .finance-account:hover { border-color: #d8d1ed; background: var(--primary-soft); }
.finance-obligation > span, .finance-obligation small { display: block; color: var(--muted); font-size: 12px; }
.finance-obligation strong { display: block; margin: 5px 0; font-size: 17px; }
.finance-obligation .finance-progress { margin: 9px 0 6px; }
.obligation-payment-panel { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.obligation-payment-panel .inline-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 12px 0; }
.finance-reconciliation-row .inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.finance-reconciliation-row .secondary-button.compact { min-height: 36px; padding: 7px 12px; border-radius: 12px; font-size: 12px; }
.bank-run-summary progress { width: 100%; height: 8px; margin-top: 10px; accent-color: var(--brand); }
.finance-policy-settings { display: grid; gap: 8px; }
.finance-policy-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; }
.finance-policy-setting > div { min-width: 0; display: grid; gap: 4px; }
.finance-policy-setting span, .finance-policy-setting small { overflow-wrap: anywhere; color: var(--muted); }
.finance-policy-setting span { font-size: 13px; line-height: 1.45; }
.finance-policy-setting small { font-size: 11px; }
.finance-policy-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.finance-payroll-review { display: grid; gap: 16px; padding: 18px; border: 1px solid #f2cf89; border-radius: 16px; background: #fffaf0; }
.finance-payroll-review > div:first-child { display: grid; gap: 6px; }
.finance-payroll-review span, .finance-payroll-review small { color: var(--muted); }
.finance-payroll-review .inline-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.finance-payroll-review .inline-actions button { width: 100%; min-width: 0; justify-content: center; white-space: normal; line-height: 1.3; }
.staff-payroll-totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.staff-payroll-totals > div { display: grid; gap: 5px; }
.staff-payroll-amounts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 18px; }
.staff-payroll-amounts b { display: grid; gap: 4px; text-align: right; }
.staff-payroll-payment { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) auto; align-items: end; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.staff-payroll-payment label { display: grid; gap: 6px; }
.staff-payroll-payment label span { color: var(--muted); font-size: 12px; }
.staff-shift-row.is-cancelled { opacity: .55; }
@media (max-width: 760px) { .staff-payroll-totals,.staff-payroll-payment { grid-template-columns: 1fr; } .staff-payroll-amounts { justify-content: flex-start; } .staff-payroll-amounts b { text-align: left; } }
@media (max-width: 680px) { .finance-policy-fields { grid-template-columns: 1fr; } }
.obligation-payment-history { display: grid; gap: 8px; margin-top: 14px; }
.obligation-payment-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.obligation-payment-row.reversed { opacity: .58; }
.finance-account-list { display: flex; flex-wrap: wrap; gap: 10px; }
.finance-account { display: grid; min-width: 210px; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; text-align: left; background: white; }
.finance-account span { color: var(--muted); font-size: 12px; }
.finance-account small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.bank-sync-details { margin-top: 10px; }
.bank-sync-details summary { cursor: pointer; font-weight: 700; }
.bank-sync-details div { display: grid; gap: 5px; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.finance-monthly-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.finance-monthly-summary div { padding: 14px 16px; border-radius: 14px; background: var(--primary-soft); }
.finance-monthly-summary span { display: block; color: var(--muted); font-size: 11px; }
.finance-monthly-summary strong { display: block; margin-top: 6px; font-size: 18px; }
.finance-monthly-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.finance-commitment-row { min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-align: left; background: white; }
.finance-commitment-row:hover { border-color: #d8d1ed; background: var(--primary-soft); }
.finance-commitment-row small { display: block; margin-top: 4px; color: var(--muted); }
.finance-commitment-row > span { color: var(--muted); font-size: 11px; }
.finance-commitment-row > strong { font-size: 15px; white-space: nowrap; }
.finance-fee-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.finance-fee-summary { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 16px; border-radius: 14px; background: var(--primary-soft); }
.finance-fee-summary div { display: grid; gap: 5px; }
.finance-fee-summary span,.finance-fee-summary small,.finance-fee-summary p { color: var(--muted); }
.finance-fee-summary strong { font-size: 20px; }
.finance-fee-summary p { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.45; }
.finance-fee-rule { min-height: 116px; display: grid; align-content: space-between; gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; text-align: left; background: white; }
.finance-fee-rule:hover { border-color: #d8d1ed; background: var(--primary-soft); }
.finance-fee-rule span { color: var(--muted); font-size: 11px; }
.finance-fee-rule strong { font-size: 19px; }
.finance-fee-rule small { color: var(--muted); line-height: 1.35; }
.finance-transfer-row { min-height: 62px; display: grid; grid-template-columns: 130px minmax(0,1fr) 140px auto; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.finance-transfer-row:last-child { border-bottom: 0; }
.finance-transfer-row small { display: block; margin-top: 4px; color: var(--muted); }

@media (max-width: 1000px) {
  .finance-foundation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-decision-layout { grid-template-columns: 1fr; }
  .finance-policy-layout { grid-template-columns: 1fr; }
  .finance-foundation-layout { grid-template-columns: 1fr; }
  .finance-monthly-list { grid-template-columns: 1fr; }
  .finance-fee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) { .finance-fee-summary { grid-template-columns: 1fr; } .finance-fee-summary p { grid-column: auto; } }
@media (max-width: 680px) {
  .finance-section-tabs { margin-inline: -14px; padding-inline: 14px; border-inline: 0; border-radius: 0; box-shadow: none; }
  .finance-section-tab { flex: 0 0 auto; min-height: 44px; padding-inline: 14px; }
  .finance-foundation-summary, .finance-fund-grid, .finance-monthly-summary, .finance-decision-kpis { grid-template-columns: 1fr; }
  .finance-tax-position { grid-template-columns: 1fr; }
  .finance-tax-warning { grid-column: auto; }
  .finance-decision-kpi:first-child { grid-column: auto; }
  .finance-fund-values { grid-template-columns: 1fr; }
  .finance-fee-grid { grid-template-columns: 1fr; }
  .finance-transfer-row { grid-template-columns: 1fr auto; }
  .finance-transfer-row > :nth-child(2) { grid-column: 1 / -1; }
}
.inventory-summary { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.inventory-summary > div { min-height: 82px; padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.inventory-summary span, .inventory-summary strong { display: block; }
.inventory-summary span { color: var(--muted); font-size: 11px; }
.inventory-summary strong { margin-top: 8px; font-size: 22px; }
.inventory-list { min-height: 170px; padding: 6px 18px; }
.inventory-row { min-height: 70px; display: grid; grid-template-columns: 40px minmax(180px, 1fr) 120px 120px 42px; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.inventory-row:last-child { border-bottom: 0; }
.inventory-row > div { min-width: 0; }
.inventory-row strong, .inventory-row small { display: block; }
.inventory-row small { margin-top: 5px; color: var(--muted); }
.inventory-row.low-stock { background: #fffaf0; }
.inventory-price { text-align: right; }
.sidebar-backdrop, .mobile-only { display: none; }
.staff-list { padding: 8px 16px; }
.staff-row { min-width: 0; min-height: 76px; display: grid; grid-template-columns: 42px minmax(170px, 1fr) 110px minmax(0, 1.35fr); align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.staff-row:last-child { border-bottom: 0; }
.staff-avatar { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-weight: 800; }
.staff-person strong, .staff-person small { display: block; }
.staff-person small { margin-top: 5px; color: var(--muted); }
.access-state { color: var(--muted); font-size: 11px; font-weight: 700; }
.access-state.active { color: var(--green); }
.owner-chip { justify-self: end; padding: 6px 9px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.staff-actions { min-width: 0; display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 150px) minmax(150px, auto) 40px 40px; gap: 8px; }
.staff-actions input, .staff-actions select { min-width: 0; height: 40px; padding: 0 9px; border: 1px solid var(--line); background: white; }
.auth-links { flex-wrap: wrap; }
.account-directory-section { display: grid; gap: 12px; margin-bottom: 24px; }
.account-directory-section[hidden] { display: none; }
.account-directory-tabs { width: fit-content; margin-bottom: 22px; }
.account-directory-tabs button { min-width: 150px; justify-content: center; }
.account-directory-section > .portal-section-heading { min-height: 76px; padding: 12px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.account-directory-section .portal-section-heading > div,
.parent-account-layout .portal-section-heading > div { display: grid; gap: 6px; min-width: 0; }
.account-directory-section .portal-section-heading strong,
.parent-account-layout .portal-section-heading strong { font-size: 18px; line-height: 1.25; }
.account-directory-section .portal-section-heading span,
.parent-account-layout .portal-section-heading span { line-height: 1.45; }
.client-account-list { min-height: 100px; padding: 12px 20px; }
.client-account-row { width: 100%; min-height: 76px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 110px auto 22px; align-items: center; gap: 14px; margin: 4px 0; padding: 10px 14px; color: var(--ink); border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.client-account-row:hover { background: var(--hover); transform: translateY(-1px); }
.client-account-row > svg { width: 18px; color: var(--muted); }
.client-account-copy { min-width: 0; }
.client-account-copy strong, .client-account-copy small { display: block; }
.client-account-copy small { margin-top: 5px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.client-child-count { padding: 7px 10px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; white-space: nowrap; }
.parent-account-panel { margin-top: 6px; overflow: hidden; border-radius: 18px; }
.parent-account-header { min-height: 112px; padding: 22px 24px; }
.parent-account-header > div:first-child { display: grid; align-content: center; gap: 5px; min-width: 0; }
.parent-account-header-actions { display: flex; align-items: center; gap: 10px; }
.parent-account-header h2 { margin: 5px 0 0; }
.parent-account-header p { margin: 6px 0 0; }
.parent-account-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 0; border-top: 1px solid var(--line); }
.parent-account-layout > section { padding: 24px; }
.parent-link-list { display: grid; gap: 8px; margin-top: 14px; }
.parent-link-row { min-height: 68px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.parent-link-row strong, .parent-link-row small { display: block; }
.parent-link-row small { margin-top: 4px; color: var(--muted); }
.parent-link-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--primary); background: var(--primary-soft); }
.parent-link-icon svg { width: 19px; }
.parent-link-form { align-content: start; gap: 20px; padding: 24px; border-left: 1px solid var(--line); background: #fcfbff; }
.parent-link-form .form-grid { gap: 16px; }
.parent-link-form label { gap: 8px; font-size: 13px; }
.parent-link-form select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); font: inherit; }
.parent-link-form .primary-button { margin-top: 4px; }
.danger-icon { color: var(--red); }
.danger-icon:hover { border-color: var(--red); background: var(--red-soft); }
.client-onboarding-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 26px 80px rgba(31, 20, 74, .2); }
.client-onboarding-dialog::backdrop { background: rgba(24, 19, 47, .48); backdrop-filter: blur(4px); }
.client-onboarding-dialog > article { min-height: min(570px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.client-onboarding-header { min-height: 84px; display: flex; align-items: center; justify-content: space-between; padding: 16px 24px 10px; }
.client-onboarding-header img { width: 112px; height: 58px; object-fit: contain; object-position: left center; mix-blend-mode: multiply; }
.client-onboarding-progress { height: 4px; margin: 0 24px; overflow: hidden; border-radius: 999px; background: var(--primary-soft); }
.client-onboarding-progress span { width: 16.66%; height: 100%; display: block; border-radius: inherit; background: var(--primary); transition: width .22s ease; }
.client-onboarding-content { min-height: 0; display: grid; align-content: start; justify-items: start; padding: 34px 56px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.client-onboarding-icon { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 18px; color: var(--primary); background: var(--primary-soft); }
.client-onboarding-icon svg { width: 30px; height: 30px; }
.client-onboarding-content .eyebrow { margin-bottom: 10px; }
.client-onboarding-content h2 { max-width: 560px; margin: 0; font-size: 30px; line-height: 1.14; }
.client-onboarding-content > p { max-width: 570px; margin: 16px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.client-onboarding-points { display: grid; gap: 10px; margin-top: 22px; }
.client-onboarding-points span { display: flex; align-items: flex-start; gap: 9px; line-height: 1.45; }
.client-onboarding-points svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; color: var(--green); }
.client-onboarding-tip { display: flex; align-items: flex-start; gap: 9px; margin-top: 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fcfbff; font-size: 13px; line-height: 1.5; }
.client-onboarding-tip svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; color: var(--primary); }
.client-onboarding-dialog footer { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.client-onboarding-dialog footer > div { display: flex; gap: 10px; }
.birthday-panel { margin-bottom: 20px; }
.birthday-list { display: grid; gap: 8px; padding: 0 20px 20px; }
.birthday-row { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--interactive-radius); background: var(--surface-soft); }
.birthday-row-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); }
.birthday-row-icon svg { width: 22px; height: 22px; }
.birthday-row > div:nth-child(2) { display: grid; gap: 3px; }
.birthday-row small { color: var(--muted); }
.birthday-recipient { display: grid; gap: 4px; padding: 14px 18px; border-radius: 14px; background: var(--surface-soft); }
.birthday-recipient span { color: var(--muted); font-size: 13px; }
.birthday-message-preview { white-space: pre-line; padding: 18px; border: 1px solid var(--line); border-radius: 16px; line-height: 1.6; background: #fff; }
.birthday-discount-note { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 16px; color: var(--primary); background: var(--primary-soft); }
.birthday-discount-note svg { width: 22px; height: 22px; flex: 0 0 22px; }
.birthday-discount-note p { margin: 0; color: var(--ink); line-height: 1.5; }
.compact-button { min-height: 40px; padding-inline: 11px; }
.bordered { border: 1px solid var(--line); }
.settings-layout { display: grid; gap: 18px; }
.account-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.account-summary-panel { grid-column: 1 / -1; min-height: 112px; display: flex; align-items: center; gap: 18px; padding: 20px; }
.account-avatar { width: 68px; height: 68px; display: grid; place-items: center; flex: 0 0 68px; border: 1px solid var(--line-strong); border-radius: 50%; color: white; background: var(--primary); font-size: 25px; font-weight: 800; }
.account-summary-panel h2 { margin: 0; font-size: 21px; }
.account-summary-panel p { margin: 6px 0 0; color: var(--muted); }
.account-form { display: grid; gap: 14px; padding: 18px; }
.account-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.account-form input { width: 100%; height: 42px; padding: 0 10px; border: 1px solid var(--line); outline: 0; background: white; }
.account-form input:focus { border-color: var(--primary); }
.account-form .primary-button { justify-self: start; }
.email-security-state, .session-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft, #faf9fd); }
.email-security-state > div, .session-copy { min-width: 0; display: grid; gap: 4px; }
.email-security-state span, .session-copy span, .session-copy small { color: var(--muted); }
.email-security-actions { display: grid; gap: 12px; margin-top: 14px; }
.email-security-actions label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.email-security-actions input { width: 100%; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.session-list { display: grid; gap: 10px; }
.session-row.current { border-color: #b9dfc8; background: #f0faf4; }
.session-current { color: var(--green); font-size: 12px; font-weight: 800; }
.security-explanation { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-panel .panel-header { min-height: 76px; }
.settings-panel .panel-header h2 { font-size: 18px; line-height: 1.3; letter-spacing: 0; }
.settings-panel .panel-header p { max-width: 880px; margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; letter-spacing: 0; }
.settings-content { padding: 18px; }
.access-ready, .access-warning { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid; }
.access-ready { color: var(--green); background: var(--green-soft); }
.access-warning { color: var(--amber); background: var(--amber-soft); }
.access-ready strong, .access-ready span, .access-warning strong, .access-warning span { display: block; }
.access-ready span, .access-warning span { margin-top: 3px; font-size: 12px; }
.inline-security-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.inline-security-form label { min-width: 210px; display: grid; flex: 1; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.inline-security-form input { height: 42px; padding: 0 10px; border: 1px solid var(--line); }
.permission-matrix { padding: 0 18px 18px; }
.permission-group { margin-top: 20px; }
.permission-group h3 { margin: 0 0 8px; color: var(--primary); font-size: 12px; text-transform: uppercase; }
.permission-row { min-width: 0; min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.permission-row-title { min-width: 0; }
.permission-row strong { display: block; }
.permission-row-title p { max-width: 780px; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.permission-row small { display: block; min-height: 16px; margin-top: 6px; color: var(--green); font-weight: 700; }
.permission-role-options { min-width: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.permission-row label { min-width: min(180px, 100%); display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--canvas); font-size: 12px; cursor: pointer; }
.permission-row label:has(input:checked) { border-color: var(--primary-light); background: var(--primary-soft); color: var(--primary); }
.permission-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.security-dialog article { padding: 20px; }
.security-dialog header { display: flex; align-items: center; justify-content: space-between; }
.security-dialog h2 { margin: 0; }
.security-dialog p { color: var(--muted); line-height: 1.5; }
.recovery-code-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery-code-list code { padding: 10px; border: 1px solid var(--line); background: var(--canvas); text-align: center; }
.portal-toolbar { align-items: end; }
.portal-toolbar label { min-width: min(430px, 100%); }
.client-toolbar label { min-width: 170px; }
.client-toolbar label:first-child { min-width: min(320px, 100%); flex: 1; }
.client-toolbar select { width: 100%; height: 42px; }
.portal-toolbar input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid var(--line); background: white; outline: 0; }
.portal-toolbar input:focus { border-color: var(--primary); }
.attendance-toolbar label { min-width: 170px; flex: 1; }
.attendance-toolbar label:first-child { min-width: min(280px, 100%); flex: 1.5; }
.attendance-toolbar select { width: 100%; height: 42px; }
.attendance-summary { grid-template-columns: repeat(6, minmax(120px, 1fr)); }
.attendance-student-row .status-pill { justify-self: end; }
.lesson-attendance-dialog { max-width: min(860px, calc(100vw - 28px)); }
.lesson-operation-dialog { max-width: min(720px, calc(100vw - 28px)); }
.lesson-attendance-roster { min-height: 160px; }
.attendance-day-panel { display: grid; gap: 14px; }
.attendance-date-nav {
  display: grid;
  grid-template-columns: 42px minmax(190px, 220px) 42px auto 42px;
  align-items: center;
  gap: 8px;
}
.attendance-date-step,
.attendance-reload-button { width: 42px; height: 42px; border: 1px solid var(--line); background: var(--surface); }
.attendance-date-field {
  height: 52px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.attendance-date-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.attendance-date-field > span { color: var(--muted); font-size: 10px; font-weight: 800; line-height: 1.2; letter-spacing: 0; }
.attendance-date-field input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; font-weight: 750; line-height: 1.3; letter-spacing: 0; }
.attendance-date-field input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .62; }
.attendance-today-button { height: 42px; white-space: nowrap; }
.attendance-day-lessons { min-height: 128px; }
.attendance-day-source { margin-bottom: 10px; }
.attendance-day-grid { display: grid; gap: 10px; }
.attendance-lesson-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.attendance-lesson-card time { color: var(--primary); font-size: 14px; font-weight: 800; line-height: 1.35; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.attendance-lesson-card strong,
.attendance-lesson-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendance-lesson-card strong { font-size: 14px; line-height: 1.35; letter-spacing: 0; }
.attendance-lesson-card small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; letter-spacing: 0; }
.attendance-lesson-card .attendance-operation-reason { color: var(--danger); white-space: normal; }
.attendance-lesson-actions { display: flex; align-items: center; gap: 8px; }
.attendance-lesson-actions .icon-button { width: 42px; height: 42px; }
.attendance-lesson-actions .icon-button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.attendance-day-empty { display: grid; justify-items: start; gap: 10px; text-align: left; }
.lesson-attendance-list { display: grid; gap: 8px; }
.lesson-attendance-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(180px, 240px) 42px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(90deg, var(--attendance-soft-color, transparent), white 58%);
  box-shadow: inset 5px 0 0 var(--attendance-color, transparent);
}
.lesson-attendance-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.lesson-attendance-student { display: grid; gap: 2px; min-width: 0; }
.lesson-attendance-student strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-attendance-student small { color: var(--muted); font-size: 12px; }
.lesson-attendance-row select { width: 100%; border: 1px solid var(--attendance-color, var(--line)); box-shadow: 0 0 0 3px var(--attendance-soft-color, transparent); }
.lesson-attendance-heading-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.lesson-attendance-heading-actions > button { flex: 0 0 auto; width: auto; min-width: max-content; white-space: nowrap; }
.attendance-detail-summary { grid-template-columns: repeat(5, minmax(110px, 1fr)); }
.attendance-detail-list { margin-top: 18px; border-top: 1px solid var(--line); }
.portal-list { min-height: 170px; padding: 8px 18px; }
.portal-row { min-width: 0; min-height: 68px; display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(110px, auto); align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.portal-row:last-child { border-bottom: 0; }
.portal-row-button { width: 100%; border-top: 0; border-right: 0; border-left: 0; background: white; color: inherit; text-align: left; cursor: pointer; }
.portal-row-button:hover { background: var(--primary-soft); }
.portal-row > div { min-width: 0; }
.portal-row strong, .portal-row small { display: block; }
.portal-row small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.crm-group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; padding: 10px 18px 18px; }
.crm-group-card { --group-color: #4159bd; display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-top: 5px solid var(--group-color); border-radius: 8px; background: white; box-shadow: 0 8px 22px rgba(30, 22, 72, .06); }
.crm-group-card.is-archived { background: var(--surface-soft); box-shadow: none; }
.crm-group-card.is-archived .crm-group-stats,
.crm-group-card.is-archived .group-color-chip { opacity: .65; }
.crm-group-card header,
.crm-group-card footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.crm-group-card header strong,
.crm-group-card header small { display: block; }
.crm-group-card header small { margin-top: 5px; color: var(--muted); line-height: 1.35; }
.crm-group-card footer { align-items: center; justify-content: flex-start; flex-wrap: wrap; }
.crm-group-title { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.group-color-dot { --group-color: #4159bd; flex: 0 0 auto; width: 13px; height: 13px; margin-top: 4px; border-radius: 999px; background: var(--group-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--group-color) 16%, white); }
.group-color-chip { display: inline-flex; align-items: center; width: max-content; max-width: 100%; gap: 8px; padding: 7px 10px; border-radius: 999px; background: var(--canvas); color: var(--muted); font-size: 12px; font-weight: 900; }
.group-color-chip .group-color-dot { margin-top: 0; }
.crm-group-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.crm-group-stats div { min-width: 0; padding: 10px; border-radius: 8px; background: var(--canvas); }
.crm-group-stats span,
.crm-group-stats strong { display: block; }
.crm-group-stats span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.crm-group-stats strong { margin-top: 4px; font-size: 20px; font-variant-numeric: tabular-nums; }
.group-settings-dialog { max-width: min(760px, calc(100vw - 28px)); }
.group-settings-tabs { display: flex; gap: 6px; margin: 4px 0 14px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); overflow-x: auto; }
.group-settings-tab { flex: 1 0 auto; min-height: 38px; padding: 7px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.group-settings-tab:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, white); }
.group-settings-tab.active { color: white; background: var(--primary); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 22%, transparent); }
[data-group-settings-panel][hidden] { display: none; }
.group-color-preview { display: inline-flex; align-items: center; gap: 10px; width: max-content; max-width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--muted); font-size: 13px; font-weight: 700; }
.group-color-preview .group-color-dot { margin-top: 0; }
.entity-color-palette { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.entity-color-swatch { width: 30px; height: 30px; flex: 0 0 30px; border: 3px solid var(--surface); border-radius: 50%; outline: 1px solid var(--line); background: var(--swatch-color); cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.entity-color-swatch:hover { transform: translateY(-1px); }
.entity-color-swatch.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--swatch-color) 32%, transparent); outline-color: var(--swatch-color); }
.group-settings-section { display: grid; gap: 10px; margin-top: 14px; }
.group-settings-section h3 { margin: 0; font-size: 17px; }
.group-settings-checks,
.group-settings-list { display: grid; gap: 8px; min-height: 48px; }
.group-settings-checks label,
.group-settings-list .group-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.group-settings-checks label { justify-content: flex-start; font-weight: 800; }
.group-settings-checks input { width: 18px; height: 18px; flex: 0 0 auto; }
.group-settings-checks label > span { min-width: 0; display: grid; gap: 3px; }
.group-settings-checks label small { color: var(--muted); font-size: 11px; font-weight: 600; }
.group-settings-row strong,
.group-settings-row span { min-width: 0; overflow-wrap: anywhere; }
.group-settings-row span { color: var(--muted); font-size: 13px; }
.subscription-catalog-panel[hidden] { display: none; }
.subscription-types-heading { padding-top: 0; }
.subscription-types-heading > div { display: grid; gap: 4px; }
.subscription-types-heading strong { font-size: 18px; }
.subscription-templates-dialog { width: min(760px, calc(100vw - 28px)); max-width: 760px; max-height: calc(100vh - 28px); overflow: hidden; }
.aqsi-payment-dialog { width: min(680px, calc(100vw - 24px)); }
.aqsi-price-summary { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); color: var(--muted); }
.aqsi-price-summary strong { color: var(--text); }
.aqsi-payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 0; padding: 0; }
.aqsi-payment-methods legend { margin-bottom: 8px; font-weight: 700; }
.aqsi-payment-methods label { position: relative; }
.aqsi-payment-methods input { position: absolute; opacity: 0; }
.aqsi-payment-methods span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 700; }
.aqsi-payment-methods input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent); }
.aqsi-payment-result { padding: 14px 16px; border-radius: 12px; background: #eefaf3; color: #17663a; }
@media (max-width: 620px) { .aqsi-payment-methods { grid-template-columns: 1fr; } }
.group-choice-field { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.group-choice-field legend { margin-bottom: 2px; font-weight: 700; }
.group-choice-field small { color: var(--muted); line-height: 1.4; }
.group-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.group-choice-grid label { position: relative; min-width: 0; }
.group-choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.group-choice-grid label span, .group-choice-placeholder { display: flex; align-items: center; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #fff); cursor: pointer; font-weight: 700; line-height: 1.25; }
.group-choice-grid input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 14%, transparent); }
.group-choice-grid input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.group-choice-field:disabled .group-choice-grid label span, .group-choice-placeholder { color: var(--muted); background: var(--canvas); cursor: default; }
.multi-choice-dropdown { position: relative; }
.multi-choice-dropdown > summary { display: flex; align-items: center; min-height: 50px; padding: 11px 44px 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #fff); cursor: pointer; font-weight: 700; list-style: none; }
.multi-choice-dropdown > summary::-webkit-details-marker { display: none; }
.multi-choice-dropdown > summary::after { content: "⌄"; position: absolute; right: 16px; top: 13px; color: var(--muted); font-size: 20px; }
.multi-choice-dropdown[open] > summary { border-color: var(--primary); border-radius: 12px 12px 0 0; }
.multi-choice-dropdown[open] > summary::after { transform: rotate(180deg); }
.multi-choice-dropdown > .group-choice-grid { grid-template-columns: 1fr; max-height: 260px; padding: 8px; overflow-y: auto; border: 1px solid var(--primary); border-top: 0; border-radius: 0 0 12px 12px; background: var(--surface, #fff); }
.multi-choice-dropdown .group-choice-grid label span { min-height: 44px; }
.group-choice-field:disabled .multi-choice-dropdown > summary { color: var(--muted); background: var(--canvas); cursor: default; }
.group-choice-field:disabled .multi-choice-dropdown { pointer-events: none; }
@media (max-width: 620px) { .group-choice-grid { grid-template-columns: 1fr; } }
.subscription-templates-dialog form { max-height: calc(100vh - 28px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.subscription-templates-dialog .form-grid > * { min-width: 0; }
.subscription-template-list { display: grid; gap: 12px; min-height: 120px; padding: 14px; }
.subscription-template-row { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; color: inherit; }
.subscription-template-row header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.subscription-template-row header > span { min-width: 0; }
.subscription-template-row strong,
.subscription-template-row small { display: block; overflow-wrap: anywhere; }
.subscription-template-row small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.subscription-template-groups { display: grid; gap: 7px; }
.subscription-template-groups > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.subscription-template-groups > div { display: flex; flex-wrap: wrap; gap: 6px; }
.subscription-group-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 800; }
.subscription-group-chip.muted { color: var(--muted); background: var(--canvas); }
.subscription-template-prices { display: grid; grid-template-columns: repeat(5, minmax(100px, 1fr)); gap: 8px; }
.subscription-template-prices > div { min-width: 0; padding: 9px 10px; border-radius: 8px; background: var(--canvas); }
.subscription-template-prices span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.subscription-template-prices strong { margin-top: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.subscription-template-editor { display: grid; gap: 12px; }
.subscription-template-editor[hidden] { display: none; }
.subscription-price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.subscription-price-grid label { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.subscription-price-grid input { width: 100%; }
.subscription-unlimited-toggle { display: flex !important; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); cursor: pointer; }
.subscription-unlimited-toggle input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; padding: 0; }
.subscription-unlimited-toggle > span { display: grid; gap: 3px; }
.subscription-unlimited-toggle strong { font-size: 14px; }
.subscription-unlimited-toggle small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.subscription-template-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
@media (max-width: 760px) {
  .group-settings-tabs { margin-inline: -2px; }
  .group-settings-tab { flex: 0 0 auto; }
  .subscription-catalog-tabs { overflow-x: auto; padding-bottom: 4px; }
  .subscription-catalog-tab { flex: 0 0 auto; }
  .subscription-types-heading { align-items: flex-start; }
  .subscription-template-list { padding: 10px; }
  .subscription-template-prices { grid-template-columns: 1fr 1fr; }
  .subscription-price-grid { grid-template-columns: 1fr 1fr; }
  .subscription-template-actions { flex-wrap: wrap; }
}
.store-sale-row { grid-template-columns: 40px minmax(0, 1fr) minmax(100px, auto); align-items: center; }
.store-sale-total { display: grid; justify-items: end; gap: 7px; }
.store-sale-total .status-pill { margin: 0; }
.store-sale-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.store-sale-actions button { white-space: nowrap; }
.portal-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.portal-icon svg { width: 18px; }
.client-list-number { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--primary); background: white; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.portal-meta { text-align: right; }
.portal-meta span, .portal-meta strong { display: block; }
.portal-meta span { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.portal-meta .status-pill { margin: 0 0 7px auto; }
.portal-chevron { color: var(--muted); justify-self: end; }
.message-row { align-items: start; padding-block: 16px; }
.message-row.unread { background: #f7fcf9; box-shadow: inset 3px 0 0 var(--green); }
.message-row p { max-width: 900px; margin: 7px 0 9px; color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }
.notification-route-label { color: var(--primary); font-weight: 800; }
.message-row .notification-route-label { display: block; margin-top: 5px; }
.portal-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.portal-section-heading > div:first-child { min-width: 0; display: grid; gap: 5px; }
.portal-section-heading strong { line-height: 1.35; }
.portal-section-heading span { color: var(--muted); font-size: 12px; }
.schedule-catalog-row { min-height: 68px; display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.schedule-catalog-row.is-actionable { cursor: pointer; }
.schedule-catalog-row.is-actionable:hover { background: var(--primary-soft); }
.schedule-catalog-row.is-actionable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.schedule-catalog-row time { color: var(--primary); font-size: 16px; font-weight: 800; }
.schedule-catalog-row strong, .schedule-catalog-row small { display: block; }
.schedule-catalog-row small { margin-top: 5px; color: var(--muted); }
.weekly-schedule-panel { padding: 0; overflow: hidden; }
.schedule-toolbar { grid-template-columns: repeat(5, minmax(130px, 1fr)) auto; align-items: end; }
.schedule-list-view { display: grid; gap: 10px; padding: 16px; }
.schedule-list-card { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: 10px; background: white; }
.schedule-list-card.is-actionable { cursor: pointer; }
.schedule-list-card.is-actionable:hover { background: var(--primary-soft); }
.schedule-list-card time, .schedule-list-card time strong, .schedule-list-card time span, .schedule-list-card div strong, .schedule-list-card div small { display: block; }
.schedule-list-card time span, .schedule-list-card div small { margin-top: 4px; color: var(--muted); }
#schedule-bookings-panel { margin-top: 16px; }
.weekly-schedule-loading { min-height: 560px; }
.schedule-source-line { padding: 14px 16px 0; }
.weekly-schedule-scroll { max-width: 100%; max-height: calc(100vh - 230px); overflow: auto; overscroll-behavior: contain; }
.weekly-schedule-grid {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(190px, 1fr));
  min-width: 1402px;
  background: white;
}
@media (max-width: 760px) {
  .schedule-toolbar { grid-template-columns: 1fr 1fr; }
  .schedule-toolbar > button { width: 100%; }
  .schedule-list-card { grid-template-columns: 1fr auto; }
  .schedule-list-card > time { grid-column: 1 / -1; }
}
.week-time-heading,
.week-day-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 72px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}
.week-time-heading { left: 0; z-index: 6; color: var(--muted); align-items: center; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.week-day-heading { border-left: 1px solid var(--line); }
.week-day-heading strong { font-size: 14px; text-transform: capitalize; }
.week-day-heading span { color: var(--muted); font-size: 11px; }
.week-day-heading.is-today { color: var(--primary); background: #faf8ff; box-shadow: inset 0 -3px 0 var(--primary); }
.week-day-heading .schedule-add-day {
  width: max-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: white;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.week-day-heading .schedule-add-day:hover { background: var(--primary-soft); }
.week-time-axis,
.week-day-column { position: relative; height: var(--timeline-height); min-height: 240px; }
.week-time-axis { position: sticky; left: 0; z-index: 3; border-right: 1px solid var(--line); background: white; }
.week-time-axis time {
  position: absolute;
  top: var(--minute-top);
  right: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.week-day-column {
  border-right: 1px solid var(--line);
  background-color: #fcfcfe;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-height) - 1px), var(--line) calc(var(--hour-height) - 1px), var(--line) var(--hour-height));
}
.week-day-column.is-today { background-color: #fbf9ff; }
.week-lesson-card {
  position: absolute;
  top: calc(var(--minute-top) + 4px);
  left: calc((100% / var(--lanes)) * var(--lane) + 5px);
  width: calc(100% / var(--lanes) - 10px);
  height: calc(var(--lesson-height) - 8px);
  min-height: 42px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid #dedbe8;
  border-top: 5px solid var(--lesson-color);
  border-radius: 10px;
  background: white;
  box-shadow: 0 5px 14px rgba(30, 22, 72, .08);
  color: var(--text);
}
.week-lesson-card strong { flex: 0 0 auto; overflow: hidden; font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.week-lesson-card time { flex: 0 0 auto; color: var(--text); font-size: 12px; line-height: 1.2; font-weight: 800; font-variant-numeric: tabular-nums; }
.week-lesson-card small { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.week-lesson-card.is-compact { gap: 1px; min-height: 44px; padding: 6px 8px; border-top-width: 4px; }
.week-lesson-card.is-compact strong { font-size: 11px; line-height: 1.15; white-space: normal; }
.week-lesson-card.is-compact time { font-size: 11px; line-height: 1.15; }
.week-lesson-card.is-compact small,
.week-lesson-card.is-compact .week-lesson-status { display: none; }
.week-lesson-card.is-actionable { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.week-lesson-card.is-actionable:hover { z-index: 2; transform: translateY(-1px); box-shadow: 0 9px 22px rgba(30, 22, 72, .14); }
.week-lesson-card.is-actionable:focus-visible { z-index: 2; outline: 2px solid var(--primary); outline-offset: 2px; }
.week-lesson-card.color-0 { --lesson-color: #4159bd; }
.week-lesson-card.color-1 { --lesson-color: #27a66f; }
.week-lesson-card.color-2 { --lesson-color: #e0ae13; }
.week-lesson-card.color-3 { --lesson-color: #a92cb8; }
.week-lesson-card.color-4 { --lesson-color: #169fbd; }
.week-lesson-card.color-5 { --lesson-color: #d45d68; }
.week-lesson-status { width: max-content; max-width: 100%; margin-top: auto; padding: 2px 6px; border-radius: 999px; background: var(--canvas); color: var(--muted); font-size: 9px; font-weight: 800; }
.week-lesson-status.success { color: var(--green); background: var(--green-soft); }
.week-lesson-status.warning { color: var(--amber); background: var(--amber-soft); }
.week-lesson-status.danger { color: var(--red); background: var(--red-soft); }
.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.weekday-picker label { display: block; }
.weekday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker span {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.weekday-picker input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.schedule-week-control { min-width: 270px; }
.status-pill { display: inline-flex; align-items: center; width: max-content; padding: 6px 10px; border-radius: 999px; color: var(--muted); background: var(--canvas); font-size: 11px; font-weight: 800; }
.status-pill.success { color: var(--green); background: var(--green-soft); }
.status-pill.danger { color: var(--red); background: var(--red-soft); }
.status-pill.warning { color: var(--amber); background: var(--amber-soft); }
.status-pill.info { color: var(--blue); background: var(--blue-soft); }
.portal-icon, .client-profile-grid, .client-profile-grid > div, .document-content, .mark-bubble { border-radius: 6px; }
.date-control.single { grid-template-columns: 1fr; }
.report-status { display: grid; gap: 10px; padding: 16px 0; }
.report-status span { color: var(--muted); }
.mark-chat-panel { min-height: 55vh; }
.mark-history { min-height: 55vh; max-height: calc(100vh - 290px); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 20px; }
.mark-bubble { width: min(720px, 88%); padding: 13px 15px; border: 1px solid var(--line); background: white; }
.mark-bubble.user { align-self: flex-end; color: white; border-color: var(--primary); background: var(--primary); }
.mark-bubble.assistant { align-self: flex-start; background: var(--canvas); }
.mark-bubble > span { display: block; margin-bottom: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.mark-bubble p { margin: 0; line-height: 1.55; }
.mark-bubble.user .text-button { color: white; }
.mark-sources { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.mark-sources summary { width: fit-content; cursor: pointer; color: var(--primary); font-weight: 700; }
.mark-sources div { display: grid; gap: 5px; margin-top: 8px; }
.mark-sources span { overflow-wrap: anywhere; }
.mark-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mark-suggestion-chip {
  max-width: 100%;
  min-height: 34px;
  border: 1px solid rgba(59, 35, 143, .18);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--primary);
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  overflow-wrap: anywhere;
}
.mark-suggestion-chip:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.client-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.client-profile-grid > div { min-width: 0; padding: 13px; background: white; }
.client-profile-grid span, .client-profile-grid strong { display: block; }
.client-profile-grid span { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.client-profile-grid strong { overflow-wrap: anywhere; line-height: 1.45; }
.client-detail-actions { justify-content: flex-start; flex-wrap: wrap; }
.student-discount-panel { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.student-discount-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.student-discount-heading span, .student-discount-stats span { display: block; color: var(--muted); font-size: 11px; }
.student-discount-heading strong { display: block; margin-top: 4px; font-size: 18px; }
.discount-level { padding: 7px 10px; border-radius: 999px; font-weight: 800; }
.discount-level.master { color: #7b5a00; background: #fff3c4; }
.discount-level.guru { color: #155c3b; background: #ddf5e8; }
.discount-level.vip { color: #4c278e; background: #eee5ff; }
.student-discount-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.student-discount-stats > div { padding: 12px; border-radius: 6px; background: var(--canvas); }
.student-discount-stats strong, .student-discount-stats small { display: block; margin-top: 5px; }
.student-discount-progress { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.student-discount-history { margin-top: 12px; border-top: 1px solid var(--line); }
.student-discount-history summary { padding: 12px 0 4px; cursor: pointer; font-size: 12px; font-weight: 800; }
.student-discount-history > div { padding: 10px 0; border-top: 1px solid var(--line); }
.student-discount-history span, .student-discount-history strong, .student-discount-history small { display: block; }
.student-discount-history span, .student-discount-history small { color: var(--muted); font-size: 11px; }
.student-discount-history strong, .student-discount-history small { margin-top: 4px; }
.document-summary { margin-bottom: 16px; padding: 14px; border-left: 3px solid var(--primary); background: var(--primary-soft); }
.document-summary p { margin: 7px 0 0; line-height: 1.55; }
.document-content { max-height: 56vh; overflow-y: auto; padding: 16px; border: 1px solid var(--line); background: white; line-height: 1.65; overflow-wrap: anywhere; }
.document-actions { align-items: center; flex-wrap: wrap; }
.change-preview { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); }
.change-preview > div { display: grid; gap: 4px; }
.change-preview span { color: var(--muted); font-size: 11px; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-secondary { grid-template-columns: 1fr 1fr; }
  .plan-catalog { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .staff-row { grid-template-columns: 42px minmax(0, 1fr) 110px; }
  .staff-actions { grid-column: 2 / -1; width: 100%; }
  .parent-account-layout { grid-template-columns: 1fr; }
  .parent-link-form { border-top: 1px solid var(--line); border-left: 0; }
  .owner-chip { grid-column: 3; }
}

.crm-catalog-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.crm-catalog-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.crm-catalog-tab.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.crm-catalog-tab svg { width: 18px; height: 18px; }
.sales-pipeline-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  align-items: start;
}
.sales-pipeline-column {
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfaff 0%, #f7f4fc 100%);
}
.sales-pipeline-column.drag-over {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px rgba(58, 35, 129, .16), 0 10px 26px rgba(58, 35, 129, .08);
}
.sales-pipeline-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sales-pipeline-column header span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.sales-pipeline-column header span i { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 999px; background: var(--pipeline-stage-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pipeline-stage-color) 14%, transparent); }
.sales-pipeline-column header b {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
}
.sales-pipeline-column > div {
  display: grid;
  gap: 10px;
}
.sales-pipeline-card {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(37, 24, 82, .06);
}
.sales-pipeline-card:hover {
  border-color: rgba(58, 35, 129, .28);
  background: #fbfaff;
}
.sales-pipeline-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.sales-pipeline-card-head strong {
  min-width: 0;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.sales-pipeline-card-head b {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff4d6;
  color: #9a6400;
  font-size: 11px;
  font-weight: 900;
}
.sales-pipeline-card small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.sales-pipeline-card.is-new {
  border-color: #f0c15f;
  box-shadow: 0 10px 26px rgba(199, 133, 17, .12);
}

@media (max-width: 820px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-grid; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand { min-height: 160px; padding: 30px; }
  .auth-brand::after { inset: 30% -20% -120% 20%; }
  .auth-panel { width: calc(100% - 40px); padding: 42px 0; }
  .app-shell { display: block; }
  .workspace { min-height: 100vh; }
  .sidebar { transform: translateX(-101%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(20,15,45,.38); }
  .sidebar-backdrop.open { display: block; }
  .topbar { height: 70px; padding: 10px 14px; gap: 8px; }
  .global-search { height: 44px; }
  .global-search kbd, .profile-copy, .profile-button > svg { display: none; }
  .profile-button { min-width: 44px; display: block; }
  .profile-menu { top: 50px; }
  .main-scroll { padding: 18px 14px 128px; }
  .page-heading { display: grid; }
  .planner-navigation { align-items: stretch; flex-direction: column; }
  .planner-tabs, .planner-scope { width: 100%; }
  .planner-tabs button { flex: 1; justify-content: center; padding-inline: 8px; }
  .planner-scope button { flex: 1; justify-content: center; }
  .date-control { width: 100%; justify-content: space-between; }
  .date-control label { flex: 1; justify-content: center; }
  .metric-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -14px; padding: 0 14px 8px; }
  .metric-card { min-width: 190px; scroll-snap-align: start; }
  .dashboard-lower, .dashboard-secondary { grid-template-columns: 1fr; }
  .schedule-row { grid-template-columns: 78px minmax(0, 1fr); }
  .schedule-row .status-pill { grid-column: 2; justify-self: start; }
  .inventory-summary { grid-template-columns: 1fr 1fr 1fr; }
  .attendance-lesson-card { grid-template-columns: 1fr; align-items: stretch; }
  .attendance-lesson-card .status-pill,
  .attendance-lesson-card button { justify-self: start; }
  .attendance-lesson-actions { flex-wrap: wrap; }
  .lesson-attendance-row { grid-template-columns: 30px minmax(0, 1fr); }
  .lesson-attendance-row select { grid-column: 2; }
  .task-row { grid-template-columns: 26px 50px minmax(150px, 1fr) 74px; }
  .task-scope, .task-assignee { display: none; }
  .mark-composer { left: 14px; right: 14px; bottom: 10px; }
  .plan-catalog { grid-template-columns: 1fr; }
  .account-layout { grid-template-columns: 1fr; }
  .staff-row { grid-template-columns: 42px minmax(0, 1fr); }
  .access-state, .staff-actions, .owner-chip { grid-column: 2; justify-self: stretch; }
  .staff-actions { grid-template-columns: 1fr 1fr; }
  .client-account-row { grid-template-columns: 42px minmax(0, 1fr) 20px; }
  .client-account-row .access-state, .client-child-count { grid-column: 2; }
  .client-account-row > svg { grid-column: 3; grid-row: 1; }
  .parent-account-header { align-items: flex-start; flex-wrap: wrap; }
  .parent-account-header-actions { width: 100%; justify-content: space-between; }
  .parent-account-header-actions .secondary-button { flex: 1; }
  .client-onboarding-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .client-onboarding-dialog > article { min-height: min(640px, calc(100dvh - 20px)); max-height: calc(100dvh - 20px); }
  .client-onboarding-content { padding: 28px 24px; }
  .client-onboarding-content h2 { font-size: 25px; }
  .client-onboarding-dialog footer { align-items: stretch; flex-wrap: wrap; }
  .client-onboarding-dialog footer > div { margin-left: auto; }
  .client-onboarding-dialog footer button { min-height: 44px; }
  .permission-role-options { flex-direction: column; }
  .permission-row label { width: 100%; }
  .detail-summary, .detail-form { grid-template-columns: 1fr; }
  .detail-task-list button { grid-template-columns: 62px minmax(0, 1fr); }
  .detail-task-list small { grid-column: 2; }
}

@media (max-width: 480px) {
  .auth-heading h1 { font-size: 28px; }
  .top-actions { gap: 0; }
  .top-actions > .icon-button { display: none; }
  .global-search { padding-inline: 10px; }
  .global-search input::placeholder { color: transparent; }
  .page-heading h1 { font-size: 23px; }
  .planner-tabs button span { display: none; }
  .account-directory-tabs button span { display: inline; }
  .account-directory-tabs button { min-width: 0; }
  .account-directory-section > .portal-section-heading { align-items: stretch; flex-direction: column; }
  .account-directory-section > .portal-section-heading .primary-button { width: 100%; }
  .task-row { grid-template-columns: 24px 42px minmax(130px, 1fr); }
  .task-row .priority { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .staff-actions { grid-template-columns: 1fr; }
  .recovery-code-list { grid-template-columns: 1fr; }
  .portal-row { grid-template-columns: 38px minmax(0, 1fr); }
  .store-sale-row { grid-template-columns: 38px minmax(0, 1fr); }
  .store-sale-total, .store-sale-actions { grid-column: 2; justify-items: start; justify-content: flex-start; }
  .store-sale-actions { flex-wrap: wrap; }
  .portal-meta, .portal-row > .status-pill { grid-column: 2; text-align: left; justify-self: start; }
  .schedule-catalog-row { grid-template-columns: 55px minmax(0, 1fr); padding: 10px 0; }
  .schedule-catalog-row .status-pill { grid-column: 2; justify-self: start; }
  .mark-bubble { width: 94%; }
  .client-profile-grid { grid-template-columns: 1fr; }
  .student-discount-heading { align-items: flex-start; flex-direction: column; }
  .student-discount-stats { grid-template-columns: 1fr; }
  .inventory-summary { grid-template-columns: 1fr; }
  .attendance-summary, .attendance-detail-summary { grid-template-columns: 1fr 1fr; }
  .inventory-row { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 10px 0; }
  .inventory-row .inventory-price, .inventory-row .status-pill, .inventory-row > .icon-button { grid-column: 2 / -1; justify-self: start; text-align: left; }
  .certificate-preview-section > div { grid-template-columns: 1fr; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* ViArt premium brand system */
:root {
  --ink: #18181b;
  --text: #18181b;
  --muted: #6f6f7b;
  --line: #eceaf6;
  --line-strong: #d8d3ee;
  --primary: #2e1a78;
  --primary-dark: #3c2792;
  --primary-mid: #5846b8;
  --primary-light: #8d82d8;
  --primary-soft: #f2effd;
  --accent-soft: #e9e5ff;
  --surface: #ffffff;
  --canvas: #fafafc;
  --green: #27834a;
  --green-soft: #edf8f1;
  --red: #e54b4b;
  --red-soft: #fff1f1;
  --amber: #a56a08;
  --amber-soft: #fff7e6;
  --blue: #3269a8;
  --blue-soft: #eef5ff;
  --shadow: 0 10px 32px rgba(46, 26, 120, .06);
  --shadow-raised: 0 18px 42px rgba(46, 26, 120, .09);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { background: var(--canvas); }
body { color: var(--ink); background: var(--canvas); font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea, .metric-card, .panel, .plan-card, .portal-row-button {
  transition: color 200ms ease-out, background-color 200ms ease-out, border-color 200ms ease-out, box-shadow 200ms ease-out, transform 200ms ease-out;
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(88, 70, 184, .45);
  outline-offset: 3px;
}
svg { stroke-width: 1.75; }

.brand-logo { display: block; max-width: 100%; object-fit: contain; mix-blend-mode: multiply; }
.auth-screen { grid-template-columns: minmax(360px, .9fr) minmax(500px, 1.1fr); background: var(--surface); }
.auth-brand {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  padding: 64px;
  color: var(--primary);
  background: var(--canvas);
  border-right: 1px solid var(--line);
}
.auth-brand::after {
  inset: auto -16% 4% 8%;
  height: 180px;
  border: 0;
  background: url("/assets/viart-logo.png") center / contain no-repeat;
  opacity: .025;
  mix-blend-mode: multiply;
  transform: none;
}
.auth-logo { width: min(420px, 88%); }
.auth-brand p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.auth-panel { width: min(480px, calc(100% - 80px)); }
.auth-heading { margin-bottom: 38px; }
.auth-heading h1 { font-size: 34px; font-weight: 800; line-height: 1.16; }
.auth-heading p { font-size: 15px; line-height: 1.7; }
.eyebrow { color: var(--primary-mid); font-size: 12px; letter-spacing: .08em; }
.auth-form { gap: 20px; }
.auth-form label, .create-dialog label { color: var(--ink); font-weight: 600; }
.input-wrap {
  height: 58px;
  padding: 0 18px;
  border-color: var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.input-wrap:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(141, 130, 216, .12); }

.app-shell { grid-template-columns: 292px minmax(0, 1fr); }
.sidebar {
  width: 292px;
  border-color: var(--line);
  background: rgba(255, 255, 255, .98);
}
.sidebar-brand {
  height: 178px;
  justify-content: center;
  padding: 20px 30px 16px;
  border: 0;
}
.sidebar-logo { width: 205px; max-height: 145px; }
.side-nav { padding: 10px 18px 18px; }
.nav-item {
  min-height: 46px;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  margin-bottom: 3px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 24px;
  border-radius: 0 4px 4px 0;
  background: transparent;
}
.nav-item { position: relative; }
.nav-item:hover { color: var(--primary); background: #faf8ff; }
.nav-item.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.nav-item.active::before { background: var(--primary); }
.nav-item svg { color: #7b768a; }
.nav-item.active svg { color: var(--primary); }
.nav-count {
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 12px;
  color: var(--primary-mid);
  background: var(--accent-soft);
  font-weight: 700;
}
.mark-nav {
  height: 54px;
  margin: 14px 18px 20px;
  padding: 0 15px;
  border-color: #d7d1ef;
  border-radius: 16px;
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(46, 26, 120, .05);
  font-weight: 700;
}
.mark-nav:hover { border-color: var(--primary-light); background: var(--primary-soft); transform: translateY(-1px); }

.workspace { position: relative; grid-column: 2; }
.workspace::after {
  content: "";
  position: fixed;
  z-index: 0;
  right: -70px;
  bottom: 55px;
  width: 440px;
  height: 315px;
  pointer-events: none;
  background: url("/assets/viart-logo.png") center / contain no-repeat;
  opacity: .028;
  mix-blend-mode: multiply;
}
.topbar {
  height: 96px;
  padding: 18px 42px;
  border-color: var(--line);
  background: rgba(250, 250, 252, .92);
  backdrop-filter: blur(18px);
}
.global-search {
  max-width: 760px;
  height: 58px;
  padding: 0 20px;
  border-color: var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(46, 26, 120, .035);
}
.global-search:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(141, 130, 216, .1); }
.global-search input { font-size: 15px; }
.global-search kbd { border-color: var(--line); border-radius: 8px; background: var(--canvas); }
.search-results, .profile-menu {
  border-color: var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-raised);
}
.search-result, .profile-menu button { border-radius: 10px; }
.search-result span:first-child { border-radius: 10px; }
.icon-button { border-radius: 12px; }
.icon-button:hover { color: var(--primary); background: var(--primary-soft); }
.profile-button { min-width: 168px; border-radius: 14px; }
.profile-button:hover { background: var(--primary-soft); }
.profile-avatar { border-color: #d4cfee; color: var(--primary); background: var(--surface); font-weight: 800; }
.notification-badge { background: var(--primary); }

.main-scroll { position: relative; z-index: 1; padding: 40px 48px 126px; }
.view { position: relative; z-index: 1; }
.page-heading { min-height: 82px; margin-bottom: 28px; }
.page-heading h1 { margin-bottom: 8px; font-size: 32px; font-weight: 800; line-height: 1.2; }
.page-heading p { font-size: 15px; line-height: 1.6; }
.date-control {
  height: 52px;
  overflow: hidden;
  border-color: #d7d1ef;
  border-radius: 16px;
  box-shadow: 0 5px 18px rgba(46, 26, 120, .035);
}
.date-control label { padding-inline: 15px; border-color: var(--line); }

.metric-grid { grid-template-columns: repeat(3, minmax(210px, 1fr)); gap: 24px; margin-bottom: 24px; }
.metric-card {
  min-height: 178px;
  padding: 28px;
  border-color: var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.metric-card:hover { border-color: #ddd8f1; box-shadow: var(--shadow-raised); transform: translateY(-2px); }
.metric-card h3 { min-height: 0; max-width: 80%; font-size: 15px; font-weight: 600; }
.metric-value { margin-top: 18px; font-size: 36px; font-weight: 800; line-height: 1.12; }
.metric-meta { margin-top: 16px; color: var(--primary-light); font-size: 13px; font-weight: 500; }
.metric-card > svg { right: 24px; bottom: 24px; width: 34px; height: 34px; color: var(--primary-mid); }
.metric-card > div { display: grid; align-content: start; gap: 14px; }
.metric-card > div > span, .metric-card > div > strong { display: block; }

.dashboard-layout { grid-template-columns: minmax(0, 1.52fr) minmax(320px, .82fr); gap: 24px; }
.dashboard-primary, .dashboard-secondary { gap: 24px; }
.dashboard-lower { gap: 24px; }
.panel {
  border-color: var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.panel:hover { box-shadow: var(--shadow-raised); }
.panel-header { min-height: 68px; padding: 0 24px; border-color: var(--line); }
.panel-header h2 { font-size: 18px; font-weight: 700; }
.text-button { border-radius: 10px; color: var(--primary-mid); }
.text-button:hover { background: var(--primary-soft); text-decoration: none; }
.task-row { min-height: 68px; padding: 10px 24px; border-color: var(--line); font-size: 13px; }
.task-row:hover, .schedule-row:hover, .notification-row:hover, .collection-row-button:hover, .interactive-row:hover, .portal-row-button:hover { background: #faf8ff; }
.task-check { border-color: var(--primary-light); border-radius: 5px; }
.priority { padding: 5px 9px; border: 0; border-radius: 10px; }
.list-footer { min-height: 52px; padding: 0 24px; border-color: var(--line); }
.plan-list, .finance-summary, .schedule-list, .notification-list { padding: 16px 24px; }
.progress { border-radius: 999px; background: #ebe8f7; }
.progress span { border-radius: inherit; background: var(--primary-mid); }
.schedule-row { min-height: 68px; border-color: var(--line); font-size: 13px; }
.status-chip { padding: 6px 10px; border: 0; border-radius: 10px; }
.notification-row { min-height: 60px; border-color: var(--line); }

.planner-navigation { margin-bottom: 24px; padding: 0; border: 0; }
.planner-tabs, .planner-scope, .crm-catalog-tab {
  overflow: hidden;
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(46, 26, 120, .03);
}
.planner-tabs button, .planner-scope button { min-height: 48px; padding: 0 18px; border-color: var(--line); }
.planner-tabs button.active, .planner-scope button.active { color: var(--primary); background: var(--primary-soft); }
.planner-tabs button.active b { color: var(--primary); background: var(--accent-soft); }
.collection-toolbar, .financial-calendar-toolbar {
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border-color: var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.collection-toolbar select, .collection-toolbar input, .portal-toolbar input, .portal-toolbar select,
.financial-calendar-toolbar input, .account-form input, .staff-actions input, .staff-actions select {
  height: 46px;
  padding-inline: 14px;
  border-color: var(--line);
  border-radius: 14px;
}
.collection-head { min-height: 52px; padding: 0 24px; background: var(--surface); }
.collection-row { min-height: 70px; padding: 0 24px; border-color: var(--line); }
.collection-row-button { background: transparent; }
.selectable-row { border-color: var(--line); }
.plan-catalog { gap: 24px; padding: 24px; }
.plan-card { min-height: 190px; padding: 24px; border-color: var(--line); border-radius: 18px; box-shadow: 0 5px 18px rgba(46, 26, 120, .035); }
.plan-card:hover { border-color: #ddd8f1; box-shadow: var(--shadow-raised); transform: translateY(-2px); }
.plan-card-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.plan-card-meta .status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; }
.plan-card-meta .status-pill svg { width: 14px; height: 14px; }

.collection-row-button.is-completed,
.task-row.is-completed,
.plan-card.is-completed {
  color: #4f6659;
  background: var(--green-soft);
  box-shadow: inset 4px 0 0 var(--green);
}
.collection-row-button.is-completed:hover,
.task-row.is-completed:hover,
.plan-card.is-completed:hover {
  border-color: #b9ddc8;
  background: #e2f3e9;
}
.collection-row-button.is-completed::before,
.task-row.is-completed::before { background: var(--green); }
.collection-row-button.is-completed > strong:nth-of-type(2),
.task-row.is-completed .task-title,
.plan-card.is-completed h3 { color: #577064; text-decoration: line-through; text-decoration-thickness: 1px; }
.collection-row-button.is-completed .status-label { color: var(--green); font-weight: 800; }
.plan-card.is-completed { border-color: #c9e5d4; }
.plan-card.is-completed .progress span { background: var(--green); }
.detail-dialog > article.is-completed .detail-header { background: var(--green-soft); }
.detail-dialog > article.is-completed .detail-header h2 { color: #577064; text-decoration: line-through; }
.pagination { min-height: 64px; border-color: var(--line); }
.pagination button { border-color: var(--line); border-radius: 10px; }

.primary-button, .secondary-button, .danger-button {
  min-height: 50px;
  padding: 0 22px;
  border-radius: 16px;
  font-weight: 600;
}
.primary-button { border-color: var(--primary); background: var(--primary); }
.primary-button:hover { border-color: var(--primary-dark); background: var(--primary-dark); transform: translateY(-1px); }
.secondary-button { border-color: #d4cfee; color: var(--primary); background: var(--surface); }
.secondary-button:hover { border-color: var(--primary-light); background: var(--primary-soft); }
.compact, .primary-button.compact { min-height: 44px; border-radius: 14px; }
.status-pill, .discount-level, .owner-chip { border-radius: 999px; }
.portal-list, .inventory-list, .staff-list { padding: 12px 24px; }
.portal-row, .inventory-row, .staff-row { min-height: 78px; border-color: var(--line); }
.portal-icon { border-radius: 12px; background: var(--primary-soft); }
.message-row.unread { background: #f7fcf9; box-shadow: inset 3px 0 0 var(--green); }
.student-discount-panel { padding: 24px; border-color: var(--line); border-radius: 18px; }
.student-discount-stats { gap: 14px; }
.student-discount-stats > div { padding: 18px; border-radius: 14px; }
.student-discount-proof { margin-top: 18px; border-top: 1px solid var(--line); }
.student-discount-proof summary { display: inline-flex; align-items: center; gap: 9px; margin-top: 16px; padding: 11px 14px; color: var(--primary); border: 1px solid var(--accent); border-radius: 14px; background: white; font-size: 13px; font-weight: 800; cursor: pointer; list-style: none; }
.student-discount-proof summary::-webkit-details-marker { display: none; }
.student-discount-proof summary:hover { background: var(--hover); }
.student-discount-proof summary svg { width: 17px; height: 17px; }
.discount-proof-body { margin-top: 16px; }
.discount-proof-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; border-top: 1px solid var(--line); }
.discount-proof-facts > div { display: grid; gap: 4px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.discount-proof-facts span, .discount-proof-row small { color: var(--muted); font-size: 12px; }
.discount-proof-counts { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 15px 0; color: var(--muted); font-size: 13px; }
.discount-proof-counts strong { color: var(--ink); }
.discount-proof-list { border-top: 1px solid var(--line); }
.discount-proof-row { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.discount-proof-row time { color: var(--muted); font-size: 13px; }
.discount-proof-row div { display: grid; gap: 3px; min-width: 0; }
.discount-proof-row .discount-proof-statuses { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.subscription-debt-lessons { margin-top: 8px; border-top: 1px solid var(--line); }
.subscription-debt-lessons > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.subscription-debt-lessons time { color: var(--muted); }
.client-profile-grid { gap: 12px; border: 0; border-radius: 0; background: transparent; }
.client-profile-grid > div { padding: 18px; border: 1px solid var(--line); border-radius: 14px; }
.client-card-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.client-card-status > span:first-child { color: var(--muted); font-size: 12px; font-weight: 700; }
.client-card-status .secondary-button { margin-left: auto; }
.portal-row-button, .collection-row-button, .interactive-row {
  margin-block: 4px;
  overflow: hidden;
  border-radius: var(--interactive-radius);
  background-clip: padding-box;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.portal-row-button { padding-inline: var(--interactive-gutter); }
.portal-row-button:hover, .collection-row-button:hover, .interactive-row:hover {
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line);
}
.notification-row-button,
.schedule-row,
.task-row,
.plan-row-button,
.schedule-catalog-row.is-actionable,
.detail-task-list button {
  overflow: hidden;
  border-radius: var(--interactive-radius);
  background-clip: padding-box;
  transition: background-color .18s ease, box-shadow .18s ease;
}
.notification-row-button,
.schedule-row,
.plan-row-button,
.schedule-catalog-row.is-actionable {
  padding-inline: var(--interactive-gutter);
}
.notification-row-button,
.schedule-row,
.plan-row-button,
.schedule-catalog-row.is-actionable { margin-block: 4px; }
.notification-row-button:hover,
.schedule-row:hover,
.task-row:hover,
.plan-row-button:hover,
.schedule-catalog-row.is-actionable:hover,
.detail-task-list button:hover {
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line);
}
.task-row { margin: 4px 12px; }
.detail-task-list { gap: 4px; padding: 6px; border-radius: var(--interactive-radius); }
.detail-task-list button { border-bottom: 0; }
.detail-task-list button.task-priority-low,
.detail-task-list button.task-priority-normal,
.detail-task-list button.task-priority-high { padding-left: 22px; }
.portal-section-heading { padding-inline: 24px; }
.client-detail-page { width: min(1180px, 100%); margin: 0 auto; padding-bottom: 40px; }
.client-detail-page-header { display: flex; align-items: flex-start; gap: 22px; margin-bottom: 24px; }
.client-detail-page-header > div { display: grid; gap: 6px; min-width: 0; }
.client-detail-page-header h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.client-detail-page-header .eyebrow { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.client-page-content { display: grid; gap: 20px; min-height: 240px; }
.client-workspace-tabs { position: sticky; top: 8px; z-index: 3; display: flex; gap: 6px; padding: 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 24px rgba(46, 26, 120, .06); backdrop-filter: blur(14px); scrollbar-width: thin; }
.client-workspace-tab { flex: 0 0 auto; min-height: 40px; padding: 0 15px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.client-workspace-tab:hover, .client-workspace-tab.active { background: var(--surface-accent); color: var(--primary); }
.client-workspace-section { scroll-margin-top: 82px; }
.student-workspace-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.student-workspace-summary > div { display: grid; gap: 5px; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.student-workspace-summary span { color: var(--muted); font-size: 12px; font-weight: 700; }
.student-workspace-summary strong { font-size: 24px; line-height: 1; }
.student-workspace-summary .student-balance-card { border-color: #cfc5f3; background: linear-gradient(135deg, #f5f1ff, #fff); }
.student-workspace-summary .student-balance-card span { color: var(--primary); }
.student-workspace-summary .student-balance-card strong { color: var(--primary-dark); font-size: 28px; }
.attendance-counter-dot { display: inline-block; width: .65rem; height: .65rem; margin-right: .4rem; border-radius: 999px; background: var(--attendance-color, #6b7280); vertical-align: middle; }
.student-attendance-counters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.student-attendance-counters > div { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.student-attendance-counters span { color: var(--muted); font-size: 13px; font-weight: 700; }
.student-attendance-counters strong { font-size: 17px; }
.student-next-lesson { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 12px; padding: 16px; border: 1px solid #d9d1f2; border-radius: 16px; background: var(--surface-accent); }
.student-next-lesson > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--primary); background: white; }
.student-next-lesson > div { display: grid; gap: 4px; min-width: 0; }
.student-next-lesson small { color: var(--muted); }
.student-period-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.student-period-controls input { width: 150px; min-height: 40px; }
.student-schedule-list, .student-history-list, .student-workspace-list { display: grid; gap: 6px; }
.student-schedule-row { display: grid; grid-template-columns: 115px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.student-schedule-row time, .student-schedule-row > div, .student-history-row > div { display: grid; gap: 4px; min-width: 0; }
.student-schedule-row small, .student-history-row small { color: var(--muted); overflow-wrap: anywhere; }
.student-history-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.student-history-row:last-child { border-bottom: 0; }
.client-group-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.client-group-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.client-group-card > div { display: grid; gap: 4px; min-width: 0; }
.client-group-card strong, .client-group-card small { overflow-wrap: anywhere; }
.client-group-card small { color: var(--muted); }
.client-page-content .client-profile-grid { margin: 0; }
.client-page-content .student-discount-panel { margin: 0; }
.client-page-content .client-detail-actions { align-items: stretch; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 28px rgba(46, 26, 120, .07); }
.client-page-content .client-detail-actions > button,
.client-page-content .client-detail-actions > a { min-height: 44px; }
.student-lifecycle-control { padding: 16px; border: 1px solid #d9d1f2; border-radius: 16px; background: var(--surface-accent); }
.student-lifecycle-control > span { color: var(--primary-dark); }
.student-lifecycle-control small { line-height: 1.45; }
.document-summary { border-radius: 14px; }
.document-content { padding: 22px; border-color: var(--line); border-radius: 16px; }

.mark-composer {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  flex: 0 0 68px;
  width: auto;
  margin: 0 78px 20px 48px;
  height: 68px;
  grid-template-columns: 48px 1fr 52px;
  gap: 10px;
  padding: 8px 9px;
  border-color: #d8d2ef;
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(46, 26, 120, .11);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(16px);
}
.report-issue-button { right: 18px; bottom: 20px; }
.mark-composer:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 5px rgba(141, 130, 216, .1), 0 18px 42px rgba(46, 26, 120, .12); }
.mark-composer input { font-size: 15px; }
.mark-avatar { border-radius: 14px; color: var(--primary); background: var(--primary-soft); }
.send-button { border-radius: 14px; background: var(--primary); }
.send-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.mark-chat-panel { border-radius: 24px; }
.mark-history { gap: 16px; padding: 28px; }
.mark-bubble { padding: 18px 20px; border-color: var(--line); border-radius: 18px; line-height: 1.65; }
.mark-bubble.user { border-color: var(--primary); background: var(--primary); border-radius: 18px 18px 6px 18px; }
.mark-bubble.assistant { background: var(--canvas); border-radius: 18px 18px 18px 6px; }

.toast { right: 32px; bottom: 104px; border-radius: 14px; }
.create-dialog, .detail-dialog, .security-dialog {
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border-radius: 28px;
  box-shadow: 0 34px 100px rgba(24, 24, 27, .2);
}
.create-dialog form, .create-dialog .dialog-shell {
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
body:has(dialog[open]) { overflow: hidden; }
.create-dialog::backdrop, .detail-dialog::backdrop { background: rgba(24, 24, 27, .38); backdrop-filter: blur(5px); }
.create-dialog form, .create-dialog .dialog-shell { padding: 30px; }
.create-dialog header h2,
.detail-dialog .detail-header h2,
.security-dialog h2 { font-size: 24px; line-height: 1.25; letter-spacing: 0; overflow-wrap: anywhere; }
.create-dialog input, .create-dialog select, .create-dialog textarea {
  padding: 13px 15px;
  border-color: var(--line);
  border-radius: 14px;
}
.create-dialog input:focus, .create-dialog select:focus, .create-dialog textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(141, 130, 216, .1); }
.detail-dialog > article { border-radius: 28px; }
.detail-dialog { overflow-x: hidden; overflow-y: auto; }
.detail-header { padding: 24px 28px; }
.detail-content { padding: 28px; }
.account-summary-panel { padding: 28px; }
.account-form, .settings-content { padding: 24px; }
.access-ready, .access-warning { border-radius: 14px; }

.empty-state.error-state {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  color: var(--ink);
  text-align: left;
}
.empty-state.error-state .empty-state-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #b63c48;
  background: #fff0f1;
}
.empty-state.error-state .empty-state-icon svg { width: 22px; height: 22px; }
.empty-state.error-state strong { display: block; font-size: 15px; line-height: 1.4; }
.empty-state.error-state p { max-width: 620px; margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.permission-group h3 { letter-spacing: 0; }
.permission-row strong { font-size: 14px; line-height: 1.4; }
.permission-row label { min-width: 168px; }
.group-color-chip { cursor: default; }

.insight-period { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.insight-period select { min-width: 128px; }
.insight-summary-panel { padding: 24px; margin-bottom: 22px; }
.insight-summary-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.insight-summary-heading h2 { margin: 7px 0 0; max-width: 900px; font-size: 21px; line-height: 1.45; letter-spacing: 0; }
.insight-source-status { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.source-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.source-chip.available { color: #217748; background: #eef9f2; border-color: #cfead9; }
.source-chip.unavailable { color: #a43b3b; background: #fff2f2; border-color: #f0cccc; }
.system-report-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 22px; margin-top: 22px; }
.insight-list { display: grid; gap: 12px; padding: 18px; }
.insight-card { display: grid; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.insight-card p, .insight-card small { margin: 0; line-height: 1.55; }
.insight-card small { color: var(--muted); }
.insight-card-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.anomaly-control-panel { margin-top: 22px; }
.baseline-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.baseline-details summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.baseline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.baseline-card { display: grid; gap: 5px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.baseline-card span, .baseline-card small, .forecast-evidence { color: var(--muted); }
.baseline-card.unavailable { background: var(--surface-muted); }
.forecast-evidence { font-size: .82rem; font-weight: 700; }
.forecast-card > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.forecast-card span { color: var(--brand); font-size: 22px; font-weight: 800; }
.insight-generated-at { color: var(--muted); font-size: 12px; margin: 16px 2px 0; }
.user-issues-panel { margin-top: 22px; }
.user-issues-heading { align-items: center; }
.user-issues-heading > div:first-child { display: grid; gap: 4px; }
.user-issue-controls { display: flex; align-items: center; gap: 10px; }
.user-issue-controls select, .user-issue-card select { min-height: 40px; padding: 8px 34px 8px 11px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.user-issue-list { display: grid; gap: 14px; padding: 18px; }
.user-issue-card { display: grid; gap: 13px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.user-issue-card > header, .user-issue-card > footer, .user-issue-card > header > div { display: flex; align-items: center; gap: 10px; }
.user-issue-card > header { justify-content: space-between; }
.user-issue-card time { color: var(--muted); font-size: 12px; }
.user-issue-reporter, .user-issue-location { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.user-issue-reporter svg, .user-issue-location svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--primary); }
.user-issue-description { margin: 0; padding: 16px; border-radius: 14px; background: var(--canvas); line-height: 1.6; }
.user-issue-analysis, .user-issue-evidence { border-top: 1px solid var(--line); }
.user-issue-analysis summary, .user-issue-evidence summary { display: flex; align-items: center; gap: 8px; width: fit-content; padding-top: 13px; color: var(--primary); cursor: pointer; font-size: 13px; font-weight: 800; }
.user-issue-analysis summary svg { width: 17px; height: 17px; }
.user-issue-analysis > div { display: grid; gap: 9px; margin-top: 12px; padding: 16px; border-radius: 14px; background: var(--primary-soft); }
.user-issue-analysis p, .user-issue-analysis ul, .user-issue-analysis ol, .user-issue-evidence ul { margin: 0; line-height: 1.55; }
.user-issue-analysis small, .user-issue-ai-state { color: var(--muted); }
.user-issue-card > footer { justify-content: space-between; }
.user-issue-card > footer label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.report-issue-button { position: fixed; z-index: 22; right: 32px; bottom: 100px; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid #d8d2ef; border-radius: 12px; color: var(--primary); box-shadow: 0 10px 24px rgba(46, 26, 120, .12); background: rgba(255,255,255,.97); cursor: pointer; backdrop-filter: blur(14px); }
.report-issue-button:hover { border-color: var(--primary-light); background: var(--primary-soft); transform: translateY(-1px); }
.report-issue-button svg { width: 17px; height: 17px; }
.report-issue-button::after { content: attr(data-tooltip); position: absolute; right: 0; bottom: calc(100% + 8px); padding: 7px 10px; border: 1px solid #ded9ef; border-radius: 8px; color: var(--ink); background: #fff; box-shadow: 0 8px 20px rgba(29, 18, 79, .12); font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateY(3px); pointer-events: none; transition: opacity .16s ease, transform .16s ease, visibility .16s ease; }
.report-export-panel { gap: 18px; }
.report-export-controls { display: grid; grid-template-columns: minmax(210px, 1.4fr) repeat(2, minmax(145px, .8fr)) auto auto auto; gap: 12px; align-items: end; }
.report-export-controls label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.report-export-controls select, .report-export-controls input { min-height: 42px; }
.report-export-result { min-width: 0; }
.report-export-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.report-export-heading h2 { margin: 3px 0 0; font-size: 20px; }
.report-export-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.report-export-metric { min-width: 130px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.report-export-metric span { display: block; color: var(--muted); font-size: 12px; }
.report-export-metric strong { display: block; margin-top: 4px; font-size: 18px; }
.report-export-notice { margin: 8px 0; color: var(--muted); font-size: 13px; }
.report-export-table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.report-export-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-export-table th, .report-export-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
.report-export-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: var(--surface-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.report-export-table tr:last-child td { border-bottom: 0; }

/* The usable workspace is narrower than the browser viewport because of the
   permanent sidebar. Keep export actions inside that workspace at every size. */
.report-export-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-export-controls label:first-child, .report-export-controls button { grid-column: 1 / -1; }
.report-export-controls button { width: 100%; justify-content: center; }
.finance-section-tabs { flex-wrap: wrap; overflow-x: visible; }
.finance-section-tab { flex: 1 1 150px; min-width: 0; }
.communication-template-list { display: grid; gap: 10px; }
.communication-template-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.communication-template-card > div:first-child { display: grid; gap: 7px; min-width: 0; }
.communication-template-card .status-pill { justify-self: start; }
.communication-template-card strong { font-size: 15px; }
.communication-template-card p { margin: 0; color: var(--muted); line-height: 1.5; white-space: pre-wrap; }
.communication-template-card small { color: var(--muted); }
.communication-template-card.archived { opacity: .68; }
.lead-stage-list { display: grid; gap: 10px; }
.lead-stage-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-left: 5px solid var(--lead-stage-color); border-radius: 13px; background: var(--surface-soft); }
.lead-stage-card.archived { opacity: .66; }
.lead-stage-order { display: grid; place-items: center; min-height: 36px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 13px; font-weight: 900; }
.lead-stage-copy { min-width: 0; display: grid; gap: 6px; }
.lead-stage-copy > span { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.lead-stage-copy > span > i { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 999px; background: var(--lead-stage-color); }
.lead-stage-copy strong { overflow-wrap: anywhere; }
.lead-stage-copy small { color: var(--muted); }
.report-issue-button:hover::after, .report-issue-button:focus-visible::after { opacity: 1; visibility: visible; transform: translateY(0); }
.issue-report-dialog { width: min(600px, calc(100% - 32px)); }
.issue-context-summary { display: flex; gap: 12px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--canvas); }
.issue-context-summary > span { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.issue-context-summary svg { width: 18px; height: 18px; }
.issue-context-summary div { display: grid; gap: 3px; }
.issue-context-summary p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.dialog-issue-button { position: relative; z-index: 3; margin-left: auto; flex: 0 0 auto; }
.dialog-issue-button svg { width: 16px; height: 16px; }
.dialog-issue-button::after { content: attr(data-tooltip); position: absolute; right: 0; top: calc(100% + 8px); padding: 7px 10px; border: 1px solid #ded9ef; border-radius: 8px; color: var(--ink); background: #fff; box-shadow: 0 8px 20px rgba(29, 18, 79, .12); font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; }
.dialog-issue-button:hover::after, .dialog-issue-button:focus-visible::after { opacity: 1; visibility: visible; }
.toast { bottom: 158px; }

.maintenance-banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 20px; color: #704707; border-bottom: 1px solid #efd28f; background: var(--amber-soft); font-size: 13px; font-weight: 700; text-align: center; }
.maintenance-banner.blocked { color: var(--red); border-color: #f2c8c8; background: var(--red-soft); }
.maintenance-banner svg { width: 18px; height: 18px; }
.support-session-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 12px 24px 0; padding: 12px 14px; border: 1px solid #d9cff6; border-radius: 18px; color: var(--primary); background: #f6f1ff; box-shadow: 0 10px 30px rgba(47,25,108,.08); }
.support-session-banner[hidden] { display: none; }
.support-session-banner > div { min-width: 0; display: flex; align-items: center; gap: 10px; }
.support-session-banner svg { width: 19px; height: 19px; flex: 0 0 auto; }
.support-session-banner span { display: grid; gap: 2px; min-width: 0; }
.support-session-banner small { color: var(--muted); }
.support-session-actions { flex: 0 0 auto; justify-content: flex-end; }
.support-parent-content { max-width: 1280px; }
.support-parent-readonly { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid #d9cff6; border-radius: 18px; color: var(--primary); background: #fbf8ff; }
.support-parent-readonly > div { min-width: 0; display: flex; align-items: flex-start; gap: 12px; }
.support-parent-readonly svg { width: 20px; height: 20px; flex: 0 0 auto; }
.support-parent-readonly span { display: grid; gap: 4px; }
.support-parent-readonly small { color: var(--muted); line-height: 1.45; }
.user-issue-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.maintenance-lock-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, .72fr) minmax(420px, 1fr); background: var(--canvas); }
.maintenance-lock-brand { display: grid; place-items: center; padding: 48px; border-right: 1px solid var(--line); background: #fff; }
.maintenance-lock-brand img { width: min(360px, 78%); height: auto; }
.maintenance-lock-content { display: grid; place-items: center; align-content: center; gap: 24px; padding: clamp(36px, 7vw, 110px); text-align: center; }
.maintenance-lock-content h1 { max-width: 760px; margin: 0; font-size: clamp(28px, 4vw, 52px); line-height: 1.18; overflow-wrap: anywhere; }
.maintenance-lock-icon { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; color: var(--primary); background: var(--primary-soft); }
.maintenance-lock-icon svg { width: 34px; height: 34px; }
.maintenance-settings-panel { grid-column: 1 / -1; }
.maintenance-form { gap: 20px; }
.maintenance-mode-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; border: 0; }
.maintenance-mode-selector legend { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
.maintenance-mode-selector label { position: relative; min-width: 0; cursor: pointer; }
.maintenance-mode-selector input { position: absolute; opacity: 0; pointer-events: none; }
.maintenance-mode-selector label > span { min-height: 116px; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-content: center; gap: 5px 10px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.maintenance-mode-selector svg { grid-row: 1 / span 2; width: 24px; height: 24px; color: var(--primary); }
.maintenance-mode-selector strong { align-self: end; }
.maintenance-mode-selector small { color: var(--muted); line-height: 1.4; }
.maintenance-mode-selector input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(61, 35, 139, .08); }
.maintenance-mode-selector input:focus-visible + span { outline: 3px solid rgba(61, 35, 139, .18); outline-offset: 2px; }
.maintenance-message-field { display: grid; gap: 8px; padding: 18px; border-radius: 16px; background: var(--surface-soft); }
.maintenance-message-field textarea { min-height: 104px; resize: vertical; }
.maintenance-message-field small { color: var(--muted); }
.mandatory-training-notice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; margin: 0 0 20px; padding: 16px 18px; border: 1px solid #d9d0f4; border-radius: 16px; color: var(--ink); background: #f8f5ff; text-align: left; cursor: pointer; }
.mandatory-training-notice:hover { border-color: var(--primary); background: #f2edff; }
.mandatory-training-notice > span:nth-child(2) { display: grid; gap: 4px; }
.mandatory-training-notice small { color: var(--muted); font-size: 13px; }
.mandatory-training-notice > svg { width: 20px; color: var(--primary); }
.mandatory-training-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: var(--primary); }
.mandatory-training-icon svg { width: 22px; height: 22px; }
.training-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 22px; }
.training-list { display: grid; gap: 14px; padding: 18px; }
.training-card { position: relative; display: grid; gap: 14px; min-width: 0; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.training-card.completed { background: #f7fbf8; border-color: #cfe8d7; }
.training-card-visual { position: absolute; right: 22px; bottom: 16px; color: rgba(76, 43, 157, .07); pointer-events: none; }
.training-card-visual svg { width: 108px; height: 108px; stroke-width: 1.2; }
.training-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.training-card header > div { display: grid; gap: 9px; }
.training-card-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.training-card-labels > span:not(.status-pill) { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.training-card-labels svg { width: 15px; height: 15px; }
.training-card h3, .training-card p { margin: 0; }
.training-card p, .training-card header small { color: var(--muted); line-height: 1.55; }
.training-card details { border-top: 1px solid var(--line); }
.training-card summary { width: fit-content; margin-top: 12px; color: var(--primary); cursor: pointer; font-size: 13px; font-weight: 800; }
.training-content { margin-top: 14px; padding: 16px; border-radius: 12px; background: var(--canvas); line-height: 1.65; }
.training-card .primary-button { justify-self: start; }
.training-attachments { position: relative; display: grid; gap: 10px; margin-top: 14px; }
.training-attachments h4 { margin: 0 0 2px; font-size: 14px; }
.training-attachment { display: grid; gap: 8px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.training-attachment > img, .training-attachment > video { width: 100%; max-height: 360px; border-radius: 10px; object-fit: contain; background: #f3f1f8; }
.training-attachment > div { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.training-attachment a { display: grid; gap: 3px; min-width: 0; color: inherit; text-decoration: none; }
.training-attachment a strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.training-attachment a small { color: var(--muted); }
.training-existing-files { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; }
.training-existing-files > span { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; background: var(--canvas); }
.training-existing-files svg { width: 17px; height: 17px; }
.training-file-field small { color: var(--muted); font-weight: 500; }
.training-employee-progress { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.training-person-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.training-person-card > div { display: grid; gap: 6px; min-width: 0; }
.training-person-card small { color: var(--muted); line-height: 1.4; }
.training-person-card .progress { height: 5px; }
.role-choice { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; }
.role-choice legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.role-choice label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; }
.role-choice input { width: 17px; height: 17px; accent-color: var(--primary); }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; }
.switch-row span { display: grid; gap: 4px; }
.switch-row small { color: var(--muted); font-weight: 500; }
.switch-row input { width: 40px; height: 22px; accent-color: var(--primary); }
.notification-settings-panel { grid-column: 1 / -1; }
.notification-rule-settings { display: grid; gap: 24px; padding: 22px; }
.notification-rule-group { display: grid; gap: 12px; }
.notification-rule-group > h3 { margin: 0; color: var(--muted); font-size: 13px; text-transform: uppercase; }
.notification-rule-card { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.notification-rule-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.notification-rule-heading > div { display: grid; gap: 5px; }
.notification-rule-heading p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.45; }
.notification-toggle { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.notification-toggle input { width: 38px; height: 21px; accent-color: var(--primary); }
.notification-rule-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.notification-rule-controls.single { grid-template-columns: minmax(220px, 420px); }
.notification-rule-controls label { display: grid; grid-template-columns: minmax(0, 1fr) 86px auto; align-items: center; gap: 8px; padding: 11px 12px; border-radius: 12px; background: var(--canvas); }
.notification-rule-controls label > span { font-size: 12px; font-weight: 700; }
.notification-rule-controls input { min-width: 0; height: 38px; padding: 7px 9px; }
.notification-rule-controls small { color: var(--muted); }
.notification-recipients { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; }
.notification-recipients legend { padding: 0 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.notification-recipients label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.notification-recipients input { width: 17px; height: 17px; accent-color: var(--primary); }
.notification-fixed-recipient { margin: 0; padding: 11px 13px; border-radius: 12px; color: var(--muted); background: var(--canvas); font-size: 12px; }
.notification-rule-card footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.notification-rule-status { color: var(--muted); font-size: 12px; }
.va-settings-panel { grid-column: 1 / -1; }
.va-rule-settings { padding: 6px 22px 0; }
.va-rule-grid { display: grid; }
.va-rule-card { min-height: 86px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 132px 126px; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.va-rule-card:last-child { border-bottom: 0; }
.va-rule-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.va-rule-icon svg { width: 19px; height: 19px; }
.va-rule-copy { min-width: 0; display: grid; gap: 5px; }
.va-rule-card strong,
.va-rule-card p { min-width: 0; overflow-wrap: anywhere; }
.va-rule-card strong { font-size: 14px; line-height: 1.4; letter-spacing: 0; }
.va-rule-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; letter-spacing: 0; }
.va-amount-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.va-number-control { height: 42px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.va-number-control:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.va-rule-card .va-number-control input[type="number"] { width: 100%; height: 36px; padding: 0; border: 0; outline: 0; text-align: right; background: transparent; font-size: 14px; font-weight: 800; }
.va-number-control small { color: var(--muted); font-size: 11px; font-weight: 800; }
.va-rule-toggle { justify-content: space-between; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.attendance-status-settings-panel { grid-column: 1 / -1; }
.attendance-status-settings { display: grid; padding: 6px 22px 0; }
.attendance-status-rule { position: relative; display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.attendance-status-rule:last-child { border-bottom: 0; }
.attendance-status-rule.archived { opacity: .66; }
.attendance-status-rule.archived .attendance-status-color { filter: grayscale(1); }
.attendance-status-color { border-radius: 7px; background: var(--attendance-status-color, var(--primary)); }
.attendance-status-main { min-width: 0; }
.attendance-status-main > .panel-actions { justify-content: flex-end; }
.staff-payroll-rules, .staff-payroll-shifts { display: grid; gap: 16px; }
.staff-payroll-total { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid #ded8f2; border-radius: 16px; background: var(--primary-soft); }
.staff-payroll-total strong { font-size: 20px; color: var(--primary); }
.staff-payroll-card { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 5px 18px rgba(46, 26, 120, .035); }
.staff-payroll-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.staff-payroll-card > header > div { min-width: 0; display: grid; gap: 4px; }
.staff-payroll-card > header small, .staff-shift-row small { color: var(--muted); }
.staff-payroll-card > header > b { display: grid; justify-items: end; gap: 2px; color: var(--primary); white-space: nowrap; font-size: 20px; }
.staff-payroll-card > header > b small { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.staff-payroll-fields { display: grid; grid-template-columns: minmax(220px, 1.35fr) minmax(130px, .65fr) minmax(170px, .8fr) minmax(190px, auto); align-items: end; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.staff-payroll-fields label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.staff-payroll-fields label > small { min-height: 30px; font-size: 10px; font-weight: 600; line-height: 1.4; }
.staff-payroll-fields input,
.staff-payroll-fields select { width: 100%; min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; outline: 0; color: var(--ink); background: var(--surface); }
.staff-payroll-fields input:focus,
.staff-payroll-fields select:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(141, 130, 216, .1); }
.staff-payroll-fields select:disabled { color: var(--muted); background: var(--canvas); opacity: 1; }
.staff-payroll-fields button { min-width: 0; min-height: 46px; justify-content: center; white-space: normal; line-height: 1.25; }
.staff-shift-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.staff-shift-row > div { display: grid; gap: 4px; }
.bank-statement-heading { margin-top: 22px; }
.bank-operation-list { display: grid; gap: 8px; }
.bank-operation-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.bank-operation-direction { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.bank-operation-row.income .bank-operation-direction { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.bank-operation-row.neutral .bank-operation-direction { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.bank-operation-main { min-width: 0; display: grid; gap: 3px; }
.bank-operation-main span, .bank-operation-main small { color: var(--muted); overflow-wrap: anywhere; }
.bank-operation-main small { font-size: 11px; }
.bank-operation-row > b { white-space: nowrap; color: var(--danger); }
.bank-operation-row.income > b { color: var(--success); }
.bank-operation-row.neutral > b { color: var(--text); }
.attendance-status-fields { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(190px, 1fr) 92px; gap: 12px; }
.attendance-status-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.attendance-status-fields input,
.attendance-status-fields select { width: 100%; height: 42px; }
.attendance-color-field input[type="color"] { padding: 4px; }
.attendance-status-switches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.attendance-status-switches .switch-row.compact { min-height: 64px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); }
.attendance-status-switches .switch-row.compact strong { font-size: 12px; }
.attendance-status-switches .switch-row.compact small { font-size: 10px; line-height: 1.35; }
.attendance-status-outcome { margin: 10px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.public-site-settings-panel { grid-column: 1 / -1; }
.public-site-settings-panel .panel-header { align-items: center; gap: 16px; }
.public-site-settings-panel .panel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.public-group-settings { padding: 24px 22px; }
.public-group-settings-table { display: grid; gap: 14px; }
.public-group-settings-head,
.public-group-settings-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 110px 110px 110px 160px 170px minmax(140px, .9fr);
  gap: 12px;
  align-items: center;
}
.public-group-settings-head { padding: 0 12px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.public-group-settings-row { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.public-group-settings-row > div,
.public-group-settings-row label { min-width: 0; display: grid; gap: 4px; }
.public-group-settings-row strong,
.public-group-settings-row span,
.public-group-settings-row small { min-width: 0; overflow-wrap: anywhere; }
.public-group-settings-row small { color: var(--muted); font-size: 11px; }
.public-group-settings-row label > span { display: none; }
.public-group-settings-row label small { line-height: 1.3; }
.public-group-settings-row input,
.public-group-settings-row select { width: 100%; min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: var(--surface); }
.public-group-settings-row input:focus,
.public-group-settings-row select:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(141, 130, 216, .1); }
.settings-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.settings-card-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 18px 22px 22px; border-top: 1px solid var(--line); }
.settings-card-footer .primary-button { min-width: 170px; }
#broadcast-preview p { max-height: 120px; overflow: auto; color: var(--muted); line-height: 1.5; }

.compact-field { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.compact-field select { min-width: 94px; height: 42px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.event-summary { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.event-summary > span { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--surface); font-size: 13px; }
.event-summary svg { width: 17px; height: 17px; color: var(--primary); }
.event-summary strong { color: var(--ink); font-size: 16px; }
.event-list { display: grid; padding: 10px; }
.event-row { display: grid; grid-template-columns: 94px minmax(0, 1fr) auto; align-items: center; gap: 20px; width: 100%; padding: 18px; border: 0; border-radius: 16px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.event-row:hover { background: var(--primary-soft); }
.event-row > time { display: grid; gap: 3px; padding: 11px; border-radius: 12px; color: var(--primary); background: #fff; text-align: center; }
.event-row > time strong { font-size: 17px; }
.event-row > time small, .event-row-copy small, .event-row-copy span, .event-row-meta small { color: var(--muted); }
.event-row-copy { display: grid; gap: 4px; min-width: 0; }
.event-row-copy strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.event-row-meta { display: grid; justify-items: end; gap: 7px; }
.event-dialog { width: min(820px, calc(100% - 28px)); }
.event-dialog form { max-height: min(88vh, 900px); overflow-y: auto; overscroll-behavior: contain; }
.event-dialog select[multiple] { min-height: 124px; padding: 8px; }
.event-dialog select[multiple] option { padding: 8px; border-radius: 8px; }
.event-dialog label small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 500; }
.event-detail-dialog { width: min(840px, calc(100% - 28px)); }
.event-detail-dialog > article { max-height: 88vh; overflow-y: auto; padding: 28px; overscroll-behavior: contain; }
.event-detail-hero { display: grid; gap: 8px; padding: 22px; border-radius: 18px; background: var(--primary-soft); }
.event-detail-hero .status-pill { justify-self: start; }
.event-detail-hero > strong { font-size: 22px; }
.event-detail-hero > small { color: var(--muted); font-size: 14px; }
.event-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.event-detail-grid section { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.event-detail-grid small, .event-participant small { color: var(--muted); }
.event-detail-section { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; }
.event-detail-section.highlighted { border-color: #d8cff5; background: var(--primary-soft); }
.event-detail-section h3, .event-detail-section p { margin: 0; }
.event-detail-section p { margin-top: 9px; color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.event-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.event-chip-list span { padding: 8px 11px; border-radius: 999px; background: var(--canvas); font-size: 12px; font-weight: 700; }
.event-participants { display: grid; gap: 8px; margin-top: 12px; }
.event-participant { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--canvas); }
.event-participant > span:first-child { display: grid; gap: 3px; }
.event-response-actions { display: flex; gap: 5px; }
.event-detail-footer { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.event-participants-dialog { width: min(1180px, calc(100% - 28px)); }
.event-participants-dialog > article { max-height: 90vh; overflow-y: auto; padding: 28px; overscroll-behavior: contain; }
.event-participants-dialog header, .event-participants-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.event-participants-dialog footer { justify-content: flex-end; margin-top: 18px; }
.event-manifest-summary { display: grid; gap: 6px; margin: 14px 0; padding: 18px; border-radius: 16px; background: var(--primary-soft); }
.event-manifest-summary span { color: var(--muted); }
.event-manifest-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.event-manifest-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.event-manifest-table th, .event-manifest-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.event-manifest-table th { color: var(--muted); font-size: 12px; background: var(--canvas); }
.notification-detail .primary-button { margin-top: 16px; }
.parent-certificates-panel { margin-top: 18px; }
.parent-certificate-list { display: grid; gap: 10px; padding: 0 22px 22px; }
.parent-certificate-card { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.parent-certificate-card > div:nth-child(2) { display: grid; gap: 5px; }
.parent-certificate-card small { color: var(--muted); overflow-wrap: anywhere; }
.parent-certificate-preview { width: 86px; aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.parent-certificate-preview a { width: 100%; height: 100%; display: grid; place-items: center; }
.parent-certificate-preview img { width: 100%; height: 100%; object-fit: cover; }
.parent-certificate-preview svg { width: 28px; height: 28px; }
@media print {
  body > *:not(#event-participants-dialog) { display: none !important; }
  #event-participants-dialog { position: static; display: block; width: 100%; max-width: none; max-height: none; border: 0; }
  #event-participants-dialog > article { max-height: none; overflow: visible; padding: 0; }
  #event-participants-dialog header button, #event-participants-dialog footer { display: none !important; }
}

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 252px minmax(0, 1fr); }
  .sidebar { width: 252px; }
  .sidebar-brand { height: 154px; }
  .sidebar-logo { width: 175px; max-height: 124px; }
  .mark-composer { left: 282px; right: 30px; }
  .main-scroll { padding-inline: 32px; }
  .topbar { padding-inline: 32px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
  .report-export-controls { grid-template-columns: 1fr 1fr; }
  .report-export-controls label:first-child, .report-export-controls button { grid-column: 1 / -1; }
  .report-export-controls button { width: 100%; justify-content: center; }
  .finance-section-tab { flex: 0 0 auto; }
}

@media (max-width: 1180px) {
  .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
  .dashboard-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .system-report-grid { grid-template-columns: 1fr; }
  .training-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .report-export-controls { grid-template-columns: 1fr 1fr; }
  .report-export-controls label:first-child, .report-export-controls button { grid-column: 1 / -1; }
  .report-export-controls button { width: 100%; justify-content: center; }
  .report-export-heading { align-items: flex-start; flex-direction: column; }
  .report-export-summary { display: grid; grid-template-columns: 1fr 1fr; }
  .report-export-metric { min-width: 0; }
  .communication-template-card { flex-direction: column; }
  .communication-template-card .panel-actions { width: 100%; }
  .communication-template-card .panel-actions button { flex: 1; }
  .lead-stage-card { grid-template-columns: 42px minmax(0, 1fr); align-items: start; padding: 13px; }
  .lead-stage-card .panel-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .lead-stage-card .panel-actions button { width: 100%; justify-content: center; }
  .staff-payroll-card > header { align-items: flex-start; }
  .staff-payroll-fields { grid-template-columns: 1fr 1fr; }
  .staff-payroll-fields > :first-child, .staff-payroll-fields > button { grid-column: 1 / -1; }
  .finance-payroll-review .inline-actions { grid-template-columns: 1fr; }
  .bank-operation-row { grid-template-columns: 36px minmax(0, 1fr); }
  .bank-operation-row > b { grid-column: 2; justify-self: start; }
  .maintenance-lock-screen { grid-template-columns: 1fr; }
  .maintenance-lock-brand { min-height: 210px; padding: 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .maintenance-lock-brand img { width: min(260px, 72%); }
  .maintenance-lock-content { padding: 42px 24px; }
  .maintenance-lock-content h1 { font-size: 30px; }
  .maintenance-mode-selector { grid-template-columns: 1fr; }
  .maintenance-mode-selector label > span { min-height: 92px; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-brand { min-height: 220px; padding: 28px; border: 0; border-bottom: 1px solid var(--line); }
  .auth-logo { width: 240px; max-height: 150px; }
  .auth-brand p { display: none; }
  .auth-panel { width: calc(100% - 40px); padding: 42px 0; }
  .sidebar { width: min(292px, 88vw); }
  .sidebar-brand { height: 148px; }
  .sidebar-logo { width: 170px; }
  .topbar { height: 76px; padding: 10px 16px; }
  .main-scroll { padding: 24px 16px 108px; }
  .page-heading { min-height: 0; margin-bottom: 22px; }
  .page-heading h1 { font-size: 28px; }
  .metric-grid { display: grid; grid-template-columns: 1fr; overflow: visible; margin-inline: 0; padding: 0; }
  .metric-card { min-width: 0; min-height: 154px; }
  .dashboard-layout, .dashboard-lower, .dashboard-secondary { grid-template-columns: 1fr; }
  .panel-header { padding-inline: 20px; }
  .mark-composer { left: 14px; right: 14px; bottom: 12px; height: 62px; }
  .workspace::after { width: 260px; height: 188px; right: -64px; }
  .plan-catalog { padding: 16px; }
  .discount-proof-facts { grid-template-columns: 1fr; }
  .discount-proof-row { grid-template-columns: 1fr; gap: 5px; }
  .discount-proof-row .status-pill { justify-self: start; }
  .client-detail-page-header { align-items: stretch; flex-direction: column; gap: 14px; }
  .client-detail-page-header h1 { font-size: 27px; }
  .client-detail-page-header .secondary-button { align-self: flex-start; }
  .student-workspace-summary { grid-template-columns: 1fr 1fr; }
  .student-period-controls { width: 100%; justify-content: stretch; }
  .student-period-controls input { flex: 1 1 140px; width: auto; min-width: 0; }
  .student-period-controls button { flex: 1 1 100%; justify-content: center; }
  .student-schedule-row { grid-template-columns: 90px minmax(0, 1fr); gap: 10px 12px; }
  .student-schedule-row > .status-pill { grid-column: 2; justify-self: start; }
  .insight-summary-heading { flex-direction: column; }
  .report-issue-button { right: 16px; bottom: 84px; width: 40px; height: 40px; border-radius: 12px; }
  .toast { right: 16px; bottom: 142px; max-width: calc(100% - 32px); }
  .user-issues-heading, .user-issue-card > header, .user-issue-card > footer { align-items: stretch; flex-direction: column; }
  .user-issue-controls { align-items: stretch; justify-content: space-between; }
  .support-session-banner, .support-parent-readonly { align-items: stretch; flex-direction: column; margin-inline: 16px; }
  .support-session-actions { justify-content: stretch; flex-wrap: wrap; }
  .dialog-issue-button span { display: none; }
  .event-row { grid-template-columns: 70px minmax(0, 1fr); gap: 12px; padding: 13px; }
  .event-row-meta { grid-column: 2; justify-items: start; }
  .event-detail-grid { grid-template-columns: 1fr; }
  .event-participant { grid-template-columns: 1fr; }
  .notification-rule-heading { align-items: stretch; flex-direction: column; }
  .notification-toggle { justify-content: space-between; }
  .notification-rule-controls { grid-template-columns: 1fr; }
  .attendance-date-nav { width: 100%; grid-template-columns: 42px minmax(0, 1fr) 42px 42px; }
  .attendance-today-button { grid-column: 1 / -1; width: 100%; }
  .attendance-reload-button { grid-column: 4; grid-row: 1; }
  .va-rule-card { grid-template-columns: 38px minmax(0, 1fr); gap: 10px 12px; padding: 16px 0; }
  .va-rule-icon { grid-column: 1; grid-row: 1; }
  .va-rule-copy { grid-column: 2; grid-row: 1; }
  .va-amount-field,
  .va-rule-toggle { grid-column: 1 / -1; }
  .attendance-status-fields,
  .attendance-status-switches { grid-template-columns: 1fr; }
  .attendance-status-settings { padding-inline: 16px; }
  .attendance-status-rule { gap: 11px; }
  .settings-card-footer { justify-content: stretch; }
  .settings-card-footer .primary-button { width: 100%; }
  .public-site-settings-panel .panel-header { align-items: stretch; flex-direction: column; }
  .public-site-settings-panel .panel-actions { justify-content: stretch; }
  .public-site-settings-panel .panel-actions button { width: 100%; }
  .public-group-settings-head { display: none; }
  .public-group-settings-row { grid-template-columns: 1fr; gap: 12px; }
  .public-group-settings-row label > span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
  .parent-certificate-card { grid-template-columns: 68px minmax(0, 1fr); }
  .parent-certificate-preview { width: 68px; }
  .parent-certificate-card > .secondary-button, .parent-certificate-card > .status-pill { grid-column: 1 / -1; justify-self: stretch; }
  .lesson-attendance-dialog {
    width: calc(100vw - 20px);
    max-width: none;
    max-height: calc(100dvh - 20px);
  }
  .lesson-attendance-dialog form {
    max-height: calc(100dvh - 20px);
    padding: 22px 18px 18px;
  }
  .lesson-attendance-dialog header { align-items: flex-start; gap: 12px; }
  .lesson-attendance-dialog header > div { min-width: 0; }
  .lesson-attendance-dialog header h2 { font-size: 28px; line-height: 1.08; }
  .lesson-attendance-dialog .form-grid { grid-template-columns: 1fr; }
  .lesson-attendance-dialog footer {
    position: sticky;
    bottom: -18px;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px -18px -18px;
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .98);
  }
  .lesson-attendance-dialog footer button { width: 100%; min-width: 0; }
  #save-lesson-attendance { grid-column: 1 / -1; grid-row: 1; }
}

@media (max-width: 480px) {
  .auth-heading h1, .page-heading h1 { font-size: 27px; }
  .auth-logo { width: 210px; }
  .metric-card { padding: 22px; border-radius: 18px; }
  .metric-value { font-size: 34px; }
  .panel { border-radius: 18px; }
  .collection-toolbar { padding: 16px; }
  .mark-history { padding: 16px; }
  .mark-bubble { width: 96%; }
  .create-dialog form { padding: 22px; }
  .lesson-attendance-dialog form { padding: 18px 14px 14px; }
  .lesson-attendance-dialog header h2 { font-size: 26px; }
  .lesson-attendance-dialog footer {
    bottom: -14px;
    grid-template-columns: 1fr;
    margin: 18px -14px -14px;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  }
  #save-lesson-attendance { grid-column: 1; }
  .attendance-date-nav { grid-template-columns: 42px minmax(0, 1fr) 42px; }
  .attendance-date-field { grid-column: 2; grid-row: 1; }
  .attendance-date-step:first-child { grid-column: 1; grid-row: 1; }
  .attendance-date-field + .attendance-date-step { grid-column: 3; grid-row: 1; }
  .attendance-today-button { grid-column: 1 / 3; grid-row: 2; }
  .attendance-reload-button { grid-column: 3; grid-row: 2; }
  .detail-header, .detail-content { padding-inline: 18px; }
  .detail-actions { flex-wrap: wrap; }
  .detail-actions > button, .detail-actions > a { flex: 1 1 140px; justify-content: center; }
}

/* Keep operational screens inside a phone viewport. This block intentionally
   comes after the legacy responsive layers so all sections share one layout. */
@media (max-width: 820px) {
  .app-shell,
  .workspace,
  .main-scroll,
  .view,
  .page-heading,
  .page-heading > *,
  .panel,
  .panel-header,
  .portal-section-heading,
  .portal-section-heading > *,
  .collection-toolbar,
  .collection-toolbar > *,
  .heading-actions,
  .global-search,
  .top-actions { min-width: 0; max-width: 100%; }

  .workspace,
  .main-scroll { width: 100%; }
  .main-scroll { overflow-x: clip; }
  .topbar { width: 100%; }
  .global-search { flex: 1 1 auto; }
  .top-actions { flex: 0 0 auto; }

  .page-heading {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 16px;
  }
  .page-heading p {
    max-width: 68ch;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }
  .heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  .heading-actions > button,
  .heading-actions > a {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 12px;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .portal-section-heading {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }
  .portal-section-heading > div:first-child {
    min-width: 0;
    display: grid;
    gap: 5px;
  }
  .portal-section-heading strong,
  .portal-section-heading h2,
  .portal-section-heading h3,
  .portal-section-heading span {
    max-width: 100%;
    margin-top: 0;
    overflow-wrap: anywhere;
  }
  .portal-section-heading span {
    display: block;
    line-height: 1.5;
  }
  .portal-section-heading > button,
  .portal-section-heading > a {
    align-self: stretch;
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
  }

  .attendance-day-panel > .portal-section-heading { padding: 18px 18px 16px; }
  .attendance-day-panel > .portal-section-heading > div:first-child { gap: 7px; }
  .attendance-day-panel > .portal-section-heading > strong,
  .attendance-day-panel > .portal-section-heading > span { display: block; width: 100%; }
  .attendance-day-panel > .portal-section-heading > strong + span { margin-top: 7px; }
  .attendance-date-nav { min-width: 0; max-width: 100%; }
  .attendance-date-field { min-width: 0; }
  .attendance-date-field input { min-width: 0; }

  .collection-toolbar,
  .portal-toolbar,
  .attendance-toolbar {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .collection-toolbar label,
  .portal-toolbar label,
  .attendance-toolbar label,
  .client-toolbar label,
  .client-toolbar label:first-child,
  .attendance-toolbar label:first-child {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .collection-toolbar > button,
  .portal-toolbar > button,
  .attendance-toolbar > button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
  }

  .primary-button,
  .secondary-button,
  .text-button {
    max-width: 100%;
    line-height: 1.25;
  }
  .panel { overflow: hidden; }
  .collection-view { max-width: 100%; }

  .create-dialog,
  .detail-dialog,
  .security-dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    margin: auto;
  }
  .create-dialog form,
  .detail-dialog > article,
  .security-dialog > article {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .create-dialog form,
  .lesson-attendance-dialog form {
    overflow-x: clip;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .create-dialog header,
  .create-dialog footer {
    min-width: 0;
    max-width: 100%;
  }
  .create-dialog header > :first-child { min-width: 0; }
  .create-dialog header h2 { overflow-wrap: anywhere; }
  .create-dialog footer { flex-wrap: wrap; }
  .create-dialog footer > button {
    min-width: 0;
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .topbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    gap: 8px;
  }
  .top-actions,
  .profile-button { width: 44px; min-width: 44px; max-width: 44px; }
  .global-search { width: 100%; }
  .heading-actions { gap: 8px; }
  .heading-actions > button,
  .heading-actions > a { padding-inline: 8px; font-size: 13px; }
  .portal-section-heading { padding-inline: 18px; }
  .attendance-date-nav { gap: 7px; }
  .attendance-date-step,
  .attendance-reload-button { width: 42px; min-width: 42px; }
  .attendance-date-field { padding-inline: 8px; }
  .attendance-date-field input { font-size: 13px; }
  .lesson-attendance-dialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }
  .lesson-attendance-dialog form { max-height: calc(100dvh - 12px); }
  .lesson-attendance-dialog header h2 { font-size: 24px; line-height: 1.12; }
  .lesson-attendance-dialog footer button { min-height: 44px; }
  .lesson-attendance-dialog footer button span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .lesson-attendance-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }
  .lesson-attendance-row select { grid-column: 1 / -1; }
}

@media (max-width: 340px) {
  .heading-actions { grid-template-columns: minmax(0, 1fr); }
}

/* Final mobile guard for staff workspaces. Keep this at the end of the
   operational styles: older responsive blocks above are intentionally broad. */
@media (max-width: 820px) {
  html,
  body,
  #app,
  .app-shell,
  .workspace,
  .main-scroll,
  .view,
  .panel,
  .panel-header,
  .collection-toolbar,
  .portal-toolbar,
  .attendance-toolbar,
  .attendance-day-panel,
  .attendance-day-lessons,
  .attendance-day-grid {
    max-width: 100%;
    overflow-x: clip;
  }

  .workspace,
  .main-scroll,
  .view,
  .panel,
  .panel-header,
  .collection-toolbar,
  .portal-toolbar,
  .attendance-toolbar,
  .attendance-day-panel,
  .attendance-day-panel > .portal-section-heading,
  .attendance-date-nav,
  .lesson-attendance-dialog,
  .lesson-attendance-dialog form,
  .lesson-attendance-dialog footer {
    min-width: 0;
  }

  .create-dialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    margin: auto;
    overflow: hidden;
  }

  .create-dialog form {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  .student-phone-editor { padding: 13px; }
  .student-phone-editor-heading { align-items: stretch; flex-direction: column; }
  .student-phone-editor-heading button { width: 100%; }
  .student-phone-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .student-phone-row label { grid-column: 1; }
  .student-phone-row .icon-button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

  .create-dialog label,
  .create-dialog input,
  .create-dialog select,
  .create-dialog textarea,
  .create-dialog button {
    min-width: 0;
    max-width: 100%;
  }

  .create-dialog footer {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
  }

  .topbar {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    width: 100%;
    overflow: hidden;
  }

  .global-search input {
    min-width: 0;
    text-overflow: ellipsis;
  }

  .top-actions {
    min-width: 44px;
    max-width: 44px;
    overflow: hidden;
  }

  .profile-button {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding: 0;
    justify-content: center;
  }

  .main-scroll {
    padding-inline: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .attendance-day-panel > .portal-section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .attendance-day-panel > .portal-section-heading strong,
  .attendance-day-panel > .portal-section-heading span {
    display: block;
    width: 100%;
    max-width: 100%;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .attendance-date-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-auto-rows: minmax(44px, auto);
    gap: 8px;
  }

  .attendance-date-step,
  .attendance-reload-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }

  .attendance-date-field {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: auto;
    min-height: 54px;
  }

  .attendance-date-field input {
    width: 100%;
    min-width: 0;
    font-size: 14px;
  }

  .attendance-today-button {
    grid-column: 1 / 3;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
  }

  .attendance-reload-button {
    grid-column: 3;
    grid-row: 2;
  }

  .attendance-lesson-card {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .attendance-lesson-card strong,
  .attendance-lesson-card small {
    white-space: normal;
  }

  .attendance-lesson-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .attendance-lesson-actions .secondary-button,
  .attendance-lesson-actions .primary-button,
  .attendance-lesson-actions button:not(.icon-button) {
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding-inline: 10px;
    white-space: normal;
  }

  .attendance-lesson-actions .icon-button {
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

  .lesson-attendance-dialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 22px;
  }

  .lesson-attendance-dialog form {
    width: 100%;
    max-height: calc(100dvh - 12px);
    padding: 18px 14px 0;
    overflow-x: clip;
    overflow-y: auto;
  }

  .lesson-attendance-dialog header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: start;
    gap: 10px;
  }

  .lesson-attendance-dialog header h2 {
    max-width: 100%;
    font-size: clamp(24px, 8vw, 30px);
    line-height: 1.12;
  }

  .lesson-attendance-dialog .dialog-issue-button {
    display: none;
  }

  .lesson-attendance-dialog .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .lesson-attendance-roster {
    min-height: 130px;
  }

  .lesson-attendance-row {
    width: 100%;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .lesson-attendance-row select {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .lesson-attendance-row > .icon-button { grid-column: 2; justify-self: end; }
  .lesson-attendance-heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    gap: 10px;
  }
  .lesson-attendance-heading-actions > .status-pill { justify-self: start; }
  .lesson-attendance-heading-actions > button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    white-space: normal;
  }

  .lesson-attendance-dialog footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 16px -14px 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -12px 24px rgba(24, 18, 54, .08);
  }

  .lesson-attendance-dialog footer button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
    justify-content: center;
    white-space: normal;
  }

  #save-lesson-attendance {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .mark-composer {
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
  }

  .report-issue-button {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .topbar {
    grid-template-columns: 38px minmax(0, 1fr) 40px;
    padding-inline: 10px;
  }

  .profile-button,
  .top-actions {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  .attendance-lesson-actions {
    grid-template-columns: 1fr;
  }

  .lesson-attendance-dialog footer {
    grid-template-columns: 1fr;
  }

  #save-lesson-attendance {
    grid-column: 1;
  }
}
.client-dashboard-mode > :not(#client-dashboard-content) { display: none !important; }
.client-dashboard { display: grid; gap: 24px; }
.client-dashboard,
.client-dashboard > *,
.parent-summary-grid > *,
.parent-dashboard-layout > * { min-width: 0; max-width: 100%; }
.client-dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.client-dashboard-heading h1 { margin: 4px 0; }
.client-dashboard-heading p { margin: 0; color: var(--muted, #747083); }
.parent-compact-summary { display: flex; justify-content: flex-end; gap: 10px; margin: -6px 0 18px; }
.parent-compact-summary > span { min-width: 132px; display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.parent-compact-summary small { color: var(--muted); font-size: 12px; }
.parent-compact-summary strong { font-size: 18px; }
.parent-discount-highlight { color: #4d299f; background: linear-gradient(135deg,#f4efff,#fff) !important; }
.parent-discount-highlight.premium { color: #fff; border-color: transparent; background: linear-gradient(135deg,#4d299f,#8b5ce7) !important; box-shadow: 0 10px 24px rgba(77,41,159,.2); }
.parent-discount-highlight.premium small { color: rgba(255,255,255,.78); }
.parent-cabinet-tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 6px; overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.parent-cabinet-tabs button { flex: 1 0 max-content; min-height: 44px; padding: 9px 18px; border: 0; border-radius: 13px; color: var(--muted); background: transparent; font-weight: 800; cursor: pointer; }
.parent-cabinet-tabs button[aria-selected="true"] { color: #fff; background: var(--primary); box-shadow: 0 6px 14px rgba(77,41,159,.2); }
.parent-cabinet-panel { display: grid; gap: 16px; min-width: 0; }
.parent-cabinet-panel[hidden] { display: none !important; }
.parent-cabinet-panel .parent-subscription-card { grid-column: auto; min-height: 260px; padding: 22px; overflow: hidden; }
.parent-active-subscription-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.parent-active-subscription-facts > span { min-width: 0; display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fcfbff; }
.parent-active-subscription-facts > span.wide { grid-column: 1 / -1; }
.parent-active-subscription-facts small { color: var(--muted); font-size: 12px; line-height: 1.25; }
.parent-active-subscription-facts strong { overflow-wrap: anywhere; font-size: 15px; line-height: 1.35; }
.parent-cabinet-panel[data-parent-cabinet-panel="home"] .parent-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.parent-cabinet-panel > .panel, .parent-cabinet-panel > article { margin-top: 0; }
.parent-ledger-panel { padding: 22px; }
.parent-payment-order-purchase { padding: 16px; border: 1px solid #ded7f3; border-radius: 16px; background: linear-gradient(135deg,#faf8ff,#fff); }
.parent-pending-link {
  min-height: min(620px, calc(100vh - 160px));
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: clamp(34px, 6vw, 72px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 20% 18%, rgba(83, 45, 170, .12), transparent 30%),
    linear-gradient(145deg, #fff 0%, #fbf9ff 58%, #f3efff 100%);
  text-align: center;
  box-shadow: 0 24px 60px rgba(45, 27, 89, .08);
}
.parent-pending-link-illustration {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  color: var(--primary);
  background: var(--primary-soft);
}
.parent-pending-link-illustration svg { width: 36px; height: 36px; }
.parent-pending-link h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.04;
}
.parent-pending-link p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.55;
}
.parent-pending-link small {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.5;
}
.parent-pending-link-steps {
  width: min(100%, 820px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.parent-pending-link-steps span {
  min-height: 92px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  color: var(--muted);
  font-weight: 750;
}
.parent-pending-link-steps strong {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
}
.child-switcher { min-width: min(320px, 100%); }
.child-switcher span { display: block; margin-bottom: 6px; color: var(--muted, #747083); font-size: 13px; }
.child-switcher select { width: 100%; }
.parent-summary-grid { display: grid; grid-template-columns: minmax(260px, 1.25fr) repeat(3, minmax(220px, 1fr)); gap: 16px; }
.parent-summary-grid .panel, .parent-dashboard-layout .panel { padding: 22px; }
.parent-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 8px; }
.parent-card-heading h2, .parent-next-card h2, .parent-balance-card h2 { margin: 0; font-size: 22px; }
.parent-summary-grid p { color: var(--muted, #747083); }
.parent-payment-panel { margin-top: 16px; padding: 22px; }
.payment-price-preview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.payment-price-preview span { min-width: 0; display: flex; justify-content: center; gap: 7px; align-items: baseline; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: #faf9ff; white-space: nowrap; }
.parent-payment-legal { margin: 20px 0 0; line-height: 1.5; }
.payment-unavailable-note { margin: 0; color: var(--muted); }
.parent-payment-history { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.parent-payment-history h3 { margin: 0 0 10px; font-size: 15px; }
.parent-payment-order { display: grid; grid-template-columns: minmax(0,1fr) repeat(3,auto); gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.parent-payment-order > span { display: grid; gap: 3px; }
.parent-payment-order small { color: var(--muted); }
.parent-payment-order-details { grid-column: 1/-1; padding: 0; }
.parent-payment-order-details summary { width: max-content; max-width: 100%; cursor: pointer; list-style: none; color: var(--primary); font-weight: 700; }
.parent-payment-order-details summary::-webkit-details-marker { display: none; }
.parent-payment-order-details summary:hover { text-decoration: underline; }
.parent-payment-order-details dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 12px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #faf9ff; }
.parent-payment-order-details dl > div { display: grid; gap: 3px; min-width: 0; }
.parent-payment-order-details dt { color: var(--muted); font-size: 12px; }
.parent-payment-order-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.parent-payment-order-details p { margin: 10px 0 0; color: var(--muted); }
.parent-va-card { display: grid; align-content: start; gap: 12px; }
.parent-va-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.parent-va-help { padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--primary-soft); font-size: 13px; line-height: 1.5; }
.parent-va-help p, .parent-va-help ul { margin: 7px 0; }
.parent-va-help ul { padding-left: 20px; }
.parent-va-balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.parent-va-balance h2 { margin: 0; font-size: 32px; }
.parent-va-balance span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; color: var(--primary); background: var(--primary-soft); }
.parent-va-balance svg { width: 24px; height: 24px; }
.parent-va-history { display: grid; gap: 9px; }
.parent-va-history > div { display: grid; gap: 3px; padding-top: 9px; border-top: 1px solid var(--line); }
.parent-va-history span { display: flex; justify-content: space-between; gap: 10px; }
.parent-va-history strong { color: var(--green); }
.parent-va-history p, .parent-va-history small { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.parent-subscription-history-panel { margin-top: 16px; padding: 22px; }
.parent-subscription-history { display: grid; gap: 10px; }
.parent-subscription-history-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.parent-subscription-history-card summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; cursor: pointer; list-style: none; }
.parent-subscription-history-card summary::-webkit-details-marker { display: none; }
.parent-subscription-history-card summary:hover { background: #f8f6fc; }
.parent-subscription-history-card summary > span:first-child { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.parent-subscription-history-card summary small { color: var(--muted); }
.parent-freezes-panel { margin-top: 16px; padding: 22px; }
.parent-freeze-list { display: grid; gap: 10px; }
.parent-freeze-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.parent-freeze-list > div > span { display: grid; gap: 4px; }
.parent-freeze-list small { color: var(--muted); }
.parent-subscription-details { display: grid; gap: 16px; padding: 18px; border-top: 1px solid var(--line); background: #fcfbfe; }
.parent-subscription-details dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 0; }
.parent-subscription-details dl > div { min-width: 0; display: grid; align-content: start; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.parent-subscription-details dt { color: var(--muted); font-size: 12px; }
.parent-subscription-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; line-height: 1.4; }
.parent-payment-explanation { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 14px; color: #675314; background: #fff7dd; }
.parent-payment-explanation svg { flex: 0 0 auto; width: 18px; }
.parent-payment-explanation p { margin: 0; line-height: 1.5; }
.payment-student-summary, .payment-order-total { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #faf9ff; }
.payment-student-summary span, .payment-order-total span, .payment-order-total small { color: var(--muted); }
.payment-order-total strong { font-size: 28px; }
.payment-tariff-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 18px 0; padding: 0; border: 0; }
.payment-tariff-grid legend { grid-column: 1/-1; margin-bottom: 4px; font-weight: 700; }
.payment-tariff-grid label { display: block; }
.payment-tariff-grid input { position: absolute; opacity: 0; pointer-events: none; }
.payment-tariff-grid label > span { display: grid; gap: 4px; min-height: 76px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; cursor: pointer; }
.payment-tariff-grid label > span small { color: var(--muted); }
.payment-tariff-grid input:checked + span { border-color: var(--primary); background: #f3efff; box-shadow: 0 0 0 3px rgba(75,39,170,.1); }
.parent-payment-dialog { width: min(600px,calc(100% - 24px)); }
.parent-payment-dialog footer {
  position: sticky;
  bottom: -30px;
  margin: 20px -30px -30px;
  padding: 16px 30px 30px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.86), #fff 42%);
  backdrop-filter: blur(10px);
  z-index: 2;
}
@media (max-width: 640px) {
  .parent-payment-order { grid-template-columns: minmax(0,1fr) auto; }
  .parent-payment-order .secondary-button,
  .parent-payment-order .danger-button { grid-column: 1/-1; }
  .parent-payment-order-details dl { grid-template-columns: 1fr; }
  .payment-tariff-grid { grid-template-columns: 1fr; }
  .parent-payment-fulfillment-row, .parent-payment-fulfillment-actions { grid-template-columns: 1fr; }
  .parent-payment-fulfillment-result { justify-items: start; text-align: left; }
  .parent-subscription-details dl { grid-template-columns: 1fr; }
}
.subscription-progress { height: 8px; overflow: hidden; border-radius: 999px; background: #ece9f5; }
.subscription-progress span { display: block; height: 100%; border-radius: inherit; background: #4d29a6; }
.parent-card-stats { display: flex; align-items: baseline; justify-content: flex-start; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.parent-card-stats strong { font-size: 28px; line-height: 1; }
.parent-card-stats span { color: var(--muted, #747083); }
.lesson-circles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.lesson-circle { width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 50%; font-weight: 800; cursor: help; }
.lesson-circle.present { color: #176c45; background: #e7f6ee; }
.lesson-circle.absent { color: #b12d2d; background: #fdecec; }
.lesson-circle.excused { color: #8b5a00; background: #fff3d8; }
.lesson-circle.sick { color: #2368a2; background: #e8f3fd; }
.lesson-circle.future { color: #8a8694; background: #fff; border-color: #cfcbd8; box-shadow: inset 0 0 0 1px #f0eef4; }
.lesson-circle.unknown { color: #777286; background: #f0eef4; border-color: #d9d5e2; }
.parent-dashboard-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.parent-notifications-panel { grid-column: 1 / -1; }
.parent-events-panel .secondary-button { width: fit-content; max-width: 100%; }
.parent-notifications-panel .panel-header { align-items: flex-start; }
.parent-upcoming-event { display: grid; width: 100%; gap: 6px; margin-bottom: 14px; padding: 16px; border: 1px solid #ddd8eb; border-radius: 12px; background: #faf9fd; text-align: left; cursor: pointer; }
.parent-upcoming-event:hover { background: #f3f0fa; }
.parent-upcoming-event small { color: var(--muted, #747083); }
.parent-attendance-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 10px; border-radius: 12px; }
.parent-attendance-row:hover { background: #f5f3fb; }
.parent-attendance-row time, .parent-attendance-row small { color: var(--muted, #747083); }
.parent-attendance-row span { display: grid; gap: 4px; min-width: 0; }
.status-pill.interactive { cursor: pointer; }
.status-pill.interactive:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.parent-profile-request { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); gap: 22px 28px; align-items: center; margin-bottom: 20px; padding: 24px 26px; overflow: hidden; border-color: #e8b74f; background: #fffaf0; }
.parent-profile-request > div { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.parent-profile-request > div > svg { width: 44px; height: 44px; padding: 10px; border-radius: 14px; color: #8b6100; background: #fff1c9; }
.parent-profile-request > div > div { min-width: 0; padding-top: 1px; }
.parent-profile-request strong { display: block; font-size: 20px; line-height: 1.25; }
.parent-profile-request strong, .parent-profile-request p { overflow-wrap: anywhere; }
.parent-profile-request p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.parent-profile-request form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; min-width: 0; }
.parent-profile-request input, .parent-profile-request .primary-button { min-height: 50px; }
.parent-profile-request input { min-width: 0; }
.parent-profile-request .primary-button { white-space: nowrap; }
.parent-profile-request .form-error { grid-column: 1 / -1; margin: 0; }
.vk-contact-button { color: #187c4b; border-color: #82cba5; }
.parent-child-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.parent-child-facts > span { min-width: 0; display: grid; gap: 5px; padding: 16px 18px; border-right: 1px solid var(--line); }
.parent-child-facts > span:last-child { border-right: 0; }
.parent-child-facts small { color: var(--muted); font-size: 12px; }
.parent-child-facts strong { overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; }
@media (max-width: 1280px) {
  .parent-summary-grid { grid-template-columns: 1fr 1fr; }
  .parent-subscription-card { grid-column: 1 / -1; }
  .parent-child-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .parent-child-facts > span:nth-child(2) { border-right: 0; }
  .parent-child-facts > span:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .parent-profile-request { grid-template-columns: 1fr; }
  .parent-profile-request form { width: 100%; }
  .parent-profile-request input { min-width: 0; }
  .payment-price-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .client-dashboard-heading, .parent-card-heading { align-items: stretch; flex-direction: column; }
  .parent-summary-grid, .parent-dashboard-layout { grid-template-columns: 1fr; }
  .parent-subscription-card { grid-column: auto; }
  .parent-pending-link { min-height: auto; }
  .parent-pending-link-steps { grid-template-columns: 1fr; }
  .parent-attendance-row { grid-template-columns: 86px minmax(0, 1fr); }
  .parent-attendance-row .status-pill { grid-column: 2; justify-self: start; }
  .parent-profile-request { grid-template-columns: 1fr; padding: 20px; }
  .parent-child-facts { grid-template-columns: 1fr; }
  .parent-child-facts > span { border-right: 0; border-bottom: 1px solid var(--line); }
  .parent-child-facts > span:last-child { border-bottom: 0; }
  .parent-compact-summary { justify-content: stretch; margin-top: 0; }
  .parent-compact-summary > span { flex: 1; min-width: 0; }
  .parent-cabinet-panel[data-parent-cabinet-panel="home"] .parent-summary-grid { grid-template-columns: 1fr; }
  .parent-profile-request > div { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; }
  .parent-profile-request > div > svg { width: 38px; height: 38px; padding: 9px; border-radius: 12px; }
  .parent-profile-request form { grid-template-columns: 1fr; }
  .parent-profile-request .form-error { grid-column: 1; }
  .parent-profile-request .primary-button { width: 100%; }
  .payment-price-preview { grid-template-columns: 1fr; }
  .payment-price-preview span { justify-content: flex-start; white-space: normal; }
}

/* Branded boot, public studio page and meaningful data loading states. */
html { scroll-behavior: smooth; }
body.is-booting { overflow: hidden; }
.app-boot-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #fbfbfd;
  opacity: 1;
  transition: opacity 240ms ease-out, visibility 240ms ease-out;
}
.app-boot-screen.is-leaving { opacity: 0; visibility: hidden; }
.app-boot-content { width: min(460px, 100%); display: grid; justify-items: center; text-align: center; }
.app-boot-logo { width: min(320px, 78vw); max-height: 220px; }
.app-boot-copy { display: grid; gap: 8px; margin-top: 22px; }
.app-boot-copy strong { font-size: clamp(24px, 4vw, 34px); line-height: 1.15; }
.app-boot-copy span { min-height: 24px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.app-boot-progress { width: min(280px, 70vw); height: 4px; overflow: hidden; margin-top: 24px; border-radius: 999px; background: #e8e4f1; }
.app-boot-progress span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--primary); animation: boot-progress 1.35s ease-in-out infinite; }
@keyframes boot-progress { 0% { transform: translateX(-110%); } 55%, 100% { transform: translateX(240%); } }

.public-site { min-height: 100vh; color: var(--ink); background: #fff; }
.public-header {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  height: 82px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  padding: 10px max(28px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}
.public-brand-link { display: block; width: 132px; }
.public-brand-link img { display: block; width: 100%; height: 62px; object-fit: contain; mix-blend-mode: multiply; }
.public-nav { display: flex; justify-content: center; gap: 34px; }
.public-nav a, .public-text-link, .public-footer a, .public-back-link { color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; }
.public-nav a:hover, .public-nav a.active, .public-text-link:hover, .public-footer a:hover, .public-back-link:hover { color: var(--primary); }
body.public-login-open .public-nav { visibility: hidden; pointer-events: none; }
.public-login-button { min-height: 44px; border-radius: 8px; text-decoration: none; }
.public-screen-shell { min-height: calc(100vh - 120px); padding-top: 82px; }
.public-screen { min-height: calc(100svh - 82px); }

.public-hero {
  position: relative;
  min-height: calc(100svh - 82px);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 76px max(32px, calc((100vw - 1240px) / 2)) 82px;
  color: #fff;
  background: #18132f;
}
.public-hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.public-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16, 10, 36, .88) 0%, rgba(16, 10, 36, .54) 52%, rgba(16, 10, 36, .08) 100%); }
.public-hero-copy { position: relative; z-index: 2; width: min(760px, 74%); }
.public-hero-copy .eyebrow { color: #e9ddff; }
.public-hero-copy h1 { margin: 0; font-size: clamp(46px, 6vw, 82px); line-height: 1.01; letter-spacing: 0; }
.public-hero-copy p { max-width: 650px; margin: 25px 0 0; color: rgba(255,255,255,.9); font-size: clamp(17px, 1.6vw, 23px); line-height: 1.55; }
.public-hero-actions { display: flex; align-items: center; gap: 26px; margin-top: 34px; }
.public-hero-actions .primary-button { min-height: 52px; border-radius: 8px; color: var(--primary-dark); background: #fff; text-decoration: none; }
.public-text-link { display: inline-flex; align-items: center; gap: 8px; }
.public-text-link svg { width: 17px; }
.public-hero-note { position: absolute; z-index: 2; right: max(32px, calc((100vw - 1240px) / 2)); bottom: 44px; display: flex; align-items: center; gap: 9px; color: #fff; font-size: 12px; font-weight: 800; }

.public-story-screen { padding: 76px max(32px, calc((100vw - 1240px) / 2)); background: #fff; }
.public-screen-heading { max-width: 830px; margin-bottom: 38px; }
.public-screen-heading h2, .public-access-copy h2, .public-contact-copy h2 { margin: 0; font-size: clamp(36px, 4.4vw, 62px); line-height: 1.06; }
.public-screen-heading p, .public-access-copy p, .public-contact-copy p { margin: 18px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.public-split-layout, .public-team-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr); gap: 44px; align-items: stretch; }
.public-split-layout > img, .public-team-layout > img { width: 100%; min-height: 520px; height: 100%; object-fit: cover; border-radius: 8px; }
.public-group-list { border-top: 1px solid var(--line); }
.public-group-list article { display: grid; grid-template-columns: 42px 1fr; gap: 16px; padding: 22px 4px; border-bottom: 1px solid var(--line); }
.public-group-list article > span { color: var(--primary); font-size: 12px; font-weight: 800; }
.public-group-list h3 { margin: 0 0 7px; font-size: 21px; }
.public-group-list p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.public-team-list { border-top: 1px solid var(--line); }
.public-team-list article { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 26px; min-height: 150px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.public-person-mark { width: 76px; height: 76px; display: grid; place-items: center; border: 1px solid var(--primary); border-radius: 50%; color: var(--primary); font-size: 18px; font-weight: 800; }
.public-team-list h3 { margin: 0 0 8px; font-size: 26px; }
.public-team-list p { margin: 0; color: var(--muted); }
.public-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.public-gallery figure { position: relative; min-height: 320px; overflow: hidden; margin: 0; border-radius: 8px; background: var(--canvas); }
.public-gallery figure.wide { grid-column: 1 / -1; min-height: 440px; }
.public-gallery img { width: 100%; height: 100%; object-fit: cover; }
.public-gallery figcaption { position: absolute; inset: auto 0 0; padding: 42px 22px 18px; color: #fff; background: linear-gradient(transparent, rgba(20,14,42,.82)); font-size: 14px; font-weight: 800; }
.public-contact-screen { display: grid; grid-template-columns: minmax(360px, .78fr) minmax(0, 1.22fr); gap: 54px; align-items: center; padding: 64px max(32px, calc((100vw - 1240px) / 2)); }
.public-contact-screen > img { width: 100%; height: min(670px, calc(100svh - 150px)); object-fit: cover; border-radius: 8px; }
.public-social-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.public-social-links a { min-height: 46px; display: inline-flex; align-items: center; gap: 9px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 800; }
.public-social-links a:hover { color: var(--primary); border-color: var(--primary); }

.public-access-section { grid-template-columns: minmax(0, 1fr) minmax(420px, 520px); gap: 80px; align-items: center; padding: 62px max(32px, calc((100vw - 1240px) / 2)); background: #f7f6fb; }
.public-access-section:not([hidden]) { display: grid; }
.public-access-copy { max-width: 590px; padding-top: 36px; }
.public-back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 42px; }
.public-back-link svg { width: 17px; }
.public-access-section .auth-panel { width: 100%; margin: 0; padding: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.public-access-section .auth-heading { margin-bottom: 28px; }
.public-access-section .auth-heading h1 { font-size: 32px; }
.public-access-section .primary-button { border-radius: 8px; }
.public-footer { min-height: 150px; display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 30px; padding: 24px max(32px, calc((100vw - 1240px) / 2)); border-top: 1px solid var(--line); }
.public-footer img { width: 150px; height: 90px; object-fit: contain; mix-blend-mode: multiply; }
.public-footer span { color: var(--muted); font-size: 13px; }
.public-footer a { display: inline-flex; align-items: center; gap: 8px; }
.public-footer > div { display: flex; gap: 18px; }
.public-footer svg { width: 17px; }

.loading-block.is-loading { overflow: hidden; isolation: isolate; }
.loading-block.is-loading::before {
  content: "";
  position: absolute;
  z-index: 4;
  top: calc(50% - 27px);
  left: calc(50% - 11px);
  width: 22px;
  height: 22px;
  border: 2px solid #d9d3e8;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading-spin .8s linear infinite;
}
.loading-block.is-loading::after {
  content: attr(data-loading-message);
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 22px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, .96);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  animation: none;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .public-header { grid-template-columns: 130px 1fr; height: 72px; padding-inline: 20px; }
  .public-brand-link { width: 112px; }
  .public-brand-link img { height: 52px; }
  .public-nav { position: fixed; z-index: 60; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; min-height: 58px; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); backdrop-filter: blur(14px); }
  .public-nav a { display: grid; place-items: center; padding: 8px 5px; font-size: 11px; text-align: center; }
  .public-login-button { justify-self: end; }
  .public-screen-shell { padding-top: 72px; }
  .public-screen { min-height: calc(100svh - 72px); }
  .public-hero { min-height: calc(100svh - 72px); padding: 54px 24px 82px; }
  .public-hero-image { object-position: 58% center; }
  .public-hero-shade { background: rgba(19,12,43,.62); }
  .public-hero-copy { width: 100%; }
  .public-hero-note { display: none; }
  .public-story-screen { padding: 58px 24px 92px; }
  .public-split-layout, .public-team-layout, .public-contact-screen { grid-template-columns: 1fr; }
  .public-split-layout > img, .public-team-layout > img { min-height: 390px; }
  .public-gallery figure.wide { min-height: 360px; }
  .public-contact-screen { align-content: center; padding: 52px 24px 92px; }
  .public-contact-screen > img { height: 420px; }
  .public-access-section { grid-template-columns: 1fr; gap: 46px; }
  .public-access-copy { padding-top: 0; }
  .public-footer { padding-bottom: 78px; }
}

@media (max-width: 560px) {
  .public-header { grid-template-columns: 108px 1fr; }
  .public-login-button { width: 44px; min-height: 44px; padding: 0; }
  .public-login-button span { display: none; }
  .public-hero { min-height: calc(100svh - 72px); padding-inline: 20px; }
  .public-hero-copy h1 { font-size: clamp(42px, 13vw, 58px); }
  .public-hero-copy p { font-size: 18px; }
  .public-hero-actions { align-items: flex-start; flex-direction: column; gap: 20px; }
  .public-story-screen { padding-inline: 20px; }
  .public-screen-heading h2, .public-contact-copy h2 { font-size: 38px; }
  .public-split-layout > img, .public-team-layout > img { min-height: 300px; }
  .public-team-list article { grid-template-columns: 68px minmax(0, 1fr); gap: 18px; }
  .public-person-mark { width: 60px; height: 60px; }
  .public-team-list h3 { font-size: 21px; }
  .public-gallery { grid-template-columns: 1fr; }
  .public-gallery figure, .public-gallery figure.wide { grid-column: auto; min-height: 280px; }
  .public-contact-screen { padding-inline: 20px; }
  .public-contact-screen > img { height: 320px; }
  .public-access-section { padding: 72px 14px; }
  .public-access-copy { padding-inline: 6px; }
  .public-access-section .auth-panel { padding: 26px 20px; }
  .public-footer { grid-template-columns: 110px 1fr; padding-inline: 20px; }
  .public-footer img { width: 112px; }
  .public-footer > span { display: none; }
  .public-footer > div { justify-content: flex-end; }
}

/* Public studio website */
.public-site { min-height: 100vh; color: #18142c; background: #fff; }
.public-site .public-header { position: fixed; z-index: 80; inset: 0 0 auto; display: grid; grid-template-columns: 156px minmax(0, 1fr) auto; align-items: center; gap: 32px; height: 86px; padding: 10px clamp(24px, 5vw, 76px); border-bottom: 1px solid rgba(52,32,111,.12); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
.public-site .public-brand-link { display: block; width: 138px; }
.public-site .public-brand-link img { display: block; width: 100%; height: 64px; object-fit: contain; }
.public-site .public-nav { position: static; display: flex; align-items: center; justify-content: center; gap: clamp(16px, 2.3vw, 38px); min-height: 0; border: 0; background: transparent; backdrop-filter: none; }
.public-site .public-nav a { display: inline-flex; padding: 10px 2px; color: #4f4a63; font-size: 14px; font-weight: 700; text-decoration: none; }
.public-site .public-nav a:hover { color: var(--primary); }
.public-site .public-login-button { min-height: 46px; }
.public-site .public-screen-shell { padding-top: 86px; }
.public-landing[hidden], .public-site #studio-login[hidden], .public-site #studio-legal[hidden] { display: none !important; }
.public-landing .public-section { width: 100%; padding: 100px max(28px, calc((100vw - 1200px) / 2)); scroll-margin-top: 86px; }
.public-landing .public-section:nth-of-type(even) { background: #f8f7fb; }
.public-landing .public-about-section { padding-top: 56px; }
.public-section-heading { max-width: 790px; margin-bottom: 44px; }
.public-section-heading h2, .public-trial-copy h2, .public-contact-copy h2 { margin: 8px 0 14px; font-size: clamp(34px, 4vw, 56px); line-height: 1.06; letter-spacing: 0; }
.public-section-heading > p, .public-trial-copy > p { color: #656074; font-size: 18px; line-height: 1.7; }
.public-hero { position: relative; display: flex; align-items: flex-end; min-height: min(820px, calc(100svh - 130px)); padding: 80px max(28px, calc((100vw - 1200px) / 2)) 72px; overflow: hidden; color: #fff; }
.public-hero-image, .public-hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.public-hero-image { object-fit: cover; object-position: center 42%; }
.public-hero-shade { background: linear-gradient(90deg, rgba(18,12,40,.88) 0%, rgba(18,12,40,.58) 48%, rgba(18,12,40,.08) 78%); }
.public-hero-copy { position: relative; z-index: 2; width: min(760px, 72%); }
.public-hero-copy .eyebrow { color: #ddd4ff; }
.public-hero-copy h1 { max-width: 750px; margin: 10px 0 20px; font-size: clamp(48px, 6.2vw, 88px); line-height: .98; letter-spacing: 0; }
.public-hero-copy p { max-width: 680px; margin: 0; font-size: clamp(18px, 2vw, 25px); line-height: 1.55; }
.public-hero-actions { display: flex; align-items: center; gap: 26px; margin-top: 34px; }
.public-text-link { color: #fff; font-weight: 800; text-decoration: none; }
.public-hero-note { position: absolute; z-index: 2; right: max(28px, calc((100vw - 1200px) / 2)); bottom: 76px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.public-hero-note svg { width: 20px; }
.public-about-grid, .public-classes-layout, .public-trial-section, .public-contact-section { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); gap: clamp(42px, 7vw, 94px); align-items: center; }
.public-reading-copy { font-size: 18px; line-height: 1.8; }
.public-reading-copy p { margin: 0 0 22px; }
.public-emphasis { padding-left: 20px; border-left: 4px solid var(--primary); font-weight: 700; }
.public-photo-composition { position: relative; min-height: 610px; }
.public-photo-composition img { position: absolute; object-fit: cover; border-radius: 8px; }
.public-photo-main { inset: 0 9% 9% 0; width: 91%; height: 91%; }
.public-photo-side { right: 0; bottom: 0; width: 44%; height: 44%; border: 8px solid #fff; }
.public-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.public-group-card { position: relative; display: flex; flex-direction: column; min-height: 410px; padding: 32px; border: 1px solid #dfdbea; border-radius: 8px; background: #fff; }
.public-group-number { display: none; }
.public-group-card h3 { margin: 0 0 12px; font-size: 30px; }
.public-group-card > p { margin: 0 0 24px; color: #656074; line-height: 1.65; }
.public-group-live { display: grid; gap: 8px; margin-top: auto; margin-bottom: 20px; min-height: 60px; }
.public-live-group, .public-schedule-list article { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border: 1px solid #e5e1ed; border-radius: 8px; background: #faf9fc; }
.public-live-group span, .public-schedule-list article span { display: grid; gap: 4px; min-width: 0; }
.public-live-group strong, .public-live-group small, .public-schedule-list strong, .public-schedule-list small { overflow-wrap: anywhere; }
.public-live-group small, .public-schedule-list small { color: #716b80; }
.public-place-status { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.public-place-status.available { color: #167244; background: #e8f6ee; }
.public-place-status.low { color: #986000; background: #fff3d6; }
.public-place-status.full { color: #a62f3b; background: #fdebed; }
.public-live-note { margin: 0; color: #716b80; font-size: 14px; line-height: 1.5; }
.public-group-action { align-self: flex-start; }
.public-class-photos { display: grid; grid-template-columns: 1.3fr .7fr; gap: 12px; height: 610px; }
.public-class-photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.public-principles > p { margin: 0 0 30px; color: #5f596d; font-size: 18px; line-height: 1.75; }
.public-principles article { display: grid; grid-template-columns: 40px 1fr; gap: 16px; padding: 22px 0; border-top: 1px solid #ded9e8; }
.public-principles article svg { color: var(--primary); }
.public-principles h3, .public-principles p { margin: 0; }
.public-principles article p { margin-top: 7px; color: #6d677a; line-height: 1.55; }
.public-coach-grid { display: grid; gap: 22px; }
.public-coach { display: grid; grid-template-columns: minmax(250px, .65fr) minmax(0, 1.35fr); gap: clamp(30px, 5vw, 72px); align-items: center; padding: 34px; border: 1px solid #ded9e8; border-radius: 8px; background: #fff; }
.public-coach:nth-child(even) img { order: 2; }
.public-coach img { width: min(100%, 360px); height: 450px; justify-self: center; object-fit: cover; object-position: center top; border-radius: 8px; }
.public-coach span { color: var(--primary); font-weight: 800; }
.public-coach h3 { margin: 8px 0 18px; font-size: clamp(30px, 3vw, 43px); }
.public-coach p, .public-coach blockquote { color: #5f596d; line-height: 1.7; }
.public-coach blockquote { margin: 20px 0 0; padding-left: 18px; border-left: 3px solid var(--primary); font-weight: 700; }
.public-partnership-section { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(42px, 7vw, 90px); align-items: center; }
.public-partnership-section img { width: 100%; height: 560px; object-fit: cover; border-radius: 8px; }
.public-partnership-section .public-reading-copy h2 { margin: 8px 0 20px; font-size: clamp(34px, 4vw, 54px); }
.public-achievement-gallery { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 12px; }
.public-achievement-gallery figure { position: relative; min-height: 420px; margin: 0; overflow: hidden; border-radius: 8px; }
.public-achievement-gallery img { width: 100%; height: 100%; object-fit: cover; }
.public-achievement-gallery figcaption { position: absolute; inset: auto 0 0; padding: 42px 18px 18px; color: #fff; background: linear-gradient(transparent, rgba(16,12,31,.78)); font-weight: 800; }
.public-schedule-list { min-height: 110px; }
.public-schedule-week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.public-schedule-day { min-width: 150px; border: 1px solid #ded9e8; border-radius: 8px; background: #fff; overflow: hidden; }
.public-schedule-day header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid #ece8f3; background: #faf9fc; }
.public-schedule-day header strong { font-size: 18px; }
.public-schedule-day header span { color: #716b80; font-size: 12px; font-weight: 800; }
.public-schedule-day > div { display: grid; gap: 10px; padding: 12px; }
.public-schedule-day article { display: grid; gap: 5px; padding: 12px; border: 1px solid #e7e2ef; border-left: 4px solid var(--primary); border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(38,27,74,.07); }
.public-schedule-day time { color: var(--primary); font-size: 14px; font-weight: 900; }
.public-schedule-day article strong { font-size: 14px; line-height: 1.25; }
.public-schedule-day article small { color: #716b80; }
.public-schedule-day .public-place-status { justify-self: start; margin-top: 4px; }
.public-price-section { text-align: center; }
.public-price-section .public-section-heading { margin-inline: auto; }
.public-price-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 34px; border: 1px solid #ded9e8; border-radius: 8px; overflow: hidden; text-align: left; }
.public-price-list article { display: grid; gap: 16px; padding: 28px 22px; background: #fff; }
.public-price-list article + article { border-left: 1px solid #ded9e8; }
.public-price-list span { color: #6b6578; }
.public-price-list strong { font-size: 25px; }
.public-trial-section { background: #f1eef9 !important; }
.public-trial-copy > p:last-child { display: flex; align-items: center; gap: 9px; font-weight: 800; }
.public-trial-copy a { color: var(--primary); }
.public-trial-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 30px; border: 1px solid #dcd6e9; border-radius: 8px; background: #fff; }
.public-trial-form > label:not(.public-consent), .public-trial-form fieldset { display: grid; gap: 8px; }
.public-trial-form label > span, .public-trial-form legend { color: #514b61; font-size: 13px; font-weight: 800; }
.public-trial-form input:not([type="radio"]):not([type="checkbox"]), .public-trial-form select, .public-trial-form textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #cfc9dc; border-radius: 6px; background: #fff; font: inherit; }
.public-trial-form textarea { resize: vertical; }
.public-trial-form fieldset { grid-template-columns: 1fr 1fr; margin: 0; padding: 0; border: 0; }
.public-trial-form fieldset legend { grid-column: 1 / -1; margin-bottom: 8px; }
.public-trial-form fieldset label { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 12px; border: 1px solid #cfc9dc; border-radius: 6px; }
.public-form-wide { grid-column: 1 / -1; }
.public-consent { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.public-form-result { min-height: 22px; margin: 0; font-weight: 700; }
.public-form-result.success { color: #167244; }
.public-form-result.error { color: #b83243; }
.public-contact-copy > p { display: flex; align-items: center; gap: 10px; color: #625c70; font-size: 18px; }
.public-contact-section { grid-template-columns: minmax(0, 760px); justify-content: center; text-align: center; }
.public-contact-copy > p { justify-content: center; }
.public-contact-section > img { display: none; }
.public-social-links { display: flex; gap: 12px; margin: 26px 0; }
.public-social-links a { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 800; }
.public-site #studio-login { min-height: calc(100svh - 86px); padding: 72px max(24px, calc((100vw - 1050px) / 2)); }
.public-login-open .public-nav { visibility: hidden; }
.public-footer { grid-template-columns: 150px 1fr auto; gap: 30px; padding: 30px max(24px, calc((100vw - 1200px) / 2)); }
.public-footer img { width: 130px; }

@media (max-width: 980px) {
  .public-site .public-header { grid-template-columns: 130px minmax(0, 1fr) auto; height: 76px; padding-inline: 22px; }
  .public-site .public-brand-link { width: 116px; }
  .public-site .public-brand-link img { height: 54px; }
  .public-site .public-nav { gap: 12px; overflow-x: auto; justify-content: flex-start; }
  .public-site .public-nav a { font-size: 12px; white-space: nowrap; }
  .public-site .public-screen-shell { padding-top: 76px; }
  .public-landing .public-section { padding: 76px 24px; scroll-margin-top: 76px; }
  .public-hero { min-height: min(760px, calc(100svh - 110px)); padding: 64px 24px; }
  .public-about-grid, .public-classes-layout, .public-trial-section, .public-contact-section, .public-partnership-section { grid-template-columns: 1fr; }
  .public-photo-composition { min-height: 540px; }
  .public-class-photos { height: 500px; }
  .public-price-list { grid-template-columns: repeat(2, 1fr); }
  .public-price-list article + article { border-left: 0; border-top: 1px solid #ded9e8; }
  .public-price-list article:nth-child(even) { border-left: 1px solid #ded9e8; }
}

@media (max-width: 700px) {
  .public-site .public-header { grid-template-columns: 112px 1fr; height: 70px; padding-inline: 16px; }
  .public-site .public-brand-link { width: 104px; }
  .public-site .public-nav { display: none; }
  .public-site .public-login-button { justify-self: end; }
  .public-site .public-screen-shell { padding-top: 70px; }
  .public-landing .public-section { padding: 62px 18px; scroll-margin-top: 70px; }
  .public-hero { min-height: min(700px, calc(100svh - 100px)); padding: 54px 18px 46px; }
  .public-hero-shade { background: rgba(18,12,40,.67); }
  .public-hero-copy { width: 100%; }
  .public-hero-copy h1 { font-size: clamp(40px, 12vw, 58px); }
  .public-hero-actions { align-items: flex-start; flex-direction: column; }
  .public-hero-note { display: none; }
  .public-group-grid, .public-trial-form { grid-template-columns: 1fr; }
  .public-group-card { min-height: 0; padding: 24px; }
  .public-photo-composition { min-height: 420px; }
  .public-class-photos { grid-template-columns: 1fr; height: auto; }
  .public-class-photos img { height: 330px; }
  .public-coach { grid-template-columns: 1fr; padding: 22px; }
  .public-coach:nth-child(even) img { order: 0; }
  .public-coach img { width: 100%; height: auto; max-height: 520px; aspect-ratio: 4 / 5; }
  .public-partnership-section img { height: 390px; }
  .public-achievement-gallery { grid-template-columns: 1fr; }
  .public-achievement-gallery figure { min-height: 340px; }
  .public-price-list { grid-template-columns: 1fr; }
  .public-price-list article:nth-child(even) { border-left: 0; }
  .public-trial-form { padding: 22px 16px; }
  .public-form-wide { grid-column: auto; }
  .public-contact-section > img { height: 360px; }
  .public-site #studio-login { min-height: calc(100svh - 70px); padding: 42px 14px; }
  .public-footer { grid-template-columns: 105px 1fr; padding: 24px 18px 80px; }
  .public-footer img { width: 100px; }
  .public-footer > span { display: none; }
  .public-footer > div { justify-content: flex-end; }
}

/* Keep the assistant available without covering lists, forms or row actions. */
.workspace > .mark-composer {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  flex: 0 0 68px;
  width: auto;
  margin: 0 78px 20px 48px;
}
.report-issue-button { right: 18px; bottom: 20px; }

@media (max-width: 1280px) {
  .workspace > .mark-composer { left: auto; right: auto; margin-left: 32px; margin-right: 76px; }
}

@media (max-width: 820px) {
  .workspace > .mark-composer {
    left: auto;
    right: auto;
    bottom: auto;
    flex-basis: 62px;
    margin: 0 64px max(10px, env(safe-area-inset-bottom)) 10px;
  }
  .report-issue-button { right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); }
}

.public-legal-screen { padding: 62px max(24px, calc((100vw - 1120px) / 2)) 90px; background: #fff; }
.public-legal-screen:not([hidden]) { display: block; }
.public-legal-header { max-width: 880px; }
.public-legal-header .public-back-link { margin-bottom: 36px; }
.public-legal-header h1 { margin: 8px 0 0; font-size: clamp(36px, 4.5vw, 62px); line-height: 1.06; }
.public-legal-header > p { max-width: 720px; margin: 18px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

.auth-remember {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 11px !important;
  cursor: pointer;
  font-weight: 500 !important;
}
.auth-remember input { width: 19px; height: 19px; flex: 0 0 19px; margin: 2px 0 0; accent-color: var(--primary); }
.auth-remember > span { display: grid; gap: 3px; }
.auth-remember strong { font-size: 14px; }
.auth-remember small { color: var(--muted); font-size: 12px; line-height: 1.4; }

/* Mobile workspace must stay inside the actually visible Safari/Chrome area. */
@media (max-width: 820px) {
  .app-shell:not([hidden]) {
    height: 100svh;
    min-height: 100svh;
    max-height: 100svh;
    overflow: hidden;
  }

  .workspace {
    height: 100%;
    min-height: 0;
    max-height: 100svh;
    overflow: hidden;
  }

  .topbar {
    position: relative;
    top: auto;
    flex: 0 0 calc(68px + env(safe-area-inset-top));
    width: 100%;
    height: calc(68px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    overflow: visible;
  }

  .main-scroll { flex: 1 1 auto; min-height: 0; }

  .workspace > .mark-composer {
    flex: 0 0 auto;
    min-height: 62px;
    height: 62px;
    margin: 0 64px max(10px, env(safe-area-inset-bottom)) 10px;
    transform: none;
  }
}

@media (max-width: 480px) {
  .topbar { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .top-actions {
    display: flex;
    width: auto;
    min-width: 0;
    max-width: none;
    overflow: visible;
  }
  .top-actions > .icon-button { display: inline-grid; }
  .profile-button { width: 42px; min-width: 42px; max-width: 42px; }
  .global-search { min-width: 0; padding-inline: 9px; }
  .global-search input::placeholder { color: var(--muted); opacity: 1; }
  .workspace > .mark-composer {
    grid-template-columns: 42px minmax(0, 1fr) 46px;
    gap: 7px;
    margin-left: max(8px, env(safe-area-inset-left));
    margin-right: max(58px, calc(48px + env(safe-area-inset-right)));
  }
}
.public-legal-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 42px 0 54px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.public-legal-nav a { min-height: 42px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 800; }
.public-legal-nav a:hover, .public-legal-nav a.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.public-legal-documents { max-width: 860px; }
.public-legal-documents article[hidden] { display: none; }
.public-legal-documents h2 { margin: 10px 0 34px; font-size: clamp(30px, 3.8vw, 48px); line-height: 1.12; }
.public-legal-documents h3 { margin: 34px 0 10px; font-size: 20px; }
.public-legal-documents p, .public-legal-documents li { color: #585264; font-size: 15px; line-height: 1.75; }
.public-legal-documents ul { display: grid; gap: 7px; padding-left: 22px; }
.public-legal-documents a, .public-consent a, .parent-payment-legal a { color: var(--primary); font-weight: 800; }
.public-footer-links { flex-wrap: wrap; justify-content: flex-end; }
.parent-payment-legal { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.legal-document-text { white-space: pre-wrap; color: #585264; font-size: 15px; line-height: 1.75; }

.parent-legal-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100svh - 32px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(31, 20, 69, .24);
}
.parent-legal-dialog::backdrop { background: rgba(26, 20, 45, .64); backdrop-filter: blur(7px); }
.parent-legal-dialog form { display: grid; gap: 22px; max-height: min(860px, calc(100svh - 32px)); padding: 30px; overflow: auto; }
.parent-legal-dialog header h2 { margin: 6px 0 8px; font-size: clamp(26px, 4vw, 38px); }
.parent-legal-dialog header p { margin: 0; color: var(--muted); line-height: 1.55; }
.parent-legal-requirements { display: grid; gap: 12px; }
.parent-legal-requirement { display: grid; grid-template-columns: 24px 1fr; gap: 14px; align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #faf9ff; }
.parent-legal-requirement input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); }
.parent-legal-requirement span { display: grid; gap: 6px; }
.parent-legal-requirement strong { line-height: 1.45; }
.parent-legal-requirement small { color: var(--muted); line-height: 1.5; }
.parent-legal-requirement a { color: var(--primary); font-weight: 800; }
.parent-legal-dialog footer { position: sticky; bottom: -30px; display: flex; justify-content: space-between; gap: 12px; margin: 0 -30px -30px; padding: 18px 30px 30px; background: linear-gradient(180deg, rgba(255,255,255,.9), #fff 24%); }
body:has(#parent-legal-dialog[open]) .report-issue-button { visibility: hidden; }

.legal-acceptance-list { display: grid; }
.legal-acceptance-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(230px, 1.4fr) minmax(150px, .7fr) auto; gap: 18px; align-items: center; padding: 18px 4px; border-bottom: 1px solid var(--line); }
.legal-acceptance-row:last-child { border-bottom: 0; }
.legal-acceptance-row > div { display: grid; gap: 4px; min-width: 0; }
.legal-acceptance-row strong, .legal-acceptance-row small { overflow-wrap: anywhere; }
.legal-acceptance-row small { color: var(--muted); line-height: 1.35; }
.legal-evidence-dialog article { width: min(900px, calc(100vw - 32px)); max-height: min(900px, calc(100svh - 32px)); display: grid; grid-template-rows: auto auto minmax(180px, 1fr) auto; gap: 18px; padding: 28px; }
.legal-evidence-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.legal-evidence-meta span { display: grid; gap: 5px; padding: 12px 14px; border-radius: 14px; background: #f7f5fc; }
.legal-evidence-meta small { color: var(--muted); }
.legal-evidence-meta strong { overflow-wrap: anywhere; }
.legal-evidence-content { margin: 0; padding: 18px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fbfaff; color: var(--ink); white-space: pre-wrap; font: inherit; font-size: 13px; line-height: 1.6; }

@media (max-width: 700px) {
  .public-legal-screen { padding: 42px 18px 72px; }
  .public-legal-nav { display: grid; grid-template-columns: 1fr; margin: 30px 0 40px; }
  .public-legal-nav a { width: 100%; }
  .public-legal-documents h2 { margin-bottom: 26px; }
  .public-footer { grid-template-columns: 1fr; }
  .public-footer img { justify-self: start; }
  .public-footer-links { justify-content: flex-start !important; }
  .parent-legal-dialog { width: calc(100vw - 20px); max-height: calc(100svh - 20px); border-radius: 22px; }
  .parent-legal-dialog form { max-height: calc(100svh - 20px); padding: 22px 18px; }
  .parent-legal-dialog footer { bottom: -22px; display: grid; margin: 0 -18px -22px; padding: 16px 18px 22px; }
  .parent-legal-dialog footer .primary-button { grid-row: 1; }
  .legal-acceptance-row { grid-template-columns: 1fr; gap: 10px; }
  .legal-acceptance-row .secondary-button { width: 100%; justify-content: center; }
  .legal-evidence-dialog article { width: calc(100vw - 20px); max-height: calc(100svh - 20px); padding: 20px 16px; }
  .legal-evidence-meta { grid-template-columns: 1fr; }
}
