:root {
  /* Clinical light theme aligned to portal header mock */
  --bg: #dceaf8;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #d5e3f0;
  --text: #1a2b56;
  --muted: #6b7c99;
  --accent: #1a2b56;
  --accent-soft: #dceaf8;
  --green: #1f8f4e;
  --amber: #b7811a;
  --red: #d64545;
  --mw: #7b5bb8;
  --icog: #2f6fbf;
  --eyris: #2f8f55;
  --bioage: #c47a2e;
  --summary: #2f6fbf;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --topbar-bg: #ffffff;
  --topbar-text: #1a2b56;
  --topbar-muted: #6b7c99;
  --topbar-border: #e6edf5;
  --topbar-accent: #1a2b56;
  --topbar-logo-bg: #ffffff;
  --topbar-active-bg: #1a2b56;
  --topbar-active-text: #ffffff;
  --topbar-mode-active-bg: #dceaf8;
  --topbar-mode-active-text: #1a2b56;
  --surface-inset: #f5f9fd;
  --surface-raised: #eef5fb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(59, 130, 246, 0.14), transparent 55%),
    radial-gradient(800px 380px at 90% 0%, rgba(26, 43, 86, 0.08), transparent 50%),
    linear-gradient(180deg, #e8f2fb 0%, #dceaf8 48%, #d2e4f4 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--topbar-border);
  background: var(--topbar-bg);
  color: var(--topbar-text);
  position: sticky; top: 0; z-index: 5;
  min-height: 96px;
  box-shadow: 0 1px 0 rgba(26, 43, 86, 0.04);
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 16px;
  flex: 0 1 auto;
  min-width: 0;
}
.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 0;
  flex: 0 0 auto;
}
.brand-divider {
  width: 1px;
  align-self: stretch;
  min-height: 36px;
  background: #d9e3ef;
  flex: 0 0 auto;
}
.logo { height: 64px; width: auto; max-width: 260px; display: block; object-fit: contain; }
.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  min-width: 0;
}
.topbar h1 {
  margin: 0; font-size: 18px; font-weight: 700; color: var(--topbar-text);
  letter-spacing: -0.01em;
}
.topbar .sub { margin: 2px 0 0; color: var(--topbar-muted); font-size: 12.5px; }
.topright {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.topbar .modeSwitch {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 999px;
  border: 1px solid #e1e9f2;
  background: #f3f6fa;
  flex: 0 0 auto;
}
.topbar .langSwitch + .modeSwitch {
  position: static;
  margin-left: 0;
}
.topbar .langSwitch + .modeSwitch::before { display: none; }
.topbar .modeLabel {
  font-size: 13px; color: var(--topbar-muted); padding: 6px 12px;
  font-weight: 600; letter-spacing: 0;
  text-transform: none;
}
.topbar .modeBtn {
  border: 0; background: transparent; color: var(--topbar-muted);
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}
.topbar .modeBtn:hover { color: var(--topbar-text); background: rgba(26, 43, 86, 0.06); }
.topbar .modeBtn:active { transform: scale(0.96); }
.topbar .langSwitch .modeBtn.active {
  background: var(--topbar-active-bg);
  color: var(--topbar-active-text);
  box-shadow: 0 1px 2px rgba(26, 43, 86, 0.18);
}
.topbar .langSwitch .modeBtn.active:hover {
  background: var(--topbar-active-bg);
  color: var(--topbar-active-text);
}
.topbar #apiModeSwitch .modeBtn.active {
  background: var(--topbar-mode-active-bg);
  color: var(--topbar-mode-active-text);
  box-shadow: none;
}
.topbar #apiModeSwitch .modeBtn.active:hover {
  background: var(--topbar-mode-active-bg);
  color: var(--topbar-mode-active-text);
}
.topbar .modeHint { font-size: 12px; color: var(--topbar-muted); max-width: 220px; line-height: 1.4; flex: 0 0 auto; }
.topbar .modeHint.warn { color: #b7811a; }
.topbar .link { color: var(--topbar-accent); text-decoration: none; font-size: 14px; }

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.topnav .navlink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 0;
  background: none;
  color: var(--topbar-text);
  text-decoration: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.topnav .navlink:hover { background: #eef3f9; color: #122247; }
.topnav .navlink:active { transform: scale(0.97); background: #e4ebf5; }

.announce-menu {
  position: relative;
  margin-left: 2px;
}
.announce-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--topbar-text);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.announce-bell svg {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease;
}
.announce-bell:hover,
.announce-menu.open .announce-bell,
.announce-menu:focus-within .announce-bell {
  background: #eef3f9;
  color: #122247;
}
.announce-bell:hover svg {
  transform: rotate(-12deg);
}
.announce-bell:active {
  transform: scale(0.94);
}
.announce-menu.open .announce-bell svg {
  transform: none;
}
.announce-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d64545;
  border: 1.5px solid #fff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  box-sizing: border-box;
}
.announce-dot[hidden] { display: none; }
.announce-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(340px, 82vw);
  background: #fff;
  border: 1px solid #e6edf5;
  border-radius: 12px;
  padding: 10px;
  z-index: 30;
  box-shadow: 0 12px 32px rgba(26, 43, 86, 0.14);
}
.announce-pop[hidden] { display: none; }
.announce-pop-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--topbar-text);
  padding: 4px 6px 10px;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 8px;
}
.announce-list {
  display: grid;
  gap: 8px;
  max-height: min(360px, 55vh);
  overflow: auto;
}
.announce-list:empty { display: none; }
.announce-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 10px 10px 9px;
  border-radius: 10px;
  background: #f5f9fd;
  border: 1px solid #e6edf5;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.announce-item:hover,
.announce-item:focus-visible {
  background: #e8f1fb;
  border-color: #c5daf3;
  outline: none;
}
.announce-item-release {
  background: #eef5fd;
  border-color: #c5daf3;
}
.announce-item-read {
  opacity: 0.72;
}
.announce-item-read .announce-item-open {
  display: none;
}
.announce-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--topbar-text);
  margin: 0 0 4px;
}
.announce-item-body {
  margin: 0;
  font-size: 12.5px;
  color: var(--topbar-muted);
  line-height: 1.45;
}
.announce-item-date {
  margin: 6px 0 0;
  font-size: 11px;
  color: #8a9bb5;
}
.announce-empty {
  padding: 14px 8px 10px;
  font-size: 13px;
  color: var(--topbar-muted);
  text-align: center;
  line-height: 1.45;
}
.announce-empty[hidden] { display: none; }

.version-toast {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  width: min(1180px, calc(100% - 32px));
  margin-top: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #d7e4f2;
  border-left: 4px solid #1a6fd4;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(26, 43, 86, 0.08);
}
.version-toast[hidden] { display: none; }
.version-toast-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #e8f1fb;
  color: #1a6fd4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.version-toast-icon svg { width: 18px; height: 18px; }
.version-toast-copy { flex: 1 1 auto; min-width: 0; }
.version-toast-copy strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--topbar-text);
  margin: 0 0 4px;
}
.version-toast-copy p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--topbar-muted);
}
.version-toast-view,
.version-toast-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}
.version-toast-view { color: #1a6fd4; }
.version-toast-close { color: var(--topbar-muted); }
.version-toast-view:hover,
.version-toast-close:hover { background: #eef3f9; }
.announce-detail-overlay { align-items: center; }
.announce-detail-modal { max-width: 560px; }
.announce-detail-date {
  margin: 0 0 10px;
  font-size: 12px;
  color: #8a9bb5;
}
.announce-detail-summary {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.announce-detail-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.announce-detail-list:empty { display: none; }
.announce-detail-foot {
  display: flex;
  justify-content: flex-end;
  padding: 0 20px 16px;
}
.announce-detail-foot .run {
  min-width: 96px;
}
@media (max-width: 640px) {
  .version-toast {
    width: calc(100% - 24px);
    flex-wrap: wrap;
  }
}

.user-menu { position: relative; margin-left: 4px; }
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--topbar-text);
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.18s ease, transform 0.12s ease;
}
.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger,
.user-menu:focus-within .user-menu-trigger,
.user-menu:hover .user-menu-trigger {
  background: #eef3f9;
}
.user-menu-trigger:active { transform: scale(0.97); }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1a2b56;
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.user-avatar svg { width: 16px; height: 16px; }
.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-org {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
  color: #8a9bb5;
}
.user-org[hidden] { display: none; }
.user-chevron {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #6b7c99;
  margin-left: 2px;
}
.user-menu-pop {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 200px;
  padding: 16px 8px 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: none;
  gap: 2px;
  z-index: 30;
  box-shadow: none;
}
.user-menu-pop::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border: 1px solid #e6edf5;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(26, 43, 86, 0.14);
  z-index: 0;
  pointer-events: none;
}
.user-menu.open .user-menu-pop,
.user-menu:hover .user-menu-pop,
.user-menu:focus-within .user-menu-pop { display: grid; }
.user-menu-pop .logout-form {
  position: relative;
  z-index: 1;
  margin: 0;
}
.user-menu-pop a,
.user-menu-pop .user-logout {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--topbar-text);
  text-decoration: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.user-menu-pop a svg { width: 16px; height: 16px; flex: 0 0 auto; color: #1a2b56; }
.user-menu-pop a:hover { background: #eef3f9; }
.user-submenu { position: relative; z-index: 1; }
.user-submenu-trigger {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--topbar-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.user-submenu-trigger svg { width: 16px; height: 16px; flex: 0 0 auto; color: #1a2b56; }
.user-submenu-trigger span[data-i18n] { flex: 1; }
.user-submenu-chevron {
  width: 0; height: 0;
  margin-left: auto;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #6b7c99;
  transition: transform 0.12s ease;
}
.user-submenu.open .user-submenu-chevron { transform: rotate(90deg); }
.user-submenu-trigger:hover { background: #eef3f9; }
.user-submenu-pop {
  display: none;
  gap: 2px;
  padding: 0 4px 4px 28px;
}
.user-submenu.open .user-submenu-pop { display: grid; }
.user-submenu-pop a { padding: 8px 12px; font-weight: 600; }
.user-menu-pop .user-logout {
  color: #d64545;
  margin-top: 2px;
}
.user-menu-pop .user-logout::before {
  content: "";
  width: 16px; height: 16px; flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 3v2h8v14h-8v2h10V3H10zm-1.5 6.5L6 12l2.5 2.5 1.4-1.4L9.8 13H16v-2H9.8l1.1-1.1-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 3v2h8v14h-8v2h10V3H10zm-1.5 6.5L6 12l2.5 2.5 1.4-1.4L9.8 13H16v-2H9.8l1.1-1.1-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.user-menu-pop .user-logout:hover { background: #fdecec; }
.topbar .user-logout-inline { color: #d64545 !important; }
.topbar .user-logout-inline:hover { background: #fdecec !important; color: #d64545 !important; }
.topnav .navlink svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  opacity: 0.9;
}

/* legacy hooks still referenced elsewhere */
.manual-menu { position: relative; }
.manual-pop {
  position: absolute;
  right: 0;
  top: 24px;
  min-width: 230px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  display: none;
  gap: 6px;
  z-index: 20;
}
.manual-menu:hover .manual-pop,
.manual-menu:focus-within .manual-pop { display: grid; }
.manual-pop a {
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 6px;
}
.manual-pop a:hover { background: var(--surface-raised); }

.wrap { max-width: 960px; margin: 0 auto; padding: 26px 22px 60px; }

.block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 22px; margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(8, 74, 135, 0.08);
}
.block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.block-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.block-head h2 small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 8px; }
.step {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.patient-grid {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}
.patient-grid.has-patient-id {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.patient-field {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-width: 0;
  width: 100%;
}
.patient-field .field-label {
  min-height: 20px;
}
.patient-field input,
.patient-field select,
.patient-field .dob-row {
  width: 100%;
  margin-top: 6px;
  height: 46px;
  box-sizing: border-box;
}
.patient-field input,
.patient-field select {
  padding: 0 13px;
  line-height: 1.2;
}
.patient-field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%216b7c99' d='M1.4 1.2 6 5.8 10.6 1.2 12 2.6 6 8.6 0 2.6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.patient-hint { margin: 8px 0 0; }
#patientIdField[hidden],
#patientIdHint[hidden] { display: none !important; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.req { color: var(--red); }
input, select {
  width: 100%; margin-top: 8px; padding: 11px 13px;
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 15px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 112, 184, 0.18); }
input[readonly] { background: #e3edf6; color: var(--muted); cursor: default; }
input[readonly]:focus { border-color: var(--border); box-shadow: none; }
.fieldhint { display: block; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.4; }
.dob-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 6px;
  align-items: stretch;
}
.dob-row select,
.dob-row input {
  margin-top: 0;
  min-width: 0;
  width: 100%;
  height: 46px;
  padding: 0 13px;
  box-sizing: border-box;
}
.dob-row select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%216b7c99' d='M1.4 1.2 6 5.8 10.6 1.2 12 2.6 6 8.6 0 2.6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
#birth_year {
  padding-left: 10px;
  padding-right: 10px;
  text-align: center;
}
#exam_date {
  min-width: 0;
  height: 46px;
  padding: 0 13px;
  color-scheme: light;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: 0;
  padding: 0;
}
select option { background: var(--panel); color: var(--text); }

.folderbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.folderbtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  background: #e3edf6; border: 1px solid var(--accent); color: var(--accent);
  padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.folderbtn:hover { background: #d4e6f3; }
.folderbtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.folderhint { color: var(--muted); font-size: 14px; }
.folderhint.ok { color: var(--green); }
.folderhint.warn { color: var(--amber); }

.shots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.shot-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  text-align: center;
  margin: 0 0 8px;
  min-height: 0;
}
.drop {
  position: relative; display: grid; place-items: center; height: 130px;
  border: 1.5px dashed var(--border); border-radius: 10px; cursor: pointer;
  background: var(--surface-inset); overflow: hidden; text-align: center;
}
.drop:hover { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 3; }
.drop .drop-upload {
  color: var(--muted);
  font-size: 14px;
  padding: 0 8px;
  z-index: 1;
}
.drop.filled { border-style: solid; border-color: var(--green); }
.drop.filled .drop-upload { opacity: 0; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.drop .tag {
  position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.7);
  color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 5px; z-index: 4;
}

.pkg-modes { display: inline-flex; gap: 4px; margin-bottom: 14px; padding: 4px;
  background: #f3f6fa; border: 1.5px solid var(--border); border-radius: 999px; }
.pkg-mode { cursor: pointer; border: none; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; padding: 8px 20px; border-radius: 999px; transition: background .15s, color .15s; }
.pkg-mode:hover { color: var(--text); }
.pkg-mode.active { background: var(--accent); color: #ffffff; }

.packages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.packages[data-group="combo"] { grid-template-columns: repeat(2, 1fr); }
.packages[hidden] { display: none; }
.pkg { cursor: pointer; display: block; }
.pkg input { display: none; }
.pkg-body {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 16px; height: 100%;
  transition: border-color .15s, background .15s;
}
.pkg:hover .pkg-body { border-color: var(--muted); }
.pkg input:checked + .pkg-body { border-color: var(--accent); background: var(--surface-raised); }
.pkg.unavailable { cursor: not-allowed; opacity: 0.55; }
.pkg.unavailable:hover .pkg-body { border-color: var(--border); }
.pkg.unavailable .pkg-body { border-style: dashed; }
.pkg-unavail {
  display: block; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--amber);
}
.pkg-body h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.pkg-body p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 6px;
  border: 1px solid transparent;
}
.badge.mw { background: #efe8ff; color: #5f4494; border-color: #d9cbf3; }
.badge.icog { background: #e7f1fc; color: #1f5fa8; border-color: #c5daf3; }
.badge.eyris { background: #e7f6ec; color: #1f7a45; border-color: #c3e6cf; }
.badge.bioage { background: #fff1e6; color: #a85d1c; border-color: #f0d4b8; }
.badge.vlab { background: #eef2f6; color: #3d4f63; border-color: #cfd8e1; }
.badge.summary { background: #e7f1fc; color: #1f5fa8; border-color: #c5daf3; }

.actions { display: flex; gap: 12px; margin-top: 6px; }
.run {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 13px 26px; border-radius: 999px; font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(26, 43, 86, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.run:hover {
  filter: brightness(1.06);
  transform: translateY(-3px);
  box-shadow: 0 12px 22px rgba(26, 43, 86, 0.24);
}
.run:active { transform: translateY(-1px); }
.run:disabled,
.run:disabled:hover {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 6px 16px rgba(26, 43, 86, 0.18);
  filter: none;
}
.reset {
  background: #fff; border: 1px solid var(--border); color: var(--text);
  padding: 13px 20px; border-radius: 999px; font-size: 14px; cursor: pointer;
}
.reset:hover { background: #eef3f9; }

.results { margin-top: 30px; }
.results-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.results-copy { min-width: 0; }
.results-head h2 { margin: 0; font-size: 22px; font-weight: 700; color: #16325c; }
.results-sub {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: #8a9bb5;
  line-height: 1.4;
}

.vcard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 16px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(8, 74, 135, 0.07);
}
.vcard-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.vcard-head h3 { margin: 0; font-size: 16px; flex: 1; font-weight: 600; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.pill.run { background: #e3edf6; color: var(--accent); }
.pill.ok { background: #e5f6ec; color: var(--green); }
.pill.err { background: #fdecec; color: var(--red); }
.steps { padding: 12px 18px; display: flex; flex-direction: column; gap: 7px; }
.sline { font-size: 14px; display: flex; gap: 9px; align-items: baseline; }
.sline .ic { width: 16px; text-align: center; }
.sline.ok .ic { color: var(--green); }
.sline.err .ic { color: var(--red); }
.sline.run .ic { color: var(--amber); }
.sline .lbl { color: var(--text); font-weight: 500; }
.sline .det { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.report-links { padding: 0 18px 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.report-links a {
  font-size: 14px; color: #fff; background: var(--accent);
  padding: 7px 13px; border-radius: 8px; text-decoration: none;
}
.report-links a.dlbtn,
.report-links button.dlbtn { background: var(--green); font-weight: 600; border: none; cursor: pointer; }
.report-links a.dlbtn:hover,
.report-links button.dlbtn:hover { filter: brightness(1.08); }
.report-links button.dlbtn:disabled,
.combo-dlbtn:disabled { opacity: 0.88; cursor: wait; }

.combo-dl { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }
.combo-dlbtn { width: 100%; max-width: 520px; }

#resultCards.result-dash {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#resultCards.result-dash.dash-count-1 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#resultCards.result-dash.dash-count-1 .dash-card {
  grid-column: 1 / -1;
}
#resultCards.result-dash.dash-count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#resultCards.result-dash .dash-card {
  background: #fff;
  border: 1px solid #d7e6f4;
  border-radius: 14px;
  padding: 12px 13px 11px;
  box-shadow: 0 8px 22px rgba(26, 43, 86, 0.06);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.dash-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.dash-ident {
  min-width: 0;
}
.dash-ident h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #16325c;
}
.dash-ident p {
  margin: 1px 0 0;
  font-size: 12px;
  color: #7b8aa6;
}
.dash-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.dash-flag.ok { background: #e8f7ee; color: #1f8f4e; }
.dash-flag.warn { background: #fff4e0; color: #b7811a; }
.dash-flag.alert { background: #fdecee; color: #d64545; }
.dash-flag.ok::before { content: "✓"; }
.dash-flag.warn::before { content: "!"; }
.dash-flag.alert::before { content: "!"; }
.dash-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 10px;
  flex: 1;
}
.dash-metrics {
  margin: 0;
  display: grid;
  gap: 6px;
}
.dash-metrics div { margin: 0; }
.dash-metrics dt {
  font-size: 12px;
  color: #8a9bb5;
  margin: 0 0 1px;
}
.dash-metrics dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #16325c;
  line-height: 1.15;
}
.dash-metrics dd.bad { color: #d64545; }
.dash-metrics dd.warn { color: #b7811a; }
.dash-metrics dd.good { color: #1f8f4e; }
.dash-note {
  border-radius: 9px;
  padding: 8px 9px;
  font-size: 12px;
  line-height: 1.4;
}
.dash-note p { margin: 0; font-weight: 700; }
.dash-note-sub, .dash-note .dash-note-sub {
  margin-top: 4px !important;
  font-weight: 500 !important;
  color: inherit;
  opacity: 0.85;
}
.dash-note.ok { background: #eef8f2; color: #1b6b3d; }
.dash-note.warn { background: #f4f7fb; color: #3d5273; }
.dash-note.alert { background: #fdecee; color: #b4232c; }
.dash-note-stack { display: grid; gap: 6px; }
.dash-caption {
  margin: 7px 0 0;
  font-size: 12px;
  color: #6b7c99;
  line-height: 1.4;
}
@media (max-width: 900px) {
  #resultCards.result-dash,
  #resultCards.result-dash.dash-count-1,
  #resultCards.result-dash.dash-count-2 { grid-template-columns: 1fr; }
  .dash-split { grid-template-columns: 1fr; }
}

details.raw { border-top: 1px solid var(--border); }
details.raw summary { cursor: pointer; padding: 10px 18px; color: var(--muted); font-size: 14px; }
pre.json {
  margin: 0; padding: 14px 18px; background: var(--surface-inset); overflow: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: var(--text);
}
.json .k { color: #1f8f4e; } .json .s { color: #0870b8; }
.json .n { color: #c56a14; } .json .b { color: #7a4fcf; } .json .null { color: var(--muted); }

.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; }
.banner.err { background: #fdecec; color: #a33b3b; border: 1px solid #f0c4c4; }
.banner.warn { background: #fff6e5; color: #8a6414; border: 1px solid #edd9a8; }
.banner.warn strong { color: #6e4f0d; display: block; margin-bottom: 4px; }
.banner.quota {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: #eef8f0;
  border: 1px solid #b7dfc0;
  border-radius: 999px;
  color: #1f2a24;
  box-shadow: none;
}
.banner.quota.exhausted {
  background: #fdecec;
  border-color: #f0c4c4;
}
.quota-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2f9e44;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.banner.quota.exhausted .quota-icon { background: #c23b3b; }
.quota-icon svg { width: 16px; height: 16px; display: block; }
.quota-divider {
  flex: 0 0 auto;
  width: 1px;
  align-self: stretch;
  min-height: 22px;
  background: #c9d6cc;
  margin: 2px 0;
}
.banner.quota.exhausted .quota-divider { background: #e0b8b8; }
.quota-status {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.3;
}
.quota-label { font-weight: 700; color: #1a1f1c; }
.quota-value { font-weight: 700; color: #2f9e44; }
.banner.quota.exhausted .quota-value { color: #c23b3b; }
.quota-contact {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 13.5px;
  font-weight: 400;
  color: #7a8580;
  line-height: 1.35;
}
@media (max-width: 720px) {
  .banner.quota {
    flex-wrap: wrap;
    border-radius: 14px;
    gap: 10px;
  }
  .quota-divider { display: none; }
  .quota-contact { flex-basis: 100%; padding-left: 42px; }
}
.banner.keep-awake {
  position: sticky;
  top: 96px;
  z-index: 4;
  background: #e3edf6;
  color: #084a87;
  border: 1px solid #9fc5e0;
  line-height: 1.5;
}
.banner.keep-awake strong { color: #084a87; }
.keep-awake-tip { color: #4a7194; font-size: 12.5px; }

.linkbtn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 0; font-family: inherit;
}
.linkbtn:hover { color: var(--text); }
.topbar .linkbtn {
  color: var(--topbar-accent);
  font-weight: 600;
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 8px;
}
.topbar .linkbtn:hover { color: #122247; background: #eef3f9; opacity: 1; }
.topbar .logout-form .linkbtn { color: var(--topbar-accent); }
.logout-form { margin: 0; }

/* Dashboard modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(8, 74, 135, 0.28);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%; max-width: 860px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(8, 74, 135, 0.18);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border, #2a2e36);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: none; border: 0; color: var(--muted, #9aa3af);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text, #fff); }
.modal-body { padding: 16px 20px; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th, .dash-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border, #2a2e36);
}
.dash-table th { color: var(--muted, #9aa3af); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.dash-table td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.dash-empty { text-align: center; color: var(--muted, #9aa3af); padding: 24px 12px; }
.dash-status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; background: #e3edf6; color: #4a7194; text-transform: capitalize;
}
.dash-status.ok { background: #e5f6ec; color: #1f8f4e; }
.dash-status.bad { background: #fdecec; color: #c04545; }

.dash-api {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; background: #e3edf6; color: #4a7194;
}
.dash-api.real { background: #fff6e5; color: #8a6414; }
.dash-api.mock { background: #e3f3fc; color: #0870b8; }

.wrap.dash-page { max-width: 1280px; }
.dash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.dash-layout.has-stats {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}
.dash-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 16px;
}
.dash-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dash-stats-head h2 { margin: 0; }
.dash-stats #dashStatsExport {
  color: var(--topbar-accent);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}
.dash-stats #dashStatsExport:hover { background: #eef3f9; }
.dash-stats-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.dash-stats-month {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.dash-stats-month:last-child { margin-bottom: 0; border-bottom: 0; padding-bottom: 0; }
.dash-stats-month h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.dash-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.dash-stats-row.total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-weight: 600;
}
.dash-mw .block-head h2 { margin: 0; }
.dash-mw-value {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}
@media (max-width: 820px) {
  .dash-layout { grid-template-columns: 1fr; }
}

.userbadge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px;
  background: #eef3f9; border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.topbar .userbadge {
  background: transparent;
  border: 0;
  color: var(--topbar-text);
  padding: 0;
}

.login-page {
  --login-panel-bg-start: #eef7fc;
  --login-panel-bg-mid: #c5e3f5;
  --login-panel-bg-end: #0870b8;
  --login-heading: #084a87;
  --login-text: #1a457e;
  --login-disclaimer: #4a7194;
  --login-divider: rgba(8, 74, 135, 0.16);
  --login-input-bg: #ffffff;
  --login-input-border: #9fc5e0;
  --login-input-focus: #00b5e8;
  --login-btn-bg: #0870b8;
  --login-cover-y: clamp(20%, 35%, 45%);
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(min(100%, 340px), 0.9fr);
  align-items: stretch;
  padding: 0;
  overflow: auto;
  background: #061526;
}
.login-cover {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background-color: #061526;
  background-image: url("/assets/cover_page.png");
  background-size: cover;
  background-position: center var(--login-cover-y);
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.login-wrap {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  margin-left: 0;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
}
.login-card {
  background: linear-gradient(
    165deg,
    var(--login-panel-bg-start) 0%,
    #e3edf6 20%,
    var(--login-panel-bg-mid) 50%,
    #3785c7 78%,
    var(--login-panel-bg-end) 100%
  );
  border: none;
  border-left: 1px solid var(--login-divider);
  border-radius: 0;
  padding: 0;
  flex: 1;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  overflow-y: auto;
}
.login-body {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: clamp(16px, 3.5vw, 48px) clamp(14px, 3vw, 36px);
}
.login-logo {
  position: absolute;
  grid-column: 1;
  grid-row: 1;
  top: clamp(40px, 4.5vw, 55px);
  left: clamp(40px, 4.5vw, 55px);
  width: clamp(240px, 18vw, 280px);
  height: auto;
  display: block;
  object-fit: contain;
  margin: 0;
  z-index: 2;
  pointer-events: none;
}
.login-box {
  width: 100%;
  max-width: min(440px, 100%);
  background: #ffffff;
  border: 1px solid rgba(14, 25, 48, 0.08);
  border-radius: clamp(12px, 2vw, 16px);
  padding: clamp(20px, 3.5vw, 40px) clamp(16px, 3vw, 36px);
  box-shadow:
    0 4px 6px rgba(14, 25, 48, 0.04),
    0 16px 40px rgba(14, 25, 48, 0.1);
  text-align: center;
}
.login-box h1 {
  margin: 0 0 8px;
  font-size: clamp(20px, 2.2vw + 0.4rem, 26px);
  font-weight: 700;
  color: var(--login-heading);
}
.login-sub {
  margin: 0 0 clamp(16px, 2.5vw, 28px);
  color: var(--login-text);
  font-size: clamp(13px, 1.4vw + 0.35rem, 15px);
}
.login-form {
  text-align: left;
  width: 100%;
}
.login-form label {
  display: block;
  margin-bottom: clamp(12px, 2vw, 18px);
  font-size: clamp(13px, 1.2vw + 0.4rem, 14px);
  font-weight: 600;
  color: var(--login-text);
}
.login-form input {
  width: 100%;
  margin-top: 8px;
  padding: clamp(11px, 1.6vw, 13px) clamp(12px, 1.6vw, 14px);
  font-size: clamp(14px, 1.4vw + 0.4rem, 15px);
  border-radius: 8px;
  background: var(--login-input-bg);
  border: 1px solid var(--login-input-border);
  color: var(--login-heading);
}
.login-form input:focus {
  border-color: var(--login-input-focus);
  box-shadow: 0 0 0 3px rgba(45, 108, 163, 0.18);
  outline: none;
}
.login-form input::placeholder {
  color: #8aa7c2;
  opacity: 1;
}
.login-page .login-btn {
  width: 100%;
  margin-top: 6px;
  justify-content: center;
  padding: clamp(12px, 1.8vw, 14px) 26px;
  font-size: clamp(15px, 1.5vw + 0.4rem, 16px);
  font-weight: 600;
  border-radius: 8px;
  background: var(--login-btn-bg);
  color: #ffffff;
}
.login-page .login-btn:hover { filter: brightness(1.06); }
.login-err {
  background: #fdecea;
  color: #8f2d24;
  border: 1px solid #f5c2be;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 18px;
  text-align: left;
}
.login-page .op-err { color: #8f2d24; }
.login-page .op-err-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #b42318;
}
.login-page .op-err-card {
  background: #fff5f4;
  border: 1px solid #f5c2be;
  color: #8f2d24;
}
.login-notice {
  margin-top: clamp(16px, 2.5vw, 24px);
  padding-top: clamp(14px, 2vw, 20px);
  border-top: 1px solid var(--login-divider);
  color: var(--login-disclaimer);
  font-size: clamp(11px, 1.1vw + 0.3rem, 11.5px);
  line-height: 1.65;
  text-align: left;
}
.login-notice strong { color: var(--login-text); }
.login-notice p { margin: 0 0 12px; }
.login-notice p:last-child { margin-bottom: 0; }

@media (max-width: 820px) {
  .login-page {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 34vh) minmax(0, auto);
  }
  .login-cover {
    grid-column: 1;
    grid-row: 1;
    min-height: 160px;
    height: 34vh;
  }
  .login-wrap,
  .login-card {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }
  .login-card {
    border-left: none;
    border-top: 1px solid var(--login-divider);
  }
}

@media (max-height: 720px) and (min-width: 821px) {
  .login-card {
    justify-content: flex-start;
  }
  .login-body {
    padding-top: clamp(12px, 2vh, 24px);
    padding-bottom: clamp(12px, 2vh, 24px);
  }
}

.op-err { color: #a33b3b; }
.op-err-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: #c04545; }
.op-err-action { display: block; margin-top: 6px; font-size: 13px; opacity: 0.92; }
.op-err-detail { margin-top: 8px; font-size: 12.5px; opacity: 0.85; }
.op-err-card {
  background: #fdecec; border: 1px solid #f0c4c4; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px; font-size: 13px; color: #a33b3b;
}
.report-wrap { max-width: 720px; }
.report-banner { margin-bottom: 20px; }
.report-banner.ok {
  background: #e5f6ec; color: #1f5f3a; border: 1px solid #b7e2c7;
}
.report-ref { font-size: 1.25rem; margin: 8px 0; color: #1f8f4e; }
.report-hint { font-size: 13px; opacity: 0.9; margin: 0; }
.report-hint.warn { color: var(--amber); }
.report-form textarea {
  width: 100%; min-height: 140px; resize: vertical;
  padding: 12px 14px; border-radius: 10px; font-size: 15px;
  background: var(--surface-inset); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; line-height: 1.5;
}
.report-form textarea:focus { border-color: var(--accent); outline: none; }
.report-desc-hint { margin: 6px 0 0; }
.report-grid .span2 { grid-column: 1 / -1; }
.report-note { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5; }
.report-form .reset,
.report-form a.reset {
  border-radius: 10px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  font-size: 15px;
  font-weight: 600;
}
.report-form .reset:hover,
.report-form a.reset:hover {
  background: #eef3f9;
  border-radius: 10px;
}
.op-err-report { margin: 10px 0 0; font-size: 13px; }
.op-err-report a { color: #0870b8; text-decoration: underline; }

@media (max-width: 1100px) {
  .topbar {
    flex-wrap: wrap;
    min-height: 0;
    padding: 10px 16px;
    gap: 10px 14px;
  }
  .brand {
    flex: 1 1 100%;
    width: 100%;
    gap: 12px;
  }
  .brand-logo { padding: 0; }
  .brand-copy { padding: 0; min-width: 0; }
  .topbar .sub {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .logo { height: 48px; max-width: 180px; }
  .topright {
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    overflow: visible;
  }
  .topbar .modeHint { display: none; }
  .topnav {
    width: auto;
    flex-wrap: wrap;
    margin-left: 0;
  }
  .user-menu { margin-left: 0; }
}

@media (max-width: 760px) {
  .grid, .shots, .packages { grid-template-columns: 1fr 1fr; }
  .patient-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 10px 12px; }
  .topbar h1 { font-size: 16px; }
  .logo { height: 42px; max-width: 150px; }
  .topbar .modeBtn { padding: 5px 11px; font-size: 12.5px; }
  .topnav .navlink {
    padding: 6px 9px;
    font-size: 12.5px;
  }
  .user-name, .user-org { max-width: 96px; }
}

/* Download-complete popup */
.download-toast-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 74, 135, 0.28);
}
.download-toast {
  position: relative;
  width: min(360px, 100%);
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(8, 74, 135, 0.18);
  text-align: center;
}
.download-toast h4 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
}
.download-toast p {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.download-toast-ok {
  min-width: 96px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}
.download-toast-ok:hover { filter: brightness(1.08); }
.download-toast-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.download-toast-close:hover { color: var(--text); }
.download-toast.success h4 { color: var(--green); }

/* WhatsApp floating support button */
.whatsapp-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #3875bd;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.whatsapp-float:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(56, 117, 189, 0.45);
  color: #fff;
}
.whatsapp-float:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.whatsapp-float svg {
  width: 28px;
  height: 28px;
  display: block;
}
@media (max-width: 760px) {
  .whatsapp-float {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
  }
}

/* Restricted access (IP allowlist deny) */
.restricted-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: #1a2744;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #eef4fb 0%, #f8fbff 45%, #edf3fa 100%);
}
.restricted-main {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 32px;
  text-align: center;
}
.restricted-brand {
  margin-bottom: 28px;
}
.restricted-logo {
  height: 56px;
  width: auto;
  display: block;
  margin: 0 auto 14px;
  object-fit: contain;
}
.restricted-product {
  margin: 0 0 8px;
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0a1a3a;
  font-family: Georgia, "Times New Roman", serif;
}
.restricted-tagline {
  margin: 0;
  color: #5a6d8c;
  font-size: clamp(14px, 2vw, 16px);
}
.restricted-card {
  width: min(100%, 560px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(16, 36, 74, 0.12);
  padding: 34px 36px 30px;
}
.restricted-lock {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  color: #2f67b8;
}
.restricted-lock svg {
  width: 100%;
  height: 100%;
  display: block;
}
.restricted-card h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 700;
  color: #0a1a3a;
  font-family: Georgia, "Times New Roman", serif;
}
.restricted-lead,
.restricted-detail {
  margin: 0 0 14px;
  color: #3d4f6c;
  font-size: 15px;
  line-height: 1.65;
}
.restricted-detail {
  margin-bottom: 24px;
}
.restricted-support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: #0a1a3a;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.restricted-support-btn:hover {
  background: #132a55;
  transform: translateY(-1px);
  color: #fff;
}
.restricted-support-btn:focus-visible {
  outline: 2px solid #2f67b8;
  outline-offset: 3px;
}
.restricted-debug {
  margin: 18px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f3f6fb;
  color: #5a6d8c;
  font-size: 12px;
  font-family: var(--mono);
  word-break: break-all;
}
.restricted-footer {
  margin-top: 28px;
  color: #6b7c96;
  font-size: 13px;
}
.restricted-footer p {
  margin: 0 0 4px;
}
.restricted-footnote {
  font-size: 12px;
  color: #8a9ab2;
}
@media (max-width: 640px) {
  .restricted-card {
    padding: 28px 22px 24px;
  }
}

/* E-consent form */
.consent-page {
  --consent-bg: #0e1930;
  --consent-panel: #111c33;
  --consent-surface: #0b1426;
  --consent-border: #354866;
  --consent-text: #e8eef8;
  --consent-muted: #aab6ca;
  --consent-heading: #ffffff;
  --consent-accent: #59acf5;
}
.consent-page .consent-wrap { max-width: 860px; }
.consent-banner { margin-bottom: 24px; }
.consent-sheet {
  background: var(--consent-panel);
  color: var(--consent-text);
  border: 1px solid var(--consent-border);
  border-radius: 12px;
  padding: 28px 30px 32px;
  margin-bottom: 20px;
  line-height: 1.65;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
.consent-doc-title {
  margin: 0 0 22px;
  font-size: clamp(19px, 2.2vw, 24px);
  font-weight: 700;
  color: var(--consent-heading);
  line-height: 1.35;
}
.consent-heading {
  margin: 22px 0 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--consent-heading);
}
.consent-subheading {
  margin: 16px 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #c5d3e8;
}
.consent-paragraph {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--consent-text);
  overflow-wrap: break-word;
}
.consent-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--consent-border);
  border-radius: 8px;
  background: var(--consent-surface);
}
.consent-choice-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1 1 240px;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.45;
  color: var(--consent-text);
}
.consent-choice-item input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--consent-accent);
}
.consent-choice-item span {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
.consent-choice-full {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--consent-border);
  border-radius: 8px;
  background: var(--consent-surface);
  box-sizing: border-box;
}
.consent-choice-full span {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
.consent-input-line {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
  color: var(--consent-text);
}
.consent-input-label { font-weight: 600; color: #d5dce8; }
.consent-input-line input {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--consent-border);
  border-radius: 6px;
  background: var(--consent-surface);
  color: var(--consent-text);
  box-sizing: border-box;
}
.consent-input-line input:focus {
  border-color: var(--consent-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(89, 172, 245, 0.2);
}
.consent-appendix-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--consent-border);
  border-radius: 8px;
  background: var(--consent-surface);
}
.consent-appendix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.consent-appendix-table th,
.consent-appendix-table td {
  border-bottom: 1px solid var(--consent-border);
  padding: 10px 12px;
  vertical-align: top;
  text-align: left;
}
.consent-appendix-table th {
  background: #182744;
  color: #d5dce8;
  font-weight: 700;
}
.consent-appendix-table td:first-child {
  width: 34%;
  color: #c5d3e8;
  font-weight: 600;
}
.consent-appendix-table input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--consent-border);
  border-radius: 6px;
  background: #0e1930;
  color: var(--consent-text);
  box-sizing: border-box;
}
.consent-appendix-table input:focus {
  border-color: var(--consent-accent);
  outline: none;
}
.consent-signature-block { margin: 12px 0 16px; }
.consent-signature {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 140px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--consent-border);
  background: #ffffff;
  touch-action: none;
  cursor: crosshair;
  box-sizing: border-box;
}
.consent-clear-sig { margin-top: 8px; padding: 0; color: var(--consent-accent) !important; }
.consent-actions { margin-top: 8px; }
.consent-submit {
  width: 100%;
  max-width: 420px;
  justify-content: center;
  padding: 16px 26px;
  font-size: 17px;
  border-radius: 12px;
  background: #58a9ef;
}
@media (max-width: 760px) {
  .consent-sheet { padding: 20px 16px 24px; }
  .consent-input-line { grid-template-columns: 1fr; gap: 6px; }
  .consent-choice-row { gap: 8px 12px; }
}

/* Consent chooser modal */
.consent-choice-overlay { align-items: center; padding: 24px 16px; }
.consent-choice-modal { max-width: 720px; }
.consent-choice-body { padding: 20px 22px 24px; }
.consent-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.consent-choice-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px 20px;
  background: rgba(10, 19, 43, 0.45);
  text-align: center;
}
.consent-choice-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--text);
}
.consent-choice-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  min-height: 3.2em;
}
.consent-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
  padding: 10px;
  width: fit-content;
  border-radius: 12px;
  background: #fff;
}
.consent-qr-image {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: contain;
}
.consent-qr-url {
  margin: 0 0 8px;
  font-size: 11px;
  color: #8ec8ff;
  word-break: break-all;
}
.consent-choice-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.consent-choice-btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  padding: 14px 18px;
  font-size: 15px;
  border-radius: 10px;
}
@media (max-width: 700px) {
  .consent-choice-grid { grid-template-columns: 1fr; }
}
