@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #0b1f33;
  --muted: #5a6f86;
  --line: #e2eaf2;
  --surface: #ffffff;
  --bg: #f5f8fb;
  --teal: #0a7c8c;
  --teal-dark: #066273;
  --teal-soft: rgba(10, 124, 140, 0.08);
  --navy: #0b1f33;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #027a48;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --shadow: 0 1px 2px rgba(11, 31, 51, 0.04), 0 12px 40px rgba(11, 31, 51, 0.06);
  --shadow-lg: 0 24px 64px rgba(11, 31, 51, 0.1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --font: "Plus Jakarta Sans", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(1100px 480px at 6% -12%, rgba(10, 124, 140, 0.09), transparent 55%),
    radial-gradient(800px 400px at 100% 0%, rgba(11, 31, 51, 0.045), transparent 52%),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 40%, #f3f7fa 100%);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--teal-dark); }
a:hover { color: var(--teal); }

button, input, select, textarea { font: inherit; color: inherit; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid rgba(226, 234, 242, 0.95);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #16a3b5, #075e6e);
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark-img {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  background: #0b7285;
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-size: 15px;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.nav-link,
.btn-secondary {
  appearance: none;
  -webkit-appearance: none;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 9px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.btn-secondary:hover,
.btn-secondary:focus-visible {
  color: var(--teal-dark);
  background: var(--teal-soft);
  text-decoration: none;
  outline: none;
}

.main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 0 64px;
  flex: 1;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(26px, 3.6vw, 36px);
  letter-spacing: -0.035em;
  line-height: 1.15;
  font-weight: 750;
}

h2, h3 { color: var(--navy); letter-spacing: -0.02em; }

.lede {
  max-width: 640px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 15.5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card {
  margin-top: 28px;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid rgba(226, 234, 242, 0.98);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.subsection-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 750;
}

.section-lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  max-width: 72ch;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.dash-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.dash-jump a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(11, 31, 51, 0.03);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dash-jump a:hover,
.dash-jump a:focus-visible {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: #fff;
  outline: none;
}

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

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

.stat {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(11, 31, 51, 0.03);
  min-width: 0;
}

.stat strong {
  display: block;
  font-size: 22px;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  word-break: break-word;
  line-height: 1.2;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.field {
  display: block;
  margin: 16px 0;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  padding: 11px 13px;
  border: 1px solid #c8d6e3;
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

.field select {
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #8aa0b4;
}

.field input:hover:not(:disabled):not(:focus),
.field select:hover:not(:disabled):not(:focus),
.field textarea:hover:not(:disabled):not(:focus) {
  border-color: #95b0c4;
  background: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.16);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: #f1f5f8;
}

.form-block {
  margin: 20px 0 8px;
  padding: 18px 18px 8px;
  border: 1px solid rgba(213, 225, 236, 0.9);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdfe 0%, #f7fafc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.form-block legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 750;
  color: var(--navy);
}

.form-block-lead {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.nested-form {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.product-fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0 8px;
  background: #f8fbfc;
}

.product-fieldset legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.product-fieldset-lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.product-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  margin: 0;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.product-option:hover,
.product-option:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.12);
}

.product-option:has(input:checked) {
  border-color: var(--teal);
  background: rgba(11, 114, 133, 0.06);
}

.product-option input[type="checkbox"] {
  width: 18px !important;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.field .product-option,
.product-option {
  width: auto;
}

.field .product-option span,
.product-option-body,
.product-option-desc {
  width: auto;
}

.product-option-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.product-option-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.product-option-desc {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

.clinic-product-tags {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.clinic-actions {
  white-space: nowrap;
}

.btn-inline {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 12px;
  margin: 0 6px 4px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbfc;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-inline:hover,
.btn-inline:focus-visible {
  border-color: var(--teal);
  background: #e8fafc;
  outline: none;
}

.btn-inline:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-inline-warn {
  border-color: #f0c48a;
  background: #fff8ef;
  color: #9a3412;
}

.btn-inline-warn:hover,
.btn-inline-warn:focus-visible {
  border-color: #e2a35c;
  background: #ffedd5;
  color: #7c2d12;
}

.btn-inline-ok {
  border-color: #99d6cb;
  background: #ecfdf8;
  color: #0f766e;
}

.btn-inline-ok:hover,
.btn-inline-ok:focus-visible {
  border-color: #5db7a8;
  background: #d7f5ee;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f4f7fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-badge.is-active {
  border-color: #9ad8cb;
  background: #ecfdf8;
  color: #0f766e;
}

.status-badge.is-inactive {
  border-color: #e7d0b5;
  background: #fff7ed;
  color: #9a3412;
}

.password-field { position: relative; }

.password-field input {
  padding-right: 68px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--teal-dark);
  background: rgba(11, 114, 133, 0.08);
  outline: none;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-hint code,
.section-lead code,
.result-meta code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(16, 42, 67, 0.06);
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
  min-height: 1.2em;
}

.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--teal);
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(10, 124, 140, 0.2), 0 8px 20px rgba(10, 124, 140, 0.18);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--teal-dark);
  outline: none;
}

.btn-primary:active { transform: translateY(1px); }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.status {
  min-height: 1.3em;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }
.status.info { color: var(--muted); }

body[data-page="login"] .main,
body[data-page="clinic-login"] .main,
body[data-page="operator-setup"] .main,
body[data-page="operator-reset"] .main,
body[data-page="clinic-forgot-password"] .main,
body[data-page="clinic-reset-password"] .main,
body[data-page="clinic-verify-email"] .main,
body[data-page="clinic-accept-invite"] .main {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-option {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.product-option:hover {
  transform: translateY(-1px);
}

.empty-state {
  text-align: center;
  padding: 28px 20px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #b9e1e7;
  background: rgba(232, 250, 252, 0.85);
  color: #155e75;
  font-size: 14px;
  line-height: 1.5;
}

.banner.warn {
  border-color: #f9dbaf;
  background: var(--warn-soft);
  color: var(--warn);
}

.banner a {
  color: inherit;
  font-weight: 700;
}

.result-panel {
  margin-top: 22px;
  padding: 18px 18px 14px;
  border: 1px solid #9fd4dc;
  border-radius: 14px;
  background: linear-gradient(180deg, #f2fbfd 0%, #e8f7f9 100%);
}

.result-panel-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 750;
  color: var(--teal-dark);
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0 0 14px;
}

.result-meta > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(159, 212, 220, 0.55);
}

.result-meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-meta dd {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 650;
  word-break: break-word;
  line-height: 1.35;
}

.result-urls { margin-top: 4px; }

.url-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.url-list li {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
}

.url-list li span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-top: 2px;
}

.url-list li a {
  font-size: 13px;
  word-break: break-all;
  line-height: 1.4;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }

tbody tr:hover td { background: rgba(11, 114, 133, 0.03); }

th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  background: #f8fafc;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 18px 0;
}

.footer {
  padding: 18px 16px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.92fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
  min-height: min(68vh, 640px);
}

.login-layout .card {
  margin-top: 0;
  box-shadow: var(--shadow-lg);
  border-color: rgba(226, 234, 242, 1);
}

.card-title {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.03em;
  font-weight: 750;
  line-height: 1.2;
}

.card-lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.setup-steps {
  margin: 0 0 20px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.setup-steps li { margin: 4px 0; }

.form-footer-links {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-footer-links a {
  color: var(--teal-dark);
  font-weight: 650;
  text-decoration: none;
}

.form-footer-links a:hover {
  text-decoration: underline;
}

@media (max-width: 860px) {
  .login-layout,
  .grid-2,
  .grid-3,
  .product-options,
  .result-meta {
    grid-template-columns: 1fr;
  }

  .url-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.stats-row {
  margin-top: 24px;
}

.unified-form {
  margin-top: 8px;
}

.form-section-label {
  margin: 8px 0 4px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-inline-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-divider {
  height: 1px;
  margin: 20px 0 14px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.cleanup-form {
  margin-top: 16px;
}

.cleanup-actions {
  align-items: stretch;
}

.cleanup-actions .btn-primary,
.cleanup-actions .btn-danger,
.cleanup-actions .btn-secondary {
  flex: 1 1 180px;
  width: auto;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
}

button.btn-danger,
.btn-danger {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  margin-top: 0;
  padding: 13px 16px;
  border: 0;
  border-radius: 11px;
  color: #fff !important;
  background: linear-gradient(180deg, #b4533a 0%, #9a3412 100%) !important;
  font-weight: 750;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(154, 52, 18, 0.18);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button.btn-danger:hover,
button.btn-danger:focus-visible,
.btn-danger:hover,
.btn-danger:focus-visible {
  background: linear-gradient(180deg, #9a3412 0%, #7c2d12 100%) !important;
  outline: none;
}

button.btn-danger:disabled,
.btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  color: #fff !important;
  background: linear-gradient(180deg, #b4533a 0%, #9a3412 100%) !important;
}

.card-danger-zone {
  border-color: rgba(245, 194, 122, 0.85);
  box-shadow: 0 18px 50px rgba(154, 52, 18, 0.06);
}

.confirm-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #f0c48a;
  border-radius: 14px;
  background: #fff8ef;
}

.confirm-question {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.cleanup-summary-card {
  border-color: #f0c48a;
  background: linear-gradient(180deg, #fffdf9 0%, #fff7ed 100%);
}

.cleanup-meta {
  margin-top: 12px;
}

.cleanup-retention-note {
  margin-top: 14px;
}

.cleanup-counts {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.cleanup-counts li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: var(--muted);
}

.cleanup-counts li strong {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 640px) {
  .cleanup-counts {
    grid-template-columns: 1fr;
  }
}

.empty-state {
  margin: 18px 0 0;
  padding: 18px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f8fbfc;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.manage-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdfe 0%, #f5fafb 100%);
}

.manage-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.manage-panel-eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.manage-panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  color: var(--navy);
  line-height: 1.25;
}

.manage-panel-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.syra-embed-origin-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.syra-embed-origin-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #d7e0da);
  border-radius: 10px;
  background: #fbfdfc;
}
.syra-embed-origin-list code {
  flex: 1 1 auto;
  word-break: break-all;
}
.syra-embed-add-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.syra-embed-snippet {
  margin: 8px 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f241c;
  color: #e8fff4;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow: auto;
}
.manage-panel-actions {
  margin-top: 16px;
}

.btn-primary-inline {
  width: auto;
  min-width: 200px;
  display: inline-flex;
  justify-content: center;
}

.advanced-panel {
  margin-top: 22px;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.advanced-panel > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
  font-size: 14px;
  list-style: none;
}

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

.advanced-panel > summary::before {
  content: "▸ ";
  color: var(--teal);
}

.advanced-panel[open] > summary::before { content: "▾ "; }

@media (max-width: 860px) {
  .product-toggle-grid {
    grid-template-columns: 1fr;
  }

  .manage-panel-header {
    flex-direction: column;
  }

  .btn-primary-inline {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .main { width: calc(100% - 24px); }
  .dash-jump a { font-size: 12px; padding: 7px 11px; }
}


/* Registration step indicator */
.reg-steps {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.reg-steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.reg-steps li.is-current {
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.reg-steps li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}
.reg-steps li.is-current::before {
  opacity: 1;
  background: var(--teal);
}

/* In-app confirmation dialog (replaces native window.confirm) */
.pa-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 31, 51, 0.48);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.pa-dialog-overlay.is-open {
  opacity: 1;
}
/* Per-clinic product links panel */
.pa-clinic-identity {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.03);
  border-radius: 10px;
  font-size: 0.86rem;
}
.pa-clinic-identity dt {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.pa-clinic-identity dd {
  margin: 2px 0 0;
  font-weight: 600;
  word-break: break-word;
}
.pa-product-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface);
}
.pa-product-card.is-disabled {
  background: rgba(15, 23, 42, 0.02);
}
.pa-product-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.pa-product-card h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.pa-link-row {
  display: grid;
  grid-template-columns: minmax(120px, 150px) 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px dashed rgba(15, 23, 42, 0.08);
}
.pa-link-row:first-of-type {
  border-top: 0;
}
.pa-link-label {
  font-size: 0.78rem;
  color: var(--muted);
}
.pa-link-url {
  display: block;
  font-size: 0.76rem;
  padding: 4px 6px;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 6px;
  word-break: break-all;
  max-height: 4.6em;
  overflow: auto;
}
.pa-link-actions {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.pa-link-missing {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}
.pa-link-row--empty {
  grid-template-columns: minmax(120px, 150px) 1fr;
}
@media (max-width: 640px) {
  .pa-link-row,
  .pa-link-row--empty {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .pa-link-actions {
    justify-self: start;
  }
  .pa-dialog {
    width: 100%;
  }
}
.pa-dialog {
  width: min(100%, 440px);
  max-height: min(88vh, 640px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px 22px 18px;
  transform: translateY(8px);
  transition: transform 0.16s ease;
}
.pa-dialog-overlay.is-open .pa-dialog {
  transform: translateY(0);
}
.pa-dialog-danger {
  border-color: rgba(180, 35, 24, 0.22);
}
.pa-dialog-title {
  margin: 0 0 10px;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  color: var(--navy);
}
.pa-dialog-body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.pa-dialog-body p {
  margin: 0 0 10px;
}
.pa-dialog-body strong {
  color: var(--ink);
}
.pa-dialog-body code {
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.pa-dialog-impact {
  margin: 0 0 14px;
  padding: 10px 12px 10px 28px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--ink);
}
.pa-dialog-danger .pa-dialog-impact {
  background: var(--danger-soft);
  border-color: rgba(180, 35, 24, 0.16);
}
.pa-dialog-impact li {
  margin: 4px 0;
}
.pa-dialog-code-field {
  margin: 12px 0 4px;
}
.pa-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.pa-dialog-actions .btn-secondary,
.pa-dialog-actions .btn-primary,
.pa-dialog-actions .btn-danger {
  width: auto;
  min-width: 120px;
  margin-top: 0;
}
@media (max-width: 480px) {
  .pa-dialog {
    padding: 18px 16px 14px;
  }
  .pa-dialog-actions {
    flex-direction: column-reverse;
  }
  .pa-dialog-actions .btn-secondary,
  .pa-dialog-actions .btn-primary,
  .pa-dialog-actions .btn-danger {
    width: 100%;
  }
}

/* Clinic Admin — member roster + detail panel */
.clinic-welcome-lede {
  color: var(--muted, #64748b);
  font-size: 1.05rem;
}
.clinic-welcome-lede #clinic-name-label {
  color: var(--ink, #0f172a);
  font-weight: 650;
}
.members-table tbody tr.member-row {
  cursor: pointer;
}
.members-table tbody tr.member-row:hover,
.members-table tbody tr.member-row:focus-within {
  background: rgba(14, 165, 183, 0.06);
}
.member-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 10rem;
}
.member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(14, 165, 183, 0.14);
  color: #0f8796;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.member-avatar--lg {
  width: 3rem;
  height: 3rem;
  font-size: 0.95rem;
}
.member-cell-name {
  font-weight: 600;
  color: var(--ink, #0f172a);
}
.member-detail-muted {
  color: var(--muted, #64748b);
  font-size: 0.85em;
}
.member-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.42);
}
.member-detail-overlay[hidden] {
  display: none;
}
.member-detail-panel {
  width: min(28rem, 100%);
  max-height: min(90vh, 40rem);
  overflow-y: auto;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(14, 165, 183, 0.18);
  background: #fff;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.2);
}
.member-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.member-detail-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.member-detail-identity h2 {
  margin: 0;
  font-size: 1.1rem;
}
.member-detail-sub {
  margin: 0.2rem 0 0;
  color: var(--muted, #64748b);
  font-size: 0.82rem;
}
.member-detail-grid {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1.1rem;
}
.member-detail-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.member-detail-grid dt {
  color: var(--muted, #64748b);
  font-size: 0.78rem;
}
.member-detail-grid dd {
  margin: 0;
  color: var(--ink, #0f172a);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.member-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}
.member-detail-actions .btn-danger,
.member-detail-actions .btn-secondary {
  width: auto;
  min-width: 7.5rem;
  margin-top: 0;
}
@media (max-width: 720px) {
  .members-table th:nth-child(3),
  .members-table td:nth-child(3),
  .members-table th:nth-child(5),
  .members-table td:nth-child(5) {
    display: none;
  }
}
