:root {
  --bg: #070b14;
  --bg-accent: #0a1220;
  --ink: #e8eef8;
  --muted: #8fa3bf;
  --line: rgba(120, 160, 220, 0.16);
  --panel: rgba(12, 18, 32, 0.9);
  --panel-solid: #0c1220;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-raised: rgba(255, 255, 255, 0.06);
  --surface-muted: rgba(4, 10, 20, 0.55);
  --brand: #3d9eff;
  --brand-ink: #b8dcff;
  --accent: #5eead4;
  --danger: #ff8f8f;
  --ok: #5eead4;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --display: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  --glow: 0 0 24px rgba(61, 158, 255, 0.18);
  --panel-border: rgba(88, 166, 255, 0.2);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 55% at 12% 8%, rgba(61, 158, 255, 0.12), transparent 50%),
    radial-gradient(ellipse 65% 45% at 88% 92%, rgba(94, 234, 212, 0.07), transparent 48%),
    linear-gradient(165deg, #050810 0%, #0a1220 48%, #070b14 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(61, 158, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 158, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 95% 85% at 50% 35%, #000 15%, transparent 78%);
}

#app {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}

.login-panel {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.login-panel-wide {
  width: min(560px, 100%);
}

/* ── Register page (tech layout) ── */
.register-page {
  --reg-bg: #070b14;
  --reg-panel: rgba(12, 18, 32, 0.82);
  --reg-panel-border: rgba(88, 166, 255, 0.18);
  --reg-ink: #e8eef8;
  --reg-muted: #8fa3bf;
  --reg-accent: #3d9eff;
  --reg-accent-2: #5eead4;
  --reg-line: rgba(120, 160, 220, 0.14);
  --reg-mono: ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  position: relative;
  min-height: 100vh;
  color: var(--reg-ink);
  overflow-x: hidden;
}

.register-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(61, 158, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 80%, rgba(94, 234, 212, 0.08), transparent 50%),
    linear-gradient(165deg, #050810 0%, #0a1220 45%, #070b14 100%);
}

.register-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(61, 158, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 158, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, #000 20%, transparent 75%);
}

.register-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
}

.register-bg-glow-a {
  width: 320px;
  height: 320px;
  top: 8%;
  left: -4%;
  background: #1d6fd4;
}

.register-bg-glow-b {
  width: 280px;
  height: 280px;
  right: -2%;
  bottom: 10%;
  background: #0d9488;
}

.register-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 640px);
  gap: 32px;
  align-items: start;
  justify-content: center;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

.register-hero {
  position: sticky;
  top: 40px;
  padding: 28px 0;
}

.register-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--reg-panel-border);
  border-radius: 999px;
  background: rgba(61, 158, 255, 0.08);
  color: var(--reg-accent);
  font-family: var(--reg-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  margin-bottom: 20px;
}

.register-hero-title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #fff;
}

.register-hero-sub {
  margin: 0 0 28px;
  color: var(--reg-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.register-hero-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.register-hero-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--reg-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--reg-muted);
  font-size: 0.88rem;
}

.register-hero-steps li span {
  flex: 0 0 auto;
  font-family: var(--reg-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--reg-accent-2);
  letter-spacing: 0.08em;
}

.register-main {
  min-width: 0;
}

.register-card {
  border: 1px solid var(--reg-panel-border);
  border-radius: 16px;
  background: var(--reg-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 24px 24px 20px;
}

.register-card-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.register-card-top-split {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.btn-back-register {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--reg-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--reg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-back-register:hover {
  color: var(--reg-ink);
  border-color: rgba(61, 158, 255, 0.35);
  background: rgba(61, 158, 255, 0.08);
}

.register-card .lang-switch {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--reg-line);
  border-radius: 8px;
  padding: 2px;
}

.register-card .lang-btn {
  color: var(--reg-muted);
  border-color: transparent;
  background: transparent;
}

.register-card .lang-btn.active {
  color: var(--reg-ink);
  background: rgba(61, 158, 255, 0.18);
  border-color: rgba(61, 158, 255, 0.35);
}

.register-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--reg-muted) 50%),
    linear-gradient(135deg, var(--reg-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 2px),
    calc(100% - 12px) calc(50% + 2px);
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
  cursor: pointer;
}

.register-select option {
  color: #111;
  background: #fff;
}

.register-alert {
  margin-bottom: 12px;
}

.register-gift-trial-banner {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(46, 125, 79, 0.45);
  background: rgba(46, 125, 79, 0.12);
  color: var(--reg-text, inherit);
}

.register-gift-trial-banner strong {
  display: block;
  margin-bottom: 6px;
  color: #3d9a6a;
}

.register-gift-trial-banner p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--reg-muted, rgba(255, 255, 255, 0.75));
}

#referral-code-preview.valid {
  color: #3d9a6a;
}

.firebase-recaptcha-slot {
  margin-top: 10px;
  min-height: 0;
}

.register-block {
  margin-bottom: 16px;
  border: 1px solid var(--reg-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.register-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--reg-line);
  background: rgba(61, 158, 255, 0.05);
}

.register-block-num {
  font-family: var(--reg-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--reg-accent);
  letter-spacing: 0.1em;
}

.register-block-head h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--reg-ink);
}

.register-block-body {
  padding: 14px 14px 6px;
}

.register-block-body .field label {
  color: #c5d4e8;
}

.register-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.register-input {
  width: 100%;
  border: 1px solid var(--reg-line);
  border-radius: 8px;
  background: rgba(4, 10, 20, 0.55);
  color: var(--reg-ink);
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.register-input::placeholder {
  color: #5f7390;
}

.register-input:focus {
  outline: none;
  border-color: rgba(61, 158, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(61, 158, 255, 0.15);
}

.register-input-mono {
  font-family: var(--reg-mono);
  font-size: 0.88rem;
}

.register-inline-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.register-inline-field .register-input {
  flex: 1;
  min-width: 0;
}

.btn-register-secondary {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 1px solid rgba(61, 158, 255, 0.45);
  border-radius: 8px;
  background: rgba(61, 158, 255, 0.12);
  color: #b8dcff;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-register-secondary:hover:not(:disabled) {
  background: rgba(61, 158, 255, 0.22);
  border-color: rgba(61, 158, 255, 0.7);
}

.btn-register-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-register-primary {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #2b8cff 0%, #1d6fd4 55%, #0ea5e9 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 13px 18px;
  box-shadow: 0 8px 24px rgba(29, 111, 212, 0.35);
}

.btn-register-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-register-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.register-actions {
  margin-top: 8px;
  padding-top: 4px;
}

.register-terms-panel {
  margin: 8px 0 14px;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.register-terms-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.register-terms-notice {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.register-terms-scroll {
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  scrollbar-width: thin;
}

.register-terms-section {
  margin-bottom: 14px;
}

.register-terms-section:last-child {
  margin-bottom: 0;
}

.register-terms-section h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--brand-ink);
}

.register-terms-intro,
.register-terms-block p,
.register-terms-section li,
.register-terms-block li {
  margin: 0 0 6px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}

.register-terms-block {
  margin-bottom: 10px;
}

.register-terms-block-title {
  margin: 0 0 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.register-terms-section ul,
.register-terms-block ul {
  margin: 0;
  padding-left: 1.15rem;
}

.register-terms-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
}

.register-terms-agree input {
  margin-top: 3px;
  flex: 0 0 auto;
}

#register-terms-error {
  margin: -4px 0 10px;
}

.register-auth-switch {
  margin-top: 12px;
}

.register-auth-switch .btn-link {
  color: var(--reg-accent);
}

.register-mono-hint {
  font-family: var(--reg-mono);
  font-size: 0.78rem;
  color: var(--reg-accent-2);
  word-break: break-all;
}

.register-info-box {
  border-color: rgba(61, 158, 255, 0.25);
  background: rgba(61, 158, 255, 0.08);
  color: #c5d9f2;
}

.register-plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.register-plan-grid-compact {
  grid-template-columns: 1fr 1fr;
}

.register-plan-card {
  position: relative;
  cursor: pointer;
}

.register-plan-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.register-plan-card-inner {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 12px 12px;
  border: 1px solid var(--reg-line);
  border-radius: 10px;
  background: rgba(4, 10, 20, 0.45);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.register-plan-card-inner strong {
  font-size: 0.92rem;
  color: var(--reg-ink);
}

.register-plan-card-inner small {
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--reg-muted);
}

.register-plan-card:has(input:checked) .register-plan-card-inner {
  border-color: rgba(61, 158, 255, 0.75);
  background: rgba(61, 158, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(61, 158, 255, 0.25) inset, 0 0 20px rgba(61, 158, 255, 0.12);
}

.register-plan-card-paid:has(input:checked) .register-plan-card-inner {
  border-color: rgba(94, 234, 212, 0.65);
  background: rgba(94, 234, 212, 0.08);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.2) inset, 0 0 20px rgba(94, 234, 212, 0.1);
}

.register-plan-card-compact .register-plan-card-inner {
  padding: 10px 12px;
  text-align: center;
}

.register-page .optional-tag {
  color: #6d86a8;
}

.register-page .field-hint {
  color: var(--reg-muted);
}

.register-page .field-hint.valid {
  color: #5eead4;
}

.register-page .field-hint.invalid,
.register-page .field-hint.alert {
  color: #ff8f8f;
}

.register-page .otp-input {
  font-size: 1.35rem;
  letter-spacing: 0.42em;
  text-align: center;
  font-family: var(--reg-mono);
  padding-left: 0.42em;
}

.register-page .password-meter-bar {
  background: rgba(255, 255, 255, 0.08);
}

.register-page .password-meter-fill.ok {
  background: linear-gradient(90deg, #5eead4, #3d9eff);
}

.register-page .password-meter-fill.partial {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.register-page .register-input.field-valid {
  border-color: rgba(94, 234, 212, 0.65);
}

.register-page .register-input.field-invalid {
  border-color: rgba(255, 120, 120, 0.75);
}

.register-page .info-tip-btn {
  border-color: rgba(61, 158, 255, 0.35);
  background: rgba(61, 158, 255, 0.12);
  color: var(--reg-accent);
}

.register-page .info-tip-btn:hover,
.register-page .info-tip-btn[aria-expanded="true"] {
  background: var(--reg-accent);
  border-color: var(--reg-accent);
  color: #041018;
}

@media (max-width: 900px) {
  .register-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px 40px;
  }

  .register-hero {
    position: static;
    padding: 8px 0 0;
    text-align: center;
  }

  .register-hero-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .register-hero-steps {
    grid-template-columns: 1fr;
  }

  .register-grid-2,
  .register-plan-grid,
  .register-plan-grid-compact {
    grid-template-columns: 1fr;
  }

  .register-inline-field {
    flex-direction: column;
  }

  .register-card {
    padding: 18px 14px 16px;
    border-radius: 14px;
  }
}

.optional-tag {
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.field-hint.valid {
  color: var(--ok);
}

.field-hint.invalid,
.field-hint.alert {
  color: var(--danger);
}

.otp-input {
  font-size: 1.25rem;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.password-meter {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.password-meter-bar {
  height: 4px;
  border-radius: 999px;
  background: #e8ecef;
  overflow: hidden;
}

.password-meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--danger);
  transition: width 0.2s ease, background 0.2s ease;
}

.password-meter-fill.ok {
  width: 100%;
  background: var(--ok);
}

.password-meter-fill.partial {
  width: 55%;
  background: #c47a12;
}

.field input.field-valid {
  border-color: #7cb896;
}

.field input.field-invalid {
  border-color: #d66;
}

.email-code-row {
  display: grid;
  gap: 6px;
}

.plan-options {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.plan-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.auth-switch {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.auth-switch a.btn-link {
  display: inline;
}

.inline-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.inline-field input {
  flex: 1;
  min-width: 0;
}

.inline-field .btn {
  white-space: nowrap;
}

.field-hint {
  margin: 4px 0 0;
  font-size: 0.82rem;
}

.brand {
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
  margin: 0 0 4px;
}

.subtitle {
  margin: 0 0 28px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-row label {
  margin: 0;
}

.info-tip-btn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f8fb;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.info-tip-btn:hover,
.info-tip-btn[aria-expanded="true"] {
  background: var(--brand);
  border-color: #234f73;
  color: #fff;
}

.field-info-box {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dbe7f2;
  border-radius: var(--radius);
  background: #f7fbff;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.5;
}

.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 7px 9px;
  color: var(--ink);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.remember-row input {
  width: auto;
  margin: 0;
}

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 12px;
  font-weight: 600;
  font-size: 0.92rem;
}

.btn:hover {
  opacity: 0.92;
}

.btn:active {
  opacity: 0.85;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: #234f73;
}

.btn-secondary {
  background: #f5f5f5;
  color: var(--ink);
  border-color: var(--line);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 8px 10px;
}

.btn-block {
  width: 100%;
}

.alert {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid #e0b4b0;
  background: #fdf3f2;
  color: var(--danger);
  font-size: 0.9rem;
}

.alert-ok {
  border-color: #b8d4be;
  background: #f2f8f3;
  color: var(--ok);
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

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

.topbar h1 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar-left {
  display: grid;
  gap: 2px;
}

.topbar-head-row {
  display: contents;
}

.topbar-toggle {
  display: none;
}

@media (max-width: 768px) {
  .topbar-collapsible .topbar-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .topbar-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-self: center;
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .topbar-collapsible:not(.topbar-expanded) .topbar-actions {
    display: none !important;
  }

  .topbar-collapsible:not(.topbar-expanded) .user-meta {
    display: none;
  }

  .topbar-collapsible:not(.topbar-expanded) {
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .topbar-collapsible:not(.topbar-expanded) .topbar-left h1 {
    font-size: 1rem;
    line-height: 1.25;
  }
}

.user-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
  background: #f3f3f3;
}

.nav-btn {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: -1px;
}

.nav-btn.active {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: none;
  overflow: hidden;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f7;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
}

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

.toolbar input,
.toolbar select {
  width: auto;
  min-width: 140px;
}

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
  user-select: none;
}

.toolbar-check input {
  width: auto;
  min-width: auto;
  margin: 0;
}

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

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

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.92rem;
}

th {
  color: var(--ink);
  font-weight: 600;
  background: #efefef;
}

tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.badge {
  display: inline-block;
  border-radius: var(--radius);
  padding: 2px 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eef2f6;
  color: var(--brand-ink);
  border: 1px solid #d5dde5;
}

.badge-warn {
  background: #fff6eb;
  color: #7a4510;
  border-color: #ecd4b8;
}

.badge-muted {
  background: #f2f2f2;
  color: var(--muted);
  border-color: #ddd;
}

.badge-risk-high {
  background: #fdecec;
  color: #9b1c1c;
  border-color: #f5b5b5;
}

.badge-risk-medium {
  background: #fff6eb;
  color: #7a4510;
  border-color: #ecd4b8;
}

.badge-risk-low {
  background: #ecf8f1;
  color: #176944;
  border-color: #b8dfc8;
}

.badge-risk-new {
  background: #eef3ff;
  color: #2f4f9c;
  border-color: #c8d6ff;
}

.booking-risk-panel {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f8fafb;
}

.booking-risk-panel.risk-high {
  border-color: #f0b4b4;
  background: #fff8f8;
}

.booking-risk-panel.risk-medium {
  border-color: #ecd4b8;
  background: #fffaf3;
}

.booking-risk-panel.risk-new {
  border-color: #c8d6ff;
  background: #f7f9ff;
}

.booking-risk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.booking-risk-summary {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.booking-risk-stats {
  margin: 0 0 6px;
  font-size: 0.82rem;
}

.booking-risk-flags {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--muted);
}

.bookings-cal-event-risk {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 40;
}

.modal {
  width: min(520px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 16px;
}

.modal h3 {
  margin: 0 0 12px;
  font-family: var(--font);
  font-size: 1rem;
}

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

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

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 12px 10px 24px;
  }

  th,
  td {
    padding: 8px;
  }
}

.service-id {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  font-size: 0.78rem;
  background: #f4f7f5;
  padding: 2px 6px;
  border-radius: 6px;
}

.btn-link {
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0 4px;
}

.bookings-toolbar {
  align-items: center;
}

.bookings-toolbar input[type="date"] {
  min-width: 150px;
}

.bookings-day-head {
  padding: 12px 16px 0;
}

.bookings-day-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.bookings-day-title-btn {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.bookings-day-title-btn:hover,
.bookings-day-title-btn:focus-visible {
  color: var(--accent, #3b82f6);
  outline: none;
}

.bookings-day-branch {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.inline-booking-select {
  max-width: 100%;
  min-width: 118px;
  padding: 6px 30px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface-muted);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238fa3bf' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.inline-booking-select:hover,
.inline-booking-select:focus-visible {
  border-color: var(--accent, #3b82f6);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.inline-booking-select.is-warn {
  border-color: #ca8a04;
  background: rgba(202, 138, 4, 0.12);
  color: #facc15;
}

.inline-booking-select.is-ok {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
}

.inline-booking-select.is-muted {
  border-color: #64748b;
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.inline-booking-select option {
  background: var(--panel-solid);
  color: var(--ink);
}

.booking-status-cell,
.booking-payment-cell {
  min-width: 128px;
}

.bookings-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.bookings-view-btn.active {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: transparent;
}

.bookings-view-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
}

.bookings-calendar-scroll {
  max-height: min(72vh, 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.bookings-calendar-scroll .bookings-calendar {
  border: none;
  border-radius: 0;
}

.bookings-calendar-closed {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.bookings-calendar {
  --cal-hour-h: 56px;
  position: relative;
  display: grid;
  grid-template-columns: 64px 1fr;
  min-height: calc(var(--cal-hours) * var(--cal-hour-h));
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel-solid, #0f172a);
}

.bookings-calendar-hours {
  position: relative;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.bookings-calendar-hour {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  padding: 0 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

.bookings-calendar-grid {
  position: relative;
  min-height: calc(var(--cal-hours) * var(--cal-hour-h));
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--cal-hour-h) - 1px),
    rgba(148, 163, 184, 0.18) calc(var(--cal-hour-h) - 1px),
    rgba(148, 163, 184, 0.18) var(--cal-hour-h)
  );
}

.bookings-calendar-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.bookings-cal-event {
  position: absolute;
  z-index: 1;
  overflow: auto;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(30, 64, 175, 0.45);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.bookings-cal-event.status-pending {
  border-color: rgba(250, 204, 21, 0.55);
  background: rgba(161, 98, 7, 0.4);
}

.bookings-cal-event.status-confirmed,
.bookings-cal-event.status-completed {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(21, 128, 61, 0.4);
}

.bookings-cal-event.status-cancelled,
.bookings-cal-event.status-no_show {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(71, 85, 105, 0.45);
}

.bookings-cal-event-time {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2px;
}

.bookings-cal-event-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.bookings-cal-event-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bookings-cal-event-controls .inline-booking-select {
  min-width: 0;
  flex: 1 1 110px;
}

.bookings-cal-event-actions {
  margin-top: 6px;
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.bookings-calendar-more {
  margin-top: 10px;
  text-align: center;
}

.table-wrap td.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px;
}

.modal-wide {
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
}

.service-form.modal-wide {
  width: min(680px, 100%);
  max-height: min(90vh, 860px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.service-form .modal-head {
  padding: 16px 18px 0;
  flex-shrink: 0;
}

.service-form .modal-head h3 {
  margin: 0;
}

.service-form .form-sections {
  flex: 1;
  overflow: auto;
  padding: 12px 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafafa;
  padding: 12px 14px;
}

.form-section-title {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.service-form .form-section .field {
  margin-bottom: 10px;
}

.service-form .form-section .field:last-child {
  margin-bottom: 0;
}

.service-form .field-nested {
  margin-bottom: 0;
}

.service-form .field-hint-block {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.days-grid .perm-item {
  font-size: 0.82rem;
  justify-content: center;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, #fafafa);
}

.service-days-schedule {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.service-day-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 44px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface, rgba(255, 255, 255, 0.04));
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.service-day-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.service-day-chip span {
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
}

.service-day-chip:not(.is-closed) {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--ink, var(--brand-ink));
}

.service-day-chip.is-closed {
  opacity: 0.72;
}

.service-day-chip:hover {
  border-color: var(--brand);
}

@media (max-width: 720px) {
  .service-days-schedule {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

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

.service-form .modal-actions {
  flex-shrink: 0;
  margin-top: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.branch-form.modal-wide {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.branch-form .modal-head {
  padding: 16px 18px 0;
  flex-shrink: 0;
}

.branch-form .modal-head h3 {
  margin: 0;
}

.branch-form .modal-scroll {
  flex: 1;
  overflow: auto;
  padding: 12px 18px 4px;
}

.branch-form .modal-actions {
  flex-shrink: 0;
  margin-top: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.user-form-overlay {
  align-items: flex-start;
  overflow-y: auto;
  padding: 24px 16px;
}

.user-form.modal-wide {
  width: min(640px, 100%);
  max-height: min(90vh, 820px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
}

.user-form .modal-head {
  padding: 16px 18px 0;
  flex-shrink: 0;
}

.user-form .modal-head h3 {
  margin: 0;
}

.user-form .modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px 4px;
}

.user-form .modal-actions {
  flex-shrink: 0;
  margin-top: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.user-form .field-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.user-permissions-section {
  margin-top: 4px;
}

.user-perm-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.user-perm-grid .perm-item {
  align-items: center;
  padding: 10px 12px;
}

.user-perm-grid .perm-item-text {
  gap: 1px;
}

@media (min-width: 560px) {
  .user-perm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.hours-schedule {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.hours-day-row {
  display: grid;
  grid-template-columns: minmax(92px, 110px) 1fr 1fr;
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface, #fafafa);
}

.hours-day-row.is-closed {
  opacity: 0.62;
}

.hours-day-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-size: 0.88rem;
  color: var(--ink, var(--brand-ink));
  cursor: pointer;
}

.hours-day-toggle input {
  accent-color: var(--brand);
}

.hours-time-field {
  margin-bottom: 0;
}

.hours-time-field label {
  font-size: 0.72rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .hours-day-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .hours-day-toggle {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .days-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .staff-grid,
  .payment-methods-grid {
    grid-template-columns: 1fr;
  }
}

.qr-service-name {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--brand-ink);
}

.qr-service-id {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.qrcode-box {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: fit-content;
}

.qr-hint {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 12px;
}

.checkin-scanner-modal {
  max-width: 520px;
}

.bookings-toolbar {
  flex-wrap: wrap;
}

.date-picker-field {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  cursor: pointer;
  vertical-align: middle;
}

.date-picker-display {
  min-width: 120px;
  pointer-events: none;
}

.date-picker-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.touch-device .date-picker-field {
  min-height: 44px;
}

.touch-device .date-picker-native {
  font-size: 16px;
}

.checkin-settings-hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef6ff;
  color: #1d4f91;
  font-size: 0.88rem;
  line-height: 1.5;
}

.checkin-settings-hint.is-active {
  animation: checkin-hint-pulse 0.55s ease;
}

@keyframes checkin-hint-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(29, 79, 145, 0.25);
  }
  50% {
    transform: scale(1.01);
    box-shadow: 0 0 0 6px rgba(29, 79, 145, 0.08);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.checkin-scanner-wrap {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #0b1210;
  position: relative;
}

.checkin-scanner-wrap > div,
.checkin-scanner-wrap #qr-shaded-region {
  width: 100% !important;
  min-height: 280px !important;
}

.checkin-scanner-wrap video {
  width: 100% !important;
  height: 100% !important;
  min-height: 280px;
  object-fit: cover;
  display: block !important;
  background: #000;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.overlay-checkin-scanner {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.checkin-scanner-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.checkin-scanner-status {
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: var(--brand-dark);
}

.checkin-scanner-status.error {
  color: #b42318;
}

.checkin-scanner-status.ok {
  color: #0f6b4c;
}

.checkin-permission-panel {
  margin: 12px 0 0;
  padding: 16px;
  border: 1px solid #f2c6c2;
  border-radius: 14px;
  background: #fff7f6;
}

.checkin-permission-title {
  margin: 0 0 8px;
  font-weight: 700;
  color: #b42318;
}

.checkin-permission-steps {
  margin: 0 0 14px;
  color: var(--brand-ink);
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-line;
}

.checkin-permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tenant-switcher {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 28px 6px 8px;
  background-color: var(--surface-muted);
  color: var(--ink);
  min-width: 160px;
  font-size: 0.9rem;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238fa3bf' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.shell select option {
  background: var(--panel-solid);
  color: var(--ink);
}

.contact-link {
  color: var(--accent, #3b82f6);
  text-decoration: none;
  word-break: break-all;
}

.contact-link:hover,
.contact-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.merchant-setup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
}

.merchant-setup-banner-text strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.merchant-setup-banner-text p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

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

.perm-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 0.9rem;
  color: var(--brand-ink);
  cursor: pointer;
}

.perm-item input {
  margin-top: 3px;
  flex-shrink: 0;
}

.perm-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.perm-item-zh {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.perm-item-en {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.25;
}

.perm-cell {
  max-width: 300px;
}

.perm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.perm-tag {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.3;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--ink);
}

.perm-tag-en {
  color: var(--muted);
  font-size: 0.68rem;
}

.inline-status-select {
  min-width: 96px;
}

.banner-settings {
  margin: 0 14px 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.payments-intro {
  padding: 0 20px 16px;
  color: var(--muted);
  line-height: 1.5;
}

.payments-intro .muted {
  font-size: 0.9rem;
}

.webhook-url {
  display: block;
  margin: 6px 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  color: var(--brand-ink);
  font-size: 0.8rem;
  word-break: break-all;
  font-family: var(--mono);
}

table .webhook-url {
  margin: 0;
  display: inline-block;
  max-width: min(320px, 42vw);
  vertical-align: middle;
}

.platform-tier-select {
  min-width: 108px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.db-usage {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--brand-ink);
  white-space: nowrap;
}

.db-usage-high {
  color: var(--danger);
}

.payments-form {
  display: grid;
  gap: 16px;
  padding: 0 20px 28px;
}

.payment-provider-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
}

.payment-provider-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.payment-provider-head h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  color: var(--brand-ink);
}

.payment-ready {
  margin: 0;
  font-size: 0.85rem;
  color: #9a5b2e;
}

.payment-ready.is-ready {
  color: #0f6b4c;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.banner-settings-head h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  color: var(--brand-ink);
}

.banner-settings-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.banner-settings-body {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.banner-preview-wrap,
.banner-preview-empty {
  border-radius: 12px;
  overflow: hidden;
  border: 1px dashed var(--line);
  background: #f8faf9;
}

.banner-preview-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.banner-preview-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.banner-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.banner-upload-btn {
  cursor: pointer;
}

.banner-upload-btn.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 0 20px 24px;
}

.theme-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.theme-card:hover {
  border-color: #999;
}

.theme-card-selected {
  border-color: var(--brand);
  background: #f8fafc;
}

.theme-preview {
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(165deg, var(--pv-bg), var(--pv-accent));
  border: 1px solid var(--pv-line);
  padding: 10px;
  min-height: 120px;
}

.theme-preview-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.theme-preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--pv-brand);
}

.theme-preview-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--pv-ink);
}

.theme-preview-card {
  height: 42px;
  border-radius: 8px;
  background: var(--pv-panel);
  border: 1px solid var(--pv-line);
  margin-bottom: 8px;
}

.theme-preview-btn {
  width: 58%;
  height: 10px;
  border-radius: 999px;
  background: var(--pv-brand);
}

.theme-card-meta {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.theme-card-meta strong {
  color: var(--brand-ink);
}

.theme-card-meta span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.theme-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.theme-card-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand);
}

.theme-preview-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
}

.theme-preview-link:hover {
  text-decoration: underline;
}

.analytics-panel {
  padding: 12px 14px 16px;
  display: grid;
  gap: 12px;
}

.analytics-meta-line {
  margin: 0;
  font-size: 0.88rem;
}

.analytics-narrative {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.summary-table th,
.summary-table td {
  text-align: center;
  padding: 6px 8px;
}

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

.chart-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 8px;
}

.chart-card h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 600;
}

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

.analytics-list-head h4 {
  margin: 0;
  font-size: 0.95rem;
}

.analytics-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-toolbar input[type="number"] {
  width: 88px;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0 4px;
  flex-wrap: wrap;
}

.table-pager .pager-info {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 8rem;
  text-align: center;
}

.remark-cell {
  max-width: 160px;
  font-size: 0.85rem;
  line-height: 1.35;
  word-break: break-word;
}

.analytics-hint {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.85rem;
  background: #fafafa;
}

.analytics-hint code {
  font-size: 0.82rem;
  color: var(--ink);
}

.analytics-customer-table td.cell-list {
  font-size: 0.85rem;
  max-width: 180px;
  word-break: break-word;
}

.analytics-customer-table .cell-metrics {
  white-space: nowrap;
  font-size: 0.85rem;
}

.tier-tag {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.78rem;
  background: #f5f5f5;
}

.tier-tag.tier-high {
  background: #e8f0e8;
  border-color: #b8cdb8;
}

.tier-tag.tier-mid {
  background: #f8f0e6;
  border-color: #dcc9b0;
}

.tier-tag.tier-low {
  background: #f0f0f0;
  border-color: #ccc;
}

/* legacy analytics card classes kept for compatibility */
.analytics-hero,
.analytics-eyebrow,
.analytics-stats,
.stat-card,
.analytics-list,
.insight-card,
.insight-top,
.insight-sub,
.insight-score,
.score-num,
.score-tier,
.insight-summary,
.insight-metrics,
.insight-cols,
.insight-remarks {
  display: none;
}

@media (max-width: 720px) {
  .themes-grid {
    grid-template-columns: 1fr;
    padding: 0 12px 20px;
  }

  .themes-intro {
    padding: 0 12px 14px;
  }

  .banner-settings {
    margin: 0 12px 20px;
  }

  .analytics-panel {
    padding: 10px;
  }

  .analytics-charts {
    grid-template-columns: 1fr;
  }
}

.lang-switch {
  display: inline-flex;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.lang-btn {
  border: 0;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  padding: 5px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.lang-btn + .lang-btn {
  border-left: 0;
}

.lang-btn.active {
  background: rgba(61, 158, 255, 0.2);
  color: var(--brand-ink);
}

/* ── CRM tech theme component polish ── */
.brand {
  color: #fff;
  letter-spacing: -0.02em;
}

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

.info-tip-btn {
  border-color: rgba(61, 158, 255, 0.35);
  background: rgba(61, 158, 255, 0.1);
  color: var(--brand);
}

.info-tip-btn:hover,
.info-tip-btn[aria-expanded="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #041018;
}

.field-info-box {
  border-color: rgba(61, 158, 255, 0.25);
  background: rgba(61, 158, 255, 0.08);
  color: #c5d9f2;
}

.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  border-color: rgba(61, 158, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(61, 158, 255, 0.14);
}

.btn-primary {
  background: linear-gradient(135deg, #2b8cff 0%, #1d6fd4 55%, #0ea5e9 100%);
  color: #fff;
  border-color: rgba(61, 158, 255, 0.5);
  box-shadow: 0 6px 18px rgba(29, 111, 212, 0.28);
}

.btn-upgrade {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 55%, #f97316 100%);
  color: #fff;
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.28);
  font-weight: 700;
}

.btn-upgrade:hover {
  opacity: 0.95;
}

.upgrade-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.14), rgba(234, 88, 12, 0.08));
}

.upgrade-banner-text {
  margin: 0;
  flex: 1 1 220px;
  color: #ffd7b0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.btn-secondary {
  background: rgba(61, 158, 255, 0.1);
  color: var(--brand-ink);
  border-color: rgba(61, 158, 255, 0.35);
}

.btn-danger {
  color: #ffb4b4;
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 80, 80, 0.08);
}

.alert {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 80, 80, 0.1);
  color: #ffb4b4;
}

.alert-ok {
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.1);
  color: var(--ok);
}

.topbar {
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--glow);
}

.topbar h1 {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: #fff;
}

.nav {
  gap: 4px;
  padding: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(8, 14, 26, 0.75);
  backdrop-filter: blur(12px);
}

.nav-btn {
  border-radius: 8px;
  border: 1px solid transparent;
  margin-bottom: 0;
  padding: 8px 12px;
  color: var(--muted);
}

.nav-btn.active {
  background: rgba(61, 158, 255, 0.16);
  color: var(--ink);
  border-color: rgba(61, 158, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(61, 158, 255, 0.15);
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.panel-head {
  background: rgba(61, 158, 255, 0.06);
  border-bottom-color: var(--line);
}

.panel-head h2 {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brand-ink);
}

th {
  background: rgba(61, 158, 255, 0.08);
  color: var(--brand-ink);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  border-bottom-color: var(--line);
}

tr:hover td {
  background: rgba(61, 158, 255, 0.04);
}

.badge {
  background: rgba(61, 158, 255, 0.12);
  color: var(--brand-ink);
  border-color: rgba(61, 158, 255, 0.3);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.badge-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-muted {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}

.overlay {
  background: rgba(2, 6, 14, 0.72);
  backdrop-filter: blur(4px);
}

.modal {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.form-section {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.form-section-title {
  border-bottom-color: var(--line);
  color: var(--brand);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.tenant-switcher,
.bookings-toolbar input[type="date"] {
  background-color: var(--surface-muted);
  border-color: var(--line);
  color: var(--ink);
  border-radius: 8px;
}

.tenant-switcher {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238fa3bf' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.toolbar select,
#filter-status {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--surface-muted);
  color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238fa3bf' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.service-id {
  background: rgba(61, 158, 255, 0.1);
  color: var(--brand-ink);
  font-family: var(--mono);
}

.btn-link {
  color: var(--brand);
}

.payment-provider-card,
.themes-intro,
.banner-settings,
.analytics-panel,
.referrals-intro,
.platform-accounts-intro,
.platform-logs-intro {
  border-color: var(--line);
}

.platform-accounts-intro,
.platform-logs-intro {
  margin-bottom: 12px;
}

.platform-logs-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
}

.platform-logs-table .nowrap {
  white-space: nowrap;
}

.platform-logs-more {
  margin-top: 16px;
  text-align: center;
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.payment-provider-card {
  background: var(--surface);
  border-radius: 12px;
}

.payment-ready.is-ready {
  color: var(--ok);
}

.theme-card {
  border-color: var(--line);
  background: var(--surface);
}

.theme-card.selected {
  border-color: rgba(61, 158, 255, 0.65);
  box-shadow: var(--glow);
}

.tier-tag.tier-high {
  background: rgba(94, 234, 212, 0.12);
  border-color: rgba(94, 234, 212, 0.35);
  color: var(--ok);
}

.tier-tag.tier-mid {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.tier-tag.tier-low {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}

.plan-option {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
}

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

.login-panel .brand {
  font-size: 1.35rem;
}

.login-eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 5px 10px;
  border: 1px solid rgba(61, 158, 255, 0.35);
  border-radius: 999px;
  background: rgba(61, 158, 255, 0.1);
  color: var(--brand);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.login-panel-wide {
  width: min(560px, 100%);
}

/* ── Billing / payment page ── */
.billing-layout {
  grid-template-columns: minmax(220px, 300px) minmax(0, 520px);
}

.billing-hero .billing-steps li.billing-step-active {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.08);
  color: var(--reg-ink, #e8eef8);
}

.billing-shop-chip {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--reg-line, rgba(120, 160, 220, 0.14));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.billing-shop-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--reg-muted, #8fa3bf);
  margin-bottom: 4px;
}

.billing-shop-chip strong {
  font-size: 1rem;
  color: #fff;
}

.billing-trust-note {
  margin: 20px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--reg-accent-2, #5eead4);
  color: var(--reg-muted, #8fa3bf);
  font-size: 0.86rem;
  line-height: 1.5;
}

.billing-block {
  margin-bottom: 14px;
}

.billing-benefits-block .register-block-num {
  background: rgba(94, 234, 212, 0.15);
  border-color: rgba(94, 234, 212, 0.35);
  color: var(--reg-accent-2, #5eead4);
}

.billing-benefits-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--reg-muted, #8fa3bf);
}

.billing-benefits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.billing-benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--reg-ink, #e8eef8);
  font-size: 0.92rem;
  line-height: 1.45;
}

.billing-benefit-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(94, 234, 212, 0.15);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: var(--reg-accent-2, #5eead4);
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 1px;
}

.billing-hero-benefits {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--reg-line, rgba(120, 160, 220, 0.14));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.billing-benefits-list-compact {
  gap: 8px;
}

.billing-benefits-list-compact .billing-benefit-item {
  font-size: 0.84rem;
  color: var(--reg-muted, #8fa3bf);
}

.billing-benefits-list-compact .billing-benefit-icon {
  width: 18px;
  height: 18px;
  font-size: 0.66rem;
}

.billing-plan-grid {
  margin-top: 0;
}

.billing-plan-card .register-plan-card-inner {
  min-height: 120px;
  align-content: start;
}

.billing-plan-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--reg-muted, #8fa3bf);
}

.billing-plan-price {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.billing-plan-price span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--reg-muted, #8fa3bf);
  margin-left: 2px;
}

.billing-plan-save {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(94, 234, 212, 0.15);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: var(--reg-accent-2, #5eead4);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.billing-plan-card-annual:has(input:checked) .register-plan-card-inner {
  border-color: rgba(94, 234, 212, 0.65);
  background: rgba(94, 234, 212, 0.08);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.2) inset, 0 0 24px rgba(94, 234, 212, 0.12);
}

.billing-summary {
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--reg-line, rgba(120, 160, 220, 0.14));
  border-radius: 10px;
  background: rgba(61, 158, 255, 0.06);
}

.billing-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  color: var(--reg-muted, #8fa3bf);
  font-size: 0.88rem;
}

.billing-summary-row strong {
  color: var(--reg-ink, #e8eef8);
  font-family: var(--reg-mono, var(--mono));
}

.billing-summary-note {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--reg-muted, #8fa3bf);
}

.billing-summary-total {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--reg-line, rgba(120, 160, 220, 0.14));
  font-size: 0.95rem;
}

.billing-summary-total strong {
  font-size: 1.15rem;
  color: var(--reg-accent-2, #5eead4);
}

.billing-auto-renew-note {
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted, #6b7280);
}

.billing-pay-btn {
  font-size: 1rem;
  padding: 14px 18px;
}

.billing-page .register-auth-switch .btn-link {
  color: var(--reg-accent, #3d9eff);
}

/* ── Tablet & mobile CRM (iPad / iPhone) ── */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

.touch-device .btn,
.touch-device .nav-btn,
.touch-device .inline-booking-select,
.touch-device .tenant-switcher {
  min-height: 44px;
}

.touch-device .btn {
  padding: 10px 14px;
}

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

.nav-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-scroll::-webkit-scrollbar {
  display: none;
}

.nav-scroll .nav-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.table-wrap-bookings {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
  .shell {
    padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0));
  }

  .topbar {
    gap: 14px;
  }

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

  .panel-head h2 {
    font-size: 1.05rem;
  }

  .toolbar {
    width: 100%;
  }

  .bookings-toolbar .tenant-switcher,
  .bookings-toolbar .branch-switcher,
  .bookings-toolbar #filter-status,
  .bookings-toolbar .date-picker-field {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .bookings-toolbar .btn {
    flex: 1 1 auto;
  }

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

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .shell {
    padding: 10px 10px calc(20px + env(safe-area-inset-bottom, 0));
  }

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

  .topbar-left {
    text-align: center;
  }

  .topbar h1 {
    font-size: 1.1rem;
  }

  .user-meta {
    font-size: 0.82rem;
    line-height: 1.4;
  }

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

  .topbar-actions .tenant-switcher,
  .topbar-actions .branch-switcher {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar-actions #scan-checkin-btn {
    grid-column: 1 / -1;
    font-size: 1rem;
  }

  .topbar-actions #upgrade-plan-btn {
    grid-column: 1 / -1;
  }

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

  .upgrade-banner .btn-upgrade {
    width: 100%;
  }

  .topbar-actions .lang-switch {
    justify-self: center;
  }

  .topbar-actions > a.btn,
  .topbar-actions > button.btn {
    justify-content: center;
    text-align: center;
  }

  .nav {
    margin-bottom: 10px;
    padding: 6px 8px;
  }

  .nav-btn {
    padding: 10px 14px;
    font-size: 0.88rem;
  }

  .panel-head {
    padding: 12px;
  }

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

  .toolbar input,
  .toolbar select,
  .toolbar .btn,
  .toolbar .date-picker-field {
    width: 100%;
    min-width: 0;
  }

  .bookings-toolbar .tenant-switcher,
  .bookings-toolbar .branch-switcher,
  .bookings-toolbar #filter-status,
  .bookings-toolbar .date-picker-field {
    flex: 1 1 100%;
  }

  .bookings-day-head {
    padding: 12px 12px 0;
  }

  .bookings-table thead {
    display: none;
  }

  .bookings-table tbody tr {
    display: block;
    margin: 0 10px 12px;
    padding: 4px 0 8px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  }

  .bookings-table tbody tr:last-child {
    margin-bottom: 4px;
  }

  .bookings-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    text-align: right;
  }

  .bookings-table td:last-child {
    border-bottom: 0;
  }

  .bookings-table td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 42%;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.82rem;
    padding-top: 2px;
  }

  .bookings-table td.row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .bookings-table td.row-actions::before {
    margin-bottom: 4px;
  }

  .bookings-table td.row-actions .btn {
    width: 100%;
  }

  .bookings-table td.booking-status-cell,
  .bookings-table td.booking-payment-cell {
    align-items: center;
  }

  .bookings-table td.empty {
    display: block;
    text-align: center;
  }

  .bookings-table td.empty::before {
    display: none;
  }

  .row-actions {
    justify-content: stretch;
  }

  .overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal,
  .checkin-scanner-modal {
    width: 100%;
    max-width: none;
    max-height: min(92vh, 100dvh);
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }

  .checkin-scanner-wrap {
    min-height: 240px;
  }

  .checkin-scanner-wrap > div,
  .checkin-scanner-wrap #qr-shaded-region,
  .checkin-scanner-wrap video {
    min-height: 240px !important;
  }

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

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

  .table-pager {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 12px;
  }

  .table-pager .btn {
    flex: 1 1 auto;
    min-width: 120px;
  }

  .table-pager .pager-info {
    flex: 1 1 100%;
  }

  .login-shell {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }

  .login-panel {
    padding: 24px 18px;
  }
}

.tablet-orientation-hint {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 16, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html.tablet-portrait .tablet-orientation-hint {
  display: grid;
}

.tablet-orientation-card {
  max-width: 360px;
  padding: 28px 24px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel);
  text-align: center;
  box-shadow: var(--shadow);
}

.tablet-orientation-icon {
  margin: 0 0 12px;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--brand);
  transform: rotate(90deg);
}

.tablet-orientation-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.tablet-orientation-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .billing-layout {
    grid-template-columns: 1fr;
  }

  .billing-hero-benefits {
    display: none;
  }
}

/* ── Mobile polish + PWA / first-login tour ── */
html.standalone-app body {
  padding-top: env(safe-area-inset-top, 0);
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.login-app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(88, 166, 255, 0.28);
  flex: 0 0 auto;
}

.login-brand-row .brand {
  margin: 0;
  font-size: 1.35rem;
}

.login-brand-row .login-eyebrow {
  margin-bottom: 4px;
}

.pwa-install-card {
  margin: 14px 0 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(61, 158, 255, 0.28);
  background: linear-gradient(145deg, rgba(61, 158, 255, 0.14), rgba(94, 234, 212, 0.06));
}

.pwa-install-card-compact {
  margin: 0 0 14px;
}

.pwa-install-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-ink);
}

.pwa-install-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.pwa-install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.pwa-standalone-badge {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.1);
  border: 1px solid rgba(94, 234, 212, 0.28);
}

.pwa-ios-steps {
  margin: 0 0 18px;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.55;
}

.pwa-ios-steps li + li {
  margin-top: 8px;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(3, 8, 16, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: tour-fade-in 0.28s ease;
}

@keyframes tour-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tour-card {
  width: min(440px, 100%);
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(14, 22, 38, 0.98), rgba(8, 14, 26, 0.98));
  box-shadow: var(--shadow);
  padding: 22px 20px 18px;
  animation: tour-rise 0.34s ease;
}

@keyframes tour-rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.tour-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
  font-weight: 700;
}

.tour-card h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  line-height: 1.3;
}

.tour-body {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.tour-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(143, 163, 191, 0.35);
}

.tour-dot.active {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(61, 158, 255, 0.2);
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.btn-tour-replay {
  font-size: 0.82rem;
  padding: 8px 12px;
}

@media (max-width: 768px) {
  .login-shell {
    align-items: stretch;
    padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  }

  .login-panel {
    width: 100%;
    border-radius: 18px;
    padding: 22px 18px;
  }

  .login-shell .field input {
    min-height: 48px;
    font-size: 16px;
  }

  .login-shell .btn-block {
    min-height: 48px;
    font-size: 1rem;
  }

  .shell {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 4px 12px;
    margin: 0 -4px 10px;
    background: linear-gradient(180deg, rgba(7, 11, 20, 0.96), rgba(7, 11, 20, 0.88));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }

  .topbar-actions {
    justify-content: center;
  }

  .btn-tour-replay {
    flex: 1 1 auto;
  }

  .panel {
    border-radius: 16px;
  }

  .nav-scroll {
    margin: 0 -4px 12px;
    padding: 0 4px 2px;
  }

  .nav-scroll .nav-btn {
    border-radius: 999px;
    padding: 10px 14px;
  }

  .tour-card {
    padding: 20px 16px 16px;
  }

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

  .tour-actions-right {
    width: 100%;
  }

  .tour-actions-right .btn {
    flex: 1 1 auto;
  }
}

.guide-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(94, 234, 212, 0.06));
}

.guide-hero-title {
  margin: 0 0 8px;
  font-family: var(--font);
  font-size: 1.2rem;
}

.guide-hero-intro {
  margin: 0 0 14px;
  max-width: 56ch;
}

.guide-toc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.guide-toc strong {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.guide-toc-link {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.4;
}

.guide-toc-link:hover {
  text-decoration: underline;
}

.guide-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.guide-section-grid {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 0;
}

.guide-section-media {
  background: #0b1220;
  border-right: 1px solid var(--line);
}

.guide-section-media img {
  display: block;
  width: 100%;
  height: auto;
}

.guide-section-copy {
  padding: 18px 20px;
}

.guide-section-copy h3 {
  margin: 0 0 8px;
  font-family: var(--font);
  font-size: 1.05rem;
}

.guide-section-body {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.guide-steps {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.55;
}

.guide-steps li + li {
  margin-top: 6px;
}

@media (max-width: 900px) {
  .guide-hero,
  .guide-section-grid {
    grid-template-columns: 1fr;
  }

  .guide-section-media {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

.login-mode-switch {
  margin: 0 0 16px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.password-field-wrap input {
  flex: 1;
  padding-right: 72px;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--accent, #3d9eff);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}

.password-toggle-btn:hover {
  background: rgba(61, 158, 255, 0.12);
}

.login-shell .input-with-btn {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.login-shell .input-with-btn input {
  flex: 1;
  min-width: 0;
}

.login-shell .input-with-btn .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.crm-support-corner {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 1200;
  max-width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.crm-support-corner .crm-support-whatsapp {
  pointer-events: auto;
}

.crm-support-whatsapp {
  display: inline-flex;
  align-items: center;
  color: var(--muted, #9db4d4);
  text-decoration: none;
  line-height: 1.35;
  transition: color 0.15s ease;
}

.crm-support-whatsapp:hover {
  color: #25d366;
}

.crm-support-whatsapp-topbar {
  font-size: 0.78rem;
  max-width: min(240px, 34vw);
  text-align: right;
  line-height: 1.3;
}

.crm-support-whatsapp-corner {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.9);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.78rem;
  text-align: right;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

@media (max-width: 900px) {
  .crm-support-whatsapp-topbar {
    max-width: 160px;
    font-size: 0.72rem;
  }

  .crm-support-whatsapp-corner {
    font-size: 0.72rem;
    padding: 6px 10px;
  }
}
