/* DaimoraX design system: tokens + core components shared across the platform. */
:root {
  --ds-bg: #0b0d12;
  --ds-surface: #12151c;
  --ds-elevated: #181c25;
  --ds-border: rgba(255, 255, 255, 0.08);
  --ds-border-strong: rgba(255, 255, 255, 0.14);
  --ds-text: #f4f4f5;
  --ds-muted: #9ba1ae;
  --ds-subtle: #6b7180;
  --ds-accent: #d4af37;
  --ds-accent-hover: #e2c25a;
  --ds-accent-ink: #14110a;
  --ds-danger: #f87171;
  --ds-success: #4ade80;
  --ds-radius: 12px;
  --ds-radius-lg: 16px;
  --ds-font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ds-display: 'Instrument Serif', Georgia, serif;
}

.ds-body, .ds-body *, .ds-body *::before, .ds-body *::after { box-sizing: border-box; }
html:has(.ds-body) { overflow-x: clip; }

.ds-body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.ds-display { font-family: var(--ds-display); font-weight: 400; letter-spacing: -0.01em; line-height: 1.05; }
.ds-muted { color: var(--ds-muted); }
.ds-subtle { color: var(--ds-subtle); }
.ds-accent { color: var(--ds-accent); }
.ds-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ds-accent); }

/* Surfaces */
.ds-card { background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); }
.ds-divider { height: 1px; background: var(--ds-border); border: 0; }

/* Form controls */
.ds-label { display: block; font-size: 13px; font-weight: 500; color: var(--ds-text); margin-bottom: 8px; }
.ds-field { position: relative; }
/* Sizing is set on the element itself (not only via .ds-body *) so inputs can never
   render wider than their container, even if a stale or foreign stylesheet loads. */
.ds-input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 48px;
  padding: 0 14px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border-strong);
  border-radius: var(--ds-radius);
  color: var(--ds-text);
  font: inherit;
  font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ds-input::placeholder { color: var(--ds-subtle); }
.ds-input:hover { border-color: rgba(255, 255, 255, 0.22); }
.ds-input:focus { outline: none; border-color: var(--ds-accent); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }
.ds-input.input-error, .ds-input[aria-invalid="true"] { border-color: var(--ds-danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.14); }
.ds-input-action {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ds-muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.ds-input-action:hover { color: var(--ds-text); background: rgba(255, 255, 255, 0.05); }
.ds-help { font-size: 12px; color: var(--ds-subtle); margin-top: 6px; }
.ds-error { display: none; font-size: 12px; color: var(--ds-danger); margin-top: 6px; }
.ds-error.show { display: block; }

.ds-checkbox { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ds-accent); cursor: pointer; }

/* Buttons */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: var(--ds-radius);
  font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.ds-btn:active { transform: translateY(1px); }
.ds-btn:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-btn-primary { background: var(--ds-accent); color: var(--ds-accent-ink); }
.ds-btn-primary:hover { background: var(--ds-accent-hover); }
.ds-btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.ds-btn-secondary { background: transparent; color: var(--ds-text); border-color: var(--ds-border-strong); }
.ds-btn-secondary:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.24); }
.ds-btn-block { width: 100%; }
.ds-link { color: var(--ds-accent); text-decoration: none; font-weight: 500; }
.ds-link:hover { color: var(--ds-accent-hover); text-decoration: underline; text-underline-offset: 3px; }

/* Alerts */
.ds-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--ds-radius); font-size: 14px; }
.ds-alert-error { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.25); color: #fca5a5; }
.ds-alert-success { background: rgba(74, 222, 128, 0.08); border: 1px solid rgba(74, 222, 128, 0.25); color: #86efac; }

/* Auth layout: brand panel + form panel */
.ds-auth { min-height: 100vh; min-height: 100dvh; display: flex; }
.ds-auth-brand {
  display: none; position: relative; overflow: hidden; flex: 1 1 50%;
  padding: 48px; flex-direction: column; justify-content: space-between;
  background: var(--ds-surface); border-right: 1px solid var(--ds-border);
}
.ds-auth-brand::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--ds-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--ds-border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 10%, transparent 70%);
  opacity: .6;
}
.ds-auth-brand > * { position: relative; }
.ds-auth { width: 100%; max-width: 100vw; overflow-x: hidden; }
.ds-auth-main { flex: 1 1 50%; min-width: 0; width: 100%; display: flex; flex-direction: column; padding: 20px 16px; }
.ds-auth-form { width: 100%; max-width: 400px; min-width: 0; margin: auto; padding: 24px 0; }
.ds-auth-form h2.ds-display { font-size: clamp(30px, 8vw, 40px) !important; }
.ds-auth-form form, .ds-auth-form form > * { min-width: 0; max-width: 100%; }
.ds-input, .ds-btn, .ds-alert, select, textarea { max-width: 100%; }
.ds-alert > * { min-width: 0; }

/* 16px inputs on phones prevent iOS auto-zoom, which otherwise looks like overflow. */
@media (max-width: 767px) {
  .ds-input, .ds-auth-form select, .ds-auth-form textarea { font-size: 16px; }
}
@media (min-width: 480px) {
  .ds-auth-main { padding: 24px; }
  .ds-auth-form { padding: 32px 0; }
}
.ds-brandmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ds-text); text-decoration: none; font-weight: 600; font-size: 16px; }
.ds-brandmark img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.ds-trust { display: flex; flex-direction: column; gap: 18px; }
.ds-trust-item { display: flex; gap: 14px; align-items: flex-start; }
.ds-trust-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(212, 175, 55, 0.1); color: var(--ds-accent); }
.ds-stat-row { display: flex; gap: 40px; }
.ds-stat-value { font-family: var(--ds-display); font-size: 36px; line-height: 1; }

@media (min-width: 1024px) {
  .ds-auth-brand { display: flex; }
  .ds-auth-main { padding: 40px 48px; }
  .ds-auth-mobile-brand { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* App-wide mobile shell. overflow-x: clip (not hidden) so the page keeps
 * scrolling on the viewport and sticky headers keep working. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body { max-width: 100%; overflow-x: clip; }
@supports not (overflow: clip) { body { overflow-x: hidden; } }
img, svg, video, canvas, iframe { max-width: 100%; }
main.container { max-width: 640px; overflow-wrap: anywhere; }
main.container > * { min-width: 0; }
main.container .flex > * { min-width: 0; }
main.container table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
main.container pre, main.container code { white-space: pre-wrap; word-break: break-all; }
a, button, [role="button"], input[type="checkbox"], input[type="radio"], select { touch-action: manipulation; }
[role="dialog"] { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }

/* ---------------------------------------------------------------------------
 * Compact phone layer. Tailwind sizes everything in rem, so a slightly smaller
 * root (14px on small phones, growing to 16px by 640px) tightens spacing,
 * icons and type proportionally. Percent-based, so the user's own browser or
 * OS text-size setting still scales it. Floors keep small text readable, and
 * form fields stay at 16px so iOS Safari never auto-zooms on focus.
 * ------------------------------------------------------------------------- */
@media (max-width: 640px) {
  html { font-size: clamp(87.5%, 75% + 0.6vw, 100%); }

  html .text-xs, html .text-\[10px\], html .text-\[11px\] { font-size: max(0.75rem, 11px); line-height: 1.35; }
  html .text-sm { font-size: max(0.875rem, 12.5px); line-height: 1.4; }
  html .text-\[8px\], html .text-\[9px\],
  html .efficiency-tag, html .verified-badge, html .own-note, html .redacted,
  html .chat-time, html .payment-detail-label, html .dash-tour-count,
  html .eff-tour-count, html .lifetime-badge, html .dx-day > span:first-child { font-size: 11px; }
  html .absolute.rounded-full.bg-red-500 { white-space: nowrap; line-height: 1.2; }
  html .text-5xl { font-size: 2.25rem; }
  html .text-4xl { font-size: 1.875rem; }

  html input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  html select, html textarea { font-size: 16px !important; }
  html input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  html select { min-height: 42px; }

  main .p-6, main .p-7, main .p-8 { padding: 1rem; }
  main .p-5 { padding: 0.875rem; }
  main .px-6, main .px-8 { padding-left: 1rem; padding-right: 1rem; }
  main .py-6, main .py-8 { padding-top: 1rem; padding-bottom: 1rem; }
  main .rounded-3xl { border-radius: 1.125rem; }
  main .rounded-\[2rem\], main .rounded-\[28px\], main .rounded-\[32px\] { border-radius: 1.25rem; }
  main .gap-6, main .gap-8 { gap: 0.875rem; }
  main .space-y-6 > :not([hidden]) ~ :not([hidden]),
  main .space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.875rem; }
  main .mb-8, main .mb-10 { margin-bottom: 1.25rem; }
  main .mt-8, main .mt-10 { margin-top: 1.25rem; }
}

/* Very narrow views: 360px phones at the largest display size, or browser zoom. */
@media (max-width: 340px) {
  main.container, main { padding-left: 10px; padding-right: 10px; }
  main .grid-cols-3 > *, main .grid-cols-4 > * { min-width: 0; }
  main .text-3xl { font-size: 1.5rem; }
  main .text-2xl { font-size: 1.25rem; }
}

@media (min-width: 768px) {
  main.container { max-width: 720px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------------------
 * Theme tokens. Tailwind's dark/white/gray palette reads these variables, so
 * existing pages pick up the dark palette without markup changes.
 * ------------------------------------------------------------------------- */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --dx-dark-900: 11 13 18; --dx-dark-800: 18 21 28; --dx-dark-700: 24 28 37; --dx-dark-600: 35 40 52; --dx-dark-500: 50 56 70;
  --dx-white: 255 255 255;
  --dx-gray-100: 243 244 246; --dx-gray-200: 229 231 235; --dx-gray-300: 209 213 219; --dx-gray-400: 156 163 175;
  --dx-gray-500: 107 114 128; --dx-gray-600: 75 85 99; --dx-gray-700: 55 65 81; --dx-gray-800: 31 41 55; --dx-gray-900: 17 24 39;
  --dx-nav-bg: linear-gradient(135deg, rgba(38,38,38,.72), rgba(18,18,18,.72));
}

/* ---------------------------------------------------------------------------
 * Compact app components used by the new pages (payout methods, check-in,
 * preferences, admin settings).
 * ------------------------------------------------------------------------- */
.dx-page { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.dx-topbar { display: flex; align-items: center; gap: 12px; padding: 2px 0 4px; }
.dx-topbar-title { font-size: 1.125rem; font-weight: 700; line-height: 1.3; color: rgb(var(--dx-white)); }
.dx-topbar-sub { font-size: .8125rem; color: rgb(var(--dx-gray-400)); line-height: 1.4; margin-top: 2px; }
.dx-icon-btn { flex: none; width: 40px; height: 40px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: rgb(var(--dx-dark-700)); border: 1px solid rgb(var(--dx-dark-600)); color: rgb(var(--dx-white)); }
.dx-card { background: rgb(var(--dx-dark-800)); border: 1px solid rgb(var(--dx-dark-600)); border-radius: 16px; padding: 16px; }
.dx-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 72px; padding: 10px 6px; border-radius: 14px; background: rgb(var(--dx-dark-700)); border: 1px solid rgb(var(--dx-dark-600)); color: rgb(var(--dx-white)); font-size: .75rem; font-weight: 600; text-align: center; text-decoration: none; transition: border-color .15s ease; }
.dx-tile:hover, .dx-tile:focus-visible { border-color: rgb(var(--dx-gold-500, 212 175 55) / .6); }
.dx-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-section-title { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--dx-gray-400)); margin: 6px 2px 0; }
.dx-muted { color: rgb(var(--dx-gray-400)); }
.dx-label { display: block; font-size: .8125rem; font-weight: 600; margin-bottom: 6px; color: rgb(var(--dx-gray-200)); }
.dx-help { font-size: .75rem; color: rgb(var(--dx-gray-400)); margin-top: 6px; line-height: 1.45; }
.dx-input { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px; border-radius: 12px; background: rgb(var(--dx-dark-900)); border: 1px solid rgb(var(--dx-dark-500)); color: rgb(var(--dx-white)); }
.dx-input:disabled { opacity: .6; }
.dx-check { width: 18px; height: 18px; accent-color: #d4af37; }
.dx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: .9375rem; transition: background-color .15s, opacity .15s; }
.dx-btn-primary { background: #d4af37; color: #14110a; }
.dx-btn-primary:hover { background: #e2c25a; }
.dx-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.dx-btn-ghost { background: rgb(var(--dx-dark-700)); color: rgb(var(--dx-white)); border: 1px solid rgb(var(--dx-dark-600)); }
.dx-link { font-size: .8125rem; font-weight: 600; color: #d4af37; background: none; border: 0; padding: 4px 0; cursor: pointer; }
.dx-link-danger { color: #f87171; }
.dx-badge { display: inline-flex; align-items: center; font-size: .6875rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(212,175,55,.15); color: #d4af37; margin-left: 6px; vertical-align: middle; }
.dx-alert { border-radius: 12px; padding: 12px 14px; font-size: .875rem; line-height: 1.45; }
.dx-alert-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; }
.dx-alert-info { background: rgba(212,175,55,.10); border: 1px solid rgba(212,175,55,.30); color: rgb(var(--dx-gray-200)); }
.dx-list { display: flex; flex-direction: column; background: rgb(var(--dx-dark-800)); border: 1px solid rgb(var(--dx-dark-600)); border-radius: 16px; overflow: hidden; }
.dx-list-item { display: flex; gap: 12px; padding: 14px 16px; align-items: flex-start; }
.dx-list-item + .dx-list-item { border-top: 1px solid rgb(var(--dx-dark-600)); }
a.dx-list-item { align-items: center; min-height: 56px; }
a.dx-list-item:hover { background: rgb(var(--dx-dark-700)); }
.dx-list-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(212,175,55,.12); color: #d4af37; }
.dx-list-title { font-size: .9375rem; font-weight: 600; color: rgb(var(--dx-white)); line-height: 1.35; overflow-wrap: anywhere; }
.dx-list-sub { font-size: .8125rem; color: rgb(var(--dx-gray-400)); margin-top: 2px; overflow-wrap: anywhere; }
.dx-list-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.dx-chevron { flex: none; width: 18px; height: 18px; color: rgb(var(--dx-gray-500)); }
.dx-segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgb(var(--dx-dark-900)); border: 1px solid rgb(var(--dx-dark-500)); }
.dx-segment-item { position: relative; }
.dx-segment-item input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.dx-segment-item span { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 6px; border-radius: 9px; font-size: .8125rem; font-weight: 600; color: rgb(var(--dx-gray-400)); text-align: center; line-height: 1.2; }
.dx-segment-item input:checked + span { background: #d4af37; color: #14110a; }
.dx-segment-item input:focus-visible + span { outline: 2px solid #d4af37; outline-offset: 2px; }
.dx-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dx-stat { background: rgb(var(--dx-dark-900)); border: 1px solid rgb(var(--dx-dark-600)); border-radius: 12px; padding: 10px; text-align: center; }
.dx-stat-value { font-size: 1.05rem; font-weight: 700; color: rgb(var(--dx-white)); font-variant-numeric: tabular-nums; }
.dx-stat-label { font-size: .6875rem; color: rgb(var(--dx-gray-400)); margin-top: 2px; }
.dx-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dx-day { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .6875rem; font-weight: 600; background: rgb(var(--dx-dark-900)); border: 1px solid rgb(var(--dx-dark-600)); color: rgb(var(--dx-gray-400)); }
.dx-day.is-done { background: rgba(212,175,55,.16); border-color: rgba(212,175,55,.5); color: #d4af37; }
.dx-day.is-today { outline: 2px solid #d4af37; outline-offset: 1px; }
.dx-table { width: 100%; font-size: .8125rem; border-collapse: collapse; }
.dx-table th { text-align: left; font-weight: 600; color: rgb(var(--dx-gray-400)); padding: 8px 10px; border-bottom: 1px solid rgb(var(--dx-dark-600)); white-space: nowrap; }
.dx-table td { padding: 10px; border-bottom: 1px solid rgb(var(--dx-dark-600)); vertical-align: middle; }
.dx-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
[hidden] { display: none !important; }
