/* OrthoMarketing design system: tokens, base, and shared components.
   Light theme by design (the brand is a white-ground mark); every color is set explicitly.
   Brand hues come from the logo: azure (ORTHO), slate (MARKETING), the gray rule. */
:root {
  color-scheme: light;

  /* Brand */
  --om-azure: #1A8CE6;        /* logo azure: progress, focus, selected indicators */
  --om-blue: #0B6FC9;         /* primary actions; white text passes AA (4.9:1) */
  --om-blue-deep: #0959A6;    /* hover and pressed */
  --om-blue-tint: #EDF5FD;    /* selected surfaces */
  --om-blue-tint-2: #D6E8FA;
  --om-slate: #48607F;        /* logo slate: secondary text */
  --om-rule: #A6A6A6;         /* logo rule */

  /* Neutrals, biased cool toward the brand */
  --n-0: #FFFFFF;
  --n-25: #FAFBFD;
  --n-50: #F4F6F9;
  --n-100: #ECF0F5;
  --n-200: #DFE5EC;
  --n-300: #C9D2DD;
  --n-400: #9AA7B8;
  --n-500: #66778E;
  --n-700: #2F4059;
  --n-900: #0E1A2B;

  /* Semantic roles */
  --text: var(--n-900);
  --text-2: var(--om-slate);
  --text-3: var(--n-500);
  --text-on-accent: #FFFFFF;
  --bg: var(--n-0);
  --bg-2: var(--n-50);
  --bg-3: var(--n-100);
  --surface: var(--n-0);
  --border: var(--n-200);
  --border-strong: var(--n-300);
  --accent: var(--om-blue);
  --accent-hover: var(--om-blue-deep);
  --accent-bright: var(--om-azure);
  --accent-tint: var(--om-blue-tint);
  --accent-tint-2: var(--om-blue-tint-2);
  --danger: #B42318;
  --success: #16A34A;
  --success-ink: #15803D;    /* savings text on white: 5.0:1 */
  --success-tint: #EAF7EF;
  --danger-tint: #FEF3F2;
  --scrim: rgba(14, 26, 43, 0.38);
  --focus-ring: 0 0 0 3px rgba(26, 140, 230, 0.38);

  /* Materials: translucent only for navigation, the floating plan bar and sheet chrome */
  --glass: rgba(255, 255, 255, 0.74);
  --glass-dark: rgba(20, 30, 46, 0.86);
  --glass-blur: saturate(180%) blur(20px);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-brand: "Raleway", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --fs-display: clamp(38px, 4.6vw, 58px);
  --fs-title: 28px;
  --fs-h2: 22px;
  --fs-h3: 17px;
  --fs-card: 16px;
  --fs-body: 15px;
  --fs-sm: 14px;
  --fs-xs: 13px;
  --fs-cap: 12px;
  --fs-price: 20px;
  --fs-price-lg: 30px;
  --lh-tight: 1.08;
  --lh-snug: 1.3;
  --lh-body: 1.5;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --track-caps: 0.08em;

  /* Spacing (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-7: 32px; --s-8: 40px; --s-9: 48px; --s-10: 64px; --s-11: 80px;

  /* Radius */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 28px; --r-pill: 999px;

  /* Borders and shadows */
  --bw: 1px;
  --bw-strong: 2px;
  --sh-1: 0 1px 2px rgba(14, 26, 43, 0.05);
  --sh-2: 0 1px 2px rgba(14, 26, 43, 0.04), 0 8px 24px rgba(14, 26, 43, 0.08);
  --sh-3: 0 2px 8px rgba(14, 26, 43, 0.06), 0 28px 64px rgba(14, 26, 43, 0.2);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 320ms;

  /* Component heights and widths */
  --h-sm: 36px;
  --h-md: 44px;
  --h-lg: 52px;
  --head-h: 64px;
  --w-content: 1200px;
  --w-wide: 1320px;
  --w-narrow: 760px;
  --w-text: 62ch;
  /* Breakpoints (container widths; CSS cannot read custom properties in queries, so the
     @container rules repeat these literals): mobile <= 700, tablet 701-1100, desktop 1101+. */
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg-2); color: var(--text); font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh-body); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-snug); text-wrap: balance; font-weight: var(--fw-semibold); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent-tint-2); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Type ---------- */
.t-display { font-family: var(--font-display); font-size: var(--fs-display); line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -0.025em; }
.t-title { font-family: var(--font-display); font-size: var(--fs-title); line-height: 1.15; font-weight: var(--fw-bold); letter-spacing: -0.015em; }
.t-h2 { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
.t-h3 { font-size: var(--fs-h3); font-weight: var(--fw-semibold); }
.t-sm { font-size: var(--fs-sm); }
.t-xs { font-size: var(--fs-xs); }
.t-2 { color: var(--text-2); }
.t-3 { color: var(--text-3); }
.eyebrow { font-size: var(--fs-cap); font-weight: var(--fw-semibold); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--text-2); }

/* ---------- Icons ---------- */
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--h-md); padding: 0 var(--s-5); border-radius: var(--r-pill); font-size: var(--fs-body); font-weight: var(--fw-semibold); white-space: nowrap; text-decoration: none; border: var(--bw) solid transparent; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); -webkit-tap-highlight-color: transparent; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:focus-visible { border-radius: var(--r-pill); }
.btn:disabled { opacity: 0.42; }
.btn-primary { background: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-3); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--n-200); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--n-400); }
.btn-ghost { color: var(--text); padding: 0 var(--s-3); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); }
.btn-link { min-height: auto; padding: 0; color: var(--accent); border-radius: var(--r-xs); font-weight: var(--fw-semibold); }
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.btn-added { background: var(--accent-tint); color: var(--accent); border-color: var(--accent-tint-2); }
.btn-added:hover:not(:disabled) { background: var(--accent-tint-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: var(--h-sm); padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn-lg { min-height: var(--h-lg); padding: 0 var(--s-7); font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h-md); min-height: var(--h-md); padding: 0; border-radius: 50%; }
.btn-icon.btn-sm { width: var(--h-sm); min-height: var(--h-sm); }

/* ---------- Badges and status ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 var(--s-2); border-radius: var(--r-pill); font-size: 11.5px; font-weight: var(--fw-semibold); letter-spacing: 0.01em; background: var(--bg-3); color: var(--text-2); white-space: nowrap; }
.badge .i { width: 12px; height: 12px; stroke-width: 2.2; }
.badge-accent { background: var(--accent-tint); color: var(--accent); }
.badge-off { background: var(--success-tint); color: var(--success-ink); }
.badge-solid { background: var(--accent); color: var(--text-on-accent); }
.badge-outline { background: transparent; border: var(--bw) solid var(--border-strong); }
.badge-required { background: var(--surface); color: var(--text-2); border: var(--bw) solid var(--border-strong); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.status-active { color: var(--accent); }
.status-active::before { background: currentColor; }
.status-inactive { color: var(--text-3); }
.status-unavailable::before { width: 9px; height: 2px; border: 0; border-radius: 1px; background: currentColor; }
.status-archived { color: var(--text-3); }
.status-archived::before { border-radius: 2px; }

/* ---------- Prices: the number dominates, the qualifier explains ---------- */
.price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 5px; line-height: 1.2; }
.price-pre, .price-per { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2); }
.price-num { font-size: var(--fs-price); font-weight: var(--fw-semibold); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--text); }
/* A marked-down price: the full price crossed out, just before what's paid. */
.price-was { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-3); text-decoration: line-through; text-decoration-thickness: 1.5px; font-variant-numeric: tabular-nums; }
.price-lg .price-num { font-size: var(--fs-price-lg); font-weight: var(--fw-bold); }
.price-sm .price-num { font-size: 16px; }
.price-quote .price-num { font-size: 17px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-2); }
.input, .select, .textarea { width: 100%; min-height: var(--h-md); padding: 0 var(--s-3); border: var(--bw) solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); font-size: var(--fs-body); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.textarea { padding: 10px var(--s-3); min-height: 88px; resize: vertical; line-height: 1.45; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2348607F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent-bright); box-shadow: var(--focus-ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg-2); color: var(--text-3); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: var(--fs-sm); pointer-events: none; }
.money .input { padding-left: 24px; font-variant-numeric: tabular-nums; }
.help { font-size: var(--fs-cap); color: var(--text-3); line-height: 1.4; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-3); border-radius: var(--r-md); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { min-height: 32px; padding: 0 var(--s-3); border-radius: 9px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-2); white-space: nowrap; transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(14, 26, 43, 0.12); }

/* Switch: knob position and a check mark carry the state, not color alone */
.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--n-300); flex: none; transition: background-color var(--t-base) var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(14, 26, 43, 0.25); transition: transform var(--t-base) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230B6FC9' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 12px no-repeat; }
.switch:focus-visible { border-radius: 14px; }

/* Choice rows: the one selector for tiers, per-unit quantities and billing options */
.choices { display: grid; gap: var(--s-2); }
.choices.grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.choice { position: relative; display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 64px; padding: var(--s-3) var(--s-4); border: 1.5px solid var(--border); border-radius: var(--r-lg); background: var(--surface); text-align: left; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.choice:hover { border-color: var(--border-strong); }
.choice-ind { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--n-400); flex: none; display: flex; align-items: center; justify-content: center; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.choice-ind .i { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(0.6); transition: opacity var(--t-fast) var(--ease), transform var(--t-base) var(--ease); }
.choice-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.choice-main b { font-size: var(--fs-body); font-weight: var(--fw-semibold); }
.choice-main small { font-size: var(--fs-xs); color: var(--text-2); }
.choice-price { text-align: right; flex: none; }
.choice[aria-checked="true"] { border-color: var(--accent-bright); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-bright); }
.choice[aria-checked="true"] .choice-ind { background: var(--accent); border-color: var(--accent); }
.choice[aria-checked="true"] .choice-ind .i { opacity: 1; transform: scale(1); }
.choice .badge { position: absolute; top: -10px; right: 14px; }
.choices.grid .choice { flex-direction: column; align-items: flex-start; min-height: 88px; gap: 6px; }
.choices.grid .choice .choice-ind { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; }
.choices.grid .choice-price { text-align: left; }
.choices.grid .choice .badge { top: -10px; left: 12px; right: auto; }

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

/* ---------- Overlays ---------- */
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: om-fade var(--t-base) var(--ease); }
.sheet { position: absolute; background: var(--surface); box-shadow: var(--sh-3); display: flex; flex-direction: column; overflow: hidden; }
.sheet-head { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; min-height: 58px; padding: 0 var(--s-2); border-bottom: var(--bw) solid var(--border); background: var(--glass); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); flex: none; }
.sheet-head h2 { font-size: var(--fs-h3); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head .btn-icon { justify-self: end; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-5); border-top: var(--bw) solid var(--border); background: var(--surface); }
.modal { left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: var(--r-xl); animation: om-pop var(--t-base) var(--ease); }
.drawer-right { top: 0; right: 0; bottom: 0; width: min(440px, 92%); border-radius: var(--r-xl) 0 0 var(--r-xl); animation: om-slide-left var(--t-slow) var(--ease); }
.drawer-left { top: 0; left: 0; bottom: 0; width: min(300px, 86%); border-radius: 0 var(--r-xl) var(--r-xl) 0; animation: om-slide-right var(--t-slow) var(--ease); }
.bottom-sheet { left: 0; right: 0; bottom: 0; top: 12px; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: om-slide-up var(--t-slow) var(--ease); }
.bottom-sheet.full { top: 0; border-radius: 0; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--n-300); margin: 6px auto 0; }

/* Toast */
.toast { position: absolute; left: 50%; bottom: var(--s-6); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: var(--s-3); max-width: calc(100% - 32px); padding: 10px 10px 10px 16px; border-radius: var(--r-pill); background: var(--glass-dark); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); color: #fff; font-size: var(--fs-sm); font-weight: var(--fw-medium); box-shadow: var(--sh-2); animation: om-rise var(--t-base) var(--ease); }
.toast .i { stroke: #7CC4FF; }
.toast.is-error .i { stroke: #FF9B93; }
.toast button { min-height: 32px; padding: 0 14px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.16); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.toast button:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------- Empty, error and loading states ---------- */
.state { display: grid; justify-items: center; text-align: center; gap: var(--s-2); padding: var(--s-9) var(--s-6); }
.state-ico { width: 52px; height: 52px; border-radius: 50%; background: var(--bg-3); color: var(--text-2); display: flex; align-items: center; justify-content: center; margin-bottom: var(--s-2); }
.state-ico .i { width: 24px; height: 24px; }
.state.is-error .state-ico { background: var(--danger-tint); color: var(--danger); }
.state h3 { font-size: var(--fs-h3); }
.state p { color: var(--text-2); font-size: var(--fs-sm); max-width: 38ch; }
.state .btn { margin-top: var(--s-3); }
.skel { background: linear-gradient(90deg, var(--bg-3) 0%, var(--n-50) 50%, var(--bg-3) 100%); background-size: 200% 100%; border-radius: var(--r-sm); animation: om-shimmer 1.4s linear infinite; }

/* ---------- Motion ---------- */
@keyframes om-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes om-pop { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes om-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes om-slide-left { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes om-slide-right { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes om-rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes om-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes om-bump { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes om-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
