:root {
  --lungdb-navy: #17324d;
  --lungdb-blue: #2364a8;
  --lungdb-bg: #f4f7fa;
  --lungdb-border: #dce3ea;
  --lungdb-muted: #657483;
}

html, body { min-height: 100%; }
body {
  background: var(--lungdb-bg);
  color: #263746;
  font-size: .9rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

.app-navbar { background: var(--lungdb-navy); box-shadow: 0 1px 6px rgba(16, 41, 64, .2); }
.navbar-brand { font-weight: 700; letter-spacing: .02em; }
.navbar .nav-link { font-size: .86rem; font-weight: 600; }
.page-heading { border-left: 4px solid var(--lungdb-blue); padding-left: .75rem; }

.card { border-color: var(--lungdb-border); box-shadow: 0 1px 3px rgba(20, 43, 66, .045); }
.card-header { font-size: .84rem; font-weight: 650; border-bottom-color: var(--lungdb-border); }
.stat-card { border: 0; box-shadow: 0 2px 8px rgba(20, 43, 66, .075); }
.stat-value { color: var(--lungdb-navy); font-size: 1.65rem; font-weight: 750; line-height: 1; }
.stat-label { color: var(--lungdb-muted); font-size: .72rem; font-weight: 650; letter-spacing: .04em; margin-top: .35rem; text-transform: uppercase; }
.stat-icon { font-size: 1.7rem; opacity: .75; }
.study-count-row { align-items: center; border-bottom: 1px solid #edf1f5; color: inherit; display: flex; justify-content: space-between; padding: .55rem 0; text-decoration: none; }
.study-count-row:last-child { border-bottom: 0; }

.form-label-sm { color: #5d6b78; font-size: .72rem; font-weight: 650; margin-bottom: .12rem; }
.form-control-sm, .form-select-sm { font-size: .8rem; min-height: 31px; }
.form-control:focus, .form-select:focus { border-color: #77a8d6; box-shadow: 0 0 0 .15rem rgba(35, 100, 168, .14); }
.dynamic-row:last-child { border-bottom: 0 !important; }
.dynamic-row:hover { background: rgba(235, 243, 250, .45); }
.sticky-save { bottom: 1rem; display: flex; justify-content: flex-end; position: sticky; z-index: 20; }
.sticky-save .btn { box-shadow: 0 3px 12px rgba(13, 110, 253, .25); }

.table { --bs-table-bg: #fff; }
.table th { font-size: .71rem; font-weight: 650; letter-spacing: .015em; white-space: nowrap; }
.table td { font-size: .81rem; }
.patient-table .badge { margin: 1px; }
.table-danger { --bs-table-bg: #fce4e6; --bs-table-hover-bg: #f8dadd; }
.badge { font-weight: 600; }
.nav-pills .nav-link { font-size: .8rem; font-weight: 650; }
.nav-pills .nav-link.active { background: var(--lungdb-navy); }

.detail-tile { background: #fff; border: 1px solid var(--lungdb-border); border-radius: .4rem; padding: .55rem .7rem; }
.detail-tile span { color: var(--lungdb-muted); display: block; font-size: .68rem; font-weight: 650; }
.detail-tile strong { display: block; font-size: .9rem; margin-top: .1rem; overflow-wrap: anywhere; }

.assessment-card .card-body { background: #fbfdff; }
.sum-field { background: #e8f4fd !important; color: #0b64ae; font-weight: 750; }
.baseline-change, .nadir-change { font-weight: 700; text-align: right; }
.recist-response { color: #198754 !important; background: #e9f7ef !important; }
.recist-progression { color: #c7353e !important; background: #fce9eb !important; }

.study-card { color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.study-card:hover { box-shadow: 0 5px 16px rgba(20, 43, 66, .12); transform: translateY(-1px); }
.study-patient-count { align-items: center; background: #e8f1fb; border-radius: 999px; color: var(--lungdb-blue); display: inline-flex; font-size: .78rem; font-weight: 700; height: 2rem; justify-content: center; min-width: 2rem; }
.study-view-table td, .study-view-table th { white-space: nowrap; }

.match-card { border-left-width: 4px; }
.match-candidate { border-left-color: #198754; }
.match-review { border-left-color: #e4a11b; }
.match-ineligible { border-left-color: #8b98a5; opacity: .82; }
.match-score { color: var(--lungdb-muted); font-size: .72rem; margin-top: .2rem; }
.match-dimension-match { background: #d1e7dd; color: #0a5336; }
.match-dimension-mismatch { background: #e2e5e8; color: #46515c; }
.match-dimension-unknown { background: #fff0c2; color: #6e5300; }

.login-shell { align-items: center; display: flex; justify-content: center; min-height: calc(100vh - 3rem); }
.login-card { max-width: 390px; width: 100%; }
.login-mark { align-items: center; background: #e8f1fb; border-radius: .75rem; color: var(--lungdb-blue); display: flex; font-size: 1.6rem; height: 3rem; justify-content: center; width: 3rem; }
.empty-state { color: var(--lungdb-muted); padding: 2.5rem 1rem; text-align: center; }

@media (max-width: 767.98px) {
  body { font-size: .86rem; }
  main.container-fluid { padding-left: .65rem !important; padding-right: .65rem !important; }
  .sticky-save { bottom: .5rem; }
  .patient-table { min-width: 960px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
