@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/manrope-latin-variable.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 200 800;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../assets/fonts/geist-mono-latin-variable.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 100 900;
}

:root {
  --page: #f6f8fb;
  --canvas: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --text: #111827;
  --muted: #6b7280;
  --placeholder: #9ca3af;
  --line: #dbe3ee;
  --line-strong: #c8d3df;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #e6f4f2;
  --green: #16a34a;
  --green-soft: #eaf7ee;
  --amber: #f59e0b;
  --amber-soft: #fff7e6;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
  --shadow-card: 0 14px 28px rgba(15, 23, 42, 0.07);
  color-scheme: light;
  font-family:
    "Manrope", "Aptos", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 8% -10%, rgba(0, 121, 111, 0.1), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(11, 99, 206, 0.07), transparent 28rem),
    linear-gradient(145deg, #fbfdfc 0%, var(--page) 46%, #eef6f4 100%);
  color: var(--text);
}

html.is-telegram-mini-app,
body.is-telegram-mini-app {
  min-height: 100%;
  background: var(--page);
}

body.is-telegram-mini-app {
  overscroll-behavior-y: contain;
}

.is-telegram-mini-app .app-shell {
  min-height: 100dvh;
  padding: 0;
  background: var(--page);
}

.is-telegram-mini-app .workspace {
  width: 100%;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background: var(--canvas);
  box-shadow: none;
}

.is-telegram-mini-app .topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -4px -2px 12px;
  padding: 8px 2px 10px;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(16px);
}

.is-telegram-mini-app h1 {
  font-size: clamp(1.12rem, 5.5vw, 1.6rem);
  line-height: 1.08;
}

.is-telegram-mini-app .subtitle {
  display: none;
}

.is-telegram-mini-app .maker-line {
  margin-top: 5px;
  font-size: 0.78rem;
}

.is-telegram-mini-app .command-panel,
.is-telegram-mini-app .panel,
.is-telegram-mini-app .result-card {
  background: var(--surface);
}

.is-telegram-mini-app .safety-check {
  margin-bottom: 0;
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100dvh;
  padding: 16px;
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 32px 30px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(241, 248, 246, 0.93)),
    var(--canvas);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(2rem, 3.2vw, 3.05rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.18rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.08rem;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.maker-line {
  margin: 8px 0 0;
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.35;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.pwa-status {
  border-color: rgba(22, 163, 74, 0.18);
  background: rgba(240, 253, 244, 0.78);
  color: #166534;
}

.pwa-status[data-state="offline"] {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(255, 251, 235, 0.9);
  color: #92400e;
}

.pwa-status[data-state="offline"] .status-dot {
  background: var(--amber);
}

.pwa-status[data-state="installed"] {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(239, 246, 255, 0.82);
  color: #1d4ed8;
}

.install-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(0, 121, 111, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal-dark);
}

.status-pill,
.source-badge,
.dose-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid rgba(0, 121, 111, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.subtle {
  background: var(--surface-soft);
  color: var(--muted);
}

.status-pill.is-loading {
  color: var(--blue);
}

.dose-guidance[data-status="ai_assisted_needs_review"] .dose-badge {
  border-color: rgba(184, 110, 9, 0.22);
  background: var(--amber-soft);
  color: var(--amber);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  animation: statusBreath 2.2s ease-in-out infinite;
}

.command-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.28fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid rgba(0, 121, 111, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(247, 251, 250, 0.92)),
    var(--surface);
  box-shadow: 0 12px 28px rgba(8, 43, 51, 0.06);
}

.command-copy p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.command-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.command-bar input {
  min-height: 50px;
  font-size: 1rem;
}

.command-button {
  width: auto;
  min-width: 106px;
  min-height: 50px;
  font-size: 0.98rem;
}

.mobile-result-strip {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: minmax(390px, 0.7fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
}

.panel {
  padding: 24px;
}

.calculator-panel {
  display: grid;
  align-self: start;
}

.panel-heading,
.metric-heading,
.source-header,
.dose-guidance-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  margin-bottom: 24px;
}

.heading-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--teal-dark);
}

.heading-line svg {
  flex: 0 0 auto;
}

.section-kicker {
  margin: 0;
  color: var(--teal-dark);
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0;
}

.ghost-button,
.primary-button,
.secondary-link {
  border: 0;
  border-radius: 8px;
  font-weight: 850;
  text-decoration: none;
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ghost-button:active,
.primary-button:active,
.secondary-link:active {
  transform: translateY(1px) scale(0.99);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 4px;
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover {
  color: var(--teal);
}

.ghost-button:disabled,
.ghost-button[aria-disabled="true"] {
  color: var(--placeholder);
  cursor: not-allowed;
  transform: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 18px;
}

.field {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > span {
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 800;
}

.field em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 650;
}

input,
select {
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  border: 1px solid #cfdad8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  padding: 0 14px;
}

select {
  padding: 0 38px 0 14px;
}

input::placeholder {
  color: var(--placeholder);
  font-weight: 450;
  opacity: 1;
}

input:focus,
select:focus,
.unit-input:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 121, 111, 0.12);
}

.unit-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #cfdad8;
  border-radius: 8px;
  background: #fff;
}

.unit-input input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.unit-input span {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  justify-content: flex-end;
  padding: 0 13px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.route-field {
  grid-column: 1 / -1;
}

.context-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 121, 111, 0.14);
  border-radius: 8px;
  background: rgba(225, 244, 240, 0.48);
}

.context-controls .field {
  min-width: 0;
}

.route-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cfdad8;
  border-radius: 8px;
  background: #fff;
}

.route-segment label {
  position: relative;
  min-width: 0;
}

.route-segment label + label {
  border-left: 1px solid var(--line);
}

.route-segment input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.route-segment span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 850;
}

.route-segment input:checked + span {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
}

.route-segment input:focus-visible + span {
  outline: 3px solid rgba(0, 121, 111, 0.18);
  outline-offset: -3px;
}

.actions {
  margin-top: 24px;
  padding-top: 2px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 14px 30px rgba(0, 121, 111, 0.2);
}

.primary-button:hover {
  filter: brightness(0.96);
  box-shadow: 0 16px 32px rgba(0, 121, 111, 0.24);
}

.recent-panel {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.recent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-item {
  display: inline-grid;
  gap: 2px;
  max-width: 100%;
  min-height: 48px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(247, 251, 250, 0.82);
  color: var(--text);
  text-align: left;
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.recent-item:hover {
  border-color: rgba(0, 121, 111, 0.34);
  background: var(--surface);
  transform: translateY(-1px);
}

.recent-item span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item strong {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-column {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.result-card {
  padding: 22px;
}

.metric-card {
  min-height: 210px;
}

.metric-card h2 {
  margin: 24px 0 6px;
  color: #003f49;
  font-size: clamp(3.5rem, 6.4vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.metric-unit,
.helper-text,
#drug-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.metric-card .helper-text {
  margin-top: 28px;
}

.stage-badge {
  min-width: 86px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
}

.stage-badge[data-tone="good"] {
  background: var(--green-soft);
  color: #11683f;
}

.stage-badge[data-tone="caution"] {
  background: var(--amber-soft);
  color: #995c08;
}

.stage-badge[data-tone="warning"] {
  background: #ffe8d6;
  color: #9a4b12;
}

.stage-badge[data-tone="danger"] {
  background: #ffe3e3;
  color: var(--red);
}

.dose-card {
  padding: 22px;
  border-color: rgba(0, 121, 111, 0.24);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 250, 0.93)),
    var(--surface);
}

.dose-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.copy-button {
  min-height: 32px;
  padding: 0 8px;
}

.copy-button svg {
  width: 17px;
  height: 17px;
}

.drug-empty {
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed #b9cbc6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  line-height: 1.55;
}

.drug-panel {
  min-height: 208px;
}

.dose-callout {
  margin-top: 16px;
}

.dose-loading {
  position: relative;
  display: grid;
  gap: 14px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(0, 121, 111, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(225, 244, 240, 0.56), rgba(255, 255, 255, 0.96) 46%, rgba(232, 242, 255, 0.34)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dose-loading-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.dose-loading-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dose-loading-header > span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  text-align: right;
  white-space: nowrap;
}

.dose-loading-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(210px, 0.72fr);
  gap: 12px;
  align-items: stretch;
}

.source-scan-card,
.dose-build-card {
  min-width: 0;
  border: 1px solid rgba(0, 121, 111, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 24px rgba(8, 43, 51, 0.05);
}

.source-scan-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.scan-toolbar {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 121, 111, 0.11);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.scan-toolbar span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 121, 111, 0.32);
}

.scan-toolbar span:nth-child(2) {
  background: rgba(11, 99, 206, 0.28);
}

.scan-toolbar span:nth-child(3) {
  background: rgba(11, 138, 85, 0.3);
}

.scan-sheet {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 154px;
  overflow: hidden;
  padding: 14px 14px 12px;
  background:
    linear-gradient(90deg, rgba(0, 121, 111, 0.04) 1px, transparent 1px) 0 0 / 24px 100%,
    linear-gradient(180deg, rgba(0, 121, 111, 0.03), transparent 44%),
    rgba(250, 253, 252, 0.86);
}

.scan-beam {
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 30px;
  transform: translateY(-34px);
  background:
    linear-gradient(180deg, transparent, rgba(0, 121, 111, 0.16), transparent),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.82), transparent);
  animation: sourceScan 2.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  pointer-events: none;
}

.scan-row,
.skeleton-line,
.dose-card-skeleton span {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(196, 210, 207, 0.42);
}

.scan-row::after,
.skeleton-line::after,
.dose-card-skeleton span::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: shimmer 1.85s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.scan-row {
  width: 76%;
  height: 9px;
}

.scan-row-wide {
  width: 92%;
}

.scan-row-medium {
  width: 64%;
}

.scan-row-short {
  width: 46%;
}

.scan-highlight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 260px);
  margin: 2px 0;
  padding: 9px 10px;
  border: 1px solid rgba(0, 121, 111, 0.18);
  border-radius: 8px;
  background: rgba(225, 244, 240, 0.74);
  color: var(--teal-dark);
  font-size: 0.83rem;
  font-weight: 850;
  animation: scanFocus 2.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.scan-highlight span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(0, 121, 111, 0.08);
}

.dose-build-card {
  display: grid;
  gap: 11px;
  padding: 12px;
}

.renal-band-loader {
  display: grid;
  gap: 9px;
}

.band-loader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.band-loader-head span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.band-loader-head strong {
  color: var(--teal-dark);
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
}

.band-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 42px;
  overflow: hidden;
  border: 1px solid rgba(0, 121, 111, 0.13);
  border-radius: 8px;
  background: rgba(247, 251, 250, 0.92);
}

.band-track span {
  display: grid;
  place-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.band-track span + span {
  border-left: 1px solid rgba(0, 121, 111, 0.1);
}

.band-track span.is-active {
  background: rgba(0, 121, 111, 0.09);
  color: var(--teal-dark);
}

.crcl-marker {
  position: absolute;
  left: var(--crcl-position);
  bottom: 4px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--teal);
  box-shadow:
    0 0 0 5px rgba(0, 121, 111, 0.13),
    0 6px 14px rgba(8, 43, 51, 0.16);
  transform: translateX(-50%);
  animation: markerPulse 1.6s ease-in-out infinite;
}

.dose-card-skeleton {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.skeleton-line {
  display: block;
  width: 84%;
  height: 10px;
}

.skeleton-title {
  width: 58%;
  height: 13px;
}

.skeleton-short {
  width: 50%;
}

.skeleton-dose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.skeleton-dose-grid span {
  display: block;
  height: 42px;
  border-radius: 8px;
  background: rgba(0, 121, 111, 0.08);
}

.source-steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.source-steps div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(0, 121, 111, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.15;
}

.source-steps span {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
  animation: statusBreath 1.4s ease-in-out infinite;
}

.source-steps div:nth-child(2) span {
  animation-delay: 180ms;
}

.source-steps div:nth-child(3) span {
  animation-delay: 360ms;
}

.source-steps div:nth-child(4) span {
  animation-delay: 540ms;
}

.dose-guidance {
  display: grid;
  gap: 14px;
}

.dose-guidance-header {
  align-items: flex-start;
  justify-content: space-between;
}

.dose-header-stack {
  display: grid;
  gap: 9px;
  width: 100%;
}

.dose-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.dose-context-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid rgba(0, 121, 111, 0.12);
  border-radius: 999px;
  background: rgba(247, 251, 250, 0.82);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1;
}

.dose-context-chip[data-tone="source"] {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(11, 99, 206, 0.12);
}

.dose-context-chip[data-tone="ok"] {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(11, 138, 85, 0.14);
}

.dose-context-chip[data-tone="caution"] {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(184, 110, 9, 0.18);
}

.guidance-safety {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 121, 111, 0.16);
  border-radius: 8px;
  background: rgba(225, 244, 240, 0.42);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.guidance-safety strong {
  color: var(--teal-dark);
  font-size: 0.86rem;
}

.guidance-safety[data-level="manual-review"] {
  border-color: rgba(184, 110, 9, 0.26);
  background: rgba(255, 243, 219, 0.72);
}

.guidance-safety[data-level="manual-review"] strong {
  color: #8a5207;
}

.guidance-safety[data-level="source-summary"] {
  border-color: rgba(11, 99, 206, 0.18);
  background: rgba(232, 242, 255, 0.68);
}

.guidance-safety[data-level="source-summary"] strong {
  color: var(--blue);
}

.dose-guidance[data-review-level="clean-dose"] .dose-badge {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(11, 138, 85, 0.2);
}

.dose-guidance[data-review-level="source-summary"] .dose-badge {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(11, 99, 206, 0.12);
}

.dose-guidance[data-review-level="manual-review"] .dose-badge {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(184, 110, 9, 0.22);
}

.dose-main {
  display: grid;
  grid-template-columns: minmax(120px, 0.32fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 4px 0 2px;
}

.dose-band-large {
  display: grid;
  gap: 8px;
  padding-right: 24px;
  border-right: 1px solid var(--line);
}

.dose-band-large span,
.dose-columns span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.dose-band-large strong {
  color: #9a5b06;
  font-size: 1.55rem;
  line-height: 1.05;
}

.dose-recommendation h3 {
  margin-bottom: 18px;
  font-size: 1.25rem;
}

.dose-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.dose-columns > div + div {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.dose-columns strong {
  display: block;
  margin-top: 5px;
  color: var(--teal-dark);
  font-size: clamp(1.28rem, 2.3vw, 1.82rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.dose-guidance[data-status="ai_assisted_needs_review"] .dose-columns strong {
  color: #8a5207;
}

.dose-recommendation p {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.dose-recommendation .dose-note {
  color: var(--amber);
  font-weight: 750;
}

.dose-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  padding-top: 2px;
}

.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(0, 121, 111, 0.16);
  border-radius: 8px;
  background: rgba(247, 251, 250, 0.78);
  color: var(--teal-dark);
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.text-action:hover {
  border-color: rgba(0, 121, 111, 0.34);
  background: var(--surface);
  transform: translateY(-1px);
}

.text-action:active {
  transform: translateY(0);
}

.dose-table {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.dose-table summary {
  color: var(--teal-dark);
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
}

.dose-bands {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.dose-band {
  display: grid;
  grid-template-columns: 135px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.dose-band.is-selected {
  border-color: rgba(0, 121, 111, 0.38);
  background: var(--teal-soft);
}

.dose-band span {
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

.dose-band strong {
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.4;
}

.source-panel {
  display: grid;
  gap: 16px;
}

.source-badge {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: transparent;
}

.drug-summary {
  display: grid;
  gap: 4px;
}

.source-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.source-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--teal-dark);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 850;
  list-style: none;
}

.source-details summary::-webkit-details-marker {
  display: none;
}

.source-details summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.source-details[open] summary::after {
  transform: rotate(225deg);
}

.source-details summary strong {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.label-sections {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.label-section {
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  position: relative;
}

.label-section::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.7em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--muted);
}

.label-section h4 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 0.9rem;
}

.label-section p {
  margin-bottom: 0;
}

.keyword-badge {
  display: none;
}

.source-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--blue);
  font-size: 0.9rem;
}

.secondary-link.is-disabled {
  color: var(--placeholder);
  pointer-events: none;
}

.interpretation-card {
  display: none;
}

.clinical-list {
  margin: 0;
  padding-left: 20px;
}

.hidden {
  display: none !important;
}

.safety-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  margin-top: 26px;
  padding: 17px 20px;
  border: 1px solid rgba(11, 138, 85, 0.25);
  border-radius: 8px;
  background: rgba(234, 248, 241, 0.84);
  color: #244a40;
  font-size: 0.94rem;
  line-height: 1.45;
}

.safety-check strong {
  color: var(--green);
}

.safety-check > span:last-child {
  color: var(--muted);
  text-align: right;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes sourceScan {
  0% {
    opacity: 0;
    transform: translateY(-34px);
  }
  14% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(174px);
  }
}

@keyframes scanFocus {
  0%,
  100% {
    transform: translateY(0);
    border-color: rgba(0, 121, 111, 0.16);
  }
  50% {
    transform: translateY(-1px);
    border-color: rgba(0, 121, 111, 0.32);
  }
}

@keyframes markerPulse {
  0%,
  100% {
    transform: translateX(-50%) scale(0.94);
  }
  50% {
    transform: translateX(-50%) scale(1.12);
  }
}

@keyframes statusBreath {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-beam,
  .scan-highlight,
  .scan-row::after,
  .skeleton-line::after,
  .dose-card-skeleton span::after,
  .crcl-marker,
  .source-steps span,
  .status-pill.is-loading::before {
    animation: none;
  }
}

@media (max-width: 980px) {
  .workspace {
    padding: 22px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .command-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 18px 12px 16px;
  }

  .command-panel {
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
  }

  .command-copy {
    display: none;
  }

  .command-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .command-bar input {
    min-height: 42px;
    font-size: 0.88rem;
  }

  .command-button {
    min-width: 72px;
    min-height: 42px;
    padding: 0 12px;
    font-size: 0.86rem;
  }

  .mobile-result-strip {
    position: sticky;
    top: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    margin: 0 0 10px;
    padding: 9px 10px;
    border: 1px solid rgba(0, 121, 111, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(8, 43, 51, 0.1);
    backdrop-filter: blur(16px);
  }

  .mobile-result-strip > div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .mobile-result-strip span {
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 800;
    line-height: 1;
  }

  .mobile-result-strip strong {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .context-controls {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: center;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 1.05rem;
    line-height: 1.15;
  }

  .subtitle {
    display: none;
  }

  .status-pill {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .panel,
  .result-card {
    padding: 14px;
  }

  .panel-heading {
    margin-bottom: 12px;
  }

  .heading-line {
    gap: 8px;
  }

  .heading-line svg {
    width: 17px;
    height: 17px;
  }

  .field-grid,
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px 10px;
  }

  .field > span,
  .ghost-button,
  .metric-unit,
  .helper-text,
  #drug-meta {
    font-size: 0.78rem;
  }

  input,
  select {
    min-height: 38px;
    border-radius: 7px;
  }

  input {
    padding: 0 10px;
  }

  .unit-input {
    border-radius: 7px;
  }

  .unit-input span {
    min-width: 44px;
    padding: 0 8px;
    font-size: 0.76rem;
  }

  .route-segment span {
    min-height: 36px;
    font-size: 0.82rem;
  }

  .primary-button {
    min-height: 42px;
    font-size: 0.92rem;
  }

  .recent-panel {
    margin-top: 12px;
    padding-top: 12px;
  }

  .recent-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
  }

  .recent-item {
    flex: 0 0 min(74vw, 250px);
    scroll-snap-align: start;
  }

  .metric-card {
    min-height: 126px;
  }

  .metric-card h2 {
    margin: 14px 0 4px;
    font-size: 2rem;
  }

  .metric-card .helper-text {
    margin-top: 8px;
  }

  .stage-badge {
    min-width: 0;
    padding: 5px 7px;
    font-size: 0.68rem;
  }

  .dose-guidance-header {
    gap: 8px;
  }

  .dose-header-stack {
    gap: 7px;
  }

  .dose-chip-row {
    gap: 5px;
  }

  .dose-context-chip {
    min-height: 23px;
    padding: 4px 7px;
    font-size: 0.68rem;
  }

  .dose-main {
    grid-template-columns: minmax(90px, 0.34fr) minmax(0, 1fr);
    gap: 12px;
  }

  .dose-band-large {
    padding-right: 12px;
  }

  .dose-band-large strong {
    font-size: 1rem;
  }

  .dose-recommendation h3 {
    margin-bottom: 10px;
    font-size: 0.92rem;
  }

  .dose-columns {
    gap: 10px;
  }

  .dose-columns > div + div {
    padding-left: 10px;
  }

  .dose-columns span {
    display: none;
  }

  .dose-columns strong {
    font-size: 1rem;
  }

  .dose-actions-row {
    gap: 6px;
  }

  .text-action {
    min-height: 30px;
    padding: 0 8px;
    border-radius: 7px;
    font-size: 0.74rem;
  }

  .dose-loading {
    gap: 12px;
    padding: 14px;
  }

  .dose-loading-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dose-loading-header > span:last-child {
    text-align: left;
    white-space: normal;
  }

  .dose-loading-grid {
    grid-template-columns: 1fr;
  }

  .scan-sheet {
    min-height: 126px;
  }

  .source-steps {
    grid-template-columns: 1fr;
  }

  .dose-recommendation p,
  .dose-table {
    display: none;
  }

  .source-header,
  .safety-check {
    grid-template-columns: 1fr auto;
  }

  .dose-tools {
    gap: 5px;
  }

  .copy-button {
    min-height: 28px;
    padding: 0 4px;
    font-size: 0.72rem;
  }

  .copy-button svg {
    display: none;
  }

  .label-sections {
    display: none;
  }

  .source-details[open] .label-sections {
    display: grid;
  }

  .safety-check {
    margin-top: 12px;
    gap: 8px;
    padding: 12px;
    font-size: 0.74rem;
  }
}

.mobile-result-strip.hidden {
  display: none;
}

@media (max-width: 430px) {
  .topbar-actions .status-pill {
    display: none;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dose-main,
  .dose-columns {
    grid-template-columns: 1fr;
  }

  .dose-band-large {
    padding-right: 0;
    padding-bottom: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dose-columns > div + div {
    padding-left: 0;
    border-left: 0;
  }

  .result-card {
    box-shadow: 0 8px 18px rgba(8, 43, 51, 0.07);
  }
}

/* Calm clinical dashboard redesign */
body {
  background: var(--page);
}

.app-shell {
  padding: 0;
}

.workspace {
  width: min(1452px, calc(100% - 32px));
  min-height: calc(100dvh - 18px);
  margin: 4px auto 18px;
  padding: 0 22px 24px;
  border-color: #d5deea;
  border-radius: 8px 8px 30px 30px;
  background: #f8fafc;
  box-shadow:
    0 22px 48px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.topbar {
  min-height: 60px;
  margin: 0 -22px 0;
  padding: 12px 22px 11px;
  align-items: center;
  border-bottom: 1px solid #dbe3ee;
  background: rgba(255, 255, 255, 0.82);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 15px;
}

.kidney-mark {
  display: block;
  width: 46px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(0, 121, 111, 0.16));
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.35vw, 2.05rem);
  font-weight: 850;
  line-height: 1;
}

.maker-line {
  margin: 0;
  color: #374151;
  font-size: 1rem;
  font-weight: 570;
}

.warning-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 40px;
  margin: 10px 0 12px;
  padding: 8px 14px;
  border: 1px solid rgba(245, 158, 11, 0.72);
  border-radius: 8px;
  background: var(--amber-soft);
  color: #7c4a03;
  font-size: 1rem;
  line-height: 1.2;
}

.warning-banner svg {
  width: 20px;
  height: 20px;
  color: var(--amber);
}

.warning-banner strong {
  font-weight: 850;
}

.warning-banner span {
  width: 1px;
  height: 24px;
  background: rgba(245, 158, 11, 0.36);
}

.warning-banner p {
  margin: 0;
  font-weight: 520;
}

.quick-panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.quick-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 12px;
  color: var(--teal-dark);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 850;
  list-style: none;
}

.quick-panel summary::-webkit-details-marker {
  display: none;
}

.quick-panel summary strong {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.quick-panel .command-bar {
  padding: 0 10px 10px;
}

.quick-panel .command-bar input,
.quick-panel .command-button {
  min-height: 38px;
  font-size: 0.86rem;
}

.quick-example {
  margin: -2px 10px 10px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.form-sections {
  display: grid;
  gap: 13px;
}

.form-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.form-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.form-section-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 850;
}

.form-section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-align: right;
}

.clinical-summary-bar {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: grid;
  grid-template-columns: 0.85fr 0.7fr 1fr 1.25fr;
  gap: 10px;
  align-items: stretch;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.clinical-summary-bar > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid #e1e8f0;
  border-radius: 7px;
  background: #f8fafc;
}

.clinical-summary-bar span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.clinical-summary-bar strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(0.92rem, 1.15vw, 1.08rem);
  font-weight: 900;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-decision[data-tone="success"] {
  border-color: rgba(22, 163, 74, 0.3);
  background: var(--green-soft);
}

.summary-decision[data-tone="success"] strong {
  color: #166534;
}

.summary-decision[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.42);
  background: var(--amber-soft);
}

.summary-decision[data-tone="warning"] strong {
  color: #92400e;
}

.summary-decision[data-tone="danger"] {
  border-color: rgba(220, 38, 38, 0.34);
  background: var(--red-soft);
}

.summary-decision[data-tone="danger"] strong {
  color: var(--red);
}

.clinical-grid {
  grid-template-columns: minmax(360px, 0.82fr) minmax(560px, 1.18fr);
  gap: 16px;
  align-items: start;
}

.calculator-panel {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.dose-card {
  grid-column: 2;
  grid-row: 1;
}

.kidney-panel {
  grid-column: 2;
  grid-row: 2;
}

.panel,
.result-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.panel,
.result-card,
.source-evidence-panel {
  backdrop-filter: blur(14px);
}

.panel,
.result-card {
  padding: 18px;
}

.panel-heading {
  align-items: center;
  min-height: 30px;
  margin-bottom: 14px;
}

.heading-line {
  gap: 12px;
  color: #006b64;
}

.heading-line h2 {
  font-size: 1.12rem;
  font-weight: 820;
}

.calculator-panel .field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.renal-lab-grid,
.drug-grid {
  grid-template-columns: 1fr;
}

.field > span {
  color: #0a2029;
  font-size: 0.93rem;
  font-weight: 760;
}

.field small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

input,
select,
.unit-input,
.route-segment,
.sex-segment {
  min-height: 40px;
  border-color: #cad8d5;
  border-radius: 7px;
  box-shadow: inset 0 1px 2px rgba(8, 43, 51, 0.03);
}

input,
select {
  font-size: 0.94rem;
  font-weight: 520;
}

input::placeholder {
  color: #aab8bb;
  font-weight: 470;
}

.unit-input input {
  min-height: 38px;
}

.unit-input span {
  min-width: 54px;
  color: #425864;
  font-size: 0.83rem;
  font-weight: 620;
}

.sex-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #cad8d5;
  background: #fff;
}

.sex-segment label {
  position: relative;
  min-width: 0;
}

.sex-segment label + label {
  border-left: 1px solid var(--line);
}

.sex-segment input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sex-segment span,
.route-segment span {
  min-height: 40px;
  color: #14323b;
  font-size: 0.9rem;
  font-weight: 720;
}

.sex-segment span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 7px;
}

.sex-segment svg {
  width: 17px;
  height: 17px;
}

.sex-segment input:checked + span {
  background: #e8f8f5;
  color: #006b64;
  box-shadow: inset 0 0 0 1px #00796f;
}

.route-segment input:checked + span {
  background: var(--teal);
  color: #fff;
}

.drug-autocomplete-shell {
  position: relative;
  min-width: 0;
}

.drug-autocomplete {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 6;
  display: grid;
  gap: 4px;
  max-height: 292px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #cbd8e3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
}

.drug-suggestion {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.drug-suggestion strong,
.drug-suggestion span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drug-suggestion strong {
  font-size: 0.88rem;
  font-weight: 850;
}

.drug-suggestion span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.drug-suggestion:hover,
.drug-suggestion[aria-selected="true"] {
  border-color: rgba(15, 118, 110, 0.18);
  background: var(--teal-soft);
}

.primary-button {
  min-height: 42px;
  border-radius: 7px;
  background: var(--teal);
  font-size: 0.98rem;
  font-weight: 820;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
}

.actions {
  margin-top: 14px;
}

.formula-note {
  margin: 12px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(11, 99, 206, 0.22);
  border-radius: 7px;
  background: rgba(232, 242, 255, 0.7);
  color: #074da2;
  font-size: 0.78rem;
  line-height: 1.45;
}

.kidney-panel {
  display: grid;
  gap: 12px;
}

.kidney-panel .panel-heading {
  margin-bottom: 0;
}

.kidney-panel .metrics-grid {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.kidney-panel .metric-card {
  min-height: 128px;
  padding: 15px;
  box-shadow: none;
  border: 0;
  background: transparent;
}

.kidney-panel .metric-card + .metric-card {
  border-left: 1px solid var(--line);
}

.metric-label {
  color: #0d2530;
  font-size: 1rem;
  font-weight: 820;
}

.metric-label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 540;
}

.kidney-panel .metric-card h3 {
  margin: 8px 0 2px;
  color: var(--teal);
  font-size: clamp(2.8rem, 4.4vw, 3.75rem);
  font-weight: 850;
  line-height: 0.95;
}

.kidney-panel .metric-unit {
  color: #263e49;
  font-size: 0.92rem;
  font-weight: 540;
}

.kidney-panel .stage-badge {
  display: inline-flex;
  min-width: 0;
  margin-top: 7px;
  padding: 5px 9px;
  border: 1px solid rgba(11, 138, 85, 0.22);
  border-radius: 8px;
  background: var(--green-soft);
  color: #166534;
}

.kidney-panel .stage-badge[data-tone="caution"],
.ckd-stage-card[data-tone="caution"] {
  border-color: rgba(245, 158, 11, 0.32);
  background: var(--amber-soft);
  color: #92400e;
}

.kidney-panel .stage-badge[data-tone="warning"],
.kidney-panel .stage-badge[data-tone="danger"],
.ckd-stage-card[data-tone="warning"],
.ckd-stage-card[data-tone="danger"] {
  border-color: rgba(220, 38, 38, 0.28);
  background: var(--red-soft);
  color: var(--red);
}

.ckd-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.ckd-stage-card {
  display: grid;
  place-items: center;
  min-width: 72px;
  min-height: 58px;
  border: 1px solid rgba(11, 138, 85, 0.28);
  border-radius: 8px;
  background: var(--green-soft);
  color: #166534;
}

.ckd-stage-card span {
  color: currentColor;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.ckd-summary h3 {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 830;
}

.ckd-summary h3 span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 540;
}

.ckd-summary p,
.helper-text,
.clinical-list {
  color: #405663;
  font-size: 0.84rem;
  line-height: 1.45;
}

.ckd-band-table {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ckd-band-table div {
  display: grid;
  gap: 6px;
  min-height: 54px;
  place-items: center;
  padding: 8px 4px;
  color: #293f49;
}

.ckd-band-table [data-stage="G1"],
.ckd-band-table [data-stage="G2"] {
  border-top: 3px solid var(--green);
}

.ckd-band-table [data-stage="G3a"],
.ckd-band-table [data-stage="G3b"] {
  border-top: 3px solid var(--amber);
}

.ckd-band-table [data-stage="G4"],
.ckd-band-table [data-stage="G5"] {
  border-top: 3px solid var(--red);
}

.ckd-band-table div + div {
  border-left: 1px solid var(--line);
}

.ckd-band-table span {
  font-size: 0.85rem;
  font-weight: 700;
}

.ckd-band-table strong {
  font-size: 0.78rem;
  font-weight: 560;
}

.ckd-band-table [data-stage="G1"].is-active,
.ckd-band-table [data-stage="G2"].is-active {
  background: var(--green);
  color: #fff;
}

.ckd-band-table [data-stage="G3a"].is-active,
.ckd-band-table [data-stage="G3b"].is-active {
  background: var(--amber);
  color: #111827;
}

.ckd-band-table [data-stage="G4"].is-active,
.ckd-band-table [data-stage="G5"].is-active {
  background: var(--red);
  color: #fff;
}

.ckd-marker {
  margin: -8px 0 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.body-metrics {
  display: grid;
  margin: 2px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.body-metrics div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  padding: 0 12px;
}

.body-metrics div + div {
  border-top: 1px solid var(--line);
}

.body-metrics dt,
.body-metrics dd {
  margin: 0;
  color: #425864;
  font-size: 0.82rem;
}

.weight-used-line {
  color: var(--text);
  font-weight: 760;
}

.body-metrics dd {
  color: #132d36;
  font-weight: 650;
}

.clinical-list {
  display: none;
}

.dose-card {
  display: grid;
  align-content: start;
  position: relative;
  overflow: hidden;
  border-color: rgba(15, 118, 110, 0.3);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.dose-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--teal);
  content: "";
}

.dose-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.dose-title-row h3 {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 850;
  line-height: 1.12;
}

.dose-title-row #drug-meta {
  margin-top: 3px;
  color: #0b63ce;
  font-size: 0.9rem;
  font-weight: 620;
}

.dose-tools {
  flex: 0 0 auto;
}

.copy-button span {
  font-size: 0.78rem;
}

.drug-empty {
  display: grid;
  gap: 8px;
  align-content: center;
  margin-top: 6px;
  min-height: 112px;
  padding: 18px;
  border-color: #d7e1ec;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.45;
}

.drug-empty strong {
  color: var(--text);
  font-size: 1rem;
}

.drug-empty span {
  display: block;
}

.dose-guidance {
  gap: 12px;
}

.dose-guidance-header {
  display: none;
}

.guidance-safety {
  order: 3;
  border-color: rgba(22, 163, 74, 0.28);
  background: var(--green-soft);
  color: #14532d;
}

.guidance-safety strong {
  color: #166534;
}

.guidance-safety[data-level="manual-review"],
.guidance-safety[data-level="source-summary"] {
  border-color: rgba(245, 158, 11, 0.42);
  background: var(--amber-soft);
  color: #7c4a03;
}

.guidance-safety[data-level="manual-review"] strong,
.guidance-safety[data-level="source-summary"] strong {
  color: #92400e;
}

.dose-main {
  grid-template-columns: minmax(104px, 0.32fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.32);
  border-radius: 8px;
  background: #f8fffd;
}

.dose-band-large {
  align-content: center;
  padding-right: 14px;
  border-right: 1px solid rgba(15, 118, 110, 0.22);
}

.dose-band-large span,
.dose-columns span {
  color: #1d3a43;
  font-size: 0.82rem;
  font-weight: 600;
}

.dose-band-large strong {
  color: var(--teal);
  font-size: 1.38rem;
  font-weight: 850;
}

.dose-recommendation h3 {
  margin-bottom: 10px;
  font-size: 1rem;
  font-weight: 850;
}

.dose-columns {
  gap: 12px;
}

.dose-columns > div + div {
  padding-left: 12px;
}

.dose-columns strong {
  color: var(--teal);
  font-size: clamp(1.08rem, 1.65vw, 1.4rem);
  font-weight: 860;
}

.dose-actions-row {
  order: 6;
}

.text-action,
.secondary-link {
  border: 1px solid transparent;
  background: transparent;
  color: #0b63ce;
  padding-left: 0;
  padding-right: 0;
}

.dose-table {
  order: 4;
}

.source-evidence-panel {
  margin-top: 12px;
  padding: 16px;
}

.source-shell {
  display: grid;
  gap: 14px;
}

.source-shell > summary {
  list-style: none;
  cursor: pointer;
}

.source-shell > summary::-webkit-details-marker {
  display: none;
}

.source-header {
  align-items: center;
  margin-bottom: 0;
}

.source-header h2 span {
  font-weight: 540;
}

.source-evidence-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 0.9fr) minmax(260px, 0.9fr);
  gap: 22px;
}

.source-block {
  min-width: 0;
}

.source-block + .source-block {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.source-label {
  margin: 0 0 10px;
  color: #0c2530;
  font-size: 0.88rem;
  font-weight: 850;
}

.source-details {
  padding: 0;
  border-top: 0;
}

.source-details summary {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #1d3540;
}

.source-details summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-sections {
  max-height: 140px;
  overflow: auto;
  padding: 12px 2px 0;
}

.source-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.source-table > div {
  display: grid;
  grid-template-columns: minmax(120px, 0.85fr) minmax(0, 1fr);
  min-height: 32px;
}

.source-table > div + div {
  border-top: 1px solid var(--line);
}

.source-table span,
.source-table strong {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 7px 10px;
  color: #263e49;
  font-size: 0.78rem;
  line-height: 1.25;
}

.source-table span + strong,
.source-table span + span {
  border-left: 1px solid var(--line);
}

.source-table strong {
  font-weight: 680;
}

.source-table .source-table-head span {
  background: #f6faf9;
  color: #425864;
  font-size: 0.7rem;
  font-weight: 800;
}

.source-table .is-selected {
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(11, 138, 85, 0.28);
}

.source-table.loading-table span {
  margin: 8px;
  min-height: 8px;
  border-radius: 999px;
  background: rgba(196, 210, 207, 0.5);
}

.source-table-excerpt > p,
.source-detail-block dd,
.source-detail-block dt {
  color: #425864;
  font-size: 0.84rem;
  line-height: 1.45;
}

.source-detail-block h3 {
  margin-bottom: 14px;
  font-size: 0.98rem;
}

.source-detail-block dl {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.source-detail-block dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
}

.source-detail-block dt {
  font-weight: 760;
}

.source-detail-block dd {
  margin: 0;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.source-copy-button {
  font: inherit;
  cursor: pointer;
}

.source-copy-button:disabled,
.source-copy-button[aria-disabled="true"] {
  color: var(--placeholder);
  cursor: not-allowed;
}

.safety-check {
  margin-top: 14px;
  border-color: rgba(11, 138, 85, 0.24);
  background: rgba(234, 248, 241, 0.78);
}

@media (max-width: 1180px) {
  .clinical-grid {
    grid-template-columns: 1fr;
  }

  .calculator-panel,
  .dose-card,
  .kidney-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .calculator-panel .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-field,
  .drug-field,
  .context-controls {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .workspace {
    width: min(430px, 100%);
    min-height: 100dvh;
    margin: 0 auto;
    padding: 0 10px 14px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 60px;
    margin: 0 -10px 0;
    padding: max(9px, env(safe-area-inset-top)) 12px 9px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(18px);
  }

  .kidney-mark {
    width: 38px;
    height: 34px;
  }

  h1 {
    font-size: 1.08rem;
  }

  .maker-line {
    display: none;
  }

  .topbar-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  .pwa-status {
    max-width: 108px;
  }

  .install-button {
    width: 38px;
    min-width: 38px;
    padding: 0;
    justify-content: center;
  }

  .install-button svg {
    width: 18px;
    height: 18px;
  }

  .install-button {
    font-size: 0;
    gap: 0;
  }

  .warning-banner {
    justify-content: flex-start;
    min-height: 34px;
    margin: 8px 0;
    padding: 7px 9px;
    gap: 8px;
    font-size: 0.75rem;
  }

  .warning-banner svg {
    width: 15px;
    height: 15px;
  }

  .warning-banner span {
    height: 18px;
  }

  .clinical-summary-bar {
    position: sticky;
    top: 60px;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
    margin: 8px 0 10px;
    padding: 8px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(16px);
  }

  .clinical-summary-bar > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
  }

  .clinical-summary-bar span {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 850;
    line-height: 1;
  }

  .clinical-summary-bar strong {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quick-panel summary {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .quick-panel summary strong {
    display: none;
  }

  .quick-panel .command-bar {
    grid-template-columns: 1fr auto;
  }

  .clinical-grid {
    gap: 10px;
  }

  .calculator-panel {
    order: 1;
  }

  .dose-card {
    order: 2;
  }

  .kidney-panel {
    order: 3;
  }

  .panel,
  .result-card {
    padding: 12px;
  }

  .panel-heading {
    margin-bottom: 12px;
  }

  .heading-line h2 {
    font-size: 0.92rem;
  }

  .calculator-panel .field-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-section-title {
    display: grid;
    gap: 2px;
  }

  .form-section-title p {
    text-align: left;
  }

  .drug-field,
  .route-field,
  .context-controls,
  .height-field {
    grid-column: 1 / -1;
  }

  .field > span {
    font-size: 0.74rem;
  }

  input,
  select,
  .unit-input,
  .route-segment,
  .sex-segment {
    min-height: 34px;
    border-radius: 6px;
  }

  input,
  select,
  .route-segment span,
  .sex-segment span {
    min-height: 34px;
    font-size: 0.76rem;
  }

  .unit-input input {
    min-height: 32px;
  }

  .unit-input span {
    min-width: 40px;
    font-size: 0.68rem;
  }

  .primary-button {
    min-height: 38px;
    font-size: 0.82rem;
  }

  .formula-note {
    font-size: 0.68rem;
  }

  .kidney-panel {
    gap: 10px;
  }

  .kidney-panel .metrics-grid {
    grid-template-columns: 1fr;
  }

  .kidney-panel .metric-card + .metric-card {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .kidney-panel .metric-card {
    min-height: auto;
    padding: 10px;
  }

  .kidney-panel .metric-card h3 {
    font-size: 2.1rem;
  }

  .metric-label {
    font-size: 0.8rem;
  }

  .ckd-summary {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .ckd-stage-card {
    min-width: 58px;
    min-height: 48px;
  }

  .ckd-stage-card span {
    font-size: 1.45rem;
  }

  .ckd-band-table div {
    min-height: 48px;
  }

  .ckd-band-table span,
  .ckd-band-table strong {
    font-size: 0.62rem;
  }

  .body-metrics div {
    min-height: 30px;
    padding: 0 9px;
  }

  .body-metrics dt,
  .body-metrics dd,
  .helper-text,
  .clinical-list {
    font-size: 0.7rem;
  }

  .dose-title-row {
    gap: 8px;
    margin-bottom: 10px;
  }

  .dose-title-row h3 {
    font-size: 1rem;
  }

  .dose-title-row #drug-meta {
    font-size: 0.72rem;
  }

  .dose-main {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .dose-band-large {
    padding: 0 0 9px;
    border-right: 0;
    border-bottom: 1px solid rgba(11, 138, 85, 0.24);
  }

  .dose-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dose-columns span {
    display: block;
  }

  .dose-recommendation p {
    display: block;
    font-size: 0.72rem;
  }

  .source-evidence-panel {
    padding: 12px;
  }

  .source-shell {
    gap: 12px;
  }

  .source-evidence-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .source-block + .source-block {
    padding-left: 0;
    padding-top: 14px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .source-table > div {
    grid-template-columns: minmax(92px, 0.78fr) minmax(0, 1fr);
  }

  .safety-check {
    grid-template-columns: 1fr;
    padding: 10px;
    font-size: 0.7rem;
  }

  .safety-check > span:last-child {
    text-align: left;
  }
}

@media (max-width: 430px) {
  .calculator-panel .field-grid {
    grid-template-columns: 1fr;
  }

  .kidney-panel .metrics-grid {
    grid-template-columns: 1fr;
  }
}
