:root {
  --bg: #f3faf6;
  --bg-soft: #eaf7ef;
  --surface: #ffffff;
  --surface-muted: #f7fbf8;
  --text: #112118;
  --muted: #607167;
  --line: #dbe9df;
  --line-strong: #bad9c2;
  --primary: #16823f;
  --primary-dark: #0a4f2b;
  --primary-soft: #dff4e6;
  --accent: #5fbf5b;
  --danger-bg: #fff0ef;
  --danger-border: #ef8a84;
  --danger-text: #c62828;
  --warning-bg: #fff7df;
  --warning-border: #f2b447;
  --warning-text: #a45a00;
  --low-bg: #fffbe8;
  --low-border: #e7cf52;
  --low-text: #745d00;
  --ok-bg: #e9f8ed;
  --ok-border: #8bd091;
  --ok-text: #12682d;
  --focus: #0f7a3a;
  --shadow-sm: 0 10px 24px rgba(22, 74, 43, 0.08);
  --shadow-md: 0 22px 54px rgba(22, 74, 43, 0.11);
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 74% 4%, rgba(121, 207, 119, 0.22), transparent 320px),
    linear-gradient(180deg, #fbfefd 0, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.25;
}

h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.3;
}

p {
  margin-top: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
}

.skip-link:focus {
  top: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 32px 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 14px 0 38px rgba(26, 74, 45, 0.07);
}

.brand,
.side-nav a,
.topbar,
.hero-actions,
.section-header,
.panel-heading,
.drug-item,
.topbar-actions,
.source-strip,
.source-logos,
.risk-legend {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  color: var(--primary-dark);
  font-size: 1.55rem;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-mark,
.shield-small,
.shield-hero {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(150deg, #36b55c, #0b6f37);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 13px 22px rgba(16, 108, 55, 0.22);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px 12px 16px 16px;
}

.side-nav {
  display: grid;
  gap: 12px;
}

.side-nav a {
  min-height: 54px;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: #24382d;
  font-weight: 750;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.side-nav a:hover,
.side-nav a.active {
  background: linear-gradient(90deg, #dff5e8, #f6fbf7);
  color: var(--primary-dark);
}

.side-nav a:hover {
  transform: translateX(2px);
}

.sidebar-card {
  margin-top: auto;
  min-height: 180px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 92% 88%, rgba(94, 191, 91, 0.36), transparent 74px),
    linear-gradient(145deg, #e4f7ea, #ffffff);
  box-shadow: var(--shadow-sm);
}

.sidebar-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--primary-dark);
  font-size: 1.08rem;
}

.sidebar-card p {
  margin: 0;
  color: #345442;
}

.page-shell {
  min-width: 0;
  padding: 30px min(4vw, 42px) 28px;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.topbar h1 {
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 0.84rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.pill,
.user-chip,
.status-badge,
.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}

.pill,
.user-chip {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--primary-dark);
  font-weight: 800;
}

.pill-soft {
  background: #f6fbf7;
}

.pill-ok {
  min-height: 34px;
  padding: 8px 12px;
  border-color: #a7dbac;
  background: #e5f6e8;
  color: var(--ok-text);
  font-size: 0.9rem;
}

.pill-warning {
  min-height: 34px;
  padding: 8px 12px;
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 0.9rem;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  align-items: center;
  min-height: 250px;
  margin-bottom: 24px;
  padding: 34px 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 76% 42%, rgba(106, 197, 104, 0.24), transparent 260px),
    linear-gradient(135deg, #f5fbf6, #e6f4ea);
  box-shadow: var(--shadow-md);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-copy h2 {
  max-width: 680px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.15rem);
  color: var(--primary-dark);
}

.hero-copy p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}

.hero-visual {
  position: relative;
  min-height: 210px;
}

.shield-small {
  width: 42px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 16px 16px 20px 20px;
}

.shield-hero {
  position: absolute;
  right: 58px;
  bottom: 18px;
  width: 150px;
  height: 174px;
  border-radius: 42px 42px 58px 58px;
  font-size: 4.5rem;
}

.pill-capsule,
.tablet,
.leaf {
  position: absolute;
  background: #fff;
  box-shadow: 0 12px 24px rgba(31, 95, 53, 0.16);
}

.pill-capsule {
  right: 26px;
  bottom: 20px;
  width: 110px;
  height: 38px;
  border-radius: 999px;
  transform: rotate(-48deg);
  background: linear-gradient(90deg, #fff 0 50%, #32a650 50% 100%);
}

.tablet {
  width: 62px;
  height: 26px;
  border-radius: 999px;
}

.tablet-a {
  right: 164px;
  bottom: 8px;
  transform: rotate(12deg);
}

.tablet-b {
  right: 122px;
  bottom: -2px;
  transform: rotate(6deg);
}

.leaf {
  width: 82px;
  height: 34px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #bce7c7, #70bd78);
  opacity: 0.78;
}

.leaf-a {
  right: 216px;
  bottom: 84px;
  transform: rotate(28deg);
}

.leaf-b {
  right: 206px;
  bottom: 122px;
  transform: rotate(58deg);
}

.main-content {
  min-width: 0;
}

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

.left-column,
.right-column {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
}

.upload-panel,
.selected-list,
.result-panel,
.process-panel,
.source-strip {
  padding: 22px;
}

.upload-zone {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: 22px;
  border: 2px dashed #62bf75;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fbfffc, #effaf2);
}

.upload-icon {
  width: 58px;
  height: 58px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(150deg, #2ab451, #0d7138);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(16, 108, 55, 0.18);
}

.upload-zone p,
.panel-heading p,
.section-heading p,
.help-text,
.source,
.process-panel p,
.source-strip p {
  color: var(--muted);
}

.search-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-weight: 800;
}

.search-row {
  display: flex;
}

.search-row input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(22, 74, 43, 0.04);
}

.search-row input::placeholder {
  color: #809286;
}

.search-row input:focus-visible {
  border-color: var(--focus);
}

.help-text {
  margin: 10px 0 0;
  font-size: 0.94rem;
}

.support-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: #314d3b;
  font-weight: 650;
}

.support-list li::before {
  content: "✓";
  margin-right: 8px;
  color: var(--primary);
  font-weight: 900;
}

.autocomplete-wrapper {
  position: relative;
}

.autocomplete {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.autocomplete-item {
  margin: 0;
}

.autocomplete-item button {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.autocomplete-item button:hover {
  border-color: var(--primary);
  background: #eff9f2;
  transform: translateY(-1px);
}

.autocomplete-item span,
.drug-item span {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
}

.autocomplete-empty,
.empty-state {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
}

.autocomplete-loading {
  border-style: solid;
  background: #f0f8f3;
  color: var(--primary-dark);
}

.empty-state {
  margin-bottom: 0;
}

.section-header,
.panel-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2,
.panel-heading h2,
.results h2 {
  margin-bottom: 4px;
}

.section-heading p,
.panel-heading p {
  margin: 0;
}

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

.drug-item {
  gap: 14px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfdfb);
}

.drug-item > div {
  min-width: 0;
  flex: 1;
}

.drug-item strong {
  color: var(--text);
}

.medicine-thumb {
  flex: 0 0 auto;
  width: 58px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #edf5ff, #fff);
  color: #1d4f88;
  border: 1px solid #dbe5ee;
}

.status-badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 0.84rem;
  font-weight: 850;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--primary-dark);
  font-size: 1.2rem;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 850;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(180deg, #1b9a49, #087035);
  color: #fff;
  box-shadow: 0 12px 22px rgba(16, 108, 55, 0.22);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #188b42, #064d29);
}

.htmx-indicator {
  display: none;
  margin-left: 10px;
  color: var(--primary-dark);
  font-weight: 800;
}

.htmx-indicator.htmx-request,
.htmx-request .htmx-indicator {
  display: inline-flex;
}

.htmx-request button[type="submit"] {
  opacity: 0.72;
  pointer-events: none;
}

.button-secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--primary-dark);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

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

.check-action-panel form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.validation-hint {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  color: var(--warning-text);
  font-weight: 750;
}

.run-status-panel {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #84adff;
  border-radius: var(--radius);
  background: #eef4ff;
  color: #1d4f88;
}

.run-status-panel h3,
.run-status-panel p {
  margin: 0;
}

.run-status-panel--error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.run-status-error {
  padding-top: 8px;
  border-top: 1px solid currentColor;
  font-weight: 750;
}

.button-compact {
  min-height: 42px;
  padding: 9px 14px;
}

.logout-form {
  margin: 0;
}

.message {
  padding: 12px 14px;
  border: 1px solid var(--ok-border);
  border-radius: var(--radius);
  background: var(--ok-bg);
  color: var(--ok-text);
  box-shadow: var(--shadow-sm);
}

.message-warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.result-meter {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 8px 0 22px;
  text-align: center;
}

.risk-ring {
  width: 138px;
  height: 138px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 48%, transparent 49%),
    conic-gradient(#5fc55e 0 58%, #f0c419 58% 76%, #f36c62 76% 100%);
  box-shadow: inset 0 0 0 12px #edf7ef, var(--shadow-sm);
}

.risk-ring .shield-small {
  margin: 0;
}

.summary {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary p:last-child,
.result-card p:last-child {
  margin-bottom: 0;
}

.summary-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  font-weight: 900;
}

.summary-neutral {
  border-color: var(--line-strong);
  background: #edf5f0;
  color: #244435;
}

.summary-none {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
}

.summary-error,
.high {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.medium {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.low {
  border-color: var(--low-border);
  background: var(--low-bg);
  color: var(--low-text);
}

.result-cards {
  display: grid;
  gap: 14px;
}

.agent-result {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.agent-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.agent-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.agent-items {
  display: grid;
  gap: 12px;
}

.result-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: #fff;
}

.agent-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.agent-item--contraindicated,
.agent-item--major {
  border-left-color: var(--danger-text);
}

.agent-item--moderate {
  border-left-color: var(--warning-text);
}

.agent-item--pending {
  border-left-color: var(--warning-text);
  background: var(--warning-bg);
}

.agent-item--minor {
  border-left-color: var(--low-text);
}

.agent-item--none {
  border-left-color: var(--ok-text);
}

.result-card h3 {
  color: var(--text);
}

.severity-critical,
.severity-high {
  border-left-color: var(--danger-text);
}

.severity-medium {
  border-left-color: var(--warning-text);
}

.severity-low {
  border-left-color: var(--low-text);
}

.severity-badge {
  margin-bottom: 12px;
  padding: 6px 11px;
  border: 1px solid currentColor;
  font-weight: 850;
}

.severity-critical .severity-badge,
.severity-high .severity-badge,
.severity-badge.severity-critical,
.severity-badge.severity-high {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.severity-medium .severity-badge,
.severity-badge.severity-medium {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.severity-low .severity-badge,
.severity-badge.severity-low {
  background: var(--low-bg);
  color: var(--low-text);
}

.severity-badge.summary-none {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.agent-item--contraindicated .severity-badge,
.agent-item--major .severity-badge {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.agent-item--moderate .severity-badge {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.agent-item--pending .severity-badge {
  background: #fff;
  color: var(--warning-text);
}

.agent-item--minor .severity-badge {
  background: var(--low-bg);
  color: var(--low-text);
}

.agent-item--none .severity-badge {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.risk-legend {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin: 18px 0;
}

.risk-legend span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #2b4134;
  font-weight: 700;
}

.history-panel,
.analysis-detail-panel,
.findings-panel {
  padding: 22px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

.history-table th {
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 850;
  text-transform: uppercase;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
  width: 34%;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  width: 18%;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 34%;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
  width: 14%;
}

.history-table td {
  overflow-wrap: anywhere;
}

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

.history-table .severity-badge,
.analysis-summary .severity-badge {
  margin-bottom: 0;
  white-space: normal;
}

.history-empty p {
  margin: 4px 0 0;
}

.detail-layout {
  display: grid;
  gap: 18px;
}

.back-link {
  color: var(--primary-dark);
  font-weight: 850;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

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

.analysis-summary div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.analysis-summary dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: uppercase;
}

.analysis-summary dd {
  margin: 0;
  color: var(--text);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.finding-evidence {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.finding-evidence h4 {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.finding-evidence ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.finding-evidence li {
  overflow-wrap: anywhere;
}

.dot {
  width: 11px;
  height: 11px;
  display: inline-block;
  border-radius: 50%;
  margin-right: auto;
}

.dot-high {
  background: #ef5350;
}

.dot-medium {
  background: #f5a400;
}

.dot-low {
  background: #f1c40f;
}

.dot-ok {
  background: #45bd55;
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.process-steps li {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  color: #2d4b39;
  font-size: 0.9rem;
  font-weight: 700;
}

.process-steps span {
  width: 50px;
  height: 50px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.25rem;
}

.source-strip {
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.source-strip p {
  margin: 0;
}

.source-logos {
  flex-wrap: wrap;
  gap: 14px;
}

.source-logos span {
  padding: 8px 14px;
  border-radius: 999px;
  background: #f4f8f6;
  color: #174a2a;
  font-weight: 900;
}

.disclaimer {
  padding: 18px 22px;
  border: 1px solid #c9e8cf;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 94% 80%, rgba(95, 191, 91, 0.2), transparent 110px),
    linear-gradient(135deg, #eef9f1, #ffffff);
  color: #244b32;
}

.site-footer {
  padding: 24px 0 10px;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 18%, rgba(95, 191, 91, 0.26), transparent 300px),
    linear-gradient(135deg, #fbfefd 0, #e8f6ed 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 500px) minmax(280px, 1fr);
  align-items: stretch;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  padding: clamp(28px, 6vw, 64px);
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 18px 0 42px rgba(26, 74, 45, 0.08);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--primary-dark);
  font-size: 1.6rem;
  font-weight: 850;
}

.login-copy h1 {
  color: var(--primary-dark);
}

.login-copy p:not(.eyebrow),
.login-note p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 18px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field label {
  color: var(--primary-dark);
  font-weight: 800;
}

.form-field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.form-field input:focus-visible {
  border-color: var(--focus);
}

.field-error {
  margin: 0;
  color: var(--danger-text);
  font-weight: 700;
}

.login-aside {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: end;
  min-height: 100%;
  padding: clamp(28px, 6vw, 72px);
  background:
    radial-gradient(circle at 72% 38%, rgba(95, 191, 91, 0.28), transparent 260px),
    linear-gradient(145deg, #e4f7ea, #ffffff);
}

.login-aside .shield-hero {
  right: clamp(48px, 12vw, 170px);
  bottom: clamp(170px, 28vw, 280px);
}

.login-note {
  max-width: 420px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
}

.login-note h2 {
  color: var(--primary-dark);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 16px;
  }

  .flow-grid,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 180px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

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

  .sidebar-card {
    min-height: auto;
  }

  .page-shell {
    padding: 22px 14px;
  }

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

  .topbar-actions {
    flex-wrap: wrap;
  }

  .hero-panel {
    padding: 24px;
  }

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

  .support-list,
  .process-steps {
    grid-template-columns: 1fr;
  }

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

  .drug-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

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

  .login-panel {
    min-height: auto;
    border-right: 0;
  }

  .login-aside {
    min-height: 260px;
  }

  .login-aside .shield-hero {
    right: 44px;
    bottom: 42px;
  }
}

@media (max-width: 520px) {
  .side-nav {
    grid-template-columns: 1fr;
  }

  .hero-actions .button,
  .button-primary,
  .check-action-panel form {
    width: 100%;
  }

  .hero-visual {
    min-height: 150px;
  }

  .table-scroll {
    overflow-x: visible;
  }

  .history-table,
  .history-table thead,
  .history-table tbody,
  .history-table tr,
  .history-table th,
  .history-table td {
    display: block;
  }

  .history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .history-table tr {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
  }

  .history-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .history-table td {
    width: 100% !important;
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 12px;
    padding: 0;
    border-bottom: 0;
  }

  .history-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 850;
  }

  .shield-hero {
    right: 36px;
    width: 112px;
    height: 132px;
    font-size: 3.3rem;
  }

  .pill-capsule {
    right: 12px;
  }

  .login-panel,
  .login-aside {
    padding: 22px 16px;
  }

  .login-aside .shield-hero {
    width: 96px;
    height: 114px;
    font-size: 2.9rem;
  }
}
