:root {
  --bg: #f7f1f6;
  --surface: #fffafd;
  --ink: #2e2630;
  --muted: #776c77;
  --line: #ead9e6;
  --teal: #08756f;
  --teal-soft: #e2f4f0;
  --coral: #c45d78;
  --coral-soft: #ffe2ed;
  --amber: #b88624;
  --amber-soft: #fff0cf;
  --blue: #596aa1;
  --blue-soft: #e9ecfb;
  --green: #507b35;
  --lotus: #8b0f80;
  --lotus-deep: #5e155f;
  --orchid: #e8a7d8;
  --leaf: #b6c700;
  --gold: #d0a742;
  --burgundy: #6d1118;
  --premium-gold: #e7c46d;
  --shadow: 0 22px 60px rgba(89, 31, 86, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(118deg, rgba(109, 17, 24, 0.05) 0 16%, transparent 16% 100%),
    linear-gradient(118deg, transparent 0 14%, rgba(255, 255, 255, 0.75) 14% 21%, transparent 21% 100%),
    radial-gradient(ellipse at 10% 2%, rgba(232, 167, 216, 0.42), transparent 34%),
    radial-gradient(ellipse at 96% 0%, rgba(182, 199, 0, 0.22), transparent 28%),
    var(--bg);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

body.auth-checking {
  background: linear-gradient(180deg, #172293 0%, #101d82 48%, #0b1872 100%);
}

body.auth-checking .app-shell {
  visibility: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background:
    url("./assets/botanical-damask-tile-gold.svg") 18px 18px / 150px 238px repeat,
    linear-gradient(rgba(124, 70, 95, 0.72), rgba(47, 72, 70, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 42%),
    radial-gradient(ellipse at 18% 4%, rgba(255, 204, 239, 0.36), transparent 38%),
    radial-gradient(ellipse at 88% 92%, rgba(175, 211, 134, 0.2), transparent 32%),
    linear-gradient(180deg, #7c465f, #384f51 78%, #2f4846);
  color: #f7fbf9;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: auto -76px 26px auto;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(231, 196, 109, 0.14);
  border-radius: 50%;
  transform: rotate(18deg);
  background: radial-gradient(circle, rgba(231, 196, 109, 0.16), transparent 68%);
  opacity: 0.5;
  pointer-events: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 240, 184, 0.24), transparent 45%),
    linear-gradient(135deg, var(--burgundy), rgba(8, 117, 111, 0.88));
  border: 1px solid rgba(231, 196, 109, 0.46);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 12px 26px rgba(38, 20, 35, 0.22);
  font-weight: 800;
}

.brand p,
.brand strong,
.shop-card p,
.shop-card span,
.eyebrow,
.metric-card p,
.metric-card span,
.therapist-name span,
.person-card span {
  margin: 0;
}

.brand p,
.shop-card span {
  color: #a9bbb8;
  font-size: 12px;
}

.brand strong {
  font-size: 16px;
}

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

.nav-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 12px;
  color: #dce7e4;
  background: transparent;
  font-size: 20px;
  font-weight: 650;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 3px 0 0 var(--premium-gold), 0 8px 18px rgba(38, 20, 35, 0.1);
  backdrop-filter: blur(10px);
}

.shop-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 238, 190, 0.36);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
}

.shop-card strong {
  display: block;
  margin: 6px 0;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 8px;
  padding: 10px 16px;
  border: 1px solid rgba(234, 217, 230, 0.9);
  border-radius: var(--radius);
  background:
    url("./assets/botanical-damask-tile-gold.svg") right 18px top 12px / 132px 208px repeat,
    linear-gradient(106deg, rgba(255, 250, 253, 0.96) 0 47%, rgba(109, 17, 24, 0.1) 47% 100%),
    radial-gradient(ellipse at 78% 42%, rgba(232, 167, 216, 0.5), transparent 36%),
    radial-gradient(ellipse at 92% 18%, rgba(182, 199, 0, 0.24), transparent 28%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -72px;
  width: 250px;
  height: 250px;
  opacity: 0.18;
  background:
    conic-gradient(from 12deg, transparent 0 12deg, rgba(139, 15, 128, 0.42) 12deg 28deg, transparent 28deg 44deg),
    conic-gradient(from 102deg, transparent 0 12deg, rgba(232, 167, 216, 0.45) 12deg 30deg, transparent 30deg 48deg);
  border-radius: 50%;
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  color: var(--burgundy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.spa-ribbon {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  align-items: center;
  gap: 12px;
  margin: -2px 0 12px;
}

.spa-ribbon span {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(231, 196, 109, 0.78), transparent);
}

.spa-ribbon span:nth-child(2) {
  height: 8px;
  border-top: 1px solid rgba(231, 196, 109, 0.82);
  border-bottom: 1px solid rgba(231, 196, 109, 0.82);
  background:
    repeating-linear-gradient(45deg, rgba(231, 196, 109, 0.66) 0 1px, transparent 1px 7px),
    transparent;
}

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

h1 {
  max-width: 760px;
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 20px;
}

.top-actions,
.panel-head,
.line-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(234, 217, 230, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 250, 253, 0.72);
}

.language-switch button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
}

.language-switch button.selected {
  color: #ffffff;
  background: var(--burgundy);
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-head.compact {
  align-items: flex-start;
}

.primary-btn,
.ghost-btn,
.mini-btn,
.segmented button,
.line-actions button,
.close-btn {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 40px;
}

.primary-btn {
  border: 0;
  padding: 0 18px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--burgundy), var(--lotus-deep));
  box-shadow: 0 10px 24px rgba(109, 17, 24, 0.23);
}

.ghost-btn,
.mini-btn {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.86);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

.report-summary article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 253, 0.82);
}

.report-summary span,
.report-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-summary strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 24px;
}

.report-filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.report-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.report-filters input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--ink);
  background: #fffafd;
}

.report-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: #f2e6f0;
}

.report-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
}

.report-tabs button.selected {
  color: #ffffff;
  background: var(--burgundy);
}

.report-tab-panel {
  display: none;
}

.report-tab-panel.active {
  display: block;
}

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

.subhead-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.subhead h3 {
  margin: 0;
  font-size: 18px;
}

.report-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.metric-card,
.panel,
.person-card {
  border: 1px solid rgba(231, 196, 109, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 250, 253, 0.96)),
    var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 10px 14px;
  position: relative;
  overflow: hidden;
  min-height: 92px;
}

.metric-card::after,
.panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--burgundy), var(--premium-gold), var(--teal));
  opacity: 0.75;
}

.panel::before,
.person-card::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 10px;
  width: 74px;
  height: 74px;
  opacity: 0.1;
  background: url("./assets/botanical-damask-tile-gold.svg") center / 90px 142px repeat;
  pointer-events: none;
}

.metric-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 24px;
  line-height: 1.1;
}

.metric-card span,
.metric-card p {
  color: var(--muted);
  font-size: 13px;
}

.metric-card p {
  line-height: 1.35;
}

.metric-card.warning {
  background: var(--amber-soft);
}

.dashboard-layout,
.finance-layout,
.line-layout,
.workspace-grid,
.customer-layout,
.package-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(290px, 0.8fr);
  gap: 18px;
}

.package-hero {
  min-height: 250px;
}

.package-price {
  display: inline-grid;
  gap: 2px;
  margin: 8px 0 16px;
  align-items: start;
}

.package-price span,
.package-price p,
.annual-offer span,
.annual-offer p {
  margin: 0;
  color: var(--muted);
}

.package-price strong {
  color: var(--burgundy);
  font-size: 46px;
  line-height: 1;
}

.package-price del,
.annual-offer del {
  color: #9a8d96;
  font-size: 17px;
  font-weight: 800;
  text-decoration-thickness: 2px;
}

.annual-offer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(231, 196, 109, 0.38);
  border-radius: var(--radius);
  background: var(--amber-soft);
}

.annual-offer strong {
  display: block;
  margin: 2px 0 4px;
  font-size: 24px;
}

.payment-list,
.rules-grid {
  display: grid;
  gap: 10px;
}

.payment-list article,
.rules-grid article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 253, 0.82);
}

.payment-list p,
.rules-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.package-rules {
  margin-top: 18px;
}

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

.panel {
  padding: 16px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.person-card {
  position: relative;
  overflow: hidden;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: var(--radius);
  background: #f2e6f0;
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.segmented .selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(31, 42, 43, 0.08);
}

.timeline {
  display: grid;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.time-axis,
.timeline-row {
  display: grid;
  grid-template-columns: 108px minmax(720px, 1fr);
  gap: 12px;
  align-items: center;
}

.time-axis {
  color: var(--muted);
  font-size: 12px;
}

.time-axis > div {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.therapist-name {
  min-height: 50px;
  display: grid;
  align-content: center;
  gap: 2px;
}

.therapist-name span {
  color: var(--muted);
  font-size: 12px;
}

.slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(104px, 1fr));
  gap: 8px;
  min-height: 50px;
}

.slot {
  border: 0;
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: left;
  color: var(--ink);
  min-width: 0;
}

.slot small {
  display: block;
  margin-top: 2px;
}

.slot.teal {
  background: linear-gradient(180deg, #f5fffc, var(--teal-soft));
  border-left: 4px solid var(--teal);
}

.slot.coral {
  background: linear-gradient(180deg, #fff8fb, var(--coral-soft));
  border-left: 4px solid var(--coral);
}

.slot.amber {
  background: linear-gradient(180deg, #fffaf1, var(--amber-soft));
  border-left: 4px solid var(--amber);
}

.slot.open {
  background: #edf7ef;
  color: var(--green);
  border: 1px dashed rgba(61, 141, 82, 0.5);
}

.slot.open:hover {
  background: #dff2e4;
  border-color: rgba(61, 141, 82, 0.78);
  box-shadow: inset 0 0 0 1px rgba(61, 141, 82, 0.18);
}

.slot.muted {
  background: #edf0ef;
  color: var(--muted);
}

.queue-list,
.availability-list,
.deduction-list,
.automation-list,
.customer-list,
.history-list {
  display: grid;
  gap: 12px;
}

.queue-list article,
.availability-list article,
.deduction-list article,
.automation-list article,
.customer-row,
.history-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 250, 253, 0.94)),
    #fff7fb;
}

.customer-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
}

.customer-row.active {
  border-color: rgba(109, 17, 24, 0.24);
  box-shadow: inset 3px 0 0 var(--burgundy);
}

.avatar-mini {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, var(--burgundy), var(--teal));
  font-weight: 800;
}

.customer-row p,
.history-list p,
.note-box p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

.profile-summary div,
.note-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 253, 0.76);
}

.profile-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.note-box {
  margin-bottom: 12px;
}

.queue-list p,
.availability-list p,
.automation-list p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.channel,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.channel.line,
.status.ok {
  color: #206931;
  background: #dff3df;
}

.channel.phone {
  color: #345c92;
  background: var(--blue-soft);
}

.channel.walkin,
.status.wait {
  color: #79520d;
  background: var(--amber-soft);
}

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

.booking-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.booking-form input,
.booking-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: #fffafd;
}

.availability-list article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin-top: 4px;
}

.person-card {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.line-sent,
.line-pending {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.line-sent {
  color: #1f7133;
  background: #dff3df;
}

.line-pending {
  color: #79520d;
  background: var(--amber-soft);
}

.sent-btn {
  color: #1f7133;
  border-color: #bde6bf;
  background: #f0fbf1;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.image-avatar.has-photo {
  color: transparent;
}

.upload-photo {
  justify-self: start;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.avatar.warm {
  background: linear-gradient(135deg, var(--coral), var(--lotus));
}

.avatar.cool {
  background: linear-gradient(135deg, var(--blue), var(--teal));
}

.avatar.fresh {
  background: linear-gradient(135deg, var(--teal), var(--leaf));
}

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

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

.settlement-table th,
.settlement-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.settlement-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.deduction-list article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.deduction-list span {
  color: var(--muted);
}

.phone-frame {
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 14px;
  border: 10px solid #1b2526;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(232, 167, 216, 0.28), transparent 38%),
    repeating-linear-gradient(135deg, rgba(80, 123, 53, 0.08) 0 1px, transparent 1px 15px),
    #fff6fb;
  box-shadow: 0 24px 60px rgba(31, 42, 43, 0.18);
}

.phone-top {
  padding: 10px 4px 16px;
  color: var(--lotus-deep);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.chat-bubble {
  margin-bottom: 10px;
  padding: 14px;
  border-radius: 16px 16px 16px 4px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(31, 42, 43, 0.08);
}

.chat-bubble p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.line-actions {
  flex-wrap: wrap;
  margin-top: 14px;
}

.line-actions button {
  flex: 1 1 120px;
  color: var(--lotus-deep);
  background: #ffffff;
  border-color: #efc8e6;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(24, 39, 41, 0.42);
}

.modal.open {
  display: grid;
}

.modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 24px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 250, 253, 0.98)),
    var(--surface);
  box-shadow: var(--shadow);
}

.modal-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

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

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

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

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

.appointment-card {
  width: min(620px, 100%);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.detail-grid article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 253, 0.76);
}

.detail-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.detail-note {
  padding: 12px;
  border-radius: var(--radius);
  color: var(--burgundy);
  background: var(--amber-soft);
  font-weight: 700;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.manage-card {
  max-width: 760px;
}

.manage-toolbar,
.manage-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.manage-form {
  margin-top: 14px;
}

.manage-form label,
.manage-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.manage-form input,
.manage-form select,
.manage-form textarea,
.manage-toolbar select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.manage-form textarea {
  min-height: 92px;
  resize: vertical;
}

.manage-actions {
  margin-top: 16px;
}

.danger-btn {
  color: #b42318;
  border-color: #f5c2bd;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  border: 0;
  color: var(--muted);
  background: #f2e6f0;
  font-size: 22px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    gap: 14px;
  }

  .sidebar::after {
    display: none;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, max-content);
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    min-width: 132px;
    font-size: 16px;
    text-align: center;
  }

  .shop-card {
    margin-top: 0;
    display: none;
  }

  .main {
    padding: 20px;
  }

  .topbar {
    align-items: center;
  }

  h1 {
    font-size: 24px;
  }

  .metric-grid,
  .therapist-grid,
  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .finance-layout,
  .line-layout,
  .workspace-grid,
  .customer-layout,
  .package-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .main {
    padding: 12px;
  }

  .sidebar {
    padding: 12px;
    background-size: 112px 178px, auto, auto, auto, auto;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand p {
    font-size: 11px;
  }

  .nav-list {
    grid-auto-columns: minmax(108px, max-content);
    gap: 5px;
  }

  .nav-item {
    min-width: 108px;
    padding: 9px 10px;
    font-size: 14px;
  }

  .topbar,
  .panel-head,
  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 18px;
  }

  .language-switch {
    justify-content: center;
  }

  .top-actions > .ghost-btn,
  .top-actions > .primary-btn {
    width: 100%;
  }

  .metric-grid,
  .therapist-grid,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .time-axis,
  .timeline-row {
    grid-template-columns: 88px minmax(660px, 1fr);
    gap: 8px;
  }

  .slots {
    grid-template-columns: repeat(6, minmax(96px, 1fr));
  }

  .therapist-name strong,
  .slot {
    font-size: 14px;
  }

  .customer-row {
    grid-template-columns: 38px 1fr;
  }

  .customer-row .status {
    grid-column: 2;
    justify-self: start;
  }

  .profile-summary,
  .detail-grid,
  .quick-booking-form {
    grid-template-columns: 1fr;
  }

  .annual-offer,
  .subhead,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .package-price strong {
    font-size: 52px;
  }

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

  .report-filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-filters .primary-btn {
    width: 100%;
  }

  .report-tabs {
    display: flex;
    width: 100%;
  }

  .report-tabs button {
    flex: 1;
    padding: 0 10px;
  }

  .settlement-table {
    display: block;
    overflow-x: auto;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    padding: 18px;
  }
}

@media (min-width: 1181px) and (max-width: 1360px) {
  .app-shell {
    grid-template-columns: 248px 1fr;
  }

  .sidebar {
    padding: 20px 14px;
  }

  .nav-item {
    font-size: 18px;
  }

  .main {
    padding: 22px;
  }
}

@media (max-width: 420px) {
  .main {
    padding: 10px;
  }

  .topbar {
    padding: 10px;
  }

  .metric-card,
  .report-summary article {
    min-height: auto;
  }

  .person-card {
    padding: 16px;
  }

  .phone-frame {
    border-width: 7px;
  }
}

/* StockFlow-inspired clean SaaS theme */
:root {
  --bg: #eef3fb;
  --surface: #ffffff;
  --ink: #071833;
  --muted: #5f6f87;
  --line: #dbe5f2;
  --teal: #0ea5e9;
  --teal-soft: #e7f5ff;
  --coral: #6d7cf6;
  --coral-soft: #eef1ff;
  --amber: #f59e0b;
  --amber-soft: #fff7df;
  --blue: #1d4ed8;
  --blue-soft: #e8efff;
  --green: #16a34a;
  --lotus: #2563eb;
  --lotus-deep: #1e40af;
  --orchid: #7c8cff;
  --leaf: #22c55e;
  --gold: #f6c453;
  --burgundy: #1d4ed8;
  --premium-gold: #8bb6ff;
  --shadow: 0 18px 46px rgba(29, 78, 216, 0.11);
  --radius: 8px;
}

body {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.94)),
    var(--surface);
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 34px rgba(15, 23, 42, 0.05);
}

.sidebar::after,
.topbar::after,
.panel::before,
.person-card::before {
  display: none;
}

.brand-mark {
  background: linear-gradient(135deg, #4f7cff, var(--blue));
  border: 0;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(29, 78, 216, 0.2);
}

.brand p,
.shop-card span {
  color: #71829b;
}

.brand strong,
.shop-card strong {
  color: var(--ink);
}

.nav-item {
  color: #53657f;
  font-size: 18px;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
  backdrop-filter: none;
}

.nav-item:focus,
.primary-btn:focus,
.ghost-btn:focus,
.mini-btn:focus,
.language-switch button:focus,
.segmented button:focus {
  outline: none;
}

.nav-item:focus-visible,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.mini-btn:focus-visible,
.language-switch button:focus-visible,
.segmented button:focus-visible {
  outline: 2px solid rgba(37, 82, 219, 0.4);
  outline-offset: 2px;
}

.shop-card {
  border-color: var(--line);
  background: #f8fbff;
  color: var(--ink);
  backdrop-filter: none;
}

.main {
  background: var(--bg);
}

.topbar,
.metric-card,
.panel,
.person-card,
.report-summary article,
.payment-list article,
.rules-grid article,
.modal-card {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  padding: 18px 20px;
}

.eyebrow {
  color: var(--blue);
}

h1,
h2,
h3,
.metric-card strong,
.report-summary strong,
.package-price strong,
.annual-offer strong {
  color: var(--ink);
  font-weight: 800;
}

.spa-ribbon {
  display: none;
}

.language-switch,
.report-tabs,
.segmented {
  border-color: var(--line);
  background: #edf4ff;
}

.language-switch button.selected,
.report-tabs button.selected,
.segmented button.active {
  color: #ffffff;
  background: var(--blue);
}

.primary-btn {
  border: 0;
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 12px 26px rgba(29, 78, 216, 0.22);
  font-weight: 750;
}

.primary-btn:hover,
.ghost-btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn,
.mini-btn,
.line-actions button,
.close-btn {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
  font-weight: 700;
}

.metric-card::after,
.panel::after {
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  opacity: 1;
}

.metric-card.warning {
  background: #fff9e8;
}

.report-filters input,
.search-input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.modal input,
.modal select,
.modal textarea {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.status.ok,
.tag.ok,
.badge.ok {
  color: #15803d;
  background: #e7f8ed;
}

.status.info,
.tag.info,
.badge.info {
  color: var(--blue);
  background: var(--blue-soft);
}

.status.warning,
.tag.warning,
.badge.warning {
  color: #a16207;
  background: #fff7df;
}

.avatar,
.therapist-avatar {
  background: linear-gradient(135deg, #60a5fa, var(--blue));
}

/* Device support: Mobile 390, Tablet 820, Desktop 1280 */
html {
  min-width: 0;
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.app-shell,
.main,
.panel,
.topbar,
.metric-card,
.person-card {
  min-width: 0;
}

.top-actions,
.subhead-actions,
.line-actions,
.modal-actions {
  flex-wrap: wrap;
}

.booking-form input,
.booking-form select,
.quick-booking-form input,
.quick-booking-form select,
.report-filters input,
.modal input,
.modal select {
  min-width: 0;
  max-width: 100%;
}

.report-table,
.settlement-table,
.package-rules,
.timeline {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1181px) {
  .app-shell {
    grid-template-columns: minmax(248px, 280px) minmax(0, 1fr);
  }

  .main {
    width: min(100%, 1600px);
    justify-self: center;
  }

  .metric-grid,
  .report-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-layout,
  .workspace-grid,
  .finance-layout,
  .line-layout,
  .customer-layout,
  .package-layout {
    grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.82fr);
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    padding: 14px 18px 10px;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    width: max-content;
  }

  .nav-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, max-content);
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 8px;
    scrollbar-width: thin;
  }

  .nav-item {
    min-width: 132px;
    text-align: center;
    white-space: nowrap;
  }

  .shop-card {
    display: none;
  }

  .main {
    padding: 22px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .metric-grid,
  .report-summary,
  .therapist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .workspace-grid,
  .finance-layout,
  .line-layout,
  .customer-layout,
  .package-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  body {
    background: #eef3fb;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    padding: 12px 12px 8px;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }

  .brand strong {
    font-size: 14px;
  }

  .nav-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(104px, max-content);
    grid-template-columns: none;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 8px;
    scrollbar-width: thin;
  }

  .nav-item {
    min-width: 104px;
    min-height: 48px;
    padding: 8px 10px;
    text-align: center;
    white-space: normal;
    font-size: 15px;
    line-height: 1.15;
  }

  .shop-card {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .topbar {
    display: grid;
    gap: 10px;
    padding: 14px;
  }

  .topbar,
  .panel-head,
  .line-actions,
  .subhead,
  .annual-offer,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    max-width: none;
    font-size: 20px;
    line-height: 1.25;
  }

  h2 {
    font-size: 18px;
    line-height: 1.25;
  }

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

  .top-actions .language-switch,
  .top-actions .auth-actions,
  .top-actions #quickBookingBtn {
    grid-column: 1 / -1;
  }

  .top-actions > button,
  .top-actions .auth-actions button,
  .primary-btn,
  .ghost-btn {
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

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

  .auth-actions span {
    max-width: none;
    white-space: normal;
    font-size: 13px;
  }

  .language-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .metric-grid,
  .report-summary,
  .therapist-grid,
  .dashboard-layout,
  .workspace-grid,
  .finance-layout,
  .line-layout,
  .customer-layout,
  .package-layout,
  .rules-grid,
  .profile-summary,
  .detail-grid,
  .quick-booking-form {
    grid-template-columns: 1fr;
  }

  .panel,
  .metric-card,
  .person-card,
  .report-summary article {
    padding: 14px;
  }

  .metric-card {
    min-height: 96px;
  }

  .time-axis,
  .timeline-row {
    grid-template-columns: 82px minmax(640px, 1fr);
    gap: 8px;
  }

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

  .therapist-name {
    min-height: 58px;
  }

  .slot {
    min-height: 58px;
    padding: 8px;
    font-size: 14px;
    line-height: 1.25;
  }

  .queue-list article,
  .availability-list article,
  .deduction-list article,
  .automation-list article,
  .customer-row,
  .history-list article {
    padding: 12px;
  }

  .customer-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .customer-row .status {
    grid-column: 2;
    justify-self: start;
  }

  .availability-list article {
    align-items: flex-start;
    flex-direction: column;
  }

  .package-price strong {
    font-size: 42px;
  }

  .report-filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    width: min(100%, 560px);
    max-height: calc(100vh - 20px);
    padding: 18px;
    overflow-y: auto;
  }
}

@media (max-width: 420px) {
  .main {
    padding: 10px;
  }

  .topbar,
  .panel,
  .metric-card,
  .person-card,
  .report-summary article {
    border-radius: 8px;
  }

  .topbar {
    padding: 14px;
  }

  h1 {
    font-size: 20px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .nav-list {
    grid-auto-columns: minmax(96px, max-content);
  }

  .nav-item {
    min-width: 96px;
    font-size: 14px;
  }

  .metric-card strong,
  .report-summary strong {
    font-size: 23px;
  }

  .phone-frame {
    border-width: 7px;
  }
}

.data-status {
  width: max-content;
  margin: -4px 0 14px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: #d8dde2;
  color: #4c5660;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: none;
}

.data-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
}

.data-status[data-status="online"] {
  background: #dff5ea;
  color: #087044;
}

.data-status[data-status="offline"] {
  background: #d8dde2;
  color: #5f6770;
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: wait;
  opacity: 0.68;
}

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

.auth-actions span {
  max-width: 220px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden {
  display: none !important;
}

.auth-panel {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid rgba(8, 117, 111, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.auth-panel-head,
.auth-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.auth-panel-head h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.auth-mode {
  width: max-content;
  margin: 14px 0;
}

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

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

.auth-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.auth-note,
.auth-message,
.auth-form-actions {
  grid-column: 1 / -1;
}

.auth-note,
.auth-message {
  margin: 0;
  color: var(--muted);
}

.auth-message[data-status="ok"] {
  color: var(--teal);
}

.auth-message[data-status="error"] {
  color: var(--coral);
}

@media (max-width: 760px) {
  .auth-form {
    grid-template-columns: 1fr;
  }

  .auth-panel-head,
  .auth-form-actions,
  .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-actions span {
    max-width: none;
  }
}

/* Onboarding gate inspired by StockFlow reference, adapted for Relaxify fields only. */
body.onboarding-mode {
  overflow: hidden;
}

body.onboarding-mode .auth-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 55% 2%, rgba(255, 255, 255, 0.12) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 7%, rgba(255, 255, 255, 0.09) 0 3px, transparent 4px),
    linear-gradient(180deg, #172293 0%, #101d82 48%, #0b1872 100%);
  box-shadow: none;
}

body.onboarding-mode .auth-panel::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.05) 0 14%, transparent 14% 100%),
    radial-gradient(circle at 3% 70%, rgba(255, 255, 255, 0.1) 0 3px, transparent 4px);
  pointer-events: none;
}

body.onboarding-mode .auth-panel > * {
  width: min(450px, calc(100vw - 40px));
  position: relative;
  z-index: 1;
}

body.onboarding-mode .auth-panel-head,
body.onboarding-mode #authPanelTitle,
body.onboarding-mode .auth-mode,
body.onboarding-mode .auth-form {
  background: #fff;
}

body.onboarding-mode .auth-panel-head {
  padding: 34px 44px 0;
  border-radius: 24px 24px 0 0;
  justify-content: center;
}

body.onboarding-mode .auth-panel-head .close-btn {
  display: none;
}

.onboarding-logo {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  color: #173281;
}

.onboarding-mark {
  width: 72px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 3px solid #2e6dad;
  border-radius: 18px;
  color: #1f45a6;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(43, 99, 166, 0.22);
}

.onboarding-logo strong {
  font-size: 2rem;
  line-height: 1;
  color: #153b8d;
  text-transform: uppercase;
}

.onboarding-logo span {
  color: #6980a7;
  font-weight: 700;
  font-size: 0.9rem;
}

body.onboarding-mode #authPanelTitle {
  margin: 0;
  padding: 28px 44px 12px;
  color: #5f6f91;
  text-align: center;
  font-size: 1.02rem;
  font-weight: 700;
}

body.onboarding-mode .auth-mode {
  width: min(450px, calc(100vw - 40px));
  margin: 0;
  padding: 0 44px 16px;
  border-radius: 0;
  justify-content: center;
  box-shadow: none;
}

body.onboarding-mode .auth-mode button {
  min-height: 42px;
  border-radius: 999px;
}

body.onboarding-mode .auth-form {
  grid-template-columns: 1fr;
  padding: 0 44px 40px;
  border-radius: 0 0 24px 24px;
  gap: 14px;
}

body.onboarding-mode .auth-form label {
  color: #46516c;
  font-size: 0.98rem;
}

body.onboarding-mode .auth-form label b {
  color: #cf355b;
}

body.onboarding-mode .auth-form input {
  min-height: 54px;
  border: 1px solid #d9e2f0;
  border-radius: 10px;
  background: #eef4ff;
  color: #14204a;
  font-size: 1rem;
  box-shadow: inset 0 1px 2px rgba(14, 29, 80, 0.06);
}

body.onboarding-mode .auth-note {
  text-align: center;
  color: #6b7898;
}

.onboarding-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #97a4bd;
}

.onboarding-stepper span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e5ebf5;
  font-weight: 900;
}

.onboarding-stepper span.active {
  background: #2434be;
  color: #fff;
}

.onboarding-stepper i {
  width: 42px;
  height: 2px;
  background: #d6deeb;
}

body.onboarding-mode .auth-form-actions {
  flex-direction: column-reverse;
  align-items: stretch;
  gap: 14px;
}

body.onboarding-mode .auth-form-actions .primary-btn {
  min-height: 56px;
  justify-content: center;
  border-radius: 12px;
  background: #2434be;
  color: #fff;
}

body.onboarding-mode .auth-form-actions .ghost-btn {
  border: 0;
  background: transparent;
  color: #2434be;
  box-shadow: none;
}

body.onboarding-mode .auth-message {
  min-height: 22px;
  text-align: center;
  font-weight: 700;
}

body.onboarding-mode .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

body.onboarding-mode .auth-panel {
  pointer-events: auto;
}

@media (max-width: 520px) {
  body.onboarding-mode .auth-panel {
    padding: 0;
    align-items: start;
    overflow-y: auto;
  }

  body.onboarding-mode .auth-panel > *,
  body.onboarding-mode .auth-mode {
    width: min(100vw - 38px, 450px);
  }

  body.onboarding-mode .auth-panel-head {
    margin-top: 24px;
    padding: 28px 24px 0;
  }

  body.onboarding-mode #authPanelTitle,
  body.onboarding-mode .auth-mode,
  body.onboarding-mode .auth-form {
    padding-left: 24px;
    padding-right: 24px;
  }

  body.onboarding-mode .auth-form {
    padding-bottom: 28px;
  }
}

body.onboarding-mode .app-shell {
  filter: none;
  pointer-events: auto;
  user-select: auto;
}

/* Onboarding card polish: single white card and password field. */
body.onboarding-mode .auth-panel {
  background:
    radial-gradient(circle at 55% 2%, rgba(255, 255, 255, 0.12) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 7%, rgba(255, 255, 255, 0.09) 0 3px, transparent 4px),
    linear-gradient(180deg, #172293 0%, #101d82 48%, #0b1872 100%);
}

body.onboarding-mode .auth-panel::after {
  content: "";
  position: absolute;
  width: min(560px, calc(100vw - 40px));
  height: auto;
  inset: 28px auto auto 50%;
  transform: translateX(-50%);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(3, 12, 75, 0.24);
  pointer-events: none;
}

body.onboarding-mode .auth-panel > * {
  width: min(450px, calc(100vw - 86px));
  background: transparent !important;
  z-index: 2;
}

body.onboarding-mode .auth-panel-head {
  margin-top: 56px;
  padding: 0 0 18px;
  border-radius: 0;
}

body.onboarding-mode #authPanelTitle {
  padding: 18px 0 10px;
  border-top: 0;
}

body.onboarding-mode .auth-mode {
  width: min(450px, calc(100vw - 86px));
  padding: 0 0 16px;
}

body.onboarding-mode .auth-form {
  padding: 0 0 42px;
  border-radius: 0;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  width: 100%;
}

.password-field input {
  border-radius: 10px 0 0 10px !important;
  border-right: 0 !important;
}

.password-field button {
  min-width: 76px;
  border: 1px solid #d9e2f0;
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: #eef4ff;
  color: #7a86a0;
  font-weight: 800;
}

body.onboarding-mode .auth-form label:has(.password-field) input {
  min-height: 54px;
}

@media (max-width: 520px) {
  body.onboarding-mode .auth-panel::after {
    inset-top: 24px;
    width: min(100vw - 38px, 450px);
  }

  body.onboarding-mode .auth-panel > *,
  body.onboarding-mode .auth-mode {
    width: min(100vw - 86px, 364px);
  }

  body.onboarding-mode .auth-panel-head {
    margin-top: 54px;
  }
}

/* Fix onboarding white card: keep all form sections inside one visible white surface. */
body.onboarding-mode .auth-panel::after {
  display: none;
}

body.onboarding-mode .auth-panel-head {
  width: min(450px, calc(100vw - 40px));
  margin-top: 28px;
  padding: 34px 44px 18px;
  border-radius: 24px 24px 0 0;
  background: #fff !important;
  box-shadow: 0 26px 70px rgba(3, 12, 75, 0.18);
}

body.onboarding-mode #authPanelTitle {
  width: min(450px, calc(100vw - 40px));
  padding: 18px 44px 10px;
  background: #fff !important;
  color: #5f6f91;
}

body.onboarding-mode .auth-mode {
  width: min(450px, calc(100vw - 40px));
  padding: 0 44px 16px;
  background: #fff !important;
}

body.onboarding-mode .auth-form {
  width: min(450px, calc(100vw - 40px));
  padding: 0 44px 42px;
  border-radius: 0 0 24px 24px;
  background: #fff !important;
  box-shadow: 0 34px 70px rgba(3, 12, 75, 0.18);
}

@media (max-width: 520px) {
  body.onboarding-mode .auth-panel-head,
  body.onboarding-mode #authPanelTitle,
  body.onboarding-mode .auth-mode,
  body.onboarding-mode .auth-form {
    width: min(100vw - 38px, 450px);
    padding-left: 24px;
    padding-right: 24px;
  }

  body.onboarding-mode .auth-panel-head {
    margin-top: 24px;
  }
}

/* Remove onboarding divider lines between card sections. */
body.onboarding-mode .auth-panel-head,
body.onboarding-mode #authPanelTitle,
body.onboarding-mode .auth-mode,
body.onboarding-mode .auth-form {
  border: 0 !important;
  box-shadow: none !important;
}

body.onboarding-mode .auth-panel-head {
  box-shadow: 0 -10px 60px rgba(3, 12, 75, 0.18) !important;
}

body.onboarding-mode .auth-form {
  box-shadow: 0 34px 70px rgba(3, 12, 75, 0.18) !important;
}

body.onboarding-mode #authPanelTitle {
  padding-top: 22px;
}

body.onboarding-mode .auth-mode {
  padding-top: 2px;
  padding-bottom: 18px;
}

/* Final onboarding surface: one continuous white card behind every auth row. */
body.onboarding-mode .auth-panel::after {
  display: block !important;
  content: "";
  position: absolute;
  z-index: 1;
  top: 28px;
  left: 50%;
  width: min(450px, calc(100vw - 40px));
  height: calc(100vh - 56px);
  max-height: 720px;
  transform: translateX(-50%);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 34px 80px rgba(3, 12, 75, 0.24);
  pointer-events: none;
}

body.onboarding-mode .auth-panel-head,
body.onboarding-mode #authPanelTitle,
body.onboarding-mode .auth-mode,
body.onboarding-mode .auth-form {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

body.onboarding-mode .auth-panel > * {
  margin-top: -1px;
}

body.onboarding-mode .auth-panel-head {
  margin-top: 56px;
}

@media (max-width: 520px) {
  body.onboarding-mode .auth-panel::after {
    top: 24px;
    width: min(100vw - 38px, 450px);
    height: calc(100vh - 48px);
  }
}

/* Onboarding spacing refinement. */
body.onboarding-mode .auth-panel {
  align-items: center;
  overflow-y: auto;
}

body.onboarding-mode .auth-panel::after {
  top: 50%;
  height: auto;
  min-height: 640px;
  max-height: calc(100vh - 56px);
  transform: translate(-50%, -50%);
}

body.onboarding-mode .auth-panel-head {
  margin-top: 0;
  padding-top: 46px;
  padding-bottom: 22px;
}

.onboarding-mark {
  width: 72px;
  height: 58px;
  margin-bottom: 6px;
}

.onboarding-logo {
  gap: 10px;
}

.onboarding-logo strong {
  font-size: 2.08rem;
  letter-spacing: 0;
}

.onboarding-logo span {
  line-height: 1.35;
}

body.onboarding-mode #authPanelTitle {
  padding-top: 24px;
  padding-bottom: 14px;
  font-size: 1.03rem;
}

body.onboarding-mode .auth-mode {
  padding-bottom: 24px;
}

body.onboarding-mode .auth-form {
  gap: 16px;
  padding-bottom: 46px;
}

body.onboarding-mode .auth-form label {
  gap: 8px;
  font-size: 0.96rem;
}

body.onboarding-mode .auth-form input {
  min-height: 54px;
  padding: 12px 16px;
}

body.onboarding-mode .auth-note {
  margin-top: 2px;
  line-height: 1.45;
}

body.onboarding-mode .auth-form-actions {
  margin-top: 2px;
  gap: 0;
}

body.onboarding-mode .auth-form-actions .primary-btn {
  min-height: 56px;
  margin-top: 2px;
  font-size: 1rem;
}

.password-field button {
  min-width: 78px;
}

body.onboarding-mode .auth-message {
  margin-top: 2px;
  line-height: 1.45;
}

@media (min-height: 760px) {
  body.onboarding-mode .auth-panel-head {
    padding-top: 54px;
  }

  body.onboarding-mode .auth-form {
    gap: 18px;
    padding-bottom: 54px;
  }
}

@media (max-width: 520px) {
  body.onboarding-mode .auth-panel {
    align-items: start;
    padding: 18px 0;
  }

  body.onboarding-mode .auth-panel::after {
    top: 18px;
    min-height: calc(100vh - 36px);
    max-height: none;
    transform: translateX(-50%);
  }

  body.onboarding-mode .auth-panel-head {
    margin-top: 18px;
    padding-top: 30px;
    padding-bottom: 18px;
  }

  body.onboarding-mode #authPanelTitle {
    padding-top: 18px;
  }

  body.onboarding-mode .auth-mode {
    padding-bottom: 18px;
  }

  body.onboarding-mode .auth-form {
    gap: 14px;
    padding-bottom: 30px;
  }
}

/* Onboarding viewport fit pass. */
body.onboarding-mode .auth-panel {
  overflow: hidden;
}

body.onboarding-mode .auth-panel::after {
  min-height: 588px;
  max-height: calc(100vh - 42px);
}

body.onboarding-mode .auth-panel-head {
  padding-top: 34px;
  padding-bottom: 16px;
}

.onboarding-mark {
  width: 68px;
  height: 54px;
  margin-bottom: 2px;
}

.onboarding-logo {
  gap: 7px;
}

.onboarding-logo strong {
  font-size: 1.98rem;
}

body.onboarding-mode #authPanelTitle {
  padding-top: 18px;
  padding-bottom: 10px;
}

body.onboarding-mode .auth-mode {
  padding-bottom: 18px;
}

body.onboarding-mode .auth-form {
  gap: 13px;
  padding-bottom: 34px;
}

body.onboarding-mode .auth-form label {
  gap: 6px;
}

body.onboarding-mode .auth-form input,
body.onboarding-mode .auth-form label:has(.password-field) input {
  min-height: 52px;
}

body.onboarding-mode .auth-form-actions .primary-btn {
  min-height: 54px;
}

body.onboarding-mode .auth-note {
  margin-top: 0;
}

@media (max-height: 680px) and (min-width: 521px) {
  body.onboarding-mode .auth-panel::after {
    min-height: 548px;
  }

  body.onboarding-mode .auth-panel-head {
    padding-top: 24px;
    padding-bottom: 12px;
  }

  .onboarding-mark {
    width: 62px;
    height: 48px;
  }

  .onboarding-logo strong {
    font-size: 1.82rem;
  }

  .onboarding-logo span {
    font-size: 0.84rem;
  }

  body.onboarding-mode #authPanelTitle {
    padding-top: 12px;
    padding-bottom: 8px;
  }

  body.onboarding-mode .auth-mode {
    padding-bottom: 12px;
  }

  body.onboarding-mode .auth-form {
    gap: 10px;
    padding-bottom: 24px;
  }

  body.onboarding-mode .auth-form input,
  body.onboarding-mode .auth-form label:has(.password-field) input {
    min-height: 48px;
  }
}

@media (max-width: 520px) {
  body.onboarding-mode .auth-panel {
    overflow-y: auto;
  }
}

/* Trial mode has more fields, so fit it deliberately. */
body.onboarding-mode.auth-trial-mode .auth-panel {
  overflow-y: auto;
  align-items: start;
  padding: 18px 0;
}

body.onboarding-mode.auth-trial-mode .auth-panel::after {
  top: 18px;
  height: calc(100vh - 36px);
  min-height: 0;
  max-height: none;
  transform: translateX(-50%);
}

body.onboarding-mode.auth-trial-mode .auth-panel-head {
  margin-top: 18px;
  padding-top: 22px;
  padding-bottom: 10px;
}

body.onboarding-mode.auth-trial-mode .onboarding-mark {
  width: 56px;
  height: 44px;
}

body.onboarding-mode.auth-trial-mode .onboarding-logo {
  gap: 5px;
}

body.onboarding-mode.auth-trial-mode .onboarding-logo strong {
  font-size: 1.7rem;
}

body.onboarding-mode.auth-trial-mode .onboarding-logo span {
  font-size: 0.82rem;
}

body.onboarding-mode.auth-trial-mode #authPanelTitle {
  padding-top: 10px;
  padding-bottom: 6px;
  font-size: 0.98rem;
}

body.onboarding-mode.auth-trial-mode .auth-mode {
  padding-bottom: 10px;
}

body.onboarding-mode.auth-trial-mode .auth-form {
  gap: 8px;
  padding-bottom: 22px;
}

body.onboarding-mode.auth-trial-mode .auth-form label {
  gap: 4px;
  font-size: 0.92rem;
}

body.onboarding-mode.auth-trial-mode .auth-form input,
body.onboarding-mode.auth-trial-mode .auth-form label:has(.password-field) input {
  min-height: 46px;
  padding: 9px 14px;
}

body.onboarding-mode.auth-trial-mode .password-field button {
  min-width: 68px;
}

body.onboarding-mode.auth-trial-mode .auth-note,
body.onboarding-mode.auth-trial-mode .onboarding-stepper {
  display: none;
}

body.onboarding-mode.auth-trial-mode .auth-form-actions .primary-btn {
  min-height: 50px;
}

@media (max-height: 700px) and (min-width: 521px) {
  body.onboarding-mode.auth-trial-mode .auth-panel-head {
    padding-top: 16px;
    padding-bottom: 8px;
  }

  body.onboarding-mode.auth-trial-mode .auth-mode {
    padding-bottom: 8px;
  }

  body.onboarding-mode.auth-trial-mode .auth-form {
    gap: 7px;
    padding-bottom: 18px;
  }

  body.onboarding-mode.auth-trial-mode .auth-form input,
  body.onboarding-mode.auth-trial-mode .auth-form label:has(.password-field) input {
    min-height: 44px;
  }
}

/* Add breathing room around onboarding card without returning to cramped edges. */
body.onboarding-mode .auth-panel {
  padding-top: 26px;
  padding-bottom: 26px;
}

body.onboarding-mode .auth-panel::after {
  max-height: calc(100vh - 52px);
}

body.onboarding-mode.auth-trial-mode .auth-panel {
  padding-top: 28px;
  padding-bottom: 28px;
}

body.onboarding-mode.auth-trial-mode .auth-panel::after {
  top: 28px;
  height: calc(100vh - 56px);
}

body.onboarding-mode.auth-trial-mode .auth-panel-head {
  margin-top: 28px;
  padding-top: 20px;
  padding-bottom: 12px;
}

body.onboarding-mode.auth-trial-mode .auth-form {
  gap: 9px;
  padding-bottom: 28px;
}

body.onboarding-mode.auth-trial-mode .auth-form-actions .primary-btn {
  margin-top: 4px;
}

@media (min-height: 760px) {
  body.onboarding-mode.auth-trial-mode .auth-panel {
    padding-top: 38px;
    padding-bottom: 38px;
  }

  body.onboarding-mode.auth-trial-mode .auth-panel::after {
    top: 38px;
    height: calc(100vh - 76px);
  }

  body.onboarding-mode.auth-trial-mode .auth-panel-head {
    margin-top: 38px;
    padding-top: 26px;
  }

  body.onboarding-mode.auth-trial-mode .auth-form {
    gap: 11px;
    padding-bottom: 34px;
  }
}

@media (max-width: 520px) {
  body.onboarding-mode.auth-trial-mode .auth-panel {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  body.onboarding-mode.auth-trial-mode .auth-panel::after {
    top: 18px;
    height: calc(100vh - 36px);
  }

  body.onboarding-mode.auth-trial-mode .auth-panel-head {
    margin-top: 18px;
  }
}

/* Make trial card grow with content and keep bottom breathing room. */
body.onboarding-mode.auth-trial-mode .auth-panel {
  overflow-y: auto;
  padding-top: 28px;
  padding-bottom: 44px;
}

body.onboarding-mode.auth-trial-mode .auth-panel::after {
  display: none !important;
}

body.onboarding-mode.auth-trial-mode .auth-panel-head,
body.onboarding-mode.auth-trial-mode #authPanelTitle,
body.onboarding-mode.auth-trial-mode .auth-mode,
body.onboarding-mode.auth-trial-mode .auth-form {
  width: min(450px, calc(100vw - 40px));
  background: #fff !important;
}

body.onboarding-mode.auth-trial-mode .auth-panel-head {
  margin-top: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -14px 44px rgba(3, 12, 75, 0.14) !important;
}

body.onboarding-mode.auth-trial-mode .auth-form {
  border-radius: 0 0 24px 24px;
  box-shadow: 0 34px 70px rgba(3, 12, 75, 0.2) !important;
  margin-bottom: 18px;
}

body.onboarding-mode.auth-trial-mode .auth-form-actions .primary-btn {
  margin-top: 8px;
}

@media (max-height: 720px) and (min-width: 521px) {
  body.onboarding-mode.auth-trial-mode .auth-panel {
    padding-top: 18px;
    padding-bottom: 34px;
  }

  body.onboarding-mode.auth-trial-mode .auth-panel-head {
    padding-top: 16px;
    padding-bottom: 8px;
  }

  body.onboarding-mode.auth-trial-mode .auth-form {
    padding-bottom: 22px;
  }
}

/* Keep RX logo inside the onboarding card. */
body.onboarding-mode .auth-panel-head {
  padding-top: 42px !important;
  margin-top: 0 !important;
}

body.onboarding-mode .auth-panel::after {
  top: 50%;
  transform: translate(-50%, -50%);
}

body.onboarding-mode .onboarding-mark {
  margin-top: 0;
}

body.onboarding-mode.auth-trial-mode .auth-panel-head {
  padding-top: 26px !important;
  margin-top: 0 !important;
}

body.onboarding-mode.auth-trial-mode .auth-panel::after {
  top: 28px;
  transform: translateX(-50%);
}

@media (max-height: 700px) and (min-width: 521px) {
  body.onboarding-mode .auth-panel-head {
    padding-top: 30px !important;
  }

  body.onboarding-mode.auth-trial-mode .auth-panel-head {
    padding-top: 18px !important;
  }
}

/* Align login top spacing with trial mode. */
body.onboarding-mode:not(.auth-trial-mode) .auth-panel {
  align-items: start;
  overflow-y: auto;
  padding-top: 46px;
  padding-bottom: 46px;
}

body.onboarding-mode:not(.auth-trial-mode) .auth-panel::after {
  top: 46px;
  height: auto;
  min-height: 588px;
  max-height: none;
  transform: translateX(-50%);
}

body.onboarding-mode:not(.auth-trial-mode) .auth-panel-head {
  margin-top: 0;
  padding-top: 34px !important;
  padding-bottom: 18px;
}

body.onboarding-mode:not(.auth-trial-mode) #authPanelTitle {
  padding-top: 20px;
  padding-bottom: 12px;
}

body.onboarding-mode:not(.auth-trial-mode) .auth-mode {
  padding-bottom: 22px;
}

body.onboarding-mode:not(.auth-trial-mode) .auth-form {
  padding-bottom: 42px;
}

@media (max-height: 720px) and (min-width: 521px) {
  body.onboarding-mode:not(.auth-trial-mode) .auth-panel {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  body.onboarding-mode:not(.auth-trial-mode) .auth-panel::after {
    top: 28px;
  }

  body.onboarding-mode:not(.auth-trial-mode) .auth-panel-head {
    padding-top: 28px !important;
  }
}

@media (max-width: 520px) {
  body.onboarding-mode:not(.auth-trial-mode) .auth-panel {
    padding-top: 22px;
    padding-bottom: 22px;
  }

  body.onboarding-mode:not(.auth-trial-mode) .auth-panel::after {
    top: 22px;
  }
}

/* OTP authentication controls. */
.auth-otp-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.auth-otp-section.hidden {
  display: none !important;
}

body.onboarding-mode .auth-otp-section .primary-btn {
  min-height: 52px;
  justify-content: center;
  border-radius: 12px;
  background: #2434be;
  color: #fff;
}

body.onboarding-mode .auth-otp-section input {
  text-align: center;
  letter-spacing: 0.08em;
  font-weight: 900;
}

body.onboarding-mode .auth-message[data-status="error"] {
  color: #cf355b;
}

body.onboarding-mode .auth-message[data-status="ok"] {
  color: #08756f;
}
