:root {
  --bg: #fff5e8;
  --bg-soft: #ffe7c6;
  --panel: #ffffff;
  --panel-soft: #fffaf3;
  --accent: #f57f20;
  --accent-2: #ff9a2f;
  --text: #111111;
  --muted: #7a4a10;
  --ok: #12b76a;
  --warn: #efb43e;
  --danger: #ee5454;
  --border: rgba(122, 74, 16, 0.2);
  --radius: 18px;
  --shadow: 0 14px 28px rgba(58, 28, 0, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Helvetica, Arial, sans-serif;
  background: linear-gradient(145deg, var(--bg) 0%, var(--bg-soft) 60%, #ffd7a0 100%);
  color: var(--text);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body.auth-booting .app-shell,
body.auth-booting .app-footer,
body.auth-booting .bg-shape {
  visibility: hidden;
}

body.auth-booting .auth-gate {
  display: none !important;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.22;
}

.bg-shape-a {
  width: 240px;
  height: 240px;
  background: var(--accent);
  top: -40px;
  right: -50px;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: #111111;
  bottom: -80px;
  left: -70px;
}

.app-shell {
  width: min(1220px, 94vw);
  margin: 28px auto 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-session {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(245, 127, 32, 0.35);
  box-shadow: 0 5px 14px rgba(90, 45, 0, 0.14);
}

.auth-session-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.auth-session-name {
  font-weight: 800;
  color: #2a1a00;
}

.auth-session-role {
  font-size: 0.84rem;
  color: #80531c;
}

.role-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(245, 127, 32, 0.35);
  box-shadow: 0 5px 14px rgba(90, 45, 0, 0.14);
}

.role-control label {
  margin: 0;
  font-size: 0.84rem;
  color: #5a2e00;
  font-weight: 700;
}

.role-select {
  min-width: 145px;
  border: 1px solid rgba(245, 127, 32, 0.4);
  background: #fff8ef;
  color: #1f1406;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.9rem;
  font-family: inherit;
}

.role-select:focus {
  outline: 2px solid rgba(245, 127, 32, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(245, 127, 32, 0.8);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  background: #08121f;
}

.brand h1 {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: clamp(1.6rem, 2vw, 2.1rem);
  line-height: 1;
}

.brand p {
  margin: 0;
  color: var(--muted);
}

.app-footer {
  margin-top: 16px;
  text-align: center;
  color: #5a2e00;
  font-size: 0.78rem;
  line-height: 1.5;
}

.app-footer p {
  margin: 0;
}

.footer-heart {
  color: #ff7b8a;
  font-size: 0.82rem;
}

.view-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.86);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(245, 127, 32, 0.35);
  box-shadow: 0 5px 14px rgba(90, 45, 0, 0.14);
}

.toggle {
  background: transparent;
  color: #2a1a00;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.toggle.active {
  background: linear-gradient(130deg, var(--accent), #ff9f4a);
  color: #1e0e00;
}

.view {
  display: none;
}

.view.visible {
  display: grid;
  gap: 16px;
}

.panel {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(255, 248, 239, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
}

.hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.app-main-nav-panel .checkin-view-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  gap: 10px;
}

.app-main-nav-panel .checkin-view-tabs .btn {
  width: 100%;
  min-width: 0;
}

.checkin-view-tabs .btn {
  min-width: 132px;
}

.hero-panel h2 {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
}

.hero-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.input {
  width: 100%;
  border: 1px solid rgba(245, 127, 32, 0.35);
  background: #ffffff;
  border-radius: 12px;
  color: #111111;
  padding: 11px 12px;
  font-size: 0.98rem;
  font-family: inherit;
}

.input:focus {
  outline: 2px solid rgba(245, 127, 32, 0.4);
  border-color: rgba(245, 127, 32, 0.8);
}

.input.input-attention {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(254, 226, 226, 0.45);
}

.input.input-attention:focus {
  outline-color: rgba(239, 68, 68, 0.35);
  border-color: rgba(239, 68, 68, 0.85);
}

.input[multiple] option {
  padding: 2px 8px;
}

.input[multiple] option:checked {
  background: #0a64ff linear-gradient(0deg, #0a64ff, #0a64ff);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.input.input-soft-disabled[multiple] option:checked,
.input.input-soft-disabled[multiple] option:disabled:checked {
  background: rgba(255, 247, 236, 0.95) linear-gradient(0deg, rgba(255, 247, 236, 0.95), rgba(255, 247, 236, 0.95));
  color: #5a3508;
  -webkit-text-fill-color: #5a3508;
}

.input-lg {
  min-height: 56px;
  font-size: 1.18rem;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #ff9f4a);
  color: #2d1200;
}

.btn-secondary {
  background: #1a2230;
  color: #ffffff;
  border: 1px solid rgba(26, 34, 48, 0.8);
}

.btn-danger {
  background: #b42318;
  color: #ffffff;
  border: 1px solid rgba(116, 24, 16, 0.9);
}

.btn-lg {
  padding: 14px 20px;
  font-size: 1.06rem;
}

.checkin-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.checkin-search-row .btn {
  min-height: 56px;
  white-space: nowrap;
  padding-inline: 16px;
}

.checkin-search-row .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.student-results {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.search-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-empty .muted {
  margin: 0;
}

.student-option {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 127, 32, 0.3);
  background: rgba(255, 247, 237, 0.95);
  color: #111111;
  cursor: pointer;
}

.student-option:hover {
  border-color: rgba(245, 127, 32, 0.7);
}

.student-parent-match-title {
  margin: 4px 0 2px;
  font-size: 0.84rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.meta-pill {
  background: rgba(245, 127, 32, 0.15);
  color: #6b3b06;
  border: 1px solid rgba(245, 127, 32, 0.4);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
}

#checkinCard .meta-row {
  gap: 10px;
  margin-bottom: 14px;
}

#checkinCard .meta-pill {
  padding: 7px 14px;
  font-size: 1rem;
  font-weight: 700;
}

.meta-pill-danger {
  background: rgba(239, 68, 68, 0.16);
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.45);
  font-weight: 700;
}

.meta-pill-whatsapp {
  background: #e8f8ef;
  color: #135f37;
  border-color: rgba(34, 176, 93, 0.45);
  text-decoration: none;
}

.meta-pill-whatsapp:hover {
  background: #dcf4e7;
}

.wa-link {
  color: #135f37;
  text-decoration: none;
  font-weight: 700;
}

.wa-link:hover {
  text-decoration: underline;
}

.wa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #22b05d;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 800;
  margin-right: 6px;
  vertical-align: middle;
}

.wa-icon-sm {
  min-width: 16px;
  height: 16px;
  font-size: 0.5rem;
}

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

.form-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-form-tabs {
  display: inline-flex;
  gap: 8px;
  margin: 6px 0 12px;
}

.payment-form-tabs .admin-tab.active {
  background: linear-gradient(120deg, var(--accent), #ff9f4a);
  color: #2d1200;
  border-color: rgba(245, 127, 32, 0.75);
}

#paymentApplyPanel h4,
#paymentSalePanel h4 {
  margin: 0 0 8px;
}

.inline-field-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.inline-field-action .btn {
  min-height: 44px;
  white-space: nowrap;
}

.payment-sale-active-packages-wrap {
  grid-column: 1 / -1;
}

.payment-sale-active-packages {
  min-height: 0;
  border: 1px solid rgba(245, 127, 32, 0.35);
  border-radius: 12px;
  background: rgba(255, 247, 236, 0.95);
  padding: 8px 12px;
  color: #5a3508;
}

.input.input-soft-disabled,
.input.input-soft-disabled:disabled,
.input.input-soft-disabled[readonly] {
  border-color: rgba(245, 127, 32, 0.35);
  background: rgba(255, 247, 236, 0.95);
  color: #5a3508;
  -webkit-text-fill-color: #5a3508;
  opacity: 1;
  cursor: not-allowed;
}

.payment-sale-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 14px;
  align-items: start;
}

.payment-sale-left-stack {
  grid-column: 1;
  grid-row: 2 / span 2;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.payment-sale-field {
  min-width: 0;
}

.payment-sale-grid label {
  margin-bottom: 2px;
}

.payment-sale-date {
  grid-column: 1;
}

.payment-sale-student {
  grid-column: 2;
}

.payment-sale-mode {
  margin: 0;
}

.payment-sale-products {
  grid-column: 2;
  grid-row: 2 / span 2;
}

.payment-sale-products select[multiple] {
  min-height: 168px;
}

.payment-sale-products .muted,
.payment-sale-tuition .muted {
  margin-top: 4px;
  min-height: 0;
}

.payment-sale-products .muted:empty,
.payment-sale-tuition .muted:empty {
  display: none;
}

.payment-sale-package {
  margin: 0;
}

.payment-sale-active-packages-wrap {
  margin: 0;
}

.payment-sale-mode,
.payment-sale-package,
.payment-sale-active-packages-wrap {
  display: grid;
  gap: 2px;
  align-content: start;
}

.payment-sale-base-amount {
  grid-column: 1;
}

.payment-sale-tuition {
  grid-column: 2;
}

.payment-sale-total {
  grid-column: 1;
}

.payment-sale-description {
  grid-column: 2;
}

.payment-sale-paid {
  grid-column: 1;
}

.payment-sale-type {
  grid-column: 2;
}

.payment-sale-outstanding {
  grid-column: 1;
}

.payment-sale-notes {
  grid-column: 1;
}

.payment-sale-actions {
  grid-column: 2;
  align-self: end;
}

.form-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.form-actions .btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#checkinForm .form-actions {
  grid-column: 1 / -1;
  justify-content: center;
}

#checkinForm .form-actions .btn {
  width: min(620px, 100%);
}

.checkin-entry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

#checkinFlowPrimaryActions.decision-picked {
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr) minmax(0, 0.42fr);
  align-items: center;
}

#checkinFlowPrimaryActions.decision-use-package #btnCheckinUsePackage {
  grid-column: 2;
}

#checkinFlowPrimaryActions.decision-use-package #btnCheckinNoPackage {
  grid-column: 3;
}

#checkinFlowPrimaryActions.decision-no-package #btnCheckinUsePackage {
  grid-column: 1;
}

#checkinFlowPrimaryActions.decision-no-package #btnCheckinNoPackage {
  grid-column: 2;
}

#checkinForm .checkin-entry-actions .btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  border-width: 1px;
  border-style: solid;
  justify-content: center;
  text-align: center;
}

.checkin-entry-actions .btn.btn-secondary {
  background: rgba(26, 34, 48, 0.68);
  border-color: rgba(26, 34, 48, 0.22);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.checkin-entry-actions .btn.btn-secondary:hover {
  background: rgba(26, 34, 48, 0.82);
}

.checkin-entry-actions .btn.btn-primary {
  border-color: rgba(245, 127, 32, 0.72);
  box-shadow: 0 10px 20px rgba(245, 127, 32, 0.18);
}

#checkinFlowPrimaryActions.decision-picked .btn.btn-secondary {
  transform: scale(0.78);
  opacity: 0.42;
}

.checkin-flow-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.checkin-flow-panel .muted {
  margin: 0;
}

.checkin-flow-hint-error {
  color: #a12222;
  font-weight: 700;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

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

.payments-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.payments-overview-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-height: 116px;
  padding: 16px 18px;
  border: 1px solid rgba(244, 150, 62, 0.28);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 232, 0.95));
  box-shadow: 0 14px 32px rgba(68, 42, 18, 0.08);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.payments-overview-card:hover,
.payments-overview-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(68, 42, 18, 0.12);
  border-color: rgba(244, 150, 62, 0.44);
  outline: none;
}

.payments-overview-label {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(108, 63, 20, 0.76);
}

.payments-overview-value {
  font-size: clamp(1.6rem, 2.8vw, 2.45rem);
  line-height: 1;
  font-weight: 800;
  color: #161616;
}

.payments-collapsible-panel .section-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
}

.payments-collapsible-panel .section-actions {
  margin-left: 0;
  justify-self: end;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.payments-collapsible-panel .section-actions .btn {
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 10px;
  background: transparent;
  color: #111111;
  border: 1px solid transparent;
  box-shadow: none;
}

.payments-collapsible-panel .section-actions .icon-btn {
  gap: 5px;
}

.payments-collapsible-panel .section-actions .icon-btn-glyph,
.payments-collapsible-panel .section-actions .icon-btn-glyph svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.payments-collapsible-panel .section-actions .btn:hover,
.payments-collapsible-panel .section-actions .btn:focus-visible {
  background: rgba(26, 34, 48, 0.06);
  color: #111111;
  border-color: rgba(26, 34, 48, 0.12);
}

.icon-btn-glyph {
  display: inline-flex;
  width: 14px;
  height: 14px;
}

.icon-btn-glyph svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.section-title-row h3 {
  margin: 0;
}

.payments-collapsible-panel {
  overflow: clip;
}

.payments-collapsible-header {
  cursor: pointer;
}

.payments-collapsible-header:focus-visible {
  outline: 2px solid rgba(245, 127, 32, 0.4);
  outline-offset: 4px;
  border-radius: 12px;
}

.payments-collapsible-header::after {
  content: "";
  width: 10px;
  height: 10px;
  display: inline-block;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
  margin-left: auto;
  flex: 0 0 auto;
}

.payments-collapsible-body {
  display: grid;
  gap: 12px;
  max-height: 1400px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 240ms ease, opacity 180ms ease, margin-top 220ms ease;
}

.payments-collapsible-body > * {
  min-height: 0;
}

.payments-collapsible-panel.is-collapsed .payments-collapsible-body {
  max-height: 0;
  opacity: 0;
  margin-top: -6px;
  gap: 0;
}

.payments-collapsible-panel.is-collapsed .payments-collapsible-body > * {
  overflow: hidden;
}

.payments-collapsible-panel.is-collapsed .payments-collapsible-header::after {
  transform: rotate(-45deg);
}

.payments-total-row td {
  font-weight: 800;
}

.section-title-row p {
  margin: 0;
  color: var(--muted);
}

.checkin-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.checkin-status-panel {
  min-height: 180px;
}

.history-toggle-button {
  border: 0;
  background: transparent;
  color: #1f1406;
  font: inherit;
  font-size: clamp(1.6rem, 2.3vw, 2rem);
  font-weight: 800;
  margin: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.history-toggle-button:hover {
  color: #5a2e00;
}

.history-toggle-icon {
  font-size: 1rem;
  color: #7a4a10;
  transition: transform 0.18s ease;
}

.history-toggle-button[aria-expanded="true"] .history-toggle-icon {
  transform: rotate(180deg);
}

#checkinHistoryContent {
  margin-top: 10px;
}

#adminStudents .section-title-row,
#adminParents .section-title-row,
#adminProducts .section-title-row,
#adminPackages .section-title-row,
#adminTeachers .section-title-row {
  margin-bottom: 12px;
}

#adminAttendance .panel:first-child > h3,
#adminPayments .panel:first-child > h3 {
  margin: 0 0 12px;
}

.table-wrap {
  overflow-x: auto;
}

.product-table-wrap {
  max-height: 305px;
  overflow-y: auto;
}

.product-table-wrap thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 239, 219, 0.98);
  z-index: 1;
}

.parents-table-wrap {
  max-height: 305px;
  overflow-y: auto;
}

.parents-table-wrap thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 239, 219, 0.98);
  z-index: 1;
}

.students-table-wrap,
.packages-table-wrap,
.teachers-table-wrap {
  max-height: 305px;
  overflow-y: auto;
}

.students-table-wrap thead th,
.packages-table-wrap thead th,
.teachers-table-wrap thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 239, 219, 0.98);
  z-index: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid rgba(245, 127, 32, 0.18);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  color: #7a4a10;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checkin-sort-button {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.checkin-sort-button:hover {
  text-decoration: underline;
}

.checkin-sort-button.active {
  color: #5a2e00;
}

.hidden {
  display: none !important;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-tab {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font-family: inherit;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.9);
  color: #3b2000;
  border: 1px solid rgba(245, 127, 32, 0.24);
  cursor: pointer;
}

.admin-tab.active {
  background: rgba(245, 127, 32, 0.2);
  border: 1px solid rgba(245, 127, 32, 0.6);
}

.admin-section {
  display: none;
  gap: 16px;
}

.admin-section.visible {
  display: grid;
}

.analytics-header-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.analytics-header-panel h3,
.analytics-card h3 {
  margin: 0;
}

.analytics-header-panel p,
.analytics-card p {
  margin: 6px 0 0;
  color: #7a4a10;
}

.analytics-isolation-badge {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(26, 34, 48, 0.92), rgba(49, 62, 86, 0.9));
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.92rem;
  line-height: 1.4;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.analytics-kpi-card {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(255, 244, 230, 0.96));
  border: 1px solid rgba(245, 127, 32, 0.2);
  box-shadow: 0 18px 40px rgba(245, 127, 32, 0.08);
  transition:
    transform 0.32s ease,
    box-shadow 0.32s ease,
    opacity 0.32s ease,
    filter 0.32s ease;
  animation: analyticsFadeRise 0.46s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.analytics-kpi-label {
  display: block;
  margin-bottom: 8px;
  color: #7a4a10;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analytics-kpi-value {
  display: block;
  color: #1b1206;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.1;
  font-weight: 900;
}

.analytics-kpi-meta {
  margin-top: 8px;
  color: #8b5a1d;
  font-size: 0.93rem;
}

.analytics-kpi-meta.positive {
  color: #0b7a41;
}

.analytics-kpi-meta.negative {
  color: #b42318;
}

.analytics-grid {
  display: grid;
  gap: 16px;
}

.analytics-chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analytics-card-wide {
  grid-column: 1 / -1;
}

.analytics-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.analytics-card {
  transition:
    transform 0.32s ease,
    box-shadow 0.32s ease,
    opacity 0.32s ease,
    filter 0.32s ease;
  animation: analyticsFadeRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.analytics-chart-wrap {
  position: relative;
  min-height: 280px;
}

.analytics-chart-wrap canvas {
  transition:
    opacity 0.34s ease,
    transform 0.34s ease,
    filter 0.34s ease;
}

.analytics-chart-wrap-sm {
  min-height: 250px;
}

.analytics-list,
.analytics-highlight-list {
  display: grid;
  gap: 10px;
}

.analytics-list-item,
.analytics-highlight-item {
  border-radius: 16px;
  border: 1px solid rgba(245, 127, 32, 0.14);
  background: rgba(255, 249, 242, 0.9);
  padding: 12px 14px;
  transition:
    transform 0.32s ease,
    opacity 0.32s ease,
    box-shadow 0.32s ease,
    filter 0.32s ease;
  animation: analyticsFadeRise 0.46s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.analytics-list-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.analytics-list-title {
  font-weight: 900;
  color: #2d1900;
}

.analytics-list-subtitle {
  margin-top: 4px;
  color: #8b5a1d;
  font-size: 0.92rem;
}

.analytics-list-value {
  color: #2d1900;
  font-weight: 900;
  white-space: nowrap;
}

.analytics-highlight-item {
  color: #6c430f;
  line-height: 1.55;
}

.analytics-ai-panel {
  display: grid;
  gap: 14px;
}

.analytics-ai-panel.analytics-ai-panel-locked {
  background: linear-gradient(155deg, rgba(242, 242, 242, 0.96), rgba(231, 231, 231, 0.94));
  border-color: rgba(120, 120, 120, 0.18);
}

.analytics-ai-panel.analytics-ai-panel-locked .analytics-card-header h3,
.analytics-ai-panel.analytics-ai-panel-locked .analytics-card-header p,
.analytics-ai-panel.analytics-ai-panel-locked .analytics-ai-response,
.analytics-ai-panel.analytics-ai-panel-locked label {
  color: rgba(60, 60, 60, 0.9);
}

.analytics-ai-panel.analytics-ai-panel-locked .analytics-ai-response {
  background: linear-gradient(155deg, rgba(248, 248, 248, 0.98), rgba(238, 238, 238, 0.96));
  border-color: rgba(120, 120, 120, 0.14);
}

.analytics-quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.analytics-question-chip {
  width: auto !important;
  min-height: 42px;
  padding-inline: 14px;
  background: rgba(26, 34, 48, 0.82);
}

.analytics-question-chip:hover {
  background: rgba(26, 34, 48, 0.96);
}

.analytics-question-chip:disabled,
.analytics-ai-panel .btn:disabled,
.analytics-ai-panel textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.analytics-ai-form {
  display: grid;
  gap: 10px;
}

.analytics-ai-textarea {
  min-height: 118px;
  resize: vertical;
}

.analytics-ai-response {
  border-radius: 20px;
  border: 1px solid rgba(245, 127, 32, 0.2);
  background: linear-gradient(155deg, rgba(255, 252, 248, 0.98), rgba(255, 246, 235, 0.96));
  padding: 16px;
  color: #4a2f0a;
  line-height: 1.6;
  transition:
    transform 0.32s ease,
    opacity 0.32s ease,
    box-shadow 0.32s ease,
    filter 0.32s ease;
}

.analytics-ai-response h4 {
  margin: 0 0 8px;
  color: #2d1900;
}

.analytics-ai-response p,
.analytics-ai-response ul {
  margin: 0 0 10px;
}

.analytics-ai-response ul {
  padding-left: 18px;
}

.analytics-loading,
.analytics-empty-state {
  border-radius: 18px;
  border: 1px dashed rgba(245, 127, 32, 0.3);
  background: rgba(255, 249, 242, 0.84);
  padding: 18px;
  color: #7a4a10;
}

#adminAnalytics.analytics-refreshing .analytics-kpi-card,
#adminAnalytics.analytics-refreshing .analytics-card,
#adminAnalytics.analytics-refreshing .analytics-list-item,
#adminAnalytics.analytics-refreshing .analytics-highlight-item,
#adminAnalytics.analytics-refreshing .analytics-ai-response {
  opacity: 0.76;
  transform: translateY(3px) scale(0.995);
  filter: saturate(0.92);
}

#adminAnalytics.analytics-refreshing .analytics-chart-wrap canvas {
  opacity: 0.78;
  transform: scale(0.992);
  filter: saturate(0.9);
}

.analytics-kpi-card:hover,
.analytics-card:hover,
.analytics-list-item:hover,
.analytics-highlight-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(245, 127, 32, 0.12);
}

.analytics-kpi-card:nth-child(2),
.analytics-list-item:nth-child(2),
.analytics-highlight-item:nth-child(2) {
  animation-delay: 0.03s;
}

.analytics-kpi-card:nth-child(3),
.analytics-list-item:nth-child(3),
.analytics-highlight-item:nth-child(3) {
  animation-delay: 0.06s;
}

.analytics-kpi-card:nth-child(4),
.analytics-list-item:nth-child(4),
.analytics-highlight-item:nth-child(4) {
  animation-delay: 0.09s;
}

.analytics-kpi-card:nth-child(5),
.analytics-list-item:nth-child(5),
.analytics-highlight-item:nth-child(5) {
  animation-delay: 0.12s;
}

@keyframes analyticsFadeRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.builder-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 247, 236, 0.95);
  border: 1px solid var(--border);
}

.builder-item {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
}

.product-schedule-field {
  grid-column: 1 / -1;
}

.product-schedule-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 247, 236, 0.95);
  border: 1px solid var(--border);
}

.product-schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.product-schedule-row .input {
  min-width: 0;
}

.product-schedule-actions {
  margin-top: 8px;
}

.multi-picker {
  max-height: 160px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(245, 127, 32, 0.35);
  background: rgba(255, 247, 236, 0.95);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.multi-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 2px;
  margin-bottom: 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
}

.multi-picker-item span {
  font-weight: 600;
}

.multi-picker-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.student-enrollments-field {
  grid-column: 1 / -1;
}

.student-enrollments-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 247, 236, 0.95);
  border: 1px solid var(--border);
}

.student-enrollment-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.student-enrollment-row .input {
  min-width: 0;
}

.student-enrollments-actions {
  margin-top: 8px;
}

.timesup-board {
  display: grid;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.timesup-card {
  border-radius: 12px;
  border: 1px solid rgba(245, 127, 32, 0.24);
  background: rgba(255, 250, 243, 0.98);
  padding: 11px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.timesup-card.selectable {
  cursor: pointer;
}

.timesup-card.selectable:hover {
  background: rgba(245, 127, 32, 0.08);
}

.timesup-card.danger {
  border-color: rgba(238, 84, 84, 0.85);
  background: rgba(66, 18, 18, 0.72);
}

.timesup-time {
  font-weight: 800;
  text-align: right;
}

.birthdays-board {
  display: grid;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.birthday-group {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(245, 127, 32, 0.22);
  border-radius: 12px;
  background: rgba(255, 250, 243, 0.96);
  padding: 10px;
}

.birthday-empty {
  min-height: 132px;
  border: 1px solid rgba(245, 127, 32, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(rgba(255, 250, 243, 0.52), rgba(255, 245, 232, 0.52)),
    url("./pngtree-black-and-orange-balloons-for-a-festive-vibe-png-image_15912517.png") center / contain no-repeat,
    linear-gradient(150deg, rgba(255, 250, 243, 0.96), rgba(255, 245, 232, 0.96));
  opacity: 0.96;
}

.birthday-group-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #5a3508;
}

.birthday-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 3px;
}

.birthday-list li {
  font-size: 0.9rem;
  color: #2d1a00;
}

.btn-timesup-confirm {
  margin-top: 8px;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.status-ok {
  color: var(--ok);
  font-weight: 700;
}

.status-warn {
  color: var(--warn);
  font-weight: 700;
}

.status-danger {
  color: var(--danger);
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-pill.status-danger {
  color: #9b1c1c;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.status-pill.status-warning {
  color: #92400e;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
}

.status-pill.status-info {
  color: #1e3a8a;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
}

.status-pill.status-ok {
  color: #166534;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}

.badge {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge.package {
  background: rgba(245, 127, 32, 0.13);
  border-color: rgba(245, 127, 32, 0.45);
  white-space: nowrap;
}

.badge.package.package-ok {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.45);
  color: #166534;
}

.badge.package.package-warning {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
  color: #7a4204;
}

.badge.package.package-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.5);
  color: #991b1b;
  font-weight: 700;
}

.badge.status-open {
  background: rgba(239, 180, 62, 0.18);
  border-color: rgba(239, 180, 62, 0.6);
  color: #6d4b00;
}

.badge.status-closed {
  background: rgba(18, 183, 106, 0.16);
  border-color: rgba(18, 183, 106, 0.55);
  color: #0f5a36;
}

.btn-checkout {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.modal {
  width: min(680px, 92vw);
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.payments-module-content {
  max-height: min(93vh, 900px);
  overflow: auto;
  display: grid;
  gap: 14px;
}

#paymentsModuleMount {
  display: grid;
  gap: 16px;
}

#checkinPaymentsContent.payments-module-content {
  max-height: none;
  overflow: visible;
}

#checkoutDialog {
  width: min(980px, 95vw);
  max-height: min(94vh, 860px);
  overflow-y: auto;
  overflow-x: hidden;
}

#checkoutForm {
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 22, 10, 0.38);
  backdrop-filter: blur(10px);
}

.auth-card {
  width: min(460px, calc(100vw - 24px));
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 236, 0.98));
  border: 1px solid rgba(245, 127, 32, 0.22);
  box-shadow: 0 24px 54px rgba(56, 28, 0, 0.18);
}

.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.auth-card-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(90, 45, 0, 0.16);
}

.auth-card h2 {
  margin: 0;
  font-size: 1.6rem;
}

.auth-card p {
  margin: 4px 0 0;
  color: #6b4a1f;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-message {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.92rem;
  color: #7f531e;
}

.auth-message.auth-message-error {
  color: #b43a2b;
}

.modal-content {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 236, 0.98));
  border: 1px solid rgba(245, 127, 32, 0.35);
  border-radius: 20px;
  padding: 12px 16px 16px;
  color: #111111;
  box-sizing: border-box;
}

.modal-content h3 {
  margin: 0 0 8px;
  color: #1a1a1a;
}

.modal-content p {
  margin-top: 0;
  color: var(--muted);
}

.modal-content label {
  color: #2b1c07;
}

.modal-content .input {
  background: #ffffff;
  border-color: rgba(245, 127, 32, 0.35);
  color: #111111;
}

.modal-content .input::placeholder {
  color: #9a6a2d;
  opacity: 1;
}

.quick-student-form-message {
  margin: 0;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(238, 84, 84, 0.9);
  background: rgba(255, 244, 244, 0.98);
  color: #7a1010;
  font-weight: 800;
  text-align: center;
}

.modal-content input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.7;
}

.modal-actions {
  margin-top: 18px;
  padding-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: inherit;
  position: relative;
  z-index: 1;
}

.checkout-package-context {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245, 127, 32, 0.08);
  border: 1px solid rgba(245, 127, 32, 0.22);
  font-size: 0.92rem;
  line-height: 1.35;
}

.checkout-credit-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.checkout-credit-line::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 10px;
}

.checkout-credit-line.checkout-credit-ok {
  color: #0f6b39;
  background: rgba(17, 124, 67, 0.16);
  border-color: rgba(17, 124, 67, 0.45);
}

.checkout-credit-line.checkout-credit-warning {
  color: #8f4e00;
  background: rgba(245, 133, 31, 0.18);
  border-color: rgba(245, 133, 31, 0.52);
}

.checkout-credit-line.checkout-credit-critical {
  color: #9f1414;
  background: rgba(212, 37, 37, 0.18);
  border-color: rgba(212, 37, 37, 0.58);
}

#checkoutPaymentHint.checkout-hint-critical {
  color: #9f1414;
  font-weight: 800;
}

.checkout-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  flex: 1 1 auto;
  min-height: 0;
}

.checkout-services-col {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.checkout-services-col .multi-picker {
  height: clamp(300px, calc(100vh - 390px), 560px);
  max-height: clamp(300px, calc(100vh - 390px), 560px);
  min-height: 300px;
  gap: 2px;
  padding: 6px 8px;
  overflow-y: auto;
}

.checkout-services-col .multi-picker-item {
  gap: 6px;
  padding: 1px 0;
  font-size: 0.82rem;
  line-height: 1.05;
}

.checkout-services-col .multi-picker-item span {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkout-services-col .multi-picker-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.checkout-side-col {
  grid-column: 2;
  display: grid;
  grid-auto-rows: min-content;
  gap: 8px;
  align-content: start;
  padding-bottom: 8px;
}

.checkout-side-field {
  min-width: 0;
}

.range-filter-modal .modal-actions {
  flex-wrap: wrap;
}

.payments-total-row td {
  font-weight: 800;
  background: rgba(245, 127, 32, 0.12);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 10px 13px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.22s ease;
  z-index: 1200;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-center {
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  min-width: min(520px, 92vw);
  max-width: min(620px, 92vw);
  text-align: center;
  padding: 16px 20px;
  border-width: 2px;
  font-size: 1.06rem;
  font-weight: 800;
  transform: translate(-50%, calc(-50% + 10px));
}

.toast.toast-center.visible {
  transform: translate(-50%, -50%);
}

.toast.toast-prominent {
  background: rgba(255, 248, 236, 0.98);
  color: #3b2000;
  border-color: rgba(245, 127, 32, 0.8);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

.toast.toast-prominent.toast-error {
  background: rgba(255, 244, 244, 0.99);
  border-color: rgba(238, 84, 84, 0.95);
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  font-size: 0.8rem;
  padding: 6px 8px;
}

.renewal-table-wrap {
  overflow-x: hidden;
}

.renewal-watch-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.84rem;
}

.renewal-watch-table .renewal-nowrap {
  display: block;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.renewal-watch-table th,
.renewal-watch-table td {
  padding: 8px 5px;
  vertical-align: middle;
}

.renewal-watch-table th {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.04;
}

.renewal-watch-table th:nth-child(1),
.renewal-watch-table td:nth-child(1) {
  width: 24%;
}

.renewal-watch-table th:nth-child(2),
.renewal-watch-table td:nth-child(2) {
  width: 14%;
}

.renewal-watch-table th:nth-child(3),
.renewal-watch-table td:nth-child(3) {
  width: 6%;
}

.renewal-watch-table th:nth-child(4),
.renewal-watch-table td:nth-child(4) {
  width: 14%;
}

.renewal-watch-table th:nth-child(5),
.renewal-watch-table td:nth-child(5) {
  width: 13%;
}

.renewal-watch-table th:nth-child(6),
.renewal-watch-table td:nth-child(6) {
  width: 18%;
}

.renewal-watch-table th:nth-child(7),
.renewal-watch-table td:nth-child(7) {
  width: 11%;
}

.renewal-watch-table .checkin-sort-button {
  width: 100%;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.02;
  display: block;
  text-align: left;
  font-size: 0.78rem;
}

.renewal-watch-table .renewal-cell-student,
.renewal-watch-table .renewal-cell-service,
.renewal-watch-table .renewal-cell-package,
.renewal-watch-table .renewal-cell-status,
.renewal-watch-table .renewal-cell-contacted,
.renewal-watch-table .renewal-cell-balance,
.renewal-watch-table .renewal-cell-amount {
  white-space: nowrap;
}

.renewal-watch-table .renewal-cell-actions {
  min-width: 0;
  white-space: nowrap;
  padding-left: 3px;
  padding-right: 3px;
}

.renewal-contact-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.renewal-contact-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1a2230;
  flex: 0 0 auto;
}

.renewal-contact-date {
  display: inline-block;
  min-width: 78px;
}

.renewal-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.renewal-actions .btn {
  min-width: auto;
  width: auto;
  white-space: nowrap;
  font-size: 0.74rem;
  line-height: 1;
  padding: 7px 10px;
  text-align: center;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: normal;
}

.renewal-actions a.btn {
  text-align: center;
}

.product-row-selectable {
  cursor: pointer;
}

.product-row-selectable:hover {
  background: rgba(245, 127, 32, 0.09);
}

.product-row-selected {
  background: rgba(245, 127, 32, 0.14);
}

.entity-row-selectable {
  cursor: pointer;
}

.entity-row-selectable:hover {
  background: rgba(245, 127, 32, 0.09);
}

.entity-row-selected {
  background: rgba(245, 127, 32, 0.14);
}

.entity-row-inactive {
  opacity: 0.66;
}

.role-hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

@media (max-width: 980px) {
  main,
  #checkinMainContent,
  .view.visible {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 16px;
  }

  .view.visible > *,
  #checkinMainContent > *,
  main > * {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .app-shell {
    width: auto;
    margin: 12px 10px 24px;
    overflow-x: clip;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-width: 0;
  }

  .topbar-controls {
    width: 100%;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;
    min-width: 0;
  }

  .brand {
    width: 100%;
    align-items: center;
    min-width: 0;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  .role-control {
    width: 100%;
    justify-content: space-between;
  }

  .auth-session {
    width: 100%;
    justify-content: space-between;
  }

  .role-select {
    min-width: 0;
    width: 100%;
  }

  .view-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
  }

  .view-toggle .toggle {
    width: 100%;
    min-width: 0;
  }

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

  .checkout-services-col {
    grid-column: auto;
    grid-row: auto;
    min-height: 220px;
  }

  .checkout-services-col .multi-picker {
    height: auto;
    max-height: 42vh;
    min-height: 200px;
  }

  .student-enrollment-row {
    grid-template-columns: 1fr;
  }

  .product-schedule-row {
    grid-template-columns: 1fr;
  }

  #checkoutDialog {
    width: min(100vw - 10px, 760px);
    max-width: calc(100vw - 10px);
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
  }

  #checkoutForm {
    max-height: none;
    overflow: visible;
  }

  .checkout-side-col {
    grid-column: auto;
  }

  .panel {
    padding: 14px;
    border-radius: 16px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .view,
  .view.visible,
  .checkin-status-row,
  .timesup-board,
  .birthdays-board,
  .hero-panel,
  .checkin-search-row,
  .student-results {
    min-width: 0;
    max-width: 100%;
  }

  .section-title-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .section-title-row > * {
    min-width: 0;
  }

  .payments-collapsible-header {
    align-items: flex-start;
  }

  .payments-collapsible-panel .section-title-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
  }

  .payments-collapsible-header::after {
    justify-self: end;
  }

  .payments-collapsible-panel .section-actions {
    width: auto;
    justify-self: start;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .payments-overview-grid {
    grid-template-columns: 1fr;
  }

  .payment-sale-grid {
    grid-template-columns: 1fr;
  }

  .payment-sale-date,
  .payment-sale-student,
  .payment-sale-left-stack,
  .payment-sale-mode,
  .payment-sale-products,
  .payment-sale-package,
  .payment-sale-active-packages-wrap,
  .payment-sale-base-amount,
  .payment-sale-tuition,
  .payment-sale-total,
  .payment-sale-description,
  .payment-sale-paid,
  .payment-sale-type,
  .payment-sale-outstanding,
  .payment-sale-notes,
  .payment-sale-actions {
    grid-column: auto;
    grid-row: auto;
  }

  .hero-actions,
  .checkin-view-tabs,
  .form-actions,
  .modal-actions {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .hero-actions .btn,
  .checkin-view-tabs .btn,
  .form-actions .btn {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .hero-actions .btn + .btn,
  .checkin-view-tabs .btn + .btn,
  .form-actions .btn + .btn,
  .modal-actions .btn + .btn {
    margin-top: 10px;
  }

  .checkin-view-tabs .btn {
    min-width: 0;
  }

  .checkin-entry-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #checkinFlowPrimaryActions.decision-picked {
    grid-template-columns: minmax(0, 0.34fr) minmax(0, 1fr) minmax(0, 0.34fr);
  }

  #checkinForm .checkin-entry-actions .btn {
    width: 100%;
    min-height: 48px;
    padding: 10px 8px;
    font-size: 0.92rem;
    line-height: 1.15;
  }

  .checkin-entry-actions .btn + .btn {
    margin-top: 0;
  }

  .analytics-header-panel,
  .analytics-card-header,
  .analytics-list-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .analytics-kpi-grid,
  .analytics-chart-grid,
  .analytics-detail-grid {
    grid-template-columns: 1fr;
  }

  .analytics-isolation-badge {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .analytics-chart-wrap,
  .analytics-chart-wrap-sm {
    min-height: 240px;
  }

  .input,
  select,
  button,
  textarea {
    font-size: 16px;
    max-width: 100%;
  }

  th,
  td {
    font-size: 0.86rem;
    padding: 8px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }

  .renewal-watch-table {
    table-layout: fixed;
    font-size: 0.78rem;
  }

  .renewal-watch-table th,
  .renewal-watch-table td {
    padding: 7px 4px;
  }

  .renewal-watch-table th {
    font-size: 0.72rem;
  }

  .renewal-watch-table th:nth-child(1),
  .renewal-watch-table td:nth-child(1) {
    width: 24%;
  }

  .renewal-watch-table th:nth-child(2),
  .renewal-watch-table td:nth-child(2) {
    width: 14%;
  }

  .renewal-watch-table th:nth-child(3),
  .renewal-watch-table td:nth-child(3) {
    width: 6%;
  }

  .renewal-watch-table th:nth-child(4),
  .renewal-watch-table td:nth-child(4) {
    width: 14%;
  }

  .renewal-watch-table th:nth-child(5),
  .renewal-watch-table td:nth-child(5) {
    width: 13%;
  }

  .renewal-watch-table th:nth-child(6),
  .renewal-watch-table td:nth-child(6) {
    width: 18%;
  }

  .renewal-watch-table th:nth-child(7),
  .renewal-watch-table td:nth-child(7) {
    width: 11%;
  }

  .renewal-watch-table .checkin-sort-button {
    font-size: 0.7rem;
  }

  .renewal-actions .btn {
    font-size: 0.68rem;
    padding: 6px 8px;
  }

  .renewal-contact-date {
    min-width: 68px;
    font-size: 0.72rem;
  }

  .modal {
    width: min(100vw - 12px, 760px);
    max-width: calc(100vw - 12px);
    margin: 6px;
  }

  .modal-content {
    border-radius: 16px;
    padding: 12px;
  }

  .checkout-package-context {
    font-size: 0.88rem;
    padding: 10px;
  }

  .checkout-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .checkout-services-col,
  .checkout-side-col {
    grid-column: auto;
  }

  .checkout-services-col .multi-picker {
    max-height: min(36vh, 320px);
    min-height: 160px;
    padding: 8px;
  }

  .checkout-services-col .multi-picker-item {
    padding: 4px 0;
    font-size: 0.92rem;
    line-height: 1.2;
  }

  .checkout-services-col .multi-picker-item span {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .checkout-services-col .multi-picker-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: 0 0 18px;
  }

  .timesup-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .timesup-time {
    text-align: left;
  }

  .checkin-status-row {
    grid-template-columns: 1fr;
  }

  .checkin-status-panel {
    min-height: 0;
  }

  .hero-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-empty {
    flex-direction: column;
    align-items: flex-start;
  }

  .checkin-search-row {
    display: block;
  }

  .checkin-search-row .btn {
    display: block;
    width: 100%;
    min-height: 44px;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    margin-top: 10px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .app-shell {
    width: auto;
    margin: 6px;
  }

  .topbar-controls {
    flex-direction: column;
    justify-content: flex-start;
  }

  .brand h1 {
    font-size: 1.3rem;
  }

  .panel {
    padding: 12px;
  }

  .modal {
    width: calc(100vw - 8px);
    max-width: calc(100vw - 8px);
    margin: 4px;
  }

  #checkoutDialog {
    width: calc(100vw - 6px);
    max-width: calc(100vw - 6px);
    max-height: calc(100dvh - 6px);
    margin: 3px;
  }

  .modal-content {
    padding: 10px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .checkout-services-col .multi-picker {
    max-height: 30vh;
    min-height: 148px;
  }
}
