/* =================================================================
   LuxySmile / Oralens — Design System
   Editorial dental aesthetic: bone-white, ink, mint, gold luxe accent
   ================================================================= */

:root {
  /* Palette */
  --paper: #f6f1e7;            /* warm bone background */
  --paper-2: #efe8d8;          /* slightly deeper bone */
  --surface: #ffffff;          /* card surface */
  --ink: #0d1614;              /* near-black deep teal */
  --ink-2: #1f2926;
  --muted: #6c6557;            /* warm gray text */
  --muted-2: #94897a;
  --line: #e6dfcf;             /* hairline */
  --line-2: #d8d0bd;

  --mint: #0e8a6d;             /* forest mint primary */
  --mint-2: #0b6f57;           /* deeper mint hover */
  --mint-soft: #d8efe6;        /* mint tint surface */
  --mint-glow: #4ed6b0;        /* mint highlight */

  --coral: #e87a55;            /* warm coral secondary */
  --coral-soft: #fbe1d4;
  --gold: #b89548;             /* luxe gold */
  --gold-soft: #f1e7cf;
  --lilac: #9a8fc7;
  --rose: #c46b8e;

  --danger: #c1452f;
  --warn:   #d49a16;
  --ok:     #0e8a6d;

  /* Type */
  --font-display: "Instrument Serif", "DM Serif Display", Georgia, serif;
  --font-ui:      "Geist", "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  /* Spacing scale */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Shadows — soft, paper-like */
  --shadow-1: 0 1px 0 rgba(13,22,20,0.04), 0 1px 2px rgba(13,22,20,0.05);
  --shadow-2: 0 4px 14px -6px rgba(13,22,20,0.10), 0 2px 4px rgba(13,22,20,0.04);
  --shadow-3: 0 24px 48px -24px rgba(13,22,20,0.20), 0 8px 16px -8px rgba(13,22,20,0.08);
  --shadow-mint: 0 12px 32px -10px rgba(14,138,109,0.32);
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  background: var(--paper);
  overflow: hidden;
}

.sidebar {
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(78,214,176,0.08), transparent 60%),
    radial-gradient(400px 200px at 100% 100%, rgba(184,149,72,0.06), transparent 60%);
  pointer-events: none;
}

.sidebar > * { position: relative; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--mint-glow), var(--mint));
  display: grid;
  place-items: center;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-name em {
  font-style: italic;
  color: var(--mint-glow);
}
.brand-sub {
  font-size: 10px;
  color: rgba(246,241,231,0.45);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 3px;
}

.nav-section-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(246,241,231,0.4);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(246,241,231,0.7);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: color .18s ease, background .18s ease;
}
.nav-item:hover { color: var(--paper); background: rgba(246,241,231,0.04); }
.nav-item.active { color: var(--ink); background: var(--paper); }
.nav-item.active .nav-icon { color: var(--mint); }

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(246,241,231,0.08);
  color: rgba(246,241,231,0.6);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-badge { background: var(--ink); color: var(--mint-glow); }

.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(246,241,231,0.08);
}
.org-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  transition: background .18s;
}
.org-chip:hover { background: rgba(246,241,231,0.04); }
.org-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--gold), var(--coral));
  display: grid; place-items: center;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
}
.org-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.org-name { font-size: 13px; font-weight: 600; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-id { font-family: var(--font-mono); font-size: 10.5px; color: rgba(246,241,231,0.45); }

/* ---------- Main area ---------- */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.topbar {
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--paper) 88%, white);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 5;
}

.crumbs {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 13px; color: var(--muted);
  flex-wrap: nowrap;
  min-width: 0;
}
.crumbs > * { white-space: nowrap; }
.crumbs .crumb-current {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  line-height: 1;
}
.crumbs .crumb-lede {
  color: var(--muted-2);
  font-size: 12px;
  border-left: 1px solid var(--line);
  padding-left: 12px;
  margin-left: 4px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1280px) { .crumbs .crumb-lede { display: none; } }

.topbar-spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 280px;
  transition: border-color .18s, box-shadow .18s;
}
.search:focus-within { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13px; }
.search .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--paper);
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--ink);
  transition: background .18s, border-color .18s, transform .18s;
  position: relative;
}
.icon-btn:hover { background: var(--paper-2); transform: translateY(-1px); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 99px;
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Content scroll area ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 80px;
  scroll-behavior: smooth;
}

/* Section transition — fades children in on mount */
.screen { animation: screen-in .42s cubic-bezier(.2,.7,.2,1) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Headings / Type ---------- */
.h-display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  letter-spacing: -0.015em;
  line-height: 1.04;
  color: var(--ink);
  margin: 0;
}
.h-display em { font-style: italic; color: var(--mint); }
.h-section {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 4px;
}
.eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}
.lede {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 56ch;
}

/* ---------- Cards / Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card.hover:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.card-ink {
  background: var(--ink);
  color: var(--paper);
  border: 0;
}
.card-paper {
  background: var(--paper-2);
  border: 1px solid var(--line);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background .18s, color .18s, transform .12s, box-shadow .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--ink-2); box-shadow: var(--shadow-2); }

.btn-mint { background: var(--mint); color: var(--surface); }
.btn-mint:hover { background: var(--mint-2); box-shadow: var(--shadow-mint); }

.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: var(--line-2); }

.btn-soft { background: var(--paper-2); color: var(--ink); }
.btn-soft:hover { background: var(--line); }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}
.input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  transition: border-color .18s, box-shadow .18s;
  outline: 0;
  width: 100%;
}
.input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); }
.input::placeholder { color: var(--muted-2); }

/* ---------- Pills / Tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--paper-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill.mint  { background: var(--mint-soft); color: var(--mint-2); border-color: transparent; }
.pill.coral { background: var(--coral-soft); color: var(--coral); border-color: transparent; }
.pill.gold  { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.pill.ink   { background: var(--ink); color: var(--paper); border-color: transparent; }
.pill .dot  { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }

/* ---------- Stat tiles ---------- */
.stat {
  position: relative;
  overflow: hidden;
}
.stat .stat-value {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.stat .stat-delta {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mint);
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px;
}

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 80px; right: 28px; z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-3);
  min-width: 280px;
  animation: toast-in .35s cubic-bezier(.2,.8,.2,1) both;
}
.toast.success .toast-dot { background: var(--mint-glow); }
.toast-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--coral); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ---------- Scrollbars ---------- */
.content::-webkit-scrollbar, .scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.content::-webkit-scrollbar-thumb, .scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid var(--paper); }
.content::-webkit-scrollbar-thumb:hover, .scroll::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Animated dashed border (for dropzones) */
@keyframes dash-march { to { background-position: 24px 0, -24px 0, 0 24px, 0 -24px; } }
.dropzone {
  border-radius: var(--r-lg);
  background:
    linear-gradient(90deg, var(--line-2) 50%, transparent 0) repeat-x top,
    linear-gradient(90deg, var(--line-2) 50%, transparent 0) repeat-x bottom,
    linear-gradient(0deg, var(--line-2) 50%, transparent 0) repeat-y left,
    linear-gradient(0deg, var(--line-2) 50%, transparent 0) repeat-y right;
  background-size: 12px 1.5px, 12px 1.5px, 1.5px 12px, 1.5px 12px;
  padding: 32px;
  text-align: center;
  transition: background-color .18s;
}
.dropzone:hover, .dropzone.active {
  animation: dash-march 1s linear infinite;
  background-color: var(--mint-soft);
}

/* Skeleton shimmer */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skel {
  background: linear-gradient(90deg, var(--paper-2) 0%, var(--line) 50%, var(--paper-2) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}

/* Count-up reveal */
@keyframes pop-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.pop { animation: pop-in .5s cubic-bezier(.2,.8,.2,1) both; }

/* Slide reveal stagger helper */
.stagger > * { animation: pop-in .5s cubic-bezier(.2,.8,.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.00s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.20s; }
.stagger > *:nth-child(6) { animation-delay: 0.25s; }
.stagger > *:nth-child(7) { animation-delay: 0.30s; }
.stagger > *:nth-child(8) { animation-delay: 0.35s; }
.stagger > *:nth-child(9) { animation-delay: 0.40s; }
.stagger > *:nth-child(10){ animation-delay: 0.45s; }

/* Magnetic underline (link hover) */
.maglink { position: relative; }
.maglink::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: currentColor;
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.maglink:hover::after { transform: scaleX(1); }

/* Focus ring */
*:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 4px; }
