/* ============ Tokens ============ */
:root {
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-50: #EFF6FF;
  --blue-100: #DBEAFE;

  --green-600: #16A34A;
  --green-50: #F0FDF4;

  --red-600: #DC2626;
  --red-50: #FEF2F2;

  --amber-600: #D97706;
  --amber-50: #FFFBEB;

  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748B;
  --ink-400: #94A3B8;
  --ink-200: #E2E8F0;
  --ink-150: #EAEFF5;
  --ink-100: #F1F5F9;
  --ink-50: #F8FAFC;
  --white: #FFFFFF;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;

  --shadow-lg: 0 20px 60px -20px rgba(15, 23, 42, .18);
}

/* ============ Reset ============ */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, p { margin: 0; }
button { font-family: inherit; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .7; cursor: default; }
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-outline { background: var(--white); color: var(--ink-900); border-color: var(--ink-200); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink-400); background: var(--ink-50); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; gap: 5px; }
.btn-block { width: 100%; }

/* ============ Auth page ============ */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 32px 20px;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-500);
}
.auth-back:hover { color: var(--ink-900); }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}
.auth-logo span {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
}

.auth-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  color: var(--ink-900);
}
.auth-subtitle {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink-500);
  text-align: center;
}

#loginForm { margin-top: 28px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field[hidden] { display: none; }
.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
}
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 14.5px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--ink-50);
  color: var(--ink-900);
  outline: none;
  width: 100%;
  transition: border-color .15s ease, background .15s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-400); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue-600);
  background: var(--white);
}
.field input:disabled { color: var(--ink-500); cursor: not-allowed; }

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.field-row .field { flex: 1; min-width: 140px; }

.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 42px; }
.auth-toggle-password {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-400);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.auth-toggle-password:hover { color: var(--ink-600); background: var(--ink-100); }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 20px;
  font-size: 13px;
}
.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-600);
  cursor: pointer;
}
.auth-checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue-600);
}
.auth-link { color: var(--blue-600); font-weight: 600; }
.auth-link:hover { color: var(--blue-700); }

.auth-form-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--ink-50);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-500);
  text-align: center;
}
.auth-form-note[hidden] { display: none; }
.auth-form-note-error {
  background: var(--red-50);
  border-color: #FECACA;
  color: var(--red-600);
}

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--ink-150);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-500);
}
.auth-note svg { flex-shrink: 0; margin-top: 1px; color: var(--ink-400); }

@media (max-width: 420px) {
  .auth-card { padding: 28px 22px; }
}

/* ============ App shell ============ */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--ink-150);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}
.app-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 22px;
}
.app-sidebar-logo span {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink-900);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.app-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-600);
}
.app-nav-link svg { flex-shrink: 0; color: var(--ink-400); }
.app-nav-link:hover { background: var(--ink-50); color: var(--ink-900); }
.app-nav-link.is-active { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.app-nav-link.is-active svg { color: var(--blue-600); }

.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--ink-150);
}
.panel-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.app-sidebar-user-info { min-width: 0; }
.app-sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sidebar-user-email {
  font-size: 11.5px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-content { flex: 1; min-width: 0; }
.app-main-inner { max-width: 760px; margin: 0 auto; padding: 40px 36px 64px; }
.app-main-inner-wide { max-width: none; padding: 40px 0 0; }

.panel-heading { font-size: 22px; font-weight: 800; color: var(--ink-900); }
.panel-subtitle { margin-top: 6px; font-size: 14px; color: var(--ink-500); }

.panel-placeholder {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 56px 20px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  color: var(--ink-500);
}
.panel-placeholder strong { font-size: 15px; color: var(--ink-900); }
.panel-placeholder p { font-size: 13.5px; max-width: 360px; line-height: 1.6; }

.panel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink-400);
  font-size: 13.5px;
}
.panel-loading[hidden] { display: none; }

/* Bottom nav — mobile only, shown via the media query below */
.app-bottom-nav { display: none; }

/* ============ Settings ============ */
.app-main-inner-settings { max-width: 1080px; }

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  margin-top: 24px;
}

.settings-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 18px; }
.settings-nav-group-title {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.settings-nav-group-links { display: flex; flex-direction: column; gap: 2px; }
.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--ink-600);
}
.settings-nav-link:hover { background: var(--white); color: var(--ink-900); }
.settings-nav-link.is-active { background: var(--blue-50); color: var(--blue-600); }
.settings-nav-icon { display: flex; color: var(--ink-400); flex-shrink: 0; }
.settings-nav-link.is-active .settings-nav-icon { color: var(--blue-600); }
.settings-nav-text { flex: 1; min-width: 0; }
.settings-nav-text strong { display: block; font-size: 14px; font-weight: 500; }
.settings-nav-link.is-active .settings-nav-text strong { font-weight: 600; }
.settings-nav-text small { display: none; }
.settings-nav-chevron { display: none; color: var(--ink-400); }

.back-link.settings-back-link { display: none; }
.settings-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.settings-page-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink-900); }
.settings-page-desc { margin-top: 4px; font-size: 13.5px; color: var(--ink-500); }
.settings-page-actions { flex-shrink: 0; }
.settings-page .data-panel { margin-top: 0; }

.settings-card {
  padding: 20px 22px;
  margin-bottom: 16px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
}
.settings-card .field:last-of-type { margin-bottom: 14px; }
.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ink-150);
}
.settings-card-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink-900); }
.settings-card-desc { margin: 4px 0 16px; font-size: 13px; color: var(--ink-500); line-height: 1.5; }
.settings-card-flush { padding: 0; }
.settings-hint { margin: -8px 0 14px; font-size: 12.5px; color: var(--ink-500); }
.settings-card .settings-hint:last-child { margin-bottom: 0; }
.settings-card-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 24px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-500);
}
.settings-card-empty strong { font-size: 15px; color: var(--ink-900); }
.settings-card-empty p { max-width: 380px; line-height: 1.55; margin-bottom: 8px; }
.settings-card .detail-grid { margin-bottom: 0; }
.detail-grid.detail-grid-3 { grid-template-columns: repeat(3, 1fr); }

.profile-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.profile-identity strong { display: block; font-size: 15px; color: var(--ink-900); }
.profile-identity span { font-size: 13px; color: var(--ink-500); }
.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.inline-form { display: flex; align-items: flex-end; gap: 10px; }
.inline-form .field { flex: 1; margin-bottom: 0 !important; }
.inline-form + .modal-error { margin-top: 12px; margin-bottom: 0; }
.form-success {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--green-50);
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-md);
  color: var(--green-600);
  font-size: 12.5px;
}
.form-success[hidden] { display: none; }

/* Toggle switch rows (Settings → Главная страница) */
.switch-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  cursor: pointer;
}
.switch-row + .switch-row { border-top: 1px solid var(--ink-150); }
.switch-row-text { flex: 1; min-width: 0; }
.switch-row-text strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.switch-row-text small { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink-500); line-height: 1.45; }
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px;
  height: 24px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--ink-200);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .2);
  transition: transform .15s ease;
}
.switch:checked { background: var(--blue-600); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--blue-100); outline-offset: 2px; }

.integration-list { display: flex; flex-direction: column; gap: 12px; }

/* Settings → Приём платежей */
.acquiring-list { display: flex; flex-direction: column; gap: 12px; }
.acquiring-list .settings-card { margin-bottom: 0; }
.acquiring-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
}
.acquiring-card-info { flex: 1; min-width: 0; }
.acquiring-card-info > strong { display: block; font-size: 14.5px; color: var(--ink-900); }
.acquiring-card-info > span { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-500); }
.acquiring-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.acquiring-card-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.bank-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--ink-900);
  color: var(--white);
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.bank-badge-tochka { background: #6C3BEA; }
.choice-card .bank-badge { width: 32px; height: 32px; font-size: 14px; border-radius: 9px; }

.pill-success { background: var(--green-50); color: var(--green-600); }
.pill-muted { background: var(--ink-100); color: var(--ink-600); }

.modal-card-wide { max-width: 560px; }

.wizard-steps {
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}
.wizard-steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 3px solid var(--ink-150);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-400);
}
.wizard-steps li span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink-100);
  font-size: 11px;
}
.wizard-steps li.is-current { border-top-color: var(--blue-600); color: var(--ink-900); }
.wizard-steps li.is-current span { background: var(--blue-600); color: var(--white); }
.wizard-steps li.is-done { border-top-color: var(--blue-100); color: var(--ink-600); }
.wizard-steps li.is-done span { background: var(--blue-100); color: var(--blue-600); }

.wizard-saved {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--green-50);
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-md);
}
.wizard-saved strong { font-size: 14px; color: var(--ink-900); }
.wizard-saved span { font-size: 13px; color: var(--ink-700); }
.wizard-saved small { margin-top: 4px; font-size: 12px; color: var(--green-600); }
.wizard-loading .spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--blue-100);
  border-top-color: var(--blue-600);
  animation: step-spin .7s linear infinite;
}
.wizard-loading { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-500); padding: 12px 0; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice-card-compact { align-items: center; }
.choice-card:hover { border-color: var(--ink-400); }
.choice-card.is-selected { border-color: var(--blue-600); background: var(--blue-50); }
.choice-card.is-disabled { cursor: not-allowed; opacity: .55; background: var(--ink-50); }
.choice-card.is-disabled:hover { border-color: var(--ink-200); }
.choice-card input[type="radio"] { margin: 3px 0 0; accent-color: var(--blue-600); flex-shrink: 0; }
.choice-card-compact input[type="radio"] { margin: 0; }
.choice-card > strong { font-size: 14px; color: var(--ink-900); }
/* Choice cards and mode toggles live inside .field, whose input/span rules are
   meant for text inputs and labels — undo them here. */
.field .choice-card input,
.field .mode-toggle input {
  width: auto;
  padding: 0;
  border: none;
  background: none;
  flex-shrink: 0;
}
.field .choice-card .bank-badge { color: var(--white); font-size: 14px; font-weight: 800; }
.field .choice-card span,
.field .choice-card strong { color: inherit; }
.choice-card-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.field .choice-card-text strong,
.choice-card-text strong { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.choice-card-text small { font-size: 12.5px; color: var(--ink-500); overflow-wrap: anywhere; }
.choice-card-text .pill { margin-top: 4px; }

.placeholder-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 10px; }
.placeholder-chip-btn {
  padding: 4px 10px;
  border: 1px dashed var(--blue-100);
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-600);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.placeholder-chip-btn:hover { border-style: solid; border-color: var(--blue-600); }
.instructions-chips { margin: 0 0 8px; }

#acquiringPurposeStats { margin-bottom: 16px; }
.purpose-stats { font-size: 12.5px; color: var(--ink-500); }
.purpose-stats.is-ok strong { color: var(--green-600); }
.purpose-stats.is-error strong { color: var(--red-600); }
.purpose-conflicts { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--red-600); }
.purpose-example {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--ink-50);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--ink-700);
  overflow-wrap: anywhere;
}
.purpose-example span {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.acquiring-preview {
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
}
.acquiring-preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.acquiring-preview-head .bank-badge { width: 32px; height: 32px; font-size: 14px; border-radius: 9px; }
.acquiring-preview-head strong { display: block; font-size: 14px; color: var(--ink-900); }
.acquiring-preview-head span:not(.bank-badge) { font-size: 12.5px; color: var(--ink-500); }
.acquiring-preview .purpose-example { margin: 0 0 6px; }

/* Settings → Сотрудники */
.employee-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
}
.employee-card-info { flex: 1; min-width: 0; }
.employee-card-info > strong { display: block; font-size: 14.5px; color: var(--ink-900); }
.employee-card-info > span { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-500); overflow-wrap: anywhere; }
.employee-card .acquiring-card-meta { margin-top: 8px; }
.settings-hint-block { margin: 14px 2px 0; }

.permission-group { margin-bottom: 14px; }
.permission-group-title {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--ink-100);
  cursor: pointer;
}
.permission-row:last-child { border-bottom: none; }
.field .permission-row span { font-size: 14px; font-weight: 500; color: var(--ink-900); }
.permission-row span { font-size: 14px; font-weight: 500; color: var(--ink-900); order: -1; }
.field .permission-row input.switch { width: 40px; padding: 0; border: none; background: var(--ink-200); }
.field .permission-row input.switch:checked { background: var(--blue-600); }

/* Plan vs. what's really set in Bnovo, and what a manager still has to do */
.date-fact { margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--ink-500); }
.booking-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 4px 0 8px; }
.booking-action {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--amber-50);
  color: var(--amber-600);
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
}
.data-table .booking-actions { margin-bottom: 0; }
.data-table .booking-action { white-space: nowrap; }
.time-choice .modal-note { margin: 4px 0 8px; }
.booking-section .modal-warning + .modal-actions { margin-bottom: 4px; }
#guestMessageText { resize: vertical; }

.modal-warning {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--amber-50);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  color: var(--amber-600);
  font-size: 12.5px;
  line-height: 1.5;
}
.modal-warning[hidden] { display: none; }

.mode-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
}
.mode-toggle input { margin: 0; accent-color: var(--blue-600); }
.mode-toggle.is-on { border-color: var(--blue-600); background: var(--blue-50); color: var(--blue-600); }
.field .mode-toggle { color: var(--ink-700); }
.field .mode-toggle.is-on { color: var(--blue-600); }

.integration-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
}
.integration-icon { width: 44px; height: 44px; border-radius: var(--radius-md); flex-shrink: 0; }
.integration-info { flex: 1; min-width: 0; }
.integration-info strong { display: block; font-size: 14.5px; color: var(--ink-900); }
.integration-info span { font-size: 13px; color: var(--ink-500); }
.integration-actions { display: flex; gap: 8px; flex-shrink: 0; }

.sync-key { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sync-key code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--ink-900);
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  overflow-wrap: anywhere;
  user-select: all;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ink-150);
  flex-shrink: 0;
}
.modal-head strong { font-size: 15.5px; color: var(--ink-900); }
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-600);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.modal-body { padding: 20px 22px 22px; }
/* The card itself clips to its border-radius and never scrolls — otherwise a
   visible scrollbar tends to square off the corner it sits against. Only the
   (non-footer) body scrolls, so the card's rounding always renders cleanly. */
.modal-body:not(.modal-body-tight) { flex: 1; min-height: 0; overflow-y: auto; }
.modal-body-tight { padding-top: 0; flex-shrink: 0; }
.modal-note { font-size: 13px; color: var(--ink-500); margin-bottom: 16px; line-height: 1.5; }
.modal-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--red-50);
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  color: var(--red-600);
  font-size: 12.5px;
}
.modal-error[hidden] { display: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* Edit modals (e.g. object) are always full screen, desktop included — but the
   form content itself stays readable instead of stretching edge to edge. */
.modal-overlay-fullscreen { padding: 0; }
.modal-overlay-fullscreen .modal-card {
  max-width: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}
.modal-overlay-fullscreen .modal-body {
  max-width: 900px;
  margin: 0 auto;
}

/* Detail modals (e.g. booking) stay a small window on desktop — full screen
   only kicks in on mobile, in the media query below. */
.modal-overlay-full .modal-card { max-width: 640px; }

/* Sync progress steps */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}
.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}
.step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-100);
  border: 2px solid var(--ink-150);
}
.step-row.is-active .step-dot {
  border-color: var(--blue-600);
  background: var(--blue-50);
}
.step-row.is-active .step-dot .spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--blue-100);
  border-top-color: var(--blue-600);
  animation: step-spin .7s linear infinite;
}
.step-row.is-done .step-dot { background: var(--green-600); border-color: var(--green-600); color: var(--white); }
.step-row.is-error .step-dot { background: var(--red-600); border-color: var(--red-600); color: var(--white); }
.step-label { font-size: 13.5px; color: var(--ink-500); font-weight: 500; }
.step-row.is-active .step-label,
.step-row.is-done .step-label,
.step-row.is-error .step-label { color: var(--ink-900); font-weight: 600; }

@keyframes step-spin { to { transform: rotate(360deg); } }

.sync-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.sync-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green-50);
  color: var(--green-600);
  margin-bottom: 4px;
}
.sync-success strong { font-size: 15.5px; color: var(--ink-900); }
.sync-success p { font-size: 13.5px; color: var(--ink-500); line-height: 1.55; }

/* ============ Data tables (Bookings / Guests) ============ */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-row-end { justify-content: space-between; }
.toolbar-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.toolbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
}
.toolbar-search input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px 10px 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-900);
  outline: none;
}
.toolbar-search input:focus { border-color: var(--blue-600); }
.toolbar-date {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
}
.toolbar-date input {
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
  min-width: 170px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-900);
  outline: none;
}
.toolbar-date input:focus { border-color: var(--blue-600); }
.toolbar-object select,
.toolbar-sort select {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-900);
  max-width: 220px;
}

.data-panel {
  margin-top: 16px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--ink-50);
  color: var(--ink-500);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--ink-150);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-700);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr.is-clickable:hover { background: var(--ink-50); }
.data-table .cell-primary { font-weight: 600; color: var(--ink-900); }
.data-table .cell-muted { color: var(--ink-500); }
.data-table td.data-table-empty { text-align: center; color: var(--ink-400); padding: 40px 16px; white-space: normal; }

.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-600);
  white-space: nowrap;
}

/* Booking detail modal */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin-bottom: 16px;
}
.detail-grid .span-2 { grid-column: 1 / -1; }
.detail-item span {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: 3px;
}
.detail-item strong {
  display: block;
  font-size: 14px;
  color: var(--ink-900);
  font-weight: 600;
}
.link-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: var(--ink-50);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.link-row code {
  flex: 1;
  min-width: 0;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 12.5px;
  color: var(--ink-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-card-header { margin-bottom: 18px; }
.booking-guest-name { font-size: 21px; font-weight: 700; color: var(--ink-900); margin: 0 0 6px; }
.booking-card-subline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-500);
  font-weight: 500;
}

.booking-color-picker { display: flex; gap: 10px; margin-top: 14px; }
.color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
}
.color-dot.is-active::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--ink-700);
}
.color-dot-blue { background: #93C5FD; }
.color-dot-green { background: #86EFAC; }
.color-dot-yellow { background: #FDE68A; }
.color-dot-red { background: #FCA5A5; }
.color-dot-purple { background: #C4B5FD; }
.color-dot-orange { background: #FDBA74; }

/* Each logical group of the booking card gets its own card, matching the
   .data-panel treatment used for tables elsewhere — replaces flat <hr> dividers. */
.booking-section {
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.booking-section .link-row:last-child { margin-bottom: 0; }
.booking-section .detail-grid { margin-bottom: 0; }
.booking-section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-400);
  margin-bottom: 12px;
}
.booking-section .modal-note { margin-bottom: 0; }

.booking-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--ink-150);
}
.booking-tab {
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-500);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.booking-tab:hover { color: var(--ink-900); }
.booking-tab.is-active { color: var(--blue-600); border-bottom-color: var(--blue-600); }

.amount-rows { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--ink-150); }
.amount-row { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; font-size: 13.5px; color: var(--ink-600); }
.amount-row strong { color: var(--ink-900); font-weight: 600; white-space: nowrap; }

.included-services { margin-bottom: 14px; }
.included-services .booking-section-label { margin-bottom: 6px; }
.service-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.service-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--ink-150);
}
.service-item:first-of-type { border-top: 0; padding-top: 0; }
.service-item:last-of-type { padding-bottom: 0; }
.service-item-text strong { display: block; font-size: 14px; color: var(--ink-900); overflow-wrap: anywhere; }
.service-item-text span { font-size: 12.5px; color: var(--ink-500); }
.service-item-cost { font-size: 14px; color: var(--ink-900); white-space: nowrap; }
.service-item-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

.catalog-row { display: flex; gap: 8px; margin-bottom: 8px; }
.catalog-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14px;
}
.catalog-row-new { margin-top: 14px; margin-bottom: 0; }

.contact-method-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.contact-method-group:last-child { margin-bottom: 0; }
.btn-outline.is-active { background: var(--blue-600); border-color: var(--blue-600); color: var(--white); }
.contact-other-row { display: flex; flex-direction: row; gap: 8px; margin-bottom: 0 !important; }
.contact-other-row input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--ink-50);
  outline: none;
}
.contact-other-row input:focus { border-color: var(--blue-600); background: var(--white); }

.editable-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.editable-row input {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  outline: none;
  min-width: 0;
}
.editable-row input:focus { border-color: var(--blue-600); }

.detail-item-highlight strong { color: var(--blue-600); font-size: 17px; }

/* Guest detail page */
.guest-header-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
}
.guest-header-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.guest-header-info strong { font-size: 16px; color: var(--ink-900); display: block; }
.guest-header-contacts {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-500);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: 14px;
}
.back-link:hover { color: var(--ink-900); }
.section-subheading { font-size: 16px; font-weight: 700; color: var(--ink-900); margin-top: 28px; }

/* Object list: pending-deletion pill, "needs setup" warning, row actions */
.row-warning-icon { display: inline-flex; color: var(--amber-600); vertical-align: -2px; margin-right: 6px; }
.cell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.pill-warning { background: var(--amber-50); color: var(--amber-600); }
.btn-icon-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--red-600);
  cursor: pointer;
}
.btn-icon-danger:hover { background: var(--red-50); border-color: var(--red-600); }

/* Object edit modal */
.object-edit-layout { display: flex; gap: 32px; align-items: flex-start; }
.object-edit-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 190px;
  flex-shrink: 0;
}
.object-edit-nav button {
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--ink-600);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.object-edit-nav button:hover { background: var(--ink-50); color: var(--ink-900); }
.object-edit-content { flex: 1; min-width: 0; }

.settings-block {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--ink-150);
}
.settings-block:last-of-type { border-bottom: none; }
.settings-block .section-subheading { margin-top: 0; margin-bottom: 14px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.photo-grid-empty { font-size: 13.5px; color: var(--ink-400); margin-bottom: 14px; }
.photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--ink-150);
  cursor: grab;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.photo-tile-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, .65);
  color: var(--white);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.photo-tile-remove:hover { background: var(--red-600); }
.photo-upload-btn { display: inline-flex; cursor: pointer; }

.instructions-textarea {
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.6;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--ink-50);
  color: var(--ink-900);
  outline: none;
  width: 100%;
  resize: vertical;
  margin-bottom: 12px;
}
.instructions-textarea:focus { border-color: var(--blue-600); background: var(--white); }
.instructions-preview {
  font-size: 14px;
  line-height: 1.6;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--ink-50);
  border: 1px solid var(--ink-150);
  color: var(--ink-900);
}
.instructions-preview-empty { color: var(--ink-400); }
.placeholder-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 12.5px;
  font-weight: 600;
}

/* Photo lightbox */
.photo-lightbox-overlay { background: rgba(15, 23, 42, .9); }
.photo-lightbox-img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: var(--radius-md); }
.photo-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .3);
  color: var(--white);
}

/* ============ Home dashboard ============ */
.home-stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 36px 28px;
}
.home-stat-number { font-size: 34px; font-weight: 800; color: var(--ink-900); line-height: 1; }
.home-stat-label { font-size: 14px; color: var(--ink-500); font-weight: 500; }

.home-columns {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: hidden;
  padding: 0 36px 40px;
}
.home-column {
  flex: 1 1 0;
  min-width: 0;
  background: var(--ink-50);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.home-column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 12px;
}
.home-column-title { font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.home-column-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-500);
  background: var(--ink-150);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.home-column-body { display: flex; flex-direction: column; gap: 10px; }
.home-column-empty { font-size: 13px; color: var(--ink-400); padding: 8px 6px; }

.home-card {
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.home-card:hover { border-color: var(--ink-400); box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.home-card-color-blue { background: #DBEAFE; border-color: #93C5FD; }
.home-card-color-green { background: #DCFCE7; border-color: #86EFAC; }
.home-card-color-yellow { background: #FEF9C3; border-color: #FDE68A; }
.home-card-color-red { background: #FEE2E2; border-color: #FCA5A5; }
.home-card-color-purple { background: #EDE9FE; border-color: #C4B5FD; }
.home-card-color-orange { background: #FFEDD5; border-color: #FDBA74; }
.home-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.home-card-top strong { font-size: 14px; color: var(--ink-900); font-weight: 600; }
.home-card-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.status-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--white);
}
.status-dot-blue { background: var(--blue-600); }
.status-dot-amber { background: var(--amber-600); }
.status-dot-green { background: var(--green-600); }
.status-dot-gray { background: var(--ink-400); }
.home-card-source {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-500);
  background: var(--ink-100);
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  white-space: nowrap;
}
.home-card-object { font-size: 12.5px; color: var(--ink-500); margin-bottom: 8px; }
.home-card-dates { font-size: 12.5px; color: var(--ink-700); margin-bottom: 8px; }
.home-card-dates > div + div { margin-top: 3px; }
.home-card-date-label { color: var(--ink-400); }
.home-card-time {
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}
.home-card-time-real { background: var(--green-50); color: var(--green-600); }
.home-card-time-default { background: var(--red-50); color: var(--red-600); }
.home-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.home-card-nights {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--ink-100);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.home-card-contact {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-50);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}

.home-group { margin-bottom: 2px; }
.home-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  list-style: none;
}
.home-group summary::-webkit-details-marker { display: none; }
.home-group summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid var(--ink-400);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .12s ease;
  flex-shrink: 0;
}
.home-group[open] summary::before { transform: rotate(90deg); }
.home-group-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-500);
  background: var(--ink-150);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
}
.home-group-cards { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }

/* Column order editor (Settings → Колонки) */
.column-order-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.column-order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  cursor: grab;
}
.column-order-drag-handle { color: var(--ink-400); font-size: 16px; line-height: 1; }
.column-order-label { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.column-order-arrows { display: none; margin-left: auto; gap: 4px; }
.column-order-arrows button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-600);
  font-size: 10px;
  cursor: pointer;
}
.column-order-arrows button:hover { border-color: var(--ink-400); }

/* Below 1200px, five evenly-stretched columns get too narrow for their
   content — switch to the same horizontal-scroll-with-snap behavior mobile
   uses instead of shrinking everything. The general ≤860px block below (which
   also drops the column count to one at a time) overrides this by source
   order where the two ranges overlap. */
@media (max-width: 1200px) {
  .home-columns {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .home-columns::-webkit-scrollbar { display: none; }
  .home-column {
    flex: 0 0 320px;
    width: 320px;
    scroll-snap-align: center;
  }
}

@media (max-width: 860px) {
  .app-sidebar { display: none; }
  .app-content { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .app-main-inner { padding: 24px 18px 40px; }
  .app-main-inner-wide { padding: 20px 0 0; }

  .object-edit-nav { display: none; }

  .home-stat { padding: 0 18px 20px; }
  .home-columns {
    padding: 0 18px 32px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .home-columns::-webkit-scrollbar { display: none; }
  .home-column {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: center;
  }

  .column-order-drag-handle { display: none; }
  .column-order-row { cursor: default; }
  .column-order-arrows { display: flex; }

  .app-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    border-top: 1px solid var(--ink-150);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
  }
  .app-bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 16px;
    border-radius: var(--radius-md);
    color: var(--ink-500);
    font-size: 11px;
    font-weight: 600;
  }
  .app-bottom-link svg { color: var(--ink-400); }
  .app-bottom-link.is-active { color: var(--blue-600); }
  .app-bottom-link.is-active svg { color: var(--blue-600); }

  .settings-layout { display: block; margin-top: 18px; }
  .settings-layout.is-index .settings-page { display: none; }
  .settings-layout.has-section .settings-nav { display: none; }
  .settings-layout.has-section { margin-top: 0; }
  .settings-heading.has-section { display: none; }
  .settings-nav { position: static; gap: 20px; }
  .settings-nav-group-links {
    background: var(--white);
    border: 1px solid var(--ink-150);
    border-radius: var(--radius-lg);
    overflow: hidden;
    gap: 0;
  }
  .settings-nav-link { padding: 14px 16px; border-radius: 0; gap: 14px; }
  .settings-nav-link + .settings-nav-link { border-top: 1px solid var(--ink-100); }
  .settings-nav-link.is-active { background: transparent; color: var(--ink-600); }
  .settings-nav-link.is-active .settings-nav-icon { color: var(--ink-400); }
  .settings-nav-text strong { font-size: 15px; font-weight: 600; color: var(--ink-900); }
  .settings-nav-text small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-500); }
  .settings-nav-chevron { display: flex; }
  .back-link.settings-back-link { display: inline-flex; }
  .settings-page-head { flex-wrap: wrap; }
  .settings-card { padding: 18px; }
  .settings-card-flush { padding: 0; }
  .switch-row { padding: 16px 18px; }
  .detail-grid.detail-grid-3 { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .acquiring-card,
  .employee-card { flex-wrap: wrap; align-items: flex-start; }
  .employee-card-info { flex-basis: calc(100% - 60px); }
  .acquiring-card-info { flex-basis: calc(100% - 60px); }
  .acquiring-card-actions { width: 100%; }
  .acquiring-card-actions .btn { flex: 1; }

  .integration-card { flex-wrap: wrap; }
  .integration-card .btn { width: 100%; }
  .integration-actions { width: 100%; flex-direction: column; }
  .modal-actions { flex-direction: column; }

  .toolbar-row { align-items: stretch; }
  .toolbar-row-end { flex-direction: column; align-items: stretch; }
  .toolbar-search { max-width: none; }
  .toolbar-date { flex: 1; }
  .toolbar-date input { width: 100%; min-width: 0; }
  .toolbar-object select,
  .toolbar-sort select { max-width: none; width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .guest-header-card { flex-wrap: wrap; }

  .field-row { flex-direction: column; gap: 0; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

  .modal-overlay-full { padding: 0; }
  .modal-overlay-full .modal-card {
    max-width: none;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* ============ Danger buttons ============ */
.btn-danger { background: var(--red-600); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #B91C1C; }
.btn-danger-outline { background: var(--white); color: var(--red-600); border-color: #FECACA; }
.btn-danger-outline:hover:not(:disabled) { background: var(--red-50); border-color: var(--red-600); }

/* ============ Nav badge ============ */
.app-nav-link, .app-bottom-link { position: relative; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--blue-600);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.nav-badge[hidden] { display: none; }
.app-nav-link[hidden], .app-bottom-link[hidden] { display: none; }
.app-bottom-link .nav-badge { position: absolute; top: 0; right: 6px; margin: 0; }

/* ============ LumoChat settings window ============ */
.lumochat-section + .lumochat-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--ink-150); }
.lumochat-section-title { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--ink-900); }
.lumochat-section .modal-note { margin-bottom: 12px; }
.messenger-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.messenger-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
}
.messenger-row-icon { width: 30px; height: 30px; flex-shrink: 0; }
.messenger-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.messenger-row-info strong { font-size: 13.5px; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messenger-row-info span { font-size: 12px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messenger-status {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--ink-100);
  color: var(--ink-600);
}
.messenger-status.is-active { background: var(--green-50); color: var(--green-600); }
.messenger-status.is-deleted, .messenger-status.is-disconnected { background: var(--red-50); color: var(--red-600); }
.messenger-add { display: flex; gap: 8px; }
.messenger-add input {
  flex: 1;
  min-width: 0;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  outline: none;
}
.messenger-add input:focus { border-color: var(--blue-600); }
.lumochat-section .modal-error { margin-top: 10px; }

/* ============ Guest card: chat buttons ============ */
.guest-chat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.guest-chat-btn img { width: 18px; height: 18px; }

/* ============ Chats ============ */
.app-main-inner-chats { max-width: none; padding: 0; }
.chats {
  display: flex;
  height: 100vh;
  height: 100dvh;
  background: var(--white);
  overflow: hidden;
}
.chat-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Sidebar: the dialog list */
.chats-sidebar {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ink-150);
  min-height: 0;
}
.chats-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 20px 14px;
}
.chats-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--blue-600);
  color: var(--white);
  cursor: pointer;
}
.chats-new-btn:hover { background: var(--blue-700); }
.chats-search { max-width: none; flex: none; margin: 0 20px; }
.chats-search input { background: var(--ink-50); border-color: transparent; }
.chats-search input:focus { background: var(--white); }
.chats-filters {
  display: flex;
  gap: 6px;
  padding: 12px 20px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chats-filters::-webkit-scrollbar { display: none; }
.chats-filter {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-600);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.chats-filter:hover { border-color: var(--ink-400); }
.chats-filter.is-active { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-600); }
.chats-list { flex: 1; overflow-y: auto; padding: 0 10px 16px; min-height: 0; }
.chats-list-note { padding: 28px 12px; text-align: center; font-size: 13px; color: var(--ink-500); line-height: 1.5; }

.chat-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.chat-item:hover { background: var(--ink-50); }
.chat-item.is-active { background: var(--blue-50); }
.chat-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.chat-item-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-item-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-time { flex-shrink: 0; font-size: 11.5px; color: var(--ink-400); }
.chat-item-preview {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-you { color: var(--ink-700); }
.chat-unread {
  flex-shrink: 0;
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--blue-600);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.chat-ticks { margin-right: 4px; font-size: 11px; letter-spacing: -2px; color: var(--ink-400); }
.chat-ticks.is-read { color: var(--blue-600); }
.chat-object-tag {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-700);
  font-size: 11.5px;
  font-weight: 600;
}
.chat-object-tag span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.is-active .chat-object-tag { background: var(--white); }

/* Avatars */
.chat-avatar { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.chat-avatar.is-small { width: 40px; height: 40px; }
.chat-avatar-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blue-100), var(--blue-50));
  color: var(--blue-600);
  font-size: 16px;
  font-weight: 700;
}
.chat-avatar-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chat-online {
  position: absolute;
  right: 1px;
  top: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green-600);
  border: 2px solid var(--white);
}
.chat-logo {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--white);
}
.chat-logo svg { width: 100%; height: 100%; display: block; }

/* Main pane */
.chats-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--ink-50); }
.chats-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--ink-500);
}
.chats-placeholder[hidden] { display: none; }
.chats-placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--ink-150);
  color: var(--blue-600);
}
.chats-placeholder strong { font-size: 15px; color: var(--ink-900); }
.chats-placeholder p { max-width: 320px; font-size: 13.5px; line-height: 1.6; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--ink-150);
}
.chat-head[hidden] { display: none; }
.chat-head-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-left: -8px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
}
.chat-head-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 4px 8px;
  margin-left: -8px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: default;
}
.chat-head-info.is-clickable { cursor: pointer; }
.chat-head-info.is-clickable:hover { background: var(--ink-50); }
.chat-head-title {
  max-width: 100%;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head-sub { max-width: 100%; font-size: 12.5px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-sub.is-booking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-700);
}
.chat-head-sub.is-booking strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.chat-head-dates { color: var(--blue-600); font-weight: 500; }
.chat-head-actions { flex-shrink: 0; }
.chat-head-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chat-head-action:hover { border-color: var(--ink-400); background: var(--ink-50); }

.chat-pin-offer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--amber-50);
  border-bottom: 1px solid #FDE68A;
}
.chat-pin-offer[hidden] { display: none; }
.chat-pin-offer-text { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-900); font-weight: 500; }
.chat-pin-offer-text .chat-icon { color: var(--amber-600); }
.chat-pin-offer-actions { display: flex; gap: 8px; }
.chat-pin-offer-actions .btn { padding: 8px 14px; font-size: 13px; }

/* Messages */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-messages[hidden] { display: none; }
.chat-day { display: flex; justify-content: center; margin: 12px 0 8px; }
.chat-day span {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 1px solid var(--ink-150);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
}
.chat-msg { display: flex; align-items: flex-end; gap: 6px; border-radius: var(--radius-md); }
.chat-msg.is-out { flex-direction: row-reverse; }
.chat-msg.is-flash { animation: chat-flash 1.2s ease; }
@keyframes chat-flash { 0%, 40% { background: var(--blue-100); } 100% { background: transparent; } }
.chat-messages.is-selecting .chat-msg { cursor: pointer; padding: 2px 4px; }
.chat-msg.is-selected { background: var(--blue-100); }

.chat-bubble {
  position: relative;
  max-width: min(560px, 75%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 6px;
  border-radius: 16px 16px 16px 4px;
  background: var(--white);
  border: 1px solid var(--ink-150);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}
.chat-msg.is-out .chat-bubble {
  border-radius: 16px 16px 4px 16px;
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--white);
}
.chat-bubble-text { white-space: pre-wrap; }
.chat-bubble-sender { font-size: 12.5px; font-weight: 700; color: var(--blue-600); }
.chat-bubble-forward { font-size: 12px; font-style: italic; opacity: .75; }
.chat-bubble-reply {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 10px;
  border: none;
  border-left: 3px solid var(--blue-600);
  border-radius: 6px;
  background: var(--blue-50);
  font-family: inherit;
  text-align: left;
  color: var(--ink-900);
  cursor: pointer;
}
.chat-bubble-reply strong { font-size: 12.5px; color: var(--blue-600); }
.chat-bubble-reply span { font-size: 12.5px; color: var(--ink-600); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-msg.is-out .chat-bubble-reply { background: rgba(255, 255, 255, .16); border-left-color: var(--white); color: var(--white); }
.chat-msg.is-out .chat-bubble-reply strong, .chat-msg.is-out .chat-bubble-reply span { color: var(--white); }
.chat-bubble-meta {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-400);
  /* The bubble breaks long links anywhere; the time must stay whole. */
  white-space: nowrap;
  overflow-wrap: normal;
}
.chat-msg.is-out .chat-bubble-meta { color: rgba(255, 255, 255, .75); }
.chat-msg.is-out .chat-ticks, .chat-msg.is-out .chat-ticks.is-read { color: var(--white); margin: 0; }
.chat-bubble-edited { font-style: italic; }
.chat-msg-react {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-400);
  opacity: 0;
  cursor: pointer;
  transition: opacity .15s ease;
}
.chat-msg:hover .chat-msg-react { opacity: 1; }
.chat-msg-react:hover { background: var(--white); color: var(--ink-700); }
.chat-messages.is-selecting .chat-msg-react { display: none; }

/* Attachments */
.chat-photo, .chat-sticker { max-width: 100%; height: auto; border-radius: 10px; }
.chat-photo { max-height: 360px; object-fit: cover; cursor: zoom-in; }
.chat-sticker { width: 160px; }
.chat-album { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.chat-album .chat-photo { width: 100%; height: 140px; }
.chat-attach { font-size: 13.5px; }
.chat-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: var(--ink-50);
  color: var(--ink-900);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-file .chat-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--blue-600); color: var(--white); }
.chat-file-info { display: flex; flex-direction: column; min-width: 0; }
.chat-file-info strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-info span { font-size: 11.5px; color: var(--ink-500); }
.chat-msg.is-out .chat-file { background: rgba(255, 255, 255, .16); color: var(--white); }
.chat-msg.is-out .chat-file .chat-icon { background: var(--white); color: var(--blue-600); }
.chat-msg.is-out .chat-file-info span { color: rgba(255, 255, 255, .75); }

.chat-voice { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.chat-voice-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--blue-600);
  color: var(--white);
  cursor: pointer;
}
.chat-msg.is-out .chat-voice-play { background: var(--white); color: var(--blue-600); }
.chat-voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; }
.chat-voice-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--ink-200); }
.chat-voice-wave i.is-played { background: var(--blue-600); }
.chat-msg.is-out .chat-voice-wave i { background: rgba(255, 255, 255, .4); }
.chat-msg.is-out .chat-voice-wave i.is-played { background: var(--white); }
.chat-voice-time { font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .8; }

.chat-video { position: relative; width: 300px; max-width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--ink-900); }
.chat-video.is-note { width: 200px; aspect-ratio: 1; border-radius: 50%; }
.chat-video img, .chat-video video { width: 100%; height: 100%; object-fit: cover; }
.chat-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, .6);
  color: var(--white);
  cursor: pointer;
}
.chat-video-duration {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(15, 23, 42, .6);
  color: var(--white);
  font-size: 11px;
}

/* Reactions */
.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-reaction {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ink-200);
  background: var(--ink-50);
  font-size: 12.5px;
  cursor: pointer;
}
.chat-reaction.is-mine { border-color: var(--blue-600); background: var(--blue-50); }
.chat-msg.is-out .chat-reaction { background: rgba(255, 255, 255, .18); border-color: transparent; color: var(--white); }
.chat-msg.is-out .chat-reaction.is-mine { background: var(--white); color: var(--ink-900); }
.chat-reaction-picker {
  position: fixed;
  z-index: 300;
  display: flex;
  gap: 2px;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 1px solid var(--ink-150);
  box-shadow: var(--shadow-lg);
}
.chat-reaction-picker.is-full {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  max-height: 260px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
}
.chat-reaction-picker button {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 19px;
  cursor: pointer;
}
.chat-reaction-picker button:hover { background: var(--ink-100); }
.chat-picker-more { font-size: 14px !important; color: var(--ink-500); }

.chat-ctx-menu {
  position: fixed;
  z-index: 300;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--ink-150);
  box-shadow: var(--shadow-lg);
}
.chat-ctx-menu button {
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  color: var(--ink-900);
  cursor: pointer;
}
.chat-ctx-menu button:hover, .chat-ctx-menu button:focus-visible { background: var(--ink-50); outline: none; }
.chat-ctx-menu button.is-danger { color: var(--red-600); }

/* Composer */
.chat-composer { padding: 10px 20px 16px; background: var(--ink-50); }
.chat-composer[hidden] { display: none; }
.chat-context {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--blue-600);
  border-radius: var(--radius-md);
  background: var(--white);
}
.chat-context[hidden] { display: none; }
.chat-context-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-context-body strong { font-size: 12.5px; color: var(--blue-600); }
.chat-context-body span { font-size: 13px; color: var(--ink-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-context-cancel { border: none; background: transparent; font-size: 20px; color: var(--ink-400); cursor: pointer; }
.chat-draft { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chat-draft[hidden] { display: none; }
.chat-draft-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 64px;
  min-width: 64px;
  max-width: 200px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--ink-150);
  font-size: 12px;
  overflow: hidden;
}
.chat-draft-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chat-draft-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-draft-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, .6);
  color: var(--white);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.chat-upload { margin-bottom: 8px; font-size: 12.5px; color: var(--ink-500); }
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--ink-200);
}
.chat-form:focus-within { border-color: var(--blue-600); }
.chat-form[hidden] { display: none; }
.chat-form textarea {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  padding: 9px 4px;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-900);
  background: transparent;
}
.chat-tool, .chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
}
.chat-tool:hover { background: var(--ink-50); color: var(--ink-900); }
.chat-tool[hidden], .chat-send[hidden] { display: none; }
.chat-send { background: var(--blue-600); color: var(--white); }
.chat-send:hover { background: var(--blue-700); }
.chat-send:disabled { opacity: .6; }
.chat-recording, .chat-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--ink-200);
}
.chat-recording[hidden], .chat-selection[hidden] { display: none; }
.chat-recording .btn, .chat-selection .btn { padding: 8px 14px; font-size: 13px; }
.chat-recording-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red-600); animation: chat-pulse 1s ease infinite; }
@keyframes chat-pulse { 50% { opacity: .3; } }
.chat-recording-time { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-700); }
.chat-recording-level { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; }
.chat-recording-level i { flex: 1; min-width: 2px; height: 10%; border-radius: 2px; background: var(--blue-600); }
.chat-selection span { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink-700); }

/* Guest profile panel */
.chat-profile {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 22px;
  border-left: 1px solid var(--ink-150);
  background: var(--white);
  overflow-y: auto;
}
.chat-profile[hidden] { display: none; }
.chat-profile-head { display: flex; align-items: center; justify-content: space-between; }
.chat-profile-head strong { font-size: 15px; }
.chat-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 14px 14px;
  border-radius: var(--radius-lg);
  background: var(--ink-50);
  text-align: center;
}
.chat-profile-card .guest-header-avatar { margin-bottom: 4px; }
.chat-profile-name { font-size: 15px; color: var(--ink-900); }
.chat-profile-phone { font-size: 13px; color: var(--ink-500); margin-bottom: 8px; }
.chat-profile-subheading { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-700); }
.chat-profile-bookings { display: flex; flex-direction: column; gap: 8px; }
.chat-profile-booking {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.chat-profile-booking:hover { border-color: var(--ink-400); }
.chat-profile-booking.is-focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-50); }
.chat-profile-booking-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-500); }
.chat-profile-booking-row strong { font-size: 13.5px; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-profile-booking-row .chat-icon { color: var(--ink-400); }
.chat-profile-focus {
  align-self: flex-start;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-600);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
}
.chat-profile-unpin { margin-top: auto; color: var(--red-600); }

/* Pick lists in chat modals */
.chat-modal-search { max-width: none; margin-bottom: 12px; }
.chat-pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; margin: 0 -8px; }
.chat-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.chat-pick-item:hover { background: var(--ink-50); }
.chat-pick-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 13px;
  font-weight: 700;
}
.chat-pick-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-pick-info strong { font-size: 14px; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pick-info > span { font-size: 12.5px; color: var(--ink-500); }
.field select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
}

.chat-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 400;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--ink-900);
  color: var(--white);
  box-shadow: var(--shadow-lg);
}
.chat-toast[hidden] { display: none; }
.chat-toast strong { font-size: 13.5px; }
.chat-toast p { margin-top: 2px; font-size: 12.5px; color: var(--ink-200); line-height: 1.45; }
.chat-toast.is-error { background: var(--red-600); }
.chat-toast.is-error p { color: #FEE2E2; }

@media (max-width: 1200px) {
  .chats.has-profile .chats-sidebar { display: none; }
}

@media (max-width: 860px) {
  .chats { height: calc(100dvh - 76px - env(safe-area-inset-bottom, 0px)); }
  .chats-sidebar { width: 100%; border-right: none; }
  .chats-sidebar-head { padding: 20px 18px 12px; }
  .chats-search { margin: 0 18px; }
  .chats-filters { padding: 12px 18px 10px; }
  .chats-main { display: none; }
  .chats.has-chat .chats-sidebar { display: none; }
  .chats.has-chat .chats-main { display: flex; }
  .chat-head { padding: 10px 14px; }
  .chat-head-back { display: flex; }
  .chat-head-action span:last-child { display: none; }
  .chat-messages { padding: 12px 12px; }
  .chat-bubble { max-width: 85%; }
  .chat-msg-react { display: none; }
  .chat-composer { padding: 8px 10px 10px; }
  .chat-profile { position: fixed; inset: 0 0 calc(76px + env(safe-area-inset-bottom, 0px)); width: auto; z-index: 60; border-left: none; }
  .chat-toast { left: 16px; right: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); bottom: auto; max-width: none; }
}

/* ============ Booking card: contact channel ============ */
.booking-contact-channel { margin-bottom: 14px; }
.booking-contact-channel .contact-method-group { margin-bottom: 0; }
.booking-contact-channel .contact-other-row { margin-top: 8px; }

/* ============ Booking card: pinned chats ============ */
.booking-linked-chats { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.booking-linked-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  background: var(--blue-50);
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.booking-linked-chat:hover { border-color: var(--blue-600); }
.booking-linked-chat img { flex-shrink: 0; }
.booking-linked-chat-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.booking-linked-chat-info strong { font-size: 13.5px; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-linked-chat-info span { font-size: 12px; color: var(--ink-500); }
.booking-linked-chat-open { flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--blue-600); }

/* ============ Chats: quick replies ============ */
.chat-composer { position: relative; }
.chat-suggest {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 100%;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-lg);
}
.chat-suggest[hidden] { display: none; }
.chat-suggest-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-suggest-row:hover, .chat-suggest-row.is-active { background: var(--blue-50); }
.chat-suggest-row strong { flex-shrink: 0; font-size: 13.5px; color: var(--blue-600); }
.chat-suggest-row span { min-width: 0; font-size: 13px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-quick-hint { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chat-quick-hint[hidden] { display: none; }
.chat-quick-hint-booking {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--blue-700);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.chat-quick-hint-booking:hover { border-color: var(--blue-600); }
.chat-quick-hint-booking > span { flex-shrink: 0; white-space: nowrap; }
.chat-quick-hint-booking strong { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-quick-hint-dates { flex-shrink: 0; }
.chat-quick-hint-change { flex-shrink: 0; margin-left: auto; font-weight: 700; }
.chat-quick-hint-missing {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  background: var(--amber-50);
  color: var(--amber-600);
  font-size: 12.5px;
  line-height: 1.4;
}

.chat-quick-card { max-width: 520px; }
.chat-quick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-bottom: 14px; }
.chat-quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-md);
  background: var(--white);
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.chat-quick-row:hover { border-color: var(--ink-400); }
.chat-quick-row.is-static { cursor: default; }
.chat-quick-row.is-static:hover { border-color: var(--ink-150); }
.chat-quick-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-quick-row-body strong { font-size: 13.5px; color: var(--blue-600); }
.chat-quick-row-body span { font-size: 13px; line-height: 1.4; color: var(--ink-600); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-quick-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.chat-quick-alias { display: flex; align-items: center; border: 1px solid var(--ink-200); border-radius: var(--radius-md); background: var(--white); }
.chat-quick-alias:focus-within { border-color: var(--blue-600); }
.chat-quick-alias span { padding-left: 12px; font-size: 14px; font-weight: 700; color: var(--blue-600); }
.field .chat-quick-alias input { flex: 1; min-width: 0; padding-left: 2px; border: none; background: transparent; box-shadow: none; }
.chat-quick-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  outline: none;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}
.chat-quick-form textarea:focus { border-color: var(--blue-600); }
.chat-quick-placeholders { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.chat-quick-placeholders-title { font-size: 12px; font-weight: 700; color: var(--ink-500); }
.chat-quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-quick-chip {
  padding: 4px 10px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--ink-700);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chat-quick-chip:hover { border-color: var(--blue-600); color: var(--blue-600); }

@media (max-width: 860px) {
  .chat-suggest { left: 10px; right: 10px; }
  .chat-quick-row.is-static { flex-direction: column; align-items: stretch; }
}

/* ============ Booking card: BroneBoxy payments ============ */
.ledger-list { display: flex; flex-direction: column; gap: 8px; }
.booking-section .detail-grid + .ledger-list { margin-top: 14px; }
.ledger-row { padding: 10px 12px; border: 1px solid var(--ink-150); border-radius: var(--radius-md); background: var(--white); }
.ledger-row.is-cancelled { background: var(--ink-50); }
.ledger-row.is-cancelled .ledger-row-main strong { color: var(--ink-400); text-decoration: line-through; }
.ledger-row-main { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-600); }
.ledger-row-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row-main strong { color: var(--ink-900); font-weight: 600; white-space: nowrap; }
.ledger-row-meta { margin-top: 4px; font-size: 12px; color: var(--ink-500); }
.ledger-row-refund { margin-top: 6px; padding: 5px 9px; border-radius: 8px; background: var(--red-50); color: var(--red-600); font-size: 12.5px; font-weight: 600; }
.ledger-row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.status-badge.ledger-status-amber { background: var(--amber-50); color: var(--amber-600); }
.status-badge.ledger-status-green { background: var(--green-50); color: var(--green-600); }
.status-badge.ledger-status-red { background: var(--red-50); color: var(--red-600); }
.status-badge.ledger-status-gray { background: var(--ink-100); color: var(--ink-500); }
.ledger-overpaid { margin: 12px 0 0; }
.receipt-image { display: block; width: 100%; max-height: 62vh; object-fit: contain; margin-bottom: 12px; border-radius: var(--radius-md); }
.receipt-frame { display: block; width: 100%; height: 62vh; margin-bottom: 12px; border: 1px solid var(--ink-150); border-radius: var(--radius-md); }
.home-card-notices { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.home-card-notice { padding: 3px 9px; border-radius: var(--radius-pill); background: var(--amber-50); color: var(--amber-600); font-size: 11.5px; font-weight: 700; }
.home-card-notice.is-danger { background: var(--red-50); color: var(--red-600); }

/* ============ Loader ============ */
.loader { display: flex; align-items: center; justify-content: center; padding: 28px 0; }
.loader-spin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--blue-100);
  border-top-color: var(--blue-600);
  animation: step-spin .7s linear infinite;
}

/* ============ Phones and installed web app ============ */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
/* iOS zooms into any field below 16px on focus. */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* ============ OkiDoki ============ */
.okidoki-catalog { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.okidoki-catalog-col { padding: 12px; border-radius: var(--radius-md); font-size: 12.5px; line-height: 1.45; }
.okidoki-catalog-col.is-ok { background: var(--green-50); color: var(--green-600); }
.okidoki-catalog-col.is-no { background: var(--red-50); color: var(--red-600); }
.okidoki-catalog-col strong { display: block; margin-bottom: 6px; font-size: 13px; }
.okidoki-catalog-col ul { margin: 0; padding-left: 16px; }
.okidoki-catalog-col li + li { margin-top: 4px; }
.okidoki-connected { margin: 0 0 12px; }
@media (max-width: 480px) { .okidoki-catalog { grid-template-columns: 1fr; } }

.contract-preview { margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--ink-50); }
.contract-preview span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--ink-500); }
.contract-preview strong { font-size: 14px; font-weight: 600; color: var(--ink-900); overflow-wrap: anywhere; }
.contract-extras { margin: 0 0 14px; }
.contract-missing { padding: 12px 14px; border-radius: var(--radius-md); background: var(--red-50); color: var(--red-600); font-size: 13px; line-height: 1.5; }
.contract-missing strong, .contract-missing span { display: block; }
.contract-missing strong { margin-bottom: 4px; }
.contract-missing ul { margin: 6px 0; padding-left: 18px; color: var(--ink-600); }
.contract-missing li.is-missing { color: var(--red-600); font-weight: 600; }

.contract-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.contract-head .booking-section-label { margin-bottom: 0; }
.contract-help-btn {
  width: 22px;
  height: 22px;
  margin-left: auto;
  border: 1px solid var(--ink-200);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink-500);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.contract-help-btn:hover, .contract-help-btn.is-active { border-color: var(--blue-600); color: var(--blue-600); }
.contract-help { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--ink-50); font-size: 12.5px; line-height: 1.5; color: var(--ink-600); }
.contract-help span { display: block; margin-top: 6px; color: var(--ink-500); overflow-wrap: anywhere; }
.contract-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#bookingContractError { margin: 10px 0 0; }

/* ============ Finance ============ */
.fin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.fin-head .panel-subtitle { margin-bottom: 0; }
.fin-head .btn { flex-shrink: 0; }
.fin-card { margin-bottom: 16px; padding: 20px; background: var(--white); border: 1px solid var(--ink-150); border-radius: var(--radius-lg); }
.fin-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fin-card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink-900); }
.fin-card-sub { font-size: 12.5px; color: var(--ink-500); }
.fin-chart-total { font-size: 22px; font-weight: 800; color: var(--ink-900); white-space: nowrap; }

.fin-plot { position: relative; height: 230px; cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.fin-plot svg { display: block; }
.fin-grid { stroke: var(--ink-150); stroke-width: 1; }
.fin-axis { fill: var(--ink-400); font-size: 11px; }
.fin-wave { fill: none; stroke: var(--blue-600); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.fin-max-line { stroke: var(--amber-600); stroke-width: 1.5; stroke-dasharray: 5 5; }
.fin-max-label { fill: var(--amber-600); font-size: 11.5px; font-weight: 700; }
.fin-cursor { stroke: var(--ink-400); stroke-width: 1; }
.fin-dot { fill: var(--blue-600); stroke: var(--white); stroke-width: 2; }
.fin-tip {
  position: absolute;
  top: 28px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--ink-900);
  color: var(--white);
  pointer-events: none;
  white-space: nowrap;
}
.fin-tip[hidden] { display: none; }
.fin-tip span { font-size: 11.5px; color: var(--ink-400); }
.fin-tip strong { font-size: 15px; font-weight: 700; }
.fin-tip small { font-size: 11.5px; color: var(--ink-200); }

.fin-month-picks { display: flex; gap: 8px; }
.fin-month-picks select { padding: 7px 10px; border: 1px solid var(--ink-200); border-radius: 10px; background: var(--white); font-family: inherit; font-size: 13px; color: var(--ink-900); }
.fin-swipe-hint { display: none; }
@media (hover: none) { .fin-swipe-hint { display: inline; } }
.fin-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fin-tile { min-width: 0; padding: 12px 14px; border-radius: var(--radius-md); background: var(--ink-50); }
.fin-tile span, .fin-tile small { display: block; font-size: 12px; color: var(--ink-500); }
.fin-tile strong { display: block; margin-top: 2px; font-size: 17px; font-weight: 700; color: var(--ink-900); overflow-wrap: anywhere; }
.fin-sources { margin-top: 8px; }
.fin-source { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--ink-150); }
.fin-source:last-child { border-bottom: none; padding-bottom: 0; }
.fin-source-name { min-width: 0; }
.fin-source-name strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.fin-source-name span { font-size: 12.5px; color: var(--ink-500); }
.fin-source-sum { flex-shrink: 0; text-align: right; }
.fin-source-sum strong { display: block; font-size: 14px; font-weight: 700; color: var(--ink-900); }
.fin-source-sum small, .fin-row-money small { font-size: 11.5px; color: var(--red-600); }

.fin-filters-toggle { display: none; }
.fin-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 12px; }
.fin-filter-grid .field { margin-bottom: 14px; }
.fin-range-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.fin-range { min-width: 0; }
.fin-range > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink-700); }
.fin-range > div { display: flex; gap: 8px; }
.fin-range input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--ink-200); border-radius: 10px; background: var(--white); font-family: inherit; font-size: 13px; color: var(--ink-900); }
.fin-filters-body > .btn { margin-top: 14px; }

.fin-picker { position: relative; }
.fin-picker-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: var(--ink-50);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-900);
  text-align: left;
  cursor: pointer;
}
.fin-picker-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-picker-menu {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-lg);
}
.fin-picker.is-open .fin-picker-menu { display: block; }
.fin-pick-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; font-size: 13.5px; color: var(--ink-900); cursor: pointer; }
.fin-pick-row:hover { background: var(--ink-50); }
.fin-pick-row input { flex-shrink: 0; width: 16px; height: 16px; margin: 0; }
.fin-pick-empty { margin: 0; padding: 8px; font-size: 13px; color: var(--ink-500); }

.fin-list-head { margin: 0 2px 8px; font-size: 13px; color: var(--ink-500); }
.fin-rows { overflow: hidden; margin-bottom: 12px; background: var(--white); border: 1px solid var(--ink-150); border-radius: var(--radius-lg); }
.fin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 160px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-bottom: 1px solid var(--ink-150);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.fin-row:last-child { border-bottom: none; }
.fin-row:hover { background: var(--ink-50); }
.fin-row-main { min-width: 0; }
.fin-row-main strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-row-main small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-500); }
.fin-row-money { text-align: right; white-space: nowrap; }
.fin-row-money strong { display: block; font-size: 14.5px; font-weight: 700; color: var(--ink-900); }
.fin-row.is-muted .fin-row-money strong { color: var(--ink-400); }
.fin-row-status { justify-self: end; }
.fin-empty { padding: 36px 16px; text-align: center; font-size: 14px; color: var(--ink-400); }
.status-badge.ledger-status-blue { background: var(--blue-50); color: var(--blue-600); }

.fin-detail-status { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-600); }
.fin-lines { margin-bottom: 12px; padding: 4px 14px; border-radius: var(--radius-md); background: var(--ink-50); }
.fin-line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 13.5px; }
.fin-line + .fin-line { border-top: 1px solid var(--ink-150); }
.fin-line span { color: var(--ink-500); }
.fin-line strong { font-weight: 600; color: var(--ink-900); text-align: right; overflow-wrap: anywhere; }
.fin-receipt { margin-bottom: 12px; }
.fin-open-booking { margin-bottom: 8px; }
.fin-log { margin-bottom: 14px; }
.fin-log .booking-section-label { display: block; margin-bottom: 8px; }
.fin-log-item { position: relative; padding: 0 0 12px 18px; }
.fin-log-item:last-child { padding-bottom: 0; }
.fin-log-item::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-600); }
.fin-log-item:not(:last-child)::after { content: ""; position: absolute; left: 3px; top: 16px; bottom: -4px; width: 2px; background: var(--ink-150); }
.fin-log-item strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.fin-log-item span { font-size: 12.5px; color: var(--ink-500); }
.fin-receipt .booking-section-label { display: block; margin-bottom: 8px; }

.fin-report-body { max-width: none !important; width: 100%; }
.fin-report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.fin-report-table th, .fin-report-table td { padding-left: 9px; padding-right: 9px; font-size: 12.5px; white-space: nowrap; }
.fin-report-table th { white-space: normal; }
.fin-report-table .fin-cell-wrap { min-width: 104px; white-space: normal; }
.fin-report-table .fin-cell-stay { min-width: 84px; max-width: 96px; }
.fin-report-table .fin-cell-money { text-align: right; font-weight: 600; color: var(--ink-900); }
.fin-report-summary { grid-template-columns: repeat(4, 1fr); margin: 14px 0; }

@media (max-width: 860px) {
  .app-bottom-link { flex: 1; min-width: 0; padding: 6px 2px; }
  .fin-head { flex-direction: column; align-items: stretch; }
  .fin-card { padding: 16px; }
  .fin-tiles, .fin-report-summary { grid-template-columns: 1fr 1fr; }
  .fin-tile:first-child:nth-last-child(3) { grid-column: 1 / -1; }
  .fin-filters-toggle {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-900);
    text-align: left;
    cursor: pointer;
  }
  .fin-filters-body { display: none; margin-top: 14px; }
  .fin-filters.is-open .fin-filters-body { display: block; }
  .fin-range-grid { grid-template-columns: 1fr; }
  .fin-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fin-row-status { grid-column: 1 / -1; justify-self: start; }
  .fin-month-picks select { flex: 1; min-width: 0; font-size: 16px; }
  .fin-card-head { flex-direction: column; }
  .fin-month-picks { width: 100%; }
  .fin-row-main strong { white-space: normal; }
}

.device-row { background: var(--white); }
