/* Lab page styles */

.lab-hero {
  position: relative;
  padding: 168px 0 96px;
  overflow: hidden;
  isolation: isolate;
}
.lab-hero-content {
  max-width: 880px;
}
.lab-hero-content .eyebrow { margin-bottom: 22px; }
.lab-hero-content h1 { margin: 0 0 24px; }

/* Perio chart */
.perio-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.perio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  flex-wrap: wrap;
  gap: 16px;
}
.perio-mode {
  display: flex; gap: 4px;
  padding: 4px;
  background: #fff;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
}
.perio-mode button {
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-weight: 500;
}
.perio-mode button.active {
  background: var(--teal-wash);
  color: var(--teal-deep);
}

.perio-rec {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--teal-deep);
}
.perio-rec-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-wash);
  animation: pulse-rec 1.6s ease-in-out infinite;
}

.perio-grid {
  padding: 24px;
  overflow-x: auto;
}
.perio-row {
  display: grid;
  grid-template-columns: 90px repeat(16, minmax(46px, 1fr));
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
}
.perio-row-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding-right: 8px;
}
.perio-tooth {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
}
.perio-cell {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.perio-cell:hover {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-wash);
}
.perio-cell:active { transform: scale(0.96); }
.perio-cell[data-depth="0"] { color: var(--text-soft); }
.perio-cell.d-mild { background: #DCFCE7; color: #15803D; border-color: rgba(21,128,61,0.14); }
.perio-cell.d-warn { background: #FEF3C7; color: #B45309; border-color: rgba(180,83,9,0.14); }
.perio-cell.d-danger { background: #FEE2E2; color: #B91C1C; border-color: rgba(185,28,28,0.16); }
.perio-cell.bop::after {
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #DC2626;
}
.perio-cell.recent {
  box-shadow: 0 0 0 3px var(--teal), 0 8px 16px -6px var(--teal-glow);
  animation: cell-pulse 0.8s ease-out;
}
@keyframes cell-pulse {
  0% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.perio-tooth-row {
  display: grid;
  grid-template-columns: 90px repeat(16, minmax(46px, 1fr));
  gap: 4px;
  align-items: center;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.tooth-icon {
  width: 100%;
  height: 36px;
  display: grid; place-items: center;
}

.perio-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}
.perio-stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}
.perio-stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.perio-stat-val {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.perio-stat-val .unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.perio-stat-bar {
  margin-top: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-muted);
  overflow: hidden;
}
.perio-stat-bar > span {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width 0.4s ease;
}

@media (max-width: 880px) {
  .perio-stats { grid-template-columns: 1fr 1fr; }
}

/* Lab UI mock */
.lab-ui {
  display: grid;
  grid-template-columns: 248px 1fr 300px;
  min-height: 680px;
  background: #fff;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  box-shadow: 0 50px 120px -30px rgba(0,0,0,0.5);
}
.lab-ui-rail {
  background: #1C1F24;
  color: rgba(255,255,255,0.85);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.lab-ui-rail-h {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin: 16px 8px 6px;
  font-weight: 500;
}
.lab-ui-rail-h:first-of-type { margin-top: 0; }
.lab-ui-session {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  cursor: pointer;
}
.lab-ui-session:hover { background: rgba(255,255,255,0.05); }
.lab-ui-session.active { background: rgba(25,173,197,0.18); color: #fff; }
.lab-ui-session-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.lab-ui-session.live .lab-ui-session-dot {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(25,173,197,0.25);
}
.lab-ui-session-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.lab-ui-main {
  display: flex;
  flex-direction: column;
  background: #FCFCFD;
}
.lab-ui-topbar {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}
.lab-ui-patient {
  display: flex; align-items: center; gap: 12px;
}
.lab-ui-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #19ADC5, #0F7689);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
}
.lab-ui-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px;
  gap: 16px;
  overflow: auto;
}
.lab-ui-wave {
  height: 40px;
  background: var(--teal-wash);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
}
.lab-ui-wave > span {
  flex: 1; background: var(--teal); border-radius: 1px;
  opacity: 0.7;
}

.lab-ui-aside {
  background: var(--surface-subtle);
  border-left: 1px solid var(--border);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

/* NOTE: The Lab UI mock is wrapped in `.mock-scale` on lab.html, so on
   narrow viewports the entire 3-column desktop layout is rendered at its
   natural width and scaled down via transform. We intentionally do NOT
   collapse the layout into 1 column on mobile here — that produced the
   "squished" look. The previous responsive overrides are gone. */

/* Feature grid */
.lab-feat-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.4fr;
  gap: 24px;
}
.lab-feat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lab-feat--lg { grid-column: span 2; }
.lab-feat h3 { margin: 8px 0; }
.lab-feat p { margin: 0 0 12px; }

.lab-fields {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px;
}
.lab-field {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.lab-field-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--teal-wash);
  color: var(--teal-deep);
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lab-field-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.lab-field-more {
  background: transparent;
  border: 1px dashed var(--teal);
  justify-content: flex-start;
}
.lab-field-more .lab-field-tag {
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}
.lab-field-more .lab-field-name {
  color: var(--teal-deep);
  font-weight: 500;
}

.term-rows {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 12px;
}
.term-row {
  display: grid;
  grid-template-columns: 70px 20px 1fr;
  gap: 8px;
  padding: 10px 4px;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border);
  align-items: baseline;
}
.term-row:last-child { border-bottom: none; }
.term-row code {
  font-weight: 600;
  background: var(--teal-wash);
  color: var(--teal-deep);
  padding: 2px 8px;
  border-radius: 5px;
  width: fit-content;
}
.term-row > span:nth-child(2) { color: var(--text-soft); }

@media (max-width: 1080px) {
  .lab-feat-grid { grid-template-columns: 1fr 1fr; }
  .lab-feat--lg { grid-column: span 2; }
}
@media (max-width: 680px) {
  .lab-feat-grid { grid-template-columns: 1fr; }
  .lab-feat--lg { grid-column: auto; }
}

/* Template editor mock */
.tmpl-editor {
  margin-top: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  position: relative;
}
.tmpl-token {
  background: var(--teal-wash);
  color: var(--teal-deep);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.tmpl-token.filled {
  background: linear-gradient(transparent 70%, rgba(25,173,197,0.3) 70%);
  color: var(--text);
  padding: 0 2px;
}

/* Analytics mini-card */
.analytics-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.analytics-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.analytics-card-l {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.analytics-card-v {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 6px 0 8px;
}
.analytics-card svg {
  width: 100%;
  height: 32px;
}

/* Bilingual band */
.bilingual-band {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 880px) {
  .bilingual-band { grid-template-columns: 1fr; gap: 40px; }
}
