:root {
  --ink: #1d1d1f;
  --muted: #4a5562;
  --line: #d5dde6;
  --blue: #0071e3;
  --blue-deep: #005bb8;
  --paper: #fff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: Outfit, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef4fa 0%, #f5f7fb 220px, #f3f5f8 100%);
  font-size: 17px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::placeholder { color: #8b95a1; }
h1, h2, p { margin: 0; }
.ico { width: 18px; height: 18px; flex: none; }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92) 0%, rgba(236, 245, 252, 0.94) 48%, rgba(232, 246, 246, 0.94) 100%);
  border-bottom: 1px solid #d7e3ee;
  backdrop-filter: blur(16px);
}
.bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #2f6fed 0%, #7a4fd0 48%, #e11d48 100%);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
a.brand { cursor: pointer; }
a.brand:hover strong { color: var(--blue); }
.logo {
  height: 44px;
  width: 44px;
  display: block;
  flex: none;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(47, 111, 237, 0.14);
}
.brand > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #16324a;
}
.brand em { font-style: normal; color: #5c6b7a; font-size: 14px; font-weight: 500; white-space: nowrap; }

.bar nav {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(22, 50, 74, 0.06);
}
.bar nav button, .text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #3d4b5c;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.bar nav button:hover, .text-btn:hover { background: rgba(255, 255, 255, 0.7); color: #16324a; }
.bar nav button[aria-current="page"] {
  background: #fff;
  color: var(--blue-deep);
  box-shadow: 0 1px 2px rgba(22, 50, 74, 0.12), 0 0 0 1px rgba(22, 50, 74, 0.05);
}
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #5c6b7a; font-size: 16px; }
.bar .text-btn { color: #3d4b5c; }

.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 28px 64px; }
.head { margin-bottom: 16px; }
.head h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.head p { margin-top: 4px; color: var(--muted); }

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #e8f2fc;
  color: #0f3d66;
}

.card {
  background: var(--paper);
  border: 1px solid #e3eaf2;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(22, 50, 74, 0.04), 0 8px 24px rgba(22, 50, 74, 0.04);
}
.stack { display: grid; gap: 16px; }
.protocol {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  background: linear-gradient(90deg, #e7f1ff 0%, #fff1f3 100%);
  border: 1px solid #d5e3f6;
}
.protocol span { font-size: 13px; font-weight: 600; color: #16324a; }
.protocol strong { font-size: 15px; letter-spacing: 0.02em; color: #0b4fa8; }
.panel { border-radius: 12px; padding: 16px; background: #f7f9fc; border: 1px solid #e6edf5; }
.panel.sage { margin-top: 12px; }
.reg-screen {
  max-width: 1240px;
  height: calc(100vh - 64px);
  padding: 16px 24px 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.reg-head { margin-bottom: 10px; }
.reg-head h1 { font-size: 26px; }
.reg-head p { margin-top: 2px; }
.reg-form {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.reg-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.reg-split .panel {
  margin: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}
.reg-split .panel.rose {
  background: linear-gradient(180deg, #f4f8ff 0%, #fff 42%);
  border-color: #d5e4f7;
}
.reg-split .panel.sage {
  background: linear-gradient(180deg, #fff6f7 0%, #fff 42%);
  border-color: #f3d5dc;
}
.reg-split .protocol { margin-bottom: 8px; }
.reg-split .fields, .reg-split .quads { gap: 8px 10px; }
.reg-split .quads { margin-top: 8px; }
.reg-extra { margin-top: 8px; }
.reg-split .field { gap: 4px; }
.reg-split .field > span { font-size: 14px; }
.reg-split input, .reg-split select, .reg-split textarea, .reg-split .tr-date-btn { padding: 7px 10px; }
.reg-note { min-height: 52px; }
.reg-form .actions { margin-top: 8px; }
.panel h2, .group, .card > h2, .list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: #16324a;
}
.panel h2, .list-title { margin-bottom: 12px; }
.group {
  margin: 18px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#exam-form .group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.quads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
.vitals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-width: 760px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.tr-date { position: relative; display: block; }
.tr-date-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #c5d0dc;
  background: #fff;
  border-radius: 8px;
  padding: 9px 11px;
  color: inherit;
  font: inherit;
}
.tr-date-btn:focus {
  outline: none;
  border-color: #7eb6f0;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.16);
}
.age-live {
  margin-left: 8px;
  color: #5c6b7a;
  font-weight: 500;
  font-style: normal;
}
.tr-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: 280px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e3eaf2;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(22, 50, 74, 0.16);
}
.tr-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tr-pop-head strong { font-size: 16px; }
.tr-pop-head button, .tr-pop-grid button, .tr-months button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: inherit;
}
.tr-pop-head button { width: 28px; height: 28px; }
.tr-pop-head button:hover, .tr-pop-grid button:hover, .tr-months button:hover { background: #eef5ff; }
.tr-pop-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.tr-pop-grid button { padding: 6px 0; }
.tr-pop-grid button.is-on, .tr-months button.is-on { background: #0071e3; color: #fff; }
.tr-pop-grid button:disabled, .tr-months button:disabled { color: #c5d0dc; }
.tr-dow { font-size: 13px; font-weight: 700; color: #6b7c90; padding: 4px 0; }
.tr-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tr-months button { padding: 8px 4px; }
.field > span { font-size: 15px; color: #243140; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c5d0dc;
  background: #fff;
  border-radius: 8px;
  padding: 9px 11px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
textarea.mid { min-height: 88px; }
textarea.tall { min-height: 148px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #7eb6f0;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.16);
}
[aria-invalid="true"], .tr-date:has([aria-invalid="true"]) .tr-date-btn { border-color: #ff3b30; }
.field small { color: #d70015; font-size: 14px; }
.field small:empty { display: none; }
.hint { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.btn, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 550;
  letter-spacing: -0.01em;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.12s var(--ease);
}
.btn:active, .btn-danger:active { transform: scale(0.98); }
.btn-primary {
  color: #fff;
  border: 1px solid #0066cc;
  background: linear-gradient(180deg, #4c9aff 0%, #0071e3 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 70, 150, 0.25);
}
.btn-primary:hover { background: linear-gradient(180deg, #63a8ff 0%, #0077ed 100%); }
.btn-line {
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  background: linear-gradient(180deg, #fff 0%, #f5f5f7 100%);
  box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(0, 0, 0, 0.04);
}
.btn-line:hover { background: linear-gradient(180deg, #fff 0%, #ececef 100%); }

.exam-wrap {
  max-width: none;
  height: calc(100vh - 64px);
  padding: 10px 14px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.exam-wrap .notice { margin-bottom: 8px; padding: 8px 10px; }
.exam-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  gap: 10px;
  align-items: stretch;
}
.list-card, .history-card, .exam-card {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 12px;
}
.list-card, .exam-card { background: #fff; }
#exam-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.who {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.who-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.who-name-card {
  padding: 10px 12px 10px 14px;
  border-radius: 14px;
  border: 1px solid #d7e3ee;
  background: linear-gradient(105deg, #f4f8ff 0%, #fff 42%, #f7fafc 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  position: relative;
  overflow: hidden;
}
.who-name-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #2f6fed 0%, #7a4fd0 100%);
}
.who-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.who-name > span {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b7c90;
}
.who-name h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #122433;
}
.who-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}
.who-split .exam-panel,
.who-split .exam-panel.notes-panel {
  height: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, #f3f6f9 0%, #fff 70%);
  border-color: #d7dee6;
}
.who-split .exam-panel h2 {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c6b7a;
}
.who-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
}
.who-meta > div {
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #d5dde6;
  background: linear-gradient(180deg, #eef3f8 0%, #f8fafc 100%);
  box-shadow: none;
}
.who-meta > div.calm,
.who-meta > div.warn,
.who-meta > div.hot {
  background: linear-gradient(180deg, #eef3f8 0%, #f8fafc 100%);
  border-color: #d5dde6;
}
.who-meta dt {
  display: block;
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  color: #6b7c90;
  white-space: nowrap;
}
.who-meta dd {
  margin: 1px 0 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  color: #142433;
  white-space: nowrap;
}
.who-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.who-tags em {
  font-style: normal;
  font-size: 13px;
  font-weight: 650;
  border-radius: 999px;
  padding: 3px 8px;
}
.who-tags em.calm { background: #eef8f1; color: #0f6b3c; }
.who-tags em.warn { background: #fff4e0; color: #8a5a00; }
.who-tags em.hot { background: #ffe8e6; color: #b00020; }
.who { position: relative; }
.who.is-risk::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: -6px;
  border-radius: 16px;
  border: 2px solid #e0a100;
  animation: riskScreen 2.8s ease-in-out infinite;
}
.who.is-risk-high::after {
  border-color: #e11d48;
  box-shadow: 0 0 24px rgba(225, 29, 72, 0.28);
  animation-duration: 0.9s;
}
.who-tags em.pulse,
.who-meta > div.pulse {
  animation: riskBlink 2.6s ease-in-out infinite;
}
.who-tags em.pulse.hot,
.who-meta > div.pulse.hot {
  animation: riskBlinkHot 0.85s ease-in-out infinite;
}
@keyframes riskBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes riskBlinkHot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.45); }
  50% { opacity: 0.4; box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
}
@keyframes riskScreen {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.95; }
}
.exam-panel {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f4f8ff 0%, #fff 48%);
  border: 1px solid #d5e4f7;
}
.exam-panel.notes-panel {
  background: linear-gradient(180deg, #fff6f7 0%, #fff 48%);
  border-color: #f3d5dc;
}
.exam-panel h2 { margin: 0 0 10px; font-size: 16px; }
.exam-card .fields, .exam-card .notes { gap: 10px 12px; }
.exam-card .vitals { gap: 10px 12px; margin-top: 10px; max-width: none; }
.exam-card .field { gap: 5px; }
.exam-card .field > span { font-size: 14px; color: #5c6b7a; font-weight: 600; }
.exam-card input, .exam-card select, .exam-card textarea, .exam-card .tr-date-btn { padding: 8px 10px; }
.exam-card textarea { min-height: 56px; height: 56px; resize: vertical; }
.exam-card .chips { margin-top: 2px; }
.exam-card .chip { padding: 3px 8px; }
.exam-card .hint { min-height: 16px; margin: 8px 0 0; font-size: 14px; }
.exam-card .actions { margin-top: 2px; }
.search-wrap { position: relative; display: block; margin: 4px 0 8px; }
.search-wrap .ico { position: absolute; left: 12px; top: 50%; color: #6b7c90; transform: translateY(-50%); }
.search { width: 100%; margin: 0; padding-left: 36px; }
.person {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px 8px;
  transition: background 0.16s var(--ease);
}
.person:hover { background: #f3f7fb; }
.person.is-on { background: #eaf3fc; box-shadow: inset 2px 0 0 var(--blue); }
.person-top { display: flex; justify-content: space-between; gap: 8px; }
.person strong { font-weight: 600; }
.person-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.person-no {
  font-weight: 650;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #3d6ea8;
  background: #eaf3fc;
  border-radius: 999px;
  padding: 2px 7px;
}
.person em {
  font-style: normal;
  font-size: 13px;
  font-weight: 650;
  border-radius: 999px;
  padding: 2px 7px;
}
.person em.today { background: #d8f5e4; color: #0f6b3c; }
.person em.late { background: #ffe1e4; color: #b00020; }
.person em.soon { background: #e8edf3; color: #243140; }
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 3px #ffe8e6;
}
.person small { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); font-size: 16px; }
.empty { color: var(--muted); padding: 8px; }

.identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.identity h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; color: #142433; }
.facts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  margin-top: 2px;
  min-width: 0;
}
.fact {
  display: flex;
  flex: 1 1 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  background: #fff;
  border: 1px solid #e6edf5;
  border-radius: 10px;
  padding: 7px 10px;
  box-shadow: 0 1px 2px rgba(22, 50, 74, 0.04);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: cardIn 0.46s var(--ease) both;
}
.fact:hover {
  border-color: #b9d4f5;
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.1);
}
.fact-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  color: #0b63c9;
  background: #eef5ff;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.fact:hover .fact-ico { color: #fff; background: #0071e3; }
.fact-ico .ico { width: 15px; height: 15px; }
.fact > span { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: max-content; }
.facts .fact:nth-child(2) { animation-delay: 0.04s; }
.facts .fact:nth-child(3) { animation-delay: 0.08s; }
.facts .fact:nth-child(4) { animation-delay: 0.12s; }
.facts .fact:nth-child(5) { animation-delay: 0.16s; }
.facts .fact:nth-child(6) { animation-delay: 0.2s; }
.facts .fact:nth-child(7) { animation-delay: 0.24s; }
.facts .fact:nth-child(8) { animation-delay: 0.28s; }
.facts .fact:nth-child(9) { animation-delay: 0.32s; }
.facts .fact:nth-child(10) { animation-delay: 0.36s; }
.facts .fact:nth-child(11) { animation-delay: 0.4s; }
.fact small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7c90;
  white-space: nowrap;
}
.fact strong { font-size: 15px; font-weight: 650; color: #142433; white-space: nowrap; }
.alerts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
}
.alert {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border-radius: 10px;
  padding: 8px 12px 8px 14px;
  border: 1px solid transparent;
  box-shadow: none;
  transition: box-shadow 0.2s var(--ease);
  animation: cardIn 0.5s var(--ease) both;
}
.alert::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}
.alerts .alert:nth-child(2) { animation-delay: 0.08s; }
.alerts .alert:nth-child(3) { animation-delay: 0.16s; }
.alert:hover { box-shadow: 0 6px 16px rgba(22, 50, 74, 0.08); }
.alert span { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.alert strong { display: block; margin-top: 2px; font-size: 17px; line-height: 1.2; }
.alert.hot {
  background: linear-gradient(180deg, #fff 0%, #fff5f5 100%);
  color: #b00020;
  border-color: #ffd0cc;
}
.alert.hot::before { background: #e11d48; }
.alert.hot:hover { box-shadow: 0 14px 28px rgba(225, 29, 72, 0.16); }
.alert.warn {
  background: linear-gradient(180deg, #fff 0%, #fff9ee 100%);
  color: #8a5a00;
  border-color: #f6e2b3;
}
.alert.warn::before { background: #e0a100; }
.alert.warn:hover { box-shadow: 0 14px 28px rgba(224, 161, 0, 0.18); }
.alert.calm {
  background: linear-gradient(180deg, #fff 0%, #f3fbf6 100%);
  color: #0f6b3c;
  border-color: #c9ecd6;
}
.alert.calm::before { background: #1f9d55; }
.alert.calm:hover { box-shadow: 0 14px 28px rgba(31, 157, 85, 0.14); }
@keyframes cardIn {
  from { opacity: 0; translate: 0 10px; }
  to { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fact, .alert { animation: none; }
  .fact:hover, .alert:hover { transform: none; }
}
.who-actions { display: flex; gap: 8px; align-items: center; }
.btn-danger {
  color: #fff;
  border: 1px solid #e0352b;
  background: linear-gradient(180deg, #ff6961 0%, #ff3b30 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(180, 30, 20, 0.2);
}
.btn-danger:hover { background: linear-gradient(180deg, #ff7a72 0%, #ff453a 100%); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid #d2d2d7;
  background: linear-gradient(180deg, #fff 0%, #f5f5f7 100%);
  color: #1d1d1f;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 14px;
  font-weight: 550;
  box-shadow: inset 0 1px 0 #fff;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.chip:hover { border-color: #7eb6f0; background: #f5f9ff; }
.notes { margin-top: 8px; }
.past {
  padding: 10px 8px 10px 12px;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.past:hover { background: #f4f8fd; }
.past.selected {
  background: #e7f1ff;
  box-shadow: inset 4px 0 0 #0071e3;
}
.past.selected .past-title { color: #0b4fa8; }
.past header { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.past-title { margin-top: 4px; font-weight: 700; color: #142433; }
.past p { margin-top: 6px; font-size: 16px; color: #1d1d1f; line-height: 1.4; }
.past-meta { color: var(--muted); font-size: 14px; }
.history-card > h2 { margin-bottom: 8px; color: #16324a; }
.file-filter { display: grid; gap: 8px; margin-bottom: 8px; }
.file-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.file-presets button {
  border: 1px solid #d2d2d7;
  background: linear-gradient(180deg, #fff 0%, #f5f5f7 100%);
  color: #1d1d1f;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 550;
}
.file-presets button[aria-pressed="true"] {
  background: #eaf3fc;
  border-color: #7eb6f0;
  color: #005bb8;
}
.file-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.file-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; color: #243140; }
.file-dates input { padding: 6px 8px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--line);
}
td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td span { display: block; color: var(--muted); margin-top: 2px; }

.login-wrap { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-theme { position: absolute; top: 18px; right: 22px; }
.login-card { width: min(440px, 100%); }
.login-card h1 { margin-top: 8px; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.login-lead { margin: 6px 0 16px; color: var(--muted); }
.login-card .fields { grid-template-columns: 1fr; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 40, 60, 0.35);
}
.modal-card { width: min(420px, 100%); }
.admin-menu {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(22, 50, 74, 0.06);
  overflow-x: auto;
}
.admin-menu button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  border: 0;
  background: transparent;
  color: #3d4b5c;
  border-radius: 9px;
  padding: 8px 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.admin-menu button:hover { background: rgba(255, 255, 255, 0.7); color: #16324a; }
.admin-menu button[aria-current="page"] {
  background: #fff;
  color: var(--blue-deep);
  box-shadow: 0 1px 2px rgba(22, 50, 74, 0.12), 0 0 0 1px rgba(22, 50, 74, 0.05);
}
.admin-list { display: grid; gap: 8px; margin-top: 14px; }
.line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.line small { display: block; color: var(--muted); font-size: 14px; font-weight: 500; }
.fee-line small { white-space: normal; line-height: 1.45; }
.card > h2 { margin-bottom: 12px; }
.fee-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.fee-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
}
.fee-pick input { width: auto; }
.fee-pick strong { color: #0b4fa8; font-size: 15px; }
.fee-pick:has(input:checked) { border-color: #0071e3; background: #e7f1ff; }
.report-wrap { max-width: none; }
.report-stack { display: grid; gap: 14px; }
.report-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.period-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(22, 50, 74, 0.06);
}
.period-switch button {
  border: 0;
  background: transparent;
  color: #3d4b5c;
  border-radius: 9px;
  padding: 8px 16px;
  font-weight: 600;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.period-switch button:hover { color: #16324a; }
.period-switch button[aria-pressed="true"] {
  background: #fff;
  color: var(--blue-deep);
  box-shadow: 0 1px 2px rgba(22, 50, 74, 0.12), 0 0 0 1px rgba(22, 50, 74, 0.05);
}
.period-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 4px 4px 4px 14px;
  border-radius: 12px;
  background: #f4f8ff;
  border: 1px solid #d5e4f7;
}
.period-field > span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c6b7a;
}
.period-field .tr-date { width: 148px; }
.period-field .tr-date-btn,
.period-field input {
  width: 148px;
  border: 0;
  background: #fff;
  border-radius: 9px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(22, 50, 74, 0.06);
}
.report-tools h2 { margin-right: auto; }
.report-block > h2 { margin-bottom: 12px; }
.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.report-head h2 { margin: 0; }
.report-head .no-print { display: flex; gap: 8px; flex: none; }
.report-sub { margin: 16px 0 10px; font-size: 17px; font-weight: 600; color: #16324a; }
.print-fees .stats { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.pay-report { width: 100%; margin: 0; }
.pay-report th, .pay-report td {
  text-align: right;
  white-space: nowrap;
  padding: 11px 18px 11px 0;
  font-variant-numeric: tabular-nums;
}
.pay-report th:first-child, .pay-report td:first-child { text-align: left; padding-right: 18px; }
.stat { background: #f7f9fc; border: 1px solid #e6edf5; border-radius: 12px; padding: 14px 16px; }
.stat small { display: block; color: #5c6b7a; font-size: 14px; font-weight: 650; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; letter-spacing: -0.03em; color: #142433; }
.stat em { display: block; margin-top: 2px; font-style: normal; color: #0b4fa8; font-size: 15px; font-weight: 650; }
.table-scroll { overflow-x: auto; }
.report-table { width: 100%; min-width: 860px; }
.report-table.wide-report { min-width: 1480px; font-size: 15px; }
.report-table th, .report-table td { white-space: nowrap; padding: 12px 18px 12px 0; }
.report-table.wide-report th, .report-table.wide-report td { padding: 10px 12px 10px 0; }
.kind { font-style: normal; font-size: 14px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.kind.muayene { background: #e7f1ff; color: #0b4fa8; }
.kind.kontrol { background: #fff4e5; color: #8a5a00; }
.print-only { display: none; }
.print-foot { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm 10mm 16mm; }
  body { background: #fff; color: #1d1d1f; }
  .bar, .no-print, .modal { display: none !important; }
  .wrap { max-width: none; padding: 0 0 18mm; }
  .card { border: 0; box-shadow: none; background: #fff; }
  .stat { break-inside: avoid; }
  .print-only { display: block; margin: 0 0 12px; font-size: 16px; color: #1d1d1f; }
  .table-scroll { overflow: visible; }
  .report-table, .report-table.wide-report { min-width: 0; width: 100%; font-size: 12px; }
  .report-table th, .report-table td,
  .report-table.wide-report th, .report-table.wide-report td { padding: 5px 7px 5px 0; }
  .print-foot {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 10mm 6mm;
    color: #b7c0ca;
    font-size: 13px;
  }
  .print-foot a { color: inherit; text-decoration: none; }
  body[data-print="fees"] .head,
  body[data-print="visits"] .head,
  body[data-print="fees"] .report-stack > :not(.print-fees),
  body[data-print="visits"] .report-stack > :not(.print-visits) { display: none !important; }
}

@media (max-width: 1180px) {
  .exam-layout { grid-template-columns: 250px minmax(0, 1fr); }
  .history-card { grid-column: 1 / -1; height: auto; max-height: 280px; }
}
@media (max-width: 860px) {
  .bar { height: auto; flex-wrap: wrap; gap: 10px 16px; padding: 12px 14px; }
  .bar-end { margin-left: 0; width: 100%; }
  .wrap { padding: 16px 12px 40px; }
  .exam-wrap { height: auto; overflow: visible; }
  .exam-layout, .fields, .vitals, .exam-card .sat-row, .who-split { grid-template-columns: 1fr; }
  .list-card, .history-card, .exam-card { height: auto; max-height: none; }
  .quads { grid-template-columns: 1fr 1fr; }
  .identity { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .reg-screen { height: auto; overflow: visible; }
  .reg-split { grid-template-columns: 1fr; }
  .reg-split .fields { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .btn-danger, .bar nav button, .person, .chip, input, select, textarea { transition: none; }
  .who.is-risk::after, .who-tags em.pulse, .who-meta > div.pulse { animation: none; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eef6;
  --muted: #a9b6c4;
  --line: #314052;
  --paper: #1b2430;
}
html[data-theme="dark"] body {
  background: linear-gradient(180deg, #121922 0%, #161e28 220px, #10161d 100%);
}
html[data-theme="dark"] ::placeholder { color: #7e8c9c; }
html[data-theme="dark"] .bar {
  background: linear-gradient(90deg, rgba(20, 28, 38, 0.94) 0%, rgba(22, 32, 46, 0.94) 48%, rgba(32, 24, 32, 0.94) 100%);
  border-bottom-color: #2a3848;
}
html[data-theme="dark"] .brand strong,
html[data-theme="dark"] .who-name h2,
html[data-theme="dark"] .identity h2,
html[data-theme="dark"] .fact strong,
html[data-theme="dark"] .past-title,
html[data-theme="dark"] .stat strong,
html[data-theme="dark"] .panel h2,
html[data-theme="dark"] .group,
html[data-theme="dark"] .card > h2,
html[data-theme="dark"] .list-title,
html[data-theme="dark"] .history-card > h2,
html[data-theme="dark"] .report-sub { color: #e7eef6; }
html[data-theme="dark"] .who-name-card {
  background: linear-gradient(105deg, #1a2740 0%, #1b2430 55%, #1c2834 100%);
  border-color: #31486a;
  box-shadow: none;
}
html[data-theme="dark"] .who-name > span { color: #8ea0b0; }
html[data-theme="dark"] .period-switch button { color: #c5d0dc; }
html[data-theme="dark"] .period-field {
  background: #17202b;
  border-color: #314052;
}
html[data-theme="dark"] .period-field > span { color: #a9b6c4; }
html[data-theme="dark"] .period-field .tr-date-btn,
html[data-theme="dark"] .period-field input { background: #243246; color: #e7eef6; }
html[data-theme="dark"] .brand em,
html[data-theme="dark"] .bar-end,
html[data-theme="dark"] .bar nav button,
html[data-theme="dark"] .text-btn,
html[data-theme="dark"] .bar .text-btn,
html[data-theme="dark"] .admin-menu button { color: #c5d0dc; }
html[data-theme="dark"] .period-switch,
html[data-theme="dark"] .admin-menu { background: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .bar nav button:hover,
html[data-theme="dark"] .text-btn:hover,
html[data-theme="dark"] .admin-menu button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
html[data-theme="dark"] .period-switch button[aria-pressed="true"],
html[data-theme="dark"] .bar nav button[aria-current="page"],
html[data-theme="dark"] .admin-menu button[aria-current="page"] {
  background: #243246;
  color: #8ec4ff;
}
html[data-theme="dark"] .card,
html[data-theme="dark"] .list-card,
html[data-theme="dark"] .exam-card,
html[data-theme="dark"] .line,
html[data-theme="dark"] .modal-card { background: #1b2430; border-color: #314052; }
html[data-theme="dark"] .notice { background: #1a3148; color: #cfe6ff; }
html[data-theme="dark"] .protocol {
  background: linear-gradient(90deg, #1a2d44 0%, #3a2430 100%);
  border-color: #3a516c;
}
html[data-theme="dark"] .protocol span { color: #d5e2f0; }
html[data-theme="dark"] .protocol strong,
html[data-theme="dark"] .stat em,
html[data-theme="dark"] .fee-pick strong,
html[data-theme="dark"] .past.selected .past-title { color: #8ec4ff; }
html[data-theme="dark"] .panel { background: #17202b; border-color: #314052; }
html[data-theme="dark"] .reg-split .panel.rose {
  background: linear-gradient(180deg, #1a2740 0%, #1b2430 42%);
  border-color: #31486a;
}
html[data-theme="dark"] .reg-split .panel.sage {
  background: linear-gradient(180deg, #3a242c 0%, #1b2430 42%);
  border-color: #5a3842;
}
html[data-theme="dark"] .exam-panel {
  background: linear-gradient(180deg, #1a2740 0%, #1b2430 48%);
  border-color: #31486a;
}
html[data-theme="dark"] .exam-panel.notes-panel {
  background: linear-gradient(180deg, #3a242c 0%, #1b2430 48%);
  border-color: #5a3842;
}
html[data-theme="dark"] .who-split .exam-panel,
html[data-theme="dark"] .who-split .exam-panel.notes-panel {
  background: linear-gradient(180deg, #1c2834 0%, #1b2430 70%);
  border-color: #314052;
}
html[data-theme="dark"] .who-meta dt { color: #a9b6c4; }
html[data-theme="dark"] .who-meta dd { color: #e7eef6; }
html[data-theme="dark"] .who-meta > div,
html[data-theme="dark"] .who-meta > div.calm,
html[data-theme="dark"] .who-meta > div.warn,
html[data-theme="dark"] .who-meta > div.hot {
  background: linear-gradient(180deg, #22303c 0%, #1b2430 100%);
  border-color: #3a4c5c;
  box-shadow: none;
}
html[data-theme="dark"] .who-tags em.calm { background: #1a3328; color: #9ee0b8; }
html[data-theme="dark"] .who-tags em.warn { background: #3a3018; color: #ffd591; }
html[data-theme="dark"] .who-tags em.hot { background: #3a1c22; color: #ffb4b0; }
html[data-theme="dark"] .field > span,
html[data-theme="dark"] .file-dates label { color: #d5e0ea; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .tr-date-btn,
html[data-theme="dark"] .tr-pop {
  background: #121922;
  border-color: #3a4c60;
  color: #e7eef6;
}
html[data-theme="dark"] .btn-line,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .file-presets button {
  color: #e7eef6;
  border-color: #3a4c60;
  background: linear-gradient(180deg, #243140 0%, #1b2633 100%);
  box-shadow: none;
}
html[data-theme="dark"] .tr-pop-head button:hover,
html[data-theme="dark"] .tr-pop-grid button:hover,
html[data-theme="dark"] .tr-months button:hover { background: #243246; }
html[data-theme="dark"] .btn-line:hover,
html[data-theme="dark"] .chip:hover,
html[data-theme="dark"] .file-presets button:hover { background: #2a3b4e; }
html[data-theme="dark"] .file-presets button[aria-pressed="true"],
html[data-theme="dark"] .fee-pick:has(input:checked),
html[data-theme="dark"] .past.selected,
html[data-theme="dark"] .person.is-on { background: #1d3554; border-color: #3d6ea8; color: #d7e9ff; }
html[data-theme="dark"] .person:hover,
html[data-theme="dark"] .past:hover { background: #243140; }
html[data-theme="dark"] .person em.soon { background: #2a3644; color: #d5e0ea; }
html[data-theme="dark"] .person-no { background: #1d3554; color: #8ec4ff; }
html[data-theme="dark"] .fact {
  background: linear-gradient(180deg, #222c3a 0%, #1b2532 100%);
  border-color: #334658;
}
html[data-theme="dark"] .fact small { color: #9aabbc; }
html[data-theme="dark"] .fact-ico { background: #1a3354; color: #8ec4ff; }
html[data-theme="dark"] .alert.hot { background: linear-gradient(180deg, #2a1c22 0%, #24161c 100%); color: #ffb4b0; border-color: #6a3038; }
html[data-theme="dark"] .alert.warn { background: linear-gradient(180deg, #2c2416 0%, #241e14 100%); color: #ffd591; border-color: #6a5424; }
html[data-theme="dark"] .alert.calm { background: linear-gradient(180deg, #16261e 0%, #142018 100%); color: #9ee0b8; border-color: #2c5a40; }
html[data-theme="dark"] .stat,
html[data-theme="dark"] .kind.muayene { background: #1a2d44; color: #8ec4ff; }
html[data-theme="dark"] .kind.kontrol { background: #3a2e18; color: #ffd591; }
html[data-theme="dark"] .stat small { color: #a9b6c4; }
html[data-theme="dark"] .past p,
html[data-theme="dark"] td { color: #e7eef6; }
html[data-theme="dark"] th { color: #a9b6c4; }
html[data-theme="dark"] .search-wrap .ico { color: #9aabbc; }
@media print {
  html[data-theme="dark"] body { background: #fff; color: #1d1d1f; }
}
