/* DRIVE CRM — layout on top of the dashboard design tokens (../styles.css). */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 12px; }
.bad-text { color: var(--bad-text); }
.warn-text { color: var(--warn); }
.dim { color: var(--muted); opacity: 0.6; }

.demo-ribbon {
  position: sticky; top: 0; z-index: 50; text-align: center; font-size: 12px; font-weight: 500; padding: 5px 12px;
  background: repeating-linear-gradient(135deg, rgba(var(--accent-rgb), 0.18) 0 10px, rgba(var(--accent-rgb), 0.1) 10px 20px);
  color: var(--text-2); border-bottom: 1px solid var(--border);
}

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 28px); }
.side {
  position: sticky; top: 28px; height: calc(100vh - 28px); display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 6px; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--text); }
.nav-ico { width: 20px; text-align: center; color: var(--accent-2); }
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--bad); color: #fff; }
.side-foot { margin-top: auto; padding: 0 6px; }
.side-link { color: var(--text-2); font-size: 13px; text-decoration: none; }
.side-link:hover { color: var(--text); }

.main-col { min-width: 0; }
.crm-top {
  position: sticky; top: 28px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 24px;
  background: var(--topbar); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.crm-top select, .crm-top input {
  height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; padding: 0 10px;
}
.search { position: relative; flex: 1; min-width: 180px; max-width: 420px; }
.search input { width: 100%; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; display: grid; gap: 2px;
}
.sr-row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.sr-row:hover { background: var(--surface-2); }
.sr-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.clock { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; white-space: nowrap; }

.view { padding: 24px 28px 120px; max-width: 1400px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.page-head p { margin-top: 4px; font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tab-switch { margin: 0 0 12px; }

/* stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-row.compact { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 4px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow);
  text-align: left; color: inherit; font: inherit; display: grid; gap: 3px;
}
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--border-strong); }
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-row.compact .stat-value { font-size: 16px; }
.stat-sub { font-size: 12px; color: var(--muted); }
.count-badge { display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); vertical-align: middle; }

/* today */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.today-queue > .card:first-child, .today-side > .card:first-child { margin-top: 0; }
.sig-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sig { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.sig-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sig.action.p0 .sig-dot { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.sig.action.p1 .sig-dot { background: var(--warn); }
.sig.action.p2 .sig-dot { background: var(--accent); }
.sig.data .sig-dot { background: var(--accent-2); }
.sig-title { font-weight: 600; font-size: 13.5px; }
.sig-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sig-meta strong { color: var(--text-2); font-weight: 600; }
.esc { color: var(--bad-text); }
.sig-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mini-lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ml { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ml:hover { border-color: var(--border-strong); }
.ml-time { font-weight: 650; font-variant-numeric: tabular-nums; }
.ml-body { display: grid; min-width: 0; }
.ml-body .muted { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.bad { color: var(--bad-text); background: var(--bad-soft); border-color: transparent; }
.pill.bad::before { background: var(--bad); }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.warn::before { background: var(--warn); }
.sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.src-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: grid; gap: 8px; min-height: 120px; transition: border-color 0.15s, background 0.15s; }
.kcol.drop { border-color: var(--accent); background: var(--accent-soft); }
.kcol-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 2px 4px 4px; }
.lost-col { opacity: 0.75; }
.lcard { display: grid; gap: 5px; text-align: left; padding: 10px 11px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: inherit; font: inherit; cursor: pointer; }
.lcard:hover { border-color: var(--border-strong); }
.lcard[draggable="true"] { cursor: grab; }
.lcard.breach { border-color: rgba(208, 59, 59, 0.55); box-shadow: inset 3px 0 0 var(--bad); }
.lcard-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.lcard-top strong { font-size: 13.5px; }
.lcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent-2); }

/* drawer */
.drawer, .ask {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(560px, 100vw); background: var(--surface);
  border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); transform: translateX(105%); transition: transform 0.25s ease;
  display: flex; flex-direction: column;
}
.drawer.open, .ask.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.d-title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.drawer-body { padding: 14px 18px 40px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.dsec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.kv2 { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.kv2 dt { color: var(--muted); }
.kv2 dd { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.stage-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.stage-strip .chip:disabled { opacity: 0.5; cursor: not-allowed; }
.callout { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text-2); font-size: 13px; border: 1px solid var(--border); }
.callout.warn { background: var(--warn-soft); }
.callout.ok { background: var(--good-soft); color: var(--text); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; border-left: 2px solid var(--border); padding-left: 12px; font-size: 13px; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.task-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.task-list li.done span:nth-child(2) { text-decoration: line-through; color: var(--muted); }
.contract-box { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; background: var(--surface-2); }
.cb-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.paybar, .minbar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.paybar span, .minbar span { display: block; height: 100%; }
.pb-paid, .mb-done { background: var(--good); }
.pb-pending { background: repeating-linear-gradient(135deg, var(--warn) 0 4px, transparent 4px 8px); }
.mb-burn { background: var(--bad); }
.mb-res { background: var(--accent); opacity: 0.7; }
.small-bar { height: 6px; width: 120px; }
.sched { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.sched li, .skills li { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.skills { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.pay-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.pay-list > li { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.pay-list > li.pending { border-color: rgba(250, 178, 25, 0.45); }
.pay-list.wide > li > li { list-style: none; padding: 0; border: 0; background: none; }
.d-tabs { margin-bottom: 2px; }
.skill-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; font-size: 13px; }
.skill-pick label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.skill-pick select, .drawer textarea, .modal select, .modal input, .modal textarea, .drawer select, .drawer input {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: 9px; padding: 7px 9px; font: inherit;
}
.drawer textarea { width: 100%; margin-top: 6px; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field input, .form-grid .field select { width: 100%; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.modal .field input, .modal .field select { font-size: 14px; padding: 9px 11px; }

/* schedule */
.sched-card { padding: 0; overflow: hidden; }
.sched-scroll { overflow: auto; max-height: calc(100vh - 230px); }
.sched-grid { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(170px, 1fr)); min-width: calc(56px + var(--cols) * 170px); }
.sg-corner, .sg-colhead { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); }
.sg-colhead { padding: 10px 12px; display: grid; gap: 2px; border-left: 1px solid var(--border); }
.sg-hours { grid-row: 2; grid-column: 1; }
.sg-hour { height: var(--px); font-size: 11px; color: var(--muted); text-align: right; padding: 2px 8px 0 0; font-variant-numeric: tabular-nums; }
.sg-col { grid-row: 2; position: relative; border-left: 1px solid var(--border); cursor: copy; }
.sg-slot { height: calc(var(--px) / 2); border-bottom: 1px dashed var(--grid); }
.sg-slot:nth-child(2n) { border-bottom-style: solid; }
.lesson-block {
  position: absolute; left: 6px; right: 6px; z-index: 2; display: grid; align-content: start; gap: 1px; padding: 6px 8px; border-radius: 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.18); color: var(--text); font: inherit; font-size: 12px; text-align: left; cursor: pointer; overflow: hidden;
}
.lesson-block strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-block[draggable="true"] { cursor: grab; }
.lesson-block.done { background: var(--good-soft); border-color: rgba(12, 163, 12, 0.45); }
.lesson-block.no_show_student, .lesson-block.no_show_instructor { background: var(--bad-soft); border-color: rgba(208, 59, 59, 0.5); }
.lesson-block.unclosed { border-style: dashed; border-color: var(--warn); }
.lb-sub { color: var(--text-2); font-size: 11px; }
.downtime { position: absolute; left: 0; right: 0; z-index: 1; background: repeating-linear-gradient(135deg, var(--bad-soft) 0 8px, transparent 8px 16px); color: var(--bad-text); font-size: 11px; padding: 4px 8px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* fleet */
.util { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.util li { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, 2fr) auto; gap: 12px; align-items: center; }
.util-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.util-track span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.fleet-grid .card { margin-top: 14px; }
.vc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.affected { display: grid; gap: 10px; }
.aff-row { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.aff-opts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* reports */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric {
  display: grid; gap: 4px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  color: inherit; font: inherit; cursor: pointer; box-shadow: var(--shadow);
}
.metric:hover { border-color: var(--border-strong); }
.metric-formula { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }
.metric-open { font-size: 12px; color: var(--accent-2); }
.rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.plain { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; display: grid; gap: 6px; }

/* instructor mobile */
.my-list { display: grid; gap: 10px; max-width: 560px; }
.my-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.my-time { display: grid; }
.my-time strong { font-size: 18px; }
.my-body { display: grid; gap: 2px; min-width: 0; }

/* ask DRIVE */
.ask { width: min(460px, 100vw); }
.ask-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.msg { padding: 10px 12px; border-radius: 12px; font-size: 13.5px; display: grid; gap: 4px; max-width: 92%; }
.msg.me { justify-self: end; background: var(--accent); color: #fff; }
.msg.bot { background: var(--surface-2); border: 1px solid var(--border); }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.ask-chips .chip { border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); text-align: left; }
.ask-form { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.ask-form input { flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); padding: 0 12px; font: inherit; }

/* demo panel */
.demo-panel { position: fixed; left: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; justify-items: start; }
.demo-toggle { border: 1px solid rgba(var(--accent-rgb), 0.5); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13px; padding: 9px 14px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-pop); }
.demo-body { width: 300px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); display: grid; gap: 8px; }
.demo-steps { display: grid; gap: 6px; }
.demo-steps .btn { justify-content: flex-start; border: 1px solid var(--border); }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; justify-items: end; }
.toast { max-width: 380px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 13.5px; transition: opacity 0.4s, transform 0.4s; border-left: 3px solid var(--good); }
.toast.err { border-left-color: var(--bad); }
.toast.info { border-left-color: var(--accent); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* responsive */
@media (max-width: 1100px) {
  .today-grid { grid-template-columns: 1fr; }
  /* Laptop widths: icons only in the top bar, so the global search keeps its room. */
  .crm-top .hide-sm, .clock { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 80; left: 0; top: 28px; width: 260px; transform: translateX(-105%); transition: transform 0.25s; background: var(--surface); }
  body.nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .menu-btn { display: inline-flex; }
  .crm-top { padding: 8px 12px; flex-wrap: wrap; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .clock, .branch-select { display: none; }
  .view { padding: 18px 16px 110px; }
  .sig { grid-template-columns: 10px minmax(0, 1fr); }
  .sig-actions { grid-column: 2; justify-content: flex-start; }
  .kv2 { grid-template-columns: 120px minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .util li { grid-template-columns: 1fr; gap: 4px; }
  .demo-body { width: min(300px, calc(100vw - 32px)); }
  /* Phones: a compact demo button that doesn't sit on top of action buttons. */
  .demo-toggle { padding: 6px 11px; font-size: 12px; opacity: 0.92; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .ask, .toast, .side { transition: none; }
}

.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 8px; font: inherit; }
.switch { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.table th.left { text-align: left; }
.good-text { color: var(--good-text); }

/* Long lists: search, filters, paging */
.list-search { min-width: 0; width: 220px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 13px; }
.table-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.table-tools select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: 9px; padding: 6px 9px; font: inherit; font-size: 13px; }
.more-row { display: flex; justify-content: center; padding-top: 12px; }
.kcol-more { width: 100%; justify-content: center; }

/* Long names never push layout sideways */
.lcard strong, .d-title, .obj-name, .src-top strong, .sig-title, .rec-list li { overflow-wrap: anywhere; }

/* ---------- motion (docs/crm/motion.md) ---------- */
:root {
  --m-fast: 140ms; --m-state: 200ms; --m-panel: 280ms; --m-route: 240ms; --m-step: 40ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1); --ease-io: cubic-bezier(0.45, 0, 0.55, 1);
  /* the horizon glow of the loading scene — small accents only, never a status colour */
  --sun: #ffb86b; --sun-2: #ff7e6b; --sun-rgb: 255, 184, 107;
}
:root[data-motion="min"] { --m-fast: 1ms; --m-state: 1ms; --m-panel: 1ms; --m-route: 1ms; --m-step: 0ms; }

/* Loading: the analytics' scene as is; the CRM adds only the error with «Повторить». */
.loader-error { display: grid; gap: 6px; justify-items: center; margin-top: 4px; }
.loader-error[hidden], .loader-text[hidden] { display: none; }
.loader-error-text { color: #fff; font-weight: 650; font-size: 15px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.loader-error-details { color: rgba(255, 255, 255, 0.75); font-size: 13px; max-width: 360px; }
/* Devices set to "reduce motion": a still frame of the same scene, instant transitions */
:root[data-motion="min"] .sky-scene * { animation: none !important; }
:root[data-motion="min"] .sky-scene .sun { transform: translateY(-40px); }
:root[data-motion="min"] .sky-scene .stars { opacity: 0.2; }

/* Interface reveal: one warm stroke along the top bar when the scene fades. */
.crm-top::after, .crm-top::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--sun), var(--sun-2), transparent) no-repeat; background-size: 30% 100%; background-position: -43% 0;
}
:root[data-motion="full"] .crm-top.is-revealed::after { animation: sun-sweep 1.1s var(--ease-io) 1; }
@keyframes sun-sweep { 0% { opacity: 0; background-position: -43% 0; } 15%, 80% { opacity: 1; } 100% { opacity: 0; background-position: 143% 0; } }
/* Saving: the same light runs under the bar while the server works. */
.crm-top::before { transition: opacity var(--m-state); }
body.is-saving .crm-top::before { opacity: 1; animation: saving-run 1.1s var(--ease-io) infinite; }
:root[data-motion="min"] body.is-saving .crm-top::before { animation: none; background: rgba(var(--sun-rgb), 0.55); }
@keyframes saving-run { from { background-position: -43% 0; } to { background-position: 143% 0; } }

/* Sections: the active marker slides, the new content settles in. */
.nav { position: relative; }
.nav-marker {
  position: absolute; left: 0; top: 0; width: 3px; height: 0; border-radius: 3px; pointer-events: none;
  background: linear-gradient(180deg, var(--sun), var(--sun-2)); transition: transform var(--m-route) var(--ease-io), height var(--m-route) var(--ease-io);
}
:root[data-motion="full"] #view.view-enter { animation: view-in var(--m-route) var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.drawer, .ask { transition: transform var(--m-panel) var(--ease-out); }
.nav-item, .btn, .lcard, .chip { transition: background-color var(--m-fast), color var(--m-fast), border-color var(--m-fast), box-shadow var(--m-fast); }

/* The record whose card is open keeps its place visible. */
.is-current { outline: 2px solid rgba(var(--sun-rgb), 0.55); outline-offset: -2px; }
tr.is-current td { background: rgba(var(--sun-rgb), 0.06); }

/* What just changed lights up once. */
[data-rid].flash { animation: rec-flash 900ms var(--ease-out) 1; }
@keyframes rec-flash {
  0% { box-shadow: 0 0 0 0 rgba(var(--sun-rgb), 0); }
  20% { box-shadow: 0 0 0 2px rgba(var(--sun-rgb), 0.6), 0 0 18px rgba(var(--sun-rgb), 0.25); background-color: rgba(var(--sun-rgb), 0.1); }
  100% { box-shadow: 0 0 0 0 rgba(var(--sun-rgb), 0); }
}
:root[data-motion="min"] [data-rid].flash { animation: rec-outline 900ms steps(1) 1; }
@keyframes rec-outline { 0% { outline: 2px solid rgba(var(--sun-rgb), 0.6); } 100% { outline: none; } }
/* confirmed payment: the tick draws itself */
.tick { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; stroke: var(--good-text); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
:root:not([data-motion="min"]) .flash-check .tick path { stroke-dasharray: 16; animation: tick-draw 450ms var(--ease-out) 1 both; }
@keyframes tick-draw { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
/* booked lesson: the block assembles in its slot */
:root[data-motion="full"] .lesson-block.assemble { animation: assemble 320ms var(--ease-out) 1, rec-flash 900ms var(--ease-out) 1; transform-origin: top center; }
@keyframes assemble { from { opacity: 0; transform: scaleY(0.55); } }
/* kanban: the card waits in its new column until the server agrees */
.lcard.is-saving { opacity: 0.7; outline: 1px dashed rgba(var(--sun-rgb), 0.7); outline-offset: -1px; }
.lcard.is-saving::after { content: "сохраняем…"; display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
/* a number that changed since this person last saw it — the value itself is shown at once */
:root:not([data-motion="min"]) .stat.changed .stat-value { animation: value-glow 900ms var(--ease-out) 1; }
:root[data-motion="min"] .stat.changed { outline: 1px solid rgba(var(--sun-rgb), 0.5); }
@keyframes value-glow { 25% { text-shadow: 0 0 14px rgba(var(--sun-rgb), 0.7); } }

/* Theme switch: surfaces change light softly, only while switching. */
html.theme-shift, html.theme-shift *, html.theme-shift *::before, html.theme-shift *::after {
  transition: background-color var(--m-panel) var(--ease-io), color var(--m-panel) var(--ease-io), border-color var(--m-panel) var(--ease-io) !important;
}


/* The floating demo button sits bottom-left: keep the side menu footer above it. */
body:has(#demo) .side-foot { padding-bottom: 56px; }

/* ---------- student route: enrolment → … → completion ---------- */
.route-line { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; margin: 6px 0 10px; padding: 0; }
.route-track { position: absolute; left: 10%; right: 10%; top: 13px; height: 3px; border-radius: 3px; background: var(--border-strong); overflow: hidden; }
.route-fill { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--sun-2), var(--sun)); transition: width 600ms var(--ease-io); }
.route-st { position: relative; display: flex; justify-content: center; }
.route-st button { display: grid; justify-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12px; line-height: 1.25; text-align: center; cursor: pointer; padding: 4px 2px; border-radius: 8px; }
.route-st button:hover, .route-st button.is-open { color: var(--text); background: var(--surface-2); }
.route-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); transition: background-color var(--m-state), border-color var(--m-state), box-shadow var(--m-state); }
.st-done .route-dot { background: var(--sun); border-color: var(--sun); box-shadow: 0 0 0 4px rgba(var(--sun-rgb), 0.18); }
.st-progress .route-dot { border-color: var(--sun); background: linear-gradient(90deg, rgba(var(--sun-rgb), 0.85) 50%, var(--surface) 50%); }
.st-unknown .route-dot { border-style: dashed; }
.st-skip .route-dot { opacity: 0.4; }
.st-done .route-label { color: var(--text); font-weight: 600; }
.route-facts { margin: 0; padding: 10px 12px; list-style: none; display: grid; gap: 4px; font-size: 13px; border-radius: 10px; background: var(--surface-2); }

/* ---------- empty states as an invitation (drawn once, then still) ---------- */
.empty-scene { display: grid; justify-items: center; gap: 6px; padding: 18px 12px 8px; text-align: center; }
.empty-scene svg { width: 160px; height: 70px; overflow: visible; }
.empty-scene path { fill: none; stroke: var(--border-strong); stroke-width: 2; stroke-linecap: round; }
.empty-scene .horizon { stroke: var(--text-2); stroke-width: 1.5; }
.empty-scene .faint { stroke: var(--border); }
.empty-scene .sun { stroke: var(--sun); stroke-width: 2.5; }
.empty-scene .lane { stroke: var(--sun); }
.empty-scene p { margin: 0; max-width: 420px; font-size: 13px; }
:root:not([data-motion="min"]) .empty-scene .draw { stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw-once 900ms var(--ease-out) 120ms forwards; }
:root:not([data-motion="min"]) .empty-scene .sun { animation-delay: 420ms; }
:root:not([data-motion="min"]) .empty-scene .lane { animation-delay: 520ms; }
@keyframes draw-once { to { stroke-dashoffset: 0; } }

/* Telegram block in Settings → Уведомления */
.tg-block { display: grid; gap: 8px; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.tg-block p { margin: 0; }

/* Phones: the lesson-closing form in one column, drop-downs never wider than the card */
@media (max-width: 860px) {
  .skill-pick { grid-template-columns: 1fr; }
  .skill-pick select { min-width: 0; max-width: 58%; }
}

/* checkbox groups in setup forms (categories, gearboxes) */
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0; }
.checks label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.form-grid > .form-grid.full { grid-column: 1 / -1; margin: 0; }
.form-grid[hidden], .field[hidden] { display: none; }
.login-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }

/* Working CRM has no demo ribbon: the bars start at the very top */
body:not(:has(.demo-ribbon)) .shell { min-height: 100vh; }
body:not(:has(.demo-ribbon)) .side { top: 0; height: 100vh; }
body:not(:has(.demo-ribbon)) .crm-top { top: 0; }
@media (max-width: 860px) { body:not(:has(.demo-ribbon)) .side { top: 0; } }

/* First steps of a real school */
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.setup-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); }
.setup-steps li.is-done { opacity: 0.65; }
.setup-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.setup-steps li.is-done .setup-mark { border-color: var(--sun); background: var(--sun); color: #1b1206; }
