:root {
  color-scheme: dark;
  --bg: #07101d;
  --surface: #111c2d;
  --surface-2: #162338;
  --surface-3: #0d1828;
  --ink: #f4f7fb;
  --muted: #aeb9ca;
  --line: #314057;
  --cyan: #5bdcff;
  --blue: #55a9ff;
  --teal: #42e0c4;
  --violet: #a881ff;
  --coral: #ff6f91;
  --amber: #f3a75d;
  --danger: #ff8d82;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  padding-bottom: 112px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07101d;
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 22%, rgba(91, 220, 255, 0.18), transparent 34%),
    rgba(3, 7, 13, 0.92);
  backdrop-filter: blur(14px);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 28px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(18, 29, 44, 0.96), rgba(8, 14, 24, 0.96));
  box-shadow: var(--shadow);
}

.login-card img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 0 26px rgba(91, 220, 255, 0.45);
}

.login-card h1 {
  margin: 0;
  font-size: 30px;
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.login-card input {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(19, 29, 43, 0.94);
  font: inherit;
}

.login-card button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  color: #07111d;
  background: linear-gradient(135deg, #77e3ff, #a397ff);
  font-weight: 800;
  cursor: pointer;
}

.topbar {
  width: min(1420px, calc(100% - 56px));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 720;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(91, 220, 255, 0.5);
}

.header-side,
.profile-picker {
  display: flex;
  align-items: center;
}

.header-side {
  gap: 22px;
}

.connection {
  color: var(--muted);
  font-size: 13px;
}

.connection > span,
.ai-status > span {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(91, 220, 255, 0.8);
}

.profile-picker {
  gap: 8px;
}

.profile-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1c2c43;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
}

.profile-picker select {
  min-width: 145px;
  border-color: transparent;
  background: transparent;
  font-weight: 700;
}

.profile-admin-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(15, 25, 40, 0.78);
  cursor: pointer;
  font-size: 17px;
}

.profile-admin-button:hover {
  color: var(--text);
  border-color: rgba(91, 220, 255, 0.35);
}

.profile-dialog {
  width: min(620px, calc(100% - 32px));
  box-sizing: border-box;
  border: 1px solid rgba(103, 128, 165, 0.32);
  border-radius: 24px;
  padding: 24px;
  color: var(--text);
  background: #111b2a;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.6);
}

.profile-dialog::backdrop {
  background: rgba(3, 8, 15, 0.76);
  backdrop-filter: blur(8px);
}

.profile-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.profile-dialog-heading h2 {
  margin: 5px 0 0;
}

.profile-dialog-heading.compact {
  margin: 20px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.dialog-close {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}

.profile-admin-list {
  display: grid;
  gap: 9px;
}

.profile-admin-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 13, 22, 0.5);
}

.profile-admin-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07111d;
  background: linear-gradient(135deg, #68dcff, #9f92ff);
  font-weight: 800;
}

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

.profile-admin-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.profile-admin-fields .profile-wide-label {
  grid-column: 1 / -1;
}

.profile-section-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(119, 145, 179, 0.16);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.profile-admin-row input,
.profile-admin-row select,
.profile-admin-row textarea,
.profile-create-form input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--text);
  background: rgba(19, 29, 43, 0.9);
  font: inherit;
}

.profile-admin-row textarea {
  resize: vertical;
  min-height: 58px;
}

.profile-admin-actions {
  display: grid;
  gap: 9px;
}

.profile-admin-row button,
.profile-create-form button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(28, 43, 62, 0.9);
  cursor: pointer;
}

.profile-admin-row .profile-delete {
  color: #ff9da6;
  background: rgba(255, 91, 108, 0.08);
}

.profile-admin-row button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.profile-create-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.profile-create-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.profile-create-form button {
  color: #07111d;
  border: 0;
  background: linear-gradient(135deg, #77e3ff, #a397ff);
  font-weight: 750;
}

.account-admin-section,
.account-admin-list {
  display: grid;
  gap: 10px;
}

.account-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 13, 22, 0.42);
}

.account-admin-row strong,
.account-admin-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-admin-row small {
  color: var(--muted);
  font-size: 11px;
}

.account-admin-row button,
.account-create-form button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(28, 43, 62, 0.9);
  cursor: pointer;
}

.account-create-form {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.account-create-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.account-create-form input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--text);
  background: rgba(19, 29, 43, 0.9);
  font: inherit;
}

.account-create-form button {
  color: #07111d;
  border: 0;
  background: linear-gradient(135deg, #77e3ff, #a397ff);
  font-weight: 750;
}

.profile-admin-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dashboard {
  width: min(1420px, calc(100% - 56px));
  margin: 0 auto;
}

.intro {
  margin: 22px 0 24px;
}

.intro > p,
.panel-label {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.intro h1 {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1.15;
}

.intro > span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.overview-panel,
.metric-card,
.trend-panel,
.attention-panel,
.timeline-panel,
.assistant-panel,
.entry-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111c2d;
}

.overview-panel {
  min-height: 210px;
  padding: 30px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

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

.overview-copy > strong {
  display: block;
  margin: 12px 0 2px;
  font-size: 56px;
  font-weight: 520;
}

.overview-copy > p {
  color: var(--ink);
  font-size: 18px;
}

.overview-copy > small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.pulse-ring {
  width: 156px;
  height: 156px;
  margin-right: 80px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  border-radius: 50%;
  background: conic-gradient(var(--cyan) 0 72%, #243249 72% 100%);
  box-shadow: 0 0 34px rgba(71, 165, 255, 0.32);
}

.pulse-ring::before {
  content: "";
  width: 126px;
  height: 126px;
  position: absolute;
  border-radius: 50%;
  background: var(--surface);
}

.pulse-ring > div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.pulse-ring strong {
  display: block;
  font-size: 44px;
  font-weight: 540;
}

.pulse-ring span {
  color: var(--muted);
  font-size: 13px;
}

.assessment-panel {
  margin-top: 16px;
  min-height: 126px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 0.8fr auto 1.35fr;
  align-items: center;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111c2d;
}

.assessment-panel h2 {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 650;
}

.assessment-button {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid #36526f;
  border-radius: 6px;
  background: #14243a;
  color: var(--ink);
  font-weight: 760;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(91, 220, 255, 0.04);
}

.assessment-button:hover {
  border-color: var(--cyan);
  background: #172d43;
}

.assessment-result {
  min-height: 88px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 14px;
  border: 1px solid #29384f;
  border-radius: 7px;
  background: #162338;
}

.assessment-light {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 16px rgba(174, 185, 202, 0.38);
}

.assessment-result.green .assessment-light {
  background: var(--teal);
  box-shadow: 0 0 16px rgba(66, 224, 196, 0.75);
}

.assessment-result.yellow .assessment-light {
  background: var(--amber);
  box-shadow: 0 0 16px rgba(243, 167, 93, 0.72);
}

.assessment-result.red .assessment-light {
  background: var(--danger);
  box-shadow: 0 0 16px rgba(255, 141, 130, 0.74);
}

.assessment-result strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
}

.assessment-result ul {
  margin: 6px 0 0;
  padding-left: 0;
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  list-style: none;
}

.assessment-result li::before {
  content: "";
  width: 5px;
  height: 5px;
  margin: 0 7px 2px 0;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
}

.assessment-result p {
  margin-top: 6px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.35;
}

.assessment-result.empty p {
  color: var(--muted);
}

.metrics-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card {
  min-height: 124px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 800;
}

.metric-card > div > span,
.metric-card small {
  color: var(--muted);
}

.metric-card > div > span {
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 5px 0;
  font-size: 25px;
  font-weight: 560;
}

.metric-pulse .metric-icon {
  background: rgba(255, 111, 145, 0.13);
  color: var(--coral);
}

.metric-pressure .metric-icon {
  background: rgba(85, 169, 255, 0.13);
  color: var(--blue);
}

.metric-oxygen .metric-icon {
  background: rgba(66, 224, 196, 0.13);
  color: var(--teal);
}

.metric-weight .metric-icon {
  background: rgba(168, 129, 255, 0.13);
  color: var(--violet);
}

.insights-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.7fr 0.85fr 0.85fr;
  gap: 14px;
}

.trend-panel,
.attention-panel,
.timeline-panel,
.assistant-panel,
.entry-panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 650;
}

.range-label,
.ai-status {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.chart-wrap {
  height: 270px;
  margin-top: 18px;
  position: relative;
}

#trendChart {
  width: 100%;
  height: 100%;
}

#chartEmpty {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.insights-list,
.timeline {
  margin-top: 18px;
  display: grid;
  gap: 9px;
}

.insight {
  min-height: 64px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #29384f;
  border-radius: 7px;
  background: var(--surface-2);
}

.insight-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(66, 224, 196, 0.11);
  color: var(--teal);
  font-weight: 800;
}

.insight.warn .insight-mark {
  background: rgba(243, 167, 93, 0.12);
  color: var(--amber);
}

.insight strong,
.timeline-item strong {
  display: block;
  font-size: 13px;
}

.insight small,
.timeline-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.timeline {
  position: relative;
}

.timeline::before {
  content: "";
  width: 1px;
  position: absolute;
  left: 49px;
  top: 10px;
  bottom: 10px;
  background: var(--line);
}

.timeline-item {
  min-height: 47px;
  display: grid;
  grid-template-columns: 40px 10px 1fr;
  align-items: start;
  gap: 6px;
  position: relative;
}

.timeline-item time {
  padding-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(91, 220, 255, 0.6);
  z-index: 1;
}

.workspace {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 14px;
  scroll-margin-top: 20px;
}

.chat-log {
  height: 220px;
  margin: 18px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.bubble {
  max-width: 84%;
  padding: 12px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.bubble.assistant {
  align-self: flex-start;
  background: #172b3e;
  border-left: 2px solid var(--cyan);
}

.bubble.user {
  align-self: flex-end;
  background: #222d4a;
  border-right: 2px solid var(--violet);
}

.quick-prompts {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-prompts button,
.tab-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.quick-prompts button:hover,
.tab-button.active {
  border-color: var(--cyan);
  color: var(--ink);
  background: rgba(91, 220, 255, 0.08);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c1726;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(91, 220, 255, 0.18);
  border-color: var(--cyan);
}

button[type="submit"] {
  min-height: 42px;
  padding: 10px 17px;
  border: 1px solid #3fa6c7;
  border-radius: 6px;
  background: #216e8c;
  color: #fff;
  font-weight: 760;
}

button[type="submit"]:hover {
  background: #2a829f;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.disclaimer,
.form-message {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.action-tabs {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.entry-form {
  display: none;
  gap: 13px;
}

.entry-form.active {
  display: grid;
}

.entry-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.value-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c1726;
}

.value-row input {
  border: 0;
  background: transparent;
}

.value-row span {
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--cyan);
}

.history-section {
  margin-top: 36px;
  padding-top: 6px;
  scroll-margin-top: 20px;
}

.history-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 0.9fr 1.25fr 0.9fr;
  gap: 34px;
}

.history-grid h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.record-list {
  display: grid;
}

.record {
  min-height: 58px;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #243149;
}

.record strong {
  font-size: 13px;
}

.record span,
.empty-state {
  color: var(--muted);
  font-size: 11px;
}

.record span {
  text-align: right;
}

.lab-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.lab-record > div {
  min-width: 0;
}

.lab-record strong,
.lab-record > div span {
  overflow-wrap: anywhere;
}

.lab-record > div span {
  display: block;
  margin-top: 4px;
  text-align: left;
}

.lab-flag {
  min-width: 70px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(174, 185, 202, 0.1);
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.lab-flag.normal {
  background: rgba(66, 224, 196, 0.12);
  color: var(--teal);
}

.lab-flag.high,
.lab-flag.low {
  background: rgba(243, 167, 93, 0.12);
  color: var(--amber);
}

.lab-flag.critical {
  background: rgba(255, 141, 130, 0.14);
  color: var(--danger);
}

.empty-state {
  padding: 18px 0;
}

.emergency-note {
  margin: 32px 0;
  padding: 17px 20px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  border: 1px solid rgba(255, 141, 130, 0.32);
  border-radius: 8px;
  background: rgba(105, 41, 44, 0.2);
  color: #ffd2cd;
}

.emergency-note p {
  color: #dfb9b7;
  line-height: 1.45;
}

.dock {
  width: min(1100px, calc(100% - 40px));
  height: 78px;
  padding: 8px 22px;
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid #42526b;
  border-radius: 38px;
  background: #0c1828;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.dock a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 28px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.dock a span {
  font-size: 22px;
}

.dock a:hover,
.dock a.active {
  background: #17283e;
  color: var(--ink);
}

.dock a.active span {
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(91, 220, 255, 0.85);
}

@media (max-width: 1020px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .insights-grid {
    grid-template-columns: 1fr 1fr;
  }

  .trend-panel {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .assessment-panel {
    grid-template-columns: 1fr auto;
  }

  .assessment-result {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: 92px;
  }

  .topbar,
  .dashboard {
    width: min(100% - 24px, 1420px);
  }

  .topbar {
    height: auto;
    min-height: 72px;
  }

  .brand {
    font-size: 15px;
  }

  .connection {
    display: none;
  }

  .profile-picker select {
    min-width: 0;
    width: 128px;
  }

  .intro {
    margin-top: 20px;
  }

  .intro h1 {
    font-size: 29px;
  }

  .overview-panel {
    min-height: 180px;
    padding: 24px;
  }

  .overview-copy > strong {
    font-size: 40px;
  }

  .assessment-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 16px;
  }

  .assessment-button {
    width: 100%;
  }

  .pulse-ring {
    width: 112px;
    height: 112px;
    margin-right: 0;
  }

  .pulse-ring::before {
    width: 90px;
    height: 90px;
  }

  .pulse-ring strong {
    font-size: 30px;
  }

  .insights-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .trend-panel {
    grid-column: auto;
  }

  .chart-wrap {
    height: 220px;
  }

  .assistant-panel,
  .entry-panel,
  .trend-panel,
  .attention-panel,
  .timeline-panel {
    padding: 18px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-form button {
    width: 100%;
  }

  .bubble {
    max-width: 94%;
  }

  .quick-prompts {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .quick-prompts button {
    flex: 0 0 auto;
  }

  .emergency-note {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dock {
    width: calc(100% - 20px);
    height: 68px;
    bottom: 10px;
    padding: 6px 8px;
  }

  .dock a {
    flex-direction: column;
    gap: 1px;
    font-size: 10px;
  }

  .dock a span {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .profile-admin-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .profile-admin-fields {
    grid-template-columns: 1fr;
  }

  .profile-admin-actions {
    grid-column: 2;
    grid-template-columns: 1fr 1fr;
  }

  .profile-create-form {
    grid-template-columns: 1fr;
  }

  .account-create-form,
  .account-admin-row {
    grid-template-columns: 1fr;
  }
}

.nutrition-panel {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background:
    radial-gradient(circle at 85% 10%, rgba(107, 92, 255, 0.14), transparent 31%),
    linear-gradient(145deg, rgba(20, 29, 43, 0.98), rgba(13, 20, 31, 0.98));
  box-shadow: var(--shadow);
}

.quick-vitals-panel {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(17, 28, 45, 0.94);
  box-shadow: var(--shadow);
}

.daily-trends-section {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(18, 29, 46, 0.98), rgba(11, 19, 30, 0.98));
  box-shadow: var(--shadow);
}

.daily-trends-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.daily-trends-heading h2 {
  margin: 4px 0 0;
}

.daily-charts-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.daily-chart-card {
  grid-column: span 2;
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(7, 13, 22, 0.48);
}

.daily-chart-card.pressure-chart-card {
  grid-column: span 3;
}

.daily-chart-card:nth-child(1) {
  grid-column: span 3;
}

.daily-chart-card > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.daily-chart-card > div:first-child span {
  color: var(--muted);
}

.daily-chart-card > div:first-child strong {
  font-size: 18px;
}

.daily-chart-card canvas,
.daily-chart-empty {
  width: 100%;
  height: 155px;
  margin-top: 10px;
}

.daily-chart-empty {
  display: none;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
}

.chart-legend .systolic::before { background: #6f9fff; }
.chart-legend .diastolic::before { background: #a993ff; }

.quick-vitals-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.quick-vitals-heading h2 {
  margin: 4px 0 0;
}

.quick-vitals-heading p {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.quick-vitals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-vital-form {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(7, 13, 22, 0.46);
}

.quick-vital-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}

.quick-vital-icon.weight { color: #a8f1d6; background: rgba(79, 211, 164, 0.13); }
.quick-vital-icon.pressure { color: #8fb9ff; background: rgba(86, 139, 255, 0.14); }
.quick-vital-icon.pulse { color: #ff86a2; background: rgba(255, 99, 138, 0.14); font-size: 17px; }

.quick-vital-form label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.quick-vital-form label > div {
  display: flex;
  align-items: center;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(19, 29, 43, 0.9);
}

.quick-vital-form input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 0;
  padding: 9px 7px 9px 10px;
  color: var(--text);
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
}

.quick-vital-form b {
  padding-right: 9px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 10px;
}

.quick-vital-form i {
  color: var(--muted);
  font-style: normal;
}

.quick-vital-form button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--text);
  background: rgba(28, 43, 62, 0.9);
  cursor: pointer;
}

.quick-vital-form button:disabled {
  opacity: 0.55;
}

.pressure-inputs input {
  width: 64px;
  appearance: textfield;
}

.pressure-inputs input::-webkit-inner-spin-button,
.pressure-inputs input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.nutrition-heading,
.nutrition-layout,
.nutrition-workspace,
.meal-history-title,
.meal-card {
  display: flex;
  align-items: center;
}

.nutrition-heading {
  justify-content: space-between;
  gap: 24px;
}

.nutrition-heading h2 {
  margin: 5px 0 7px;
}

.nutrition-heading p,
.nutrition-message {
  margin: 0;
  color: var(--muted);
}

.nutrition-date {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.nutrition-date input {
  color-scheme: dark;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(7, 12, 20, 0.62);
}

.nutrition-layout {
  gap: 30px;
  margin: 28px 0;
}

.calorie-orbit {
  --meal-progress: 0%;
  flex: 0 0 164px;
  width: 164px;
  height: 164px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#8b7cff var(--meal-progress), rgba(139, 124, 255, 0.12) 0);
  position: relative;
}

.calorie-orbit::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #111a27;
}

.calorie-orbit > div {
  position: relative;
  display: grid;
  text-align: center;
}

.calorie-orbit strong {
  font-size: 36px;
  line-height: 1;
}

.calorie-orbit span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.macro-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.macro-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(8, 14, 23, 0.48);
}

.macro-card > span,
.macro-card small {
  color: var(--muted);
}

.macro-card strong {
  display: block;
  margin: 7px 0 14px;
  font-size: 22px;
}

.macro-card > div {
  height: 6px;
  margin-bottom: 9px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}

.macro-card i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}

.macro-card.protein i { background: #4fd3a4; }
.macro-card.fat i { background: #ffbf69; }
.macro-card.carbs i { background: #5bdcff; }

.nutrition-workspace {
  align-items: stretch;
  gap: 18px;
}

.nutrition-form,
.meal-history,
.meal-favorites,
.meal-reuse {
  flex: 1;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(7, 12, 20, 0.48);
}

.food-table {
  width: 100%;
  box-sizing: border-box;
  display: grid;
  gap: 7px;
  margin: 14px 0 10px;
}

.food-table-head,
.food-table-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.15fr) minmax(130px, 1fr) minmax(82px, 0.72fr);
  gap: 7px;
}

.food-table-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.food-table input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px;
  color: var(--text);
  background: rgba(19, 29, 43, 0.9);
  font: inherit;
  font-size: 13px;
}

.nutrition-form > button {
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 13px;
  color: #08101b;
  background: linear-gradient(135deg, #77e3ff, #a397ff);
  font-weight: 750;
  cursor: pointer;
}

.nutrition-form > button:disabled {
  opacity: 0.65;
}

.nutrition-message {
  min-height: 32px;
  margin-top: 11px;
  font-size: 12px;
  line-height: 1.4;
}

.meal-types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.meal-types input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.meal-types label {
  position: relative;
}

.meal-types span {
  display: block;
  padding: 9px 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  cursor: pointer;
}

.meal-types input:checked + span {
  color: #dff8ff;
  border-color: rgba(91, 220, 255, 0.45);
  background: rgba(91, 220, 255, 0.12);
}

.meal-history-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.meal-history-title span {
  color: var(--muted);
  font-size: 12px;
}

.meal-list {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow: auto;
}

.meal-reuse-list {
  display: grid;
  gap: 8px;
  max-height: 358px;
  overflow: auto;
}

.meal-card {
  gap: 12px;
  padding: 12px;
  border-radius: 13px;
  background: rgba(19, 29, 43, 0.72);
}

.meal-card > div {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.meal-card span,
.meal-card small {
  color: var(--muted);
  font-size: 11px;
}

.meal-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-card b {
  white-space: nowrap;
  color: #a99fff;
}

.meal-remove {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 21px;
  cursor: pointer;
}

.meal-reuse-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 13px;
  background: rgba(19, 29, 43, 0.72);
}

.meal-reuse-card > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.meal-reuse-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-reuse-card span,
.meal-reuse-card small {
  color: var(--muted);
  font-size: 11px;
}

.meal-reuse-card button {
  border: 1px solid rgba(91, 220, 255, 0.34);
  border-radius: 10px;
  padding: 8px 10px;
  color: #dff8ff;
  background: rgba(91, 220, 255, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.meal-reuse-card button:disabled {
  opacity: 0.6;
}

.meal-reuse-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.meal-reuse-actions .meal-reuse-remove {
  width: 34px;
  padding: 8px 0;
  border-color: transparent;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 17px;
  line-height: 1;
}

.meal-reuse-actions .meal-reuse-remove:hover {
  color: var(--danger);
}

@media (max-width: 760px) {
  .nutrition-panel { padding: 18px; }
  .nutrition-heading { align-items: flex-start; }
  .nutrition-layout { flex-direction: column; }
  .calorie-orbit { align-self: center; }
  .macro-grid { width: 100%; grid-template-columns: 1fr; }
  .nutrition-workspace { flex-direction: column; }
  .meal-types { grid-template-columns: repeat(2, 1fr); }
  .food-table-head { display: none; }
  .food-table-row { grid-template-columns: 1fr; }
  .meal-reuse-card { grid-template-columns: 1fr; }
  .meal-reuse-actions { justify-content: flex-start; }
  .quick-vitals-grid { grid-template-columns: 1fr; }
  .quick-vitals-heading { align-items: flex-start; flex-direction: column; }
  .daily-trends-section { padding: 18px; }
  .daily-trends-heading { align-items: flex-start; flex-direction: column; }
  .daily-charts-grid { grid-template-columns: 1fr; }
  .daily-chart-card,
  .daily-chart-card.pressure-chart-card,
  .daily-chart-card:nth-child(1) { grid-column: auto; }
}
