:root {
  color-scheme: light;
  --ao-blue: #0066a8;
  --ao-blue-dark: #004d80;
  --ao-blue-soft: #e8f4fb;
  --ink: #17232f;
  --ink-soft: #34475a;
  --muted: #6b7c8f;
  --line: #d9e3ea;
  --panel: #ffffff;
  --page: #f4f8fb;
  --blue: var(--ao-blue);
  --green: #27845f;
  --red: #c24a45;
  --gold: #ad7a1d;
  --clay: #9b6260;
  --shadow: 0 14px 34px rgba(20, 48, 70, 0.09);
  --shadow-soft: 0 8px 22px rgba(20, 48, 70, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #eaf5fb 0, var(--page) 320px),
    var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
}

body.has-modal {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

a.text-button {
  text-decoration: none;
}

.app-shell {
  width: min(1280px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 38px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(0, 102, 168, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(0, 102, 168, 0.22);
  border-radius: 999px;
  background: var(--ao-blue-soft);
  color: var(--ao-blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--blue);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.text-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(0, 102, 168, 0.24);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.sync-status {
  min-height: 18px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.dashboard-tabs {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid rgba(0, 102, 168, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.dashboard-tab { min-height: 42px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 800; }
.dashboard-tab.is-active { background: var(--blue); color: #fff; }
.dashboard-panel { display: none; }
.dashboard-panel.is-active { display: block; }
.home-alert-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.home-alert-grid button { display: grid; gap: 6px; min-height: 82px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; text-align: left; box-shadow: var(--shadow-soft); }
.home-alert-grid span { color: var(--muted); font-size: 12px; font-weight: 800; }
.home-alert-grid strong { font-size: 21px; }
.home-alert-grid button:hover { border-color: rgba(0, 102, 168, 0.35); background: #f8fcff; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.metric {
  min-height: 112px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.metric.accent {
  background: linear-gradient(135deg, var(--ao-blue), #004d80);
  border-color: rgba(0, 102, 168, 0.25);
  color: #fff;
}

.metric.accent .metric-label,
.metric.accent small {
  color: rgba(255, 255, 255, 0.72);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 9px;
  font-size: 30px;
  line-height: 1;
}

.stage-strip {
  display: grid;
  grid-template-columns: 1.25fr repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.follow-strip,
.balance-strip,
.payment-strip {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.follow-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.balance-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.follow-card,
.balance-card,
.payment-card {
  min-height: 74px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  text-align: left;
}

.follow-card.urgent {
  border-left: 5px solid var(--red);
}

.balance-card {
  border-left: 4px solid var(--blue);
}

.payment-card {
  border-left: 4px solid var(--gold);
}

.payment-card.urgent {
  border-left-color: var(--red);
}

.follow-card:hover,
.follow-card.is-active {
  border-color: var(--red);
  box-shadow: 0 12px 30px rgba(173, 77, 68, 0.14);
}

.balance-card:hover,
.balance-card.is-active {
  border-color: var(--blue);
  box-shadow: 0 12px 28px rgba(0, 102, 168, 0.14);
}

.payment-card:hover,
.payment-card.is-active {
  border-color: var(--gold);
  box-shadow: 0 12px 30px rgba(176, 123, 53, 0.16);
}

.payment-card.urgent:hover,
.payment-card.urgent.is-active {
  border-color: var(--red);
  box-shadow: 0 12px 30px rgba(173, 77, 68, 0.14);
}

.follow-card span,
.balance-card span,
.payment-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.follow-card strong,
.balance-card strong,
.payment-card strong {
  display: block;
  margin-top: 6px;
  font-size: 23px;
  line-height: 1;
}

.follow-card small,
.balance-card small,
.payment-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 12px;
  margin: 14px 0 12px;
}

.ops-panel {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.slot-closure-panel {
  margin: 0 0 12px;
}

.slot-closure-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(230px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.slot-closure-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.slot-closure-form input,
.slot-closure-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdff;
  color: var(--ink);
}

.slot-closure-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.slot-closure-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(173, 77, 68, 0.2);
  border-radius: 8px;
  background: #fffafa;
}

.slot-closure-item > div {
  display: grid;
  min-width: 0;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.slot-closure-item span,
.slot-closure-item small {
  color: var(--muted);
}

.slot-closure-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ops-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.ops-heading h2 {
  font-size: 17px;
}

.calendar-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.segmented-control {
  display: inline-flex;
  min-height: 34px;
  padding: 3px;
  border: 1px solid rgba(0, 102, 168, 0.18);
  border-radius: 8px;
  background: #f4f9fc;
}

.segmented-control button {
  min-width: 46px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.segmented-control button.is-active {
  background: var(--blue);
  color: #fff;
}

.text-button.secondary {
  border-color: rgba(0, 77, 128, 0.2);
  background: var(--ao-blue-dark);
}

.text-button.subtle {
  min-height: 34px;
  border-color: rgba(0, 102, 168, 0.18);
  background: var(--ao-blue-soft);
  color: var(--ao-blue-dark);
  box-shadow: none;
}

.text-button.subtle:hover,
button.small.ghost:hover {
  border-color: rgba(0, 102, 168, 0.34);
  background: #f4fbff;
  color: var(--ink);
  box-shadow: none;
}

.text-button.danger {
  border-color: rgba(173, 77, 68, 0.28);
  color: var(--red);
}

button.small {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(0, 102, 168, 0.22);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

button.small.ghost {
  background: #fff;
  color: var(--blue);
}

button.small.danger {
  border-color: rgba(173, 77, 68, 0.24);
  background: #fff;
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-grid select,
.form-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdff;
  color: var(--ink);
}

.attendance-preview {
  min-height: 88px;
  padding: 12px 13px;
  border: 1px solid rgba(0, 102, 168, 0.14);
  border-radius: 8px;
  background: #f7fbfe;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.attendance-picker-head { display:flex; justify-content:space-between; align-items:center; margin:12px 0 7px; font-size:13px; }
.attendance-picker-head span { color:var(--muted); font-weight:800; }
.attendance-students { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; max-height:220px; overflow:auto; margin-bottom:10px; }
.attendance-student { display:grid; grid-template-columns:20px minmax(0,1fr) auto; gap:7px; align-items:center; min-height:42px; padding:7px 9px; border:1px solid var(--line); border-radius:8px; background:#fff; cursor:pointer; }
.attendance-student.is-selected { border-color:var(--blue); background:var(--ao-blue-soft); }
.attendance-student small { color:var(--muted); }
.attendance-preview div { display:flex; justify-content:space-between; gap:10px; padding:5px 0; border-bottom:1px solid var(--line); }
.attendance-preview div:last-child { border-bottom:0; }
.attendance-preview div span { color:var(--muted); text-align:right; }

.panel-status {
  min-height: 18px;
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.booking-panel > .panel-status {
  margin: 14px 0 0;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
}

.booking-panel > .panel-status.is-sending,
.booking-panel > .panel-status.is-success,
.booking-panel > .panel-status.is-error {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.booking-panel > .panel-status.is-sending {
  border-color: rgba(0, 102, 168, 0.24);
  background: var(--ao-blue-soft);
  color: var(--ao-blue-dark);
}

.booking-panel > .panel-status.is-success {
  border-color: rgba(36, 126, 92, 0.28);
  background: #eef8f3;
  color: #176846;
}

.booking-panel > .panel-status.is-error {
  border-color: rgba(184, 62, 62, 0.28);
  background: #fff2f2;
  color: #9f2f2f;
}

.booking-form .text-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.booking-receipt {
  scroll-margin-top: 16px;
  margin: 18px 0;
  padding: 20px;
  border: 2px solid rgba(36, 126, 92, 0.32);
  border-radius: 8px;
  background: #f4fbf7;
  box-shadow: 0 10px 28px rgba(23, 104, 70, 0.1);
}

.booking-receipt[hidden] {
  display: none;
}

.booking-receipt-kicker {
  margin: 0 0 5px;
  color: #176846;
  font-size: 12px;
  font-weight: 900;
}

.booking-receipt h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.35;
}

.booking-receipt-message {
  margin: 10px 0 16px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.booking-receipt-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.booking-receipt-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.booking-receipt-meta strong {
  color: var(--ink);
  font-size: 14px;
}

.booking-receipt-list {
  display: grid;
  gap: 10px;
}

.booking-receipt-item {
  padding: 14px;
  border: 1px solid rgba(0, 102, 168, 0.18);
  border-radius: 8px;
  background: #fff;
}

.booking-receipt-date {
  margin: 0 0 8px;
  color: var(--ao-blue-dark);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.4;
}

.booking-receipt-detail {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.booking-receipt-detail strong {
  color: var(--ink);
  font-size: 21px;
  line-height: 1.2;
}

.booking-receipt-detail span {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 800;
}

.booking-receipt-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.booking-receipt-actions .text-button {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 12px;
  text-align: center;
}

.booking-receipt-note {
  margin: 14px 0 0;
  color: #176846;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

.finance-panel {
  margin: 10px 0;
  padding: 18px;
  border: 1px solid rgba(0, 102, 168, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.finance-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.finance-metrics article {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.finance-metrics span,
.finance-metrics small { color: var(--muted); font-size: 12px; font-weight: 700; }
.finance-metrics strong { color: var(--ink); font-size: 23px; }
.finance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.finance-grid.details { grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); }
.finance-chart-panel { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfdff; }
.finance-chart-panel h3 { margin: 0 0 12px; font-size: 14px; }
.bar-chart, .method-list { display: grid; gap: 7px; max-height: 310px; overflow: auto; }
.bar-row { display: grid; grid-template-columns: 58px minmax(70px, 1fr) 86px; gap: 8px; align-items: center; font-size: 12px; }
.bar-row > span { color: var(--muted); }
.bar-row > strong { text-align: right; }
.bar-track { height: 11px; overflow: hidden; border-radius: 4px; background: #e7eef3; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.compact-chart .bar-track i { background: var(--green); }
.finance-table-wrap { max-height: 310px; overflow: auto; }
.finance-table { width: 100%; font-size: 12px; }
.finance-table th, .finance-table td { padding: 8px; white-space: nowrap; }

.event-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.calendar-month-controls {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  margin: -2px 0 10px;
}

.calendar-month-controls strong {
  color: var(--ink);
  font-size: 15px;
  text-align: center;
}

.icon-button.compact {
  width: 34px;
  height: 34px;
  box-shadow: none;
}

.event-item,
.calendar-day {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.event-date,
.calendar-date {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.calendar-date {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 56px;
  padding: 8px;
  border-radius: 8px;
  background: var(--ao-blue-soft);
  text-align: center;
}

.calendar-date strong {
  font-size: 18px;
}

.calendar-date span {
  color: var(--muted);
}

.calendar-slots {
  display: grid;
  gap: 6px;
}

.calendar-slot {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: baseline;
  padding: 8px 9px;
  border-radius: 8px;
  background: #fff;
}

.calendar-slot span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.calendar-slot strong {
  min-width: 0;
  font-size: 13px;
}

.calendar-slot small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}

.month-calendar {
  min-width: 0;
}

.month-weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-weekdays {
  gap: 4px;
  margin-bottom: 5px;
}

.month-weekdays span {
  min-height: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.month-grid {
  gap: 4px;
}

.month-day {
  min-width: 0;
  min-height: 104px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.month-day:hover {
  border-color: rgba(0, 102, 168, 0.36);
  background: #f7fbfe;
}

.month-day.is-outside {
  background: #f1f5f7;
  color: var(--muted);
  opacity: 0.62;
}

.month-day.is-today {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(0, 102, 168, 0.2);
}

.month-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 18px;
  margin-bottom: 5px;
}

.month-day-head strong {
  font-size: 12px;
  line-height: 1;
}

.month-day-head span {
  min-height: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--ao-blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.month-day-events {
  display: grid;
  gap: 4px;
}

.month-event {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 4px 5px;
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  background: #fff;
}

.month-event span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
}

.month-event strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-more {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(14, 30, 44, 0.36);
}

.modal-backdrop[hidden] {
  display: none;
}

.day-modal {
  width: min(520px, 100%);
  max-height: min(620px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid rgba(0, 102, 168, 0.22);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(14, 30, 44, 0.28);
}

.day-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fcff;
}

.day-modal-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.day-modal-events {
  display: grid;
  gap: 8px;
  max-height: 500px;
  overflow: auto;
  padding: 14px;
}

.day-modal-event {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fbfdff;
}

.day-modal-event span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.day-modal-event strong {
  min-width: 0;
  font-size: 14px;
}

.day-modal-event small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.event-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
}

.event-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.request-panel {
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.request-actions {
  display: flex;
  gap: 8px;
}

.request-list {
  display: grid;
  gap: 8px;
}

.request-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 140px 148px;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.request-status {
  color: var(--ao-blue-dark);
  font-size: 12px;
  font-weight: 800;
}

.request-status.is-done {
  color: var(--green);
}

.request-main strong {
  display: block;
  margin-bottom: 4px;
}

.request-main span,
.request-date {
  color: var(--muted);
  font-size: 12px;
}

.request-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.booking-shell {
  width: min(760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.booking-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.booking-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.booking-form-spacer {
  min-height: 1px;
}

.change-source-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.change-source-fields[hidden] {
  display: none;
}

.change-source-fields > strong {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 13px;
}

.public-calendar {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid rgba(0, 102, 168, 0.16);
  border-radius: 8px;
  background: #f8fcff;
}

.public-calendar-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.public-calendar-head strong {
  text-align: center;
}

.availability-weekdays,
.availability-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.availability-weekdays {
  gap: 4px;
  margin-bottom: 5px;
}

.availability-weekdays span {
  min-height: 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.availability-grid {
  gap: 4px;
}

.availability-day {
  min-width: 0;
  min-height: 122px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.availability-day.is-outside,
.availability-day.is-past {
  background: #f1f5f7;
  opacity: 0.58;
}

.availability-day.is-closed {
  background: #f7f2f2;
}

.availability-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 18px;
  margin-bottom: 5px;
}

.availability-day-head strong {
  font-size: 12px;
}

.availability-day-head .date-weekday {
  margin-left: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.availability-day-head span {
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
}

.availability-slots {
  display: grid;
  gap: 4px;
}

.availability-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "time count"
    "type count";
  gap: 0 4px;
  align-items: center;
  min-height: 38px;
  padding: 4px 6px;
  border: 1px solid rgba(0, 102, 168, 0.18);
  border-radius: 7px;
  background: #f7fbfe;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.availability-slot:hover,
.availability-slot.is-selected {
  border-color: var(--blue);
  background: var(--ao-blue-soft);
}

.availability-slot:disabled {
  border-color: #dde3e8;
  background: #eef2f5;
  color: var(--muted);
  cursor: not-allowed;
}

.availability-slot .slot-time {
  grid-area: time;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.availability-slot .slot-type {
  grid-area: type;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
}

.availability-slot strong {
  grid-area: count;
  color: var(--blue);
  font-size: 11px;
}

.availability-slot:disabled strong {
  color: var(--muted);
}

.selected-slot {
  padding: 11px 12px;
  border: 1px solid rgba(0, 102, 168, 0.16);
  border-radius: 8px;
  background: var(--ao-blue-soft);
  color: var(--ao-blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.selected-slot-list {
  display: grid;
  gap: 6px;
  margin-top: -6px;
}

.selected-slot-list[hidden] {
  display: none;
}

.selected-slot-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 102, 168, 0.14);
  border-radius: 8px;
  background: #fbfdff;
}

.selected-slot-list strong,
.selected-slot-list span {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-slot-list strong {
  color: var(--ao-blue-dark);
}

.selected-slot-list span {
  color: var(--muted);
  font-weight: 800;
}

.booking-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.booking-form input,
.booking-form select,
.booking-form textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdff;
  color: var(--ink);
}

.booking-form textarea {
  padding: 10px;
}

.booking-form .wide,
.booking-form button {
  grid-column: 1 / -1;
}

.check-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink-soft) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.6;
}

.check-row input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
}

.stage-heading,
.stage-card {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.stage-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 13px 15px;
  border-left: 4px solid var(--blue);
  background: #f8fcff;
}

.stage-heading span,
.stage-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stage-heading strong,
.stage-card strong {
  margin-top: 6px;
  font-size: 23px;
  line-height: 1;
}

.stage-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 13px 15px;
  text-align: left;
}

.stage-card:hover,
.stage-card.is-active {
  border-color: var(--blue);
  box-shadow: 0 12px 28px rgba(0, 102, 168, 0.14);
}

.stage-card.is-active {
  background: var(--ao-blue-soft);
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.workbench {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.side-panel,
.main-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.side-panel {
  padding: 15px;
  background: #f8fbfd;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-heading.compact {
  margin-top: 20px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.status-list {
  display: grid;
  gap: 6px;
}

.status-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-item strong {
  font-size: 14px;
}

.note-box {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(0, 102, 168, 0.16);
  border-radius: 8px;
  background: var(--ao-blue-soft);
}

.note-box strong {
  display: block;
  margin-bottom: 6px;
}

.note-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.main-panel {
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
}

.tab {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.tab.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input {
  width: 220px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdff;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 285px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f9fc;
  color: var(--muted);
  font-size: 12px;
}

.name-cell {
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ao-blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.warn {
  background: #fff1ee;
  color: var(--red);
}

.pill.ok {
  background: #edf7f0;
  color: var(--green);
}

.pill.step {
  background: var(--ao-blue-soft);
  color: var(--blue);
}

.pill.rest {
  background: #fff7e8;
  color: var(--gold);
}

.pill.trial {
  background: #f5eef6;
  color: #7a557d;
}

.pill.muted-pill {
  background: #efefec;
  color: #6c6a64;
}

.pill.discount {
  margin-left: 6px;
  background: #fff7e8;
  color: var(--gold);
}

.price-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

.date-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.15;
}

.date-stack small,
.muted-cell {
  color: var(--muted);
  font-size: 12px;
}

.price-stack strong {
  font-size: 14px;
}

.price-stack small {
  color: var(--muted);
  font-size: 11px;
  text-decoration: line-through;
}

.empty {
  padding: 34px 14px;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  padding: 22px 12px;
}

@media (max-width: 920px) {
  .home-alert-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid,
  .stage-strip,
  .follow-strip,
  .balance-strip,
  .payment-strip,
  .ops-grid,
  .workbench {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    justify-content: space-between;
  }

  .search-box input {
    width: min(100%, 420px);
  }

  .table-wrap {
    max-height: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .slot-closure-form,
  .slot-closure-list {
    grid-template-columns: 1fr;
  }

  .finance-metrics,
  .finance-grid,
  .finance-grid.details {
    grid-template-columns: 1fr;
  }

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

  .calendar-actions {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .month-day {
    min-height: 88px;
    padding: 5px;
  }

  .month-event {
    padding: 3px 4px;
  }

  .request-item,
  .booking-form {
    grid-template-columns: 1fr;
  }

  .booking-form-spacer {
    display: none;
  }

  .availability-day {
    min-height: 108px;
    padding: 5px;
  }

  .availability-slot {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 38px;
  }
}

@media (max-width: 560px) {
  .dashboard-tabs { display: flex; overflow-x: auto; }
  .dashboard-tab { flex: 0 0 auto; min-width: 112px; padding: 0 12px; }
  .home-alert-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body {
    background: var(--page);
  }

  .booking-shell {
    width: 100%;
    padding: 0;
  }

  .booking-panel {
    min-height: 100svh;
    padding: 18px 12px 28px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .booking-panel h1 {
    font-size: 28px;
  }

  .booking-panel .lead {
    font-size: 13px;
    line-height: 1.55;
  }

  .change-source-fields {
    grid-template-columns: 1fr;
  }

  .change-source-fields > strong {
    grid-column: auto;
  }

  .public-calendar {
    margin-top: 16px;
    padding: 12px;
  }

  .public-calendar-head {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .public-calendar-head .icon-button {
    width: 40px;
    height: 40px;
  }

  .public-calendar-head strong {
    font-size: 17px;
  }

  .availability-weekdays {
    display: none;
  }

  .availability-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .availability-day {
    min-height: 0;
    padding: 10px;
    border-color: rgba(0, 102, 168, 0.18);
  }

  .availability-day.is-outside {
    display: none;
  }

  .availability-day.is-past {
    display: none;
  }

  .availability-day.is-closed {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    min-height: 50px;
    background: #fbf5f5;
  }

  .availability-day.is-closed .availability-slots {
    display: none;
  }

  .availability-day-head {
    min-height: 26px;
    margin-bottom: 8px;
  }

  .availability-day-head strong {
    font-size: 17px;
  }

  .availability-day-head span {
    font-size: 13px;
  }

  .availability-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .availability-slot {
    min-height: 58px;
    padding: 8px 9px;
    border-radius: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 8px;
  }

  .availability-slot .slot-time {
    font-size: 16px;
    line-height: 1.1;
    overflow: visible;
    text-overflow: clip;
  }

  .availability-slot .slot-type {
    font-size: 12px;
    line-height: 1.2;
  }

  .availability-slot strong {
    font-size: 15px;
  }

  .selected-slot-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .selected-slot-list strong,
  .selected-slot-list span {
    white-space: normal;
  }

  .booking-receipt {
    margin: 16px 0;
    padding: 16px 13px;
  }

  .booking-receipt h2 {
    font-size: 21px;
  }

  .booking-receipt-date {
    font-size: 16px;
  }

  .booking-receipt-actions {
    grid-template-columns: 1fr;
  }

  .booking-receipt-actions .text-button {
    min-height: 48px;
    font-size: 14px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .metric {
    min-height: 110px;
  }

  .month-grid {
    gap: 3px;
  }

  .month-day {
    min-height: 72px;
  }

  .month-day-head span {
    display: none;
  }

  .month-event {
    border-left-width: 2px;
  }

  .month-event span {
    font-size: 9px;
  }

  .month-event strong {
    font-size: 10px;
  }

  .booking-form {
    grid-template-columns: 1fr;
  }

  .booking-form-spacer {
    display: none;
  }
}

@media (max-width: 380px) {
  .availability-slots {
    grid-template-columns: 1fr;
  }
}
