:root {
  --bg: #eef4fb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --border: rgba(77, 105, 145, 0.14);
  --text: #162132;
  --muted: #607086;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent: #0f766e;
  --success-bg: #e1f7ee;
  --success-text: #14714a;
  --error-bg: #fde7e2;
  --error-text: #9a3826;
  --shadow: 0 24px 60px rgba(37, 99, 235, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 24%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

body.has-pwa-install-banner {
  padding-bottom: 132px;
}

body.has-image-modal {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 88%);
}

.nav-toggle {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}

.shell-layout {
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  width: min(78vw, 286px);
  height: 100vh;
  padding: 24px 18px;
  background: rgba(248, 251, 255, 0.97);
  border-right: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
  overflow: hidden;
  transform: translateX(-110%);
  transition: transform 0.22s ease;
  backdrop-filter: blur(20px);
}

.sidebar-head,
.sidebar-footer,
.side-nav {
  display: grid;
  gap: 14px;
}

.side-nav {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.nav-link {
  display: block;
  padding: 14px 16px;
  border-radius: 18px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(37, 99, 235, 0.14);
  transform: translateX(2px);
}

.sidebar-button {
  width: 100%;
}

.nav-open,
.nav-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  cursor: pointer;
}

.nav-close {
  border-radius: 999px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  font-size: 1.2rem;
  font-weight: 800;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.nav-toggle:checked ~ .shell-layout .sidebar {
  transform: translateX(0);
}

.nav-toggle:checked ~ .shell-layout .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

.app-shell {
  width: min(100%, 1080px);
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.app-shell-auth {
  width: min(100%, 1180px);
  max-width: 100%;
  min-width: 0;
  padding-top: 20px;
}

.mobile-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mobile-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.pwa-install-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(16px);
}

.pwa-install-banner[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}

.image-modal[hidden] {
  display: none;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}

.image-modal-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(100%, 920px);
  max-height: calc(100vh - 32px);
  padding: 16px;
  border-radius: 24px;
  background: rgba(248, 251, 255, 0.98);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.image-modal-close {
  justify-self: end;
}

.image-modal-media {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 132px);
  margin: 0 auto;
  border-radius: 20px;
  background: rgba(127, 154, 161, 0.18);
  object-fit: contain;
}

.pwa-install-copy {
  display: grid;
  gap: 6px;
}

.pwa-install-kicker {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.pwa-install-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.pwa-install-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pwa-install-actions .button {
  flex: 1 1 160px;
}

.stool-scale-card {
  display: grid;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(77, 105, 145, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
}

.stool-scale-field {
  display: grid;
  gap: 12px;
}

.stool-scale-field + .stool-scale-field {
  padding-top: 18px;
  border-top: 1px solid rgba(77, 105, 145, 0.14);
}

.stool-scale-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-weight: 900;
}

.stool-range {
  width: 100%;
  margin: 0;
  accent-color: var(--primary);
}

.stool-range-value {
  flex: 0 1 auto;
  color: var(--primary);
  font-weight: 800;
  line-height: 1.1;
  text-align: right;
}

.stool-datetime-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stool-datetime-field {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 38px 10px 12px;
  border: 1px solid rgba(77, 105, 145, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.stool-datetime-field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.stool-datetime-field input {
  width: 100%;
  min-width: 0;
  min-height: 22px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  outline: none;
}

.stool-datetime-field svg {
  position: absolute;
  right: 12px;
  bottom: 11px;
  width: 18px;
  height: 18px;
  color: var(--text);
  fill: currentColor;
  pointer-events: none;
}

.stool-datetime-field:focus-within {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.stool-odor-field {
  padding: 0;
  border: 0;
  margin: 0;
}

.stool-odor-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stool-odor-toggle label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.stool-odor-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.stool-odor-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(77, 105, 145, 0.16);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 900;
}

.stool-odor-toggle input:checked + span {
  border-color: rgba(37, 99, 235, 0.7);
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.stool-odor-toggle input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.auth-layout,
.page-layout,
.content-grid,
.stats-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.auth-layout {
  min-height: calc(100vh - 72px);
  align-items: center;
}

.hero-copy,
.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  padding: 28px;
}

.card {
  padding: 20px;
}

.hero-copy::after,
.card::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% auto;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.18), transparent 66%);
  pointer-events: none;
}

.eyebrow,
.section-kicker,
.badge {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 600;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

h2 {
  font-size: clamp(1.45rem, 3.5vw, 2rem);
}

h3 {
  font-size: 1.1rem;
}

.hero-text,
.muted,
.empty-state p,
.stat-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-heading {
  margin-bottom: 16px;
}

.agenda-page-header h1 {
  margin: 0;
}

.section-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.section-subnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.section-subnav-link:hover {
  background: rgba(37, 99, 235, 0.14);
}

.dashboard-quick-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 -4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dashboard-quick-nav::-webkit-scrollbar {
  display: none;
}

.dashboard-quick-nav a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
}

.dashboard-quick-nav a:hover {
  background: rgba(37, 99, 235, 0.1);
}

.page-hero {
  padding-top: 24px;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 0.94rem;
  font-weight: 600;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.auth-card,
.entry-form,
.entry-list,
.inline-form,
.section-card,
.history-block,
.stats-grid,
.stat-card {
  display: grid;
  gap: 14px;
}

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

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid rgba(39, 76, 60, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid rgba(39, 76, 60, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
  outline: none;
}

.field input[type="file"] {
  padding: 12px 14px;
}

.field input:focus {
  border-color: rgba(39, 76, 60, 0.45);
  box-shadow: 0 0 0 4px rgba(39, 76, 60, 0.12);
  transform: translateY(-1px);
}

.field select:focus {
  border-color: rgba(39, 76, 60, 0.45);
  box-shadow: 0 0 0 4px rgba(39, 76, 60, 0.12);
}

.toggle-field {
  align-content: start;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 132px;
  min-height: 52px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(161, 61, 49, 0.14);
  border: 1px solid rgba(161, 61, 49, 0.22);
  box-shadow: inset 0 1px 2px rgba(17, 24, 39, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 6px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.toggle-slider::after {
  content: attr(data-off);
  width: 100%;
  padding-left: 38px;
  color: #a13d31;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  transition: color 0.2s ease, padding 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(23, 104, 72, 0.14);
  border-color: rgba(23, 104, 72, 0.22);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(80px);
}

.toggle-switch input:checked + .toggle-slider::after {
  content: attr(data-on);
  padding-left: 0;
  padding-right: 38px;
  color: #176848;
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 4px rgba(39, 76, 60, 0.12);
}

.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #f4f8f6;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  box-shadow: 0 16px 28px rgba(23, 50, 39, 0.22);
}

.button-secondary,
.link-button {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.button-danger {
  color: #fff6f2;
  background: linear-gradient(135deg, #9e4b3e 0%, #7c3425 100%);
  box-shadow: 0 14px 24px rgba(124, 52, 37, 0.2);
}

.button-icon {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  box-shadow: none;
  font-size: 1rem;
}

.button-edit {
  color: #1f6a53;
  background: rgba(31, 106, 83, 0.12);
}

.button-delete {
  color: #a13d31;
  background: rgba(161, 61, 49, 0.12);
}

.button-save {
  color: #176848;
  background: rgba(23, 104, 72, 0.12);
}

.subheading h3 {
  margin: 0;
}

.pressure-group,
.metrics-grid,
.content-grid,
.filter-form,
.chart-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

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

.stats-grid-analytics .stat-card {
  padding: 14px;
  border-radius: 20px;
}

.stats-grid-analytics .stat-card .section-kicker {
  margin-bottom: 4px;
  font-size: 0.68rem;
}

.stats-grid-analytics .stat-card p:not(.section-kicker) {
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.filter-card {
  display: grid;
  gap: 12px;
}

.is-hidden {
  display: none !important;
}

.chart-card {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-wrap {
  position: relative;
  min-height: 280px;
  min-width: 0;
}

.stat-card h2 {
  font-size: clamp(2rem, 8vw, 3rem);
}

.stats-grid-analytics .stat-card h2 {
  font-size: clamp(1.35rem, 5vw, 2.05rem);
}

.entry-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid rgba(39, 76, 60, 0.1);
}

.dashboard-priority-card {
  background: rgba(252, 244, 218, 0.56);
  border-color: rgba(214, 158, 46, 0.22);
}

.dashboard-dose-list {
  max-height: 420px;
  overflow-y: auto;
}

.dashboard-dose-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(39, 76, 60, 0.1);
}

.dashboard-dose-card-ready {
  background: rgba(223, 246, 230, 0.9);
  border-color: rgba(34, 197, 94, 0.28);
}

.dashboard-dose-toggle-form {
  margin: 0;
}

.dashboard-dose-skip-form {
  margin: 0;
}

.dashboard-dose-skip-button {
  width: 100%;
  min-height: 44px;
  color: #9a3826;
  background: rgba(161, 61, 49, 0.1);
}

.dashboard-dose-timing {
  display: grid;
  gap: 4px;
}

.dashboard-dose-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.dashboard-dose-countdown {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.entry-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: flex-start;
}

.dose-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.dose-actions form {
  margin: 0;
}

.button-whatsapp-icon {
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  height: 48px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 12px 22px rgba(22, 163, 74, 0.22);
}

.button-whatsapp-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.dose-skip-icon {
  width: 50px;
  min-width: 50px;
  height: 50px;
  min-height: 50px;
  border-radius: 999px;
  color: #9a3826;
  background: rgba(161, 61, 49, 0.1);
  box-shadow: 0 10px 20px rgba(161, 61, 49, 0.12);
}

.dose-skip-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.dose-edit-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dose-edit-trigger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.dose-confirm-toggle {
  min-width: 0;
}

.dose-skip-toggle {
  min-width: 0;
}

.dose-confirm-toggle .toggle-slider,
.dose-skip-toggle .toggle-slider {
  min-width: 152px;
  min-height: 50px;
  box-shadow: 0 12px 24px rgba(23, 50, 39, 0.12);
}

.dose-confirm-toggle .toggle-slider {
  background: rgba(161, 61, 49, 0.14);
  border-color: rgba(161, 61, 49, 0.22);
}

.dose-skip-toggle .toggle-slider {
  background: rgba(161, 61, 49, 0.12);
  border-color: rgba(161, 61, 49, 0.22);
}

.dose-confirm-toggle .toggle-slider::after,
.dose-skip-toggle .toggle-slider::after {
  font-size: 0.82rem;
}

.dose-skip-toggle .toggle-slider::after {
  color: #9a3826;
}

.dose-skip-toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, #b84938 0%, #8f3327 100%);
}

.dose-confirm-toggle.is-locked {
  cursor: not-allowed;
}

.dose-confirm-toggle.is-locked .toggle-slider {
  background: rgba(96, 112, 134, 0.1);
  border-color: rgba(96, 112, 134, 0.18);
  box-shadow: none;
}

.dose-confirm-toggle.is-locked .toggle-slider::after {
  color: #6b7a8f;
}

.dose-confirm-toggle.is-locked .toggle-slider::before {
  background: #f3f4f6;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(39, 76, 60, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.32);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
}

.data-table thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(37, 99, 235, 0.06);
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.data-table thead th:first-child {
  border-top-left-radius: 14px;
}

.data-table thead th:last-child {
  border-top-right-radius: 14px;
}

.data-table tbody td {
  padding: 14px;
  vertical-align: top;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
  background: rgba(255, 255, 255, 0.56);
  font-weight: 600;
}

.data-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 14px;
}

.data-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 14px;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.table-actions > form,
.table-actions > details {
  margin: 0;
}

.table-actions .edit-box[open] {
  width: 100%;
}

.table-actions .edit-box[open] .inline-form-table {
  width: 100%;
  margin-top: 0;
}

.meal-description-cell {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.meal-nutrition-cell {
  min-width: 270px;
}

.meal-nutrition-card {
  min-width: 0;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.07), rgba(255, 255, 255, 0.78));
  overflow: hidden;
}

.meal-nutrition-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.meal-nutrition-summary::-webkit-details-marker {
  display: none;
}

.meal-nutrition-summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 0.9rem;
  transition: transform 160ms ease;
}

.meal-nutrition-card[open] .meal-nutrition-summary::after {
  transform: rotate(180deg);
}

.meal-nutrition-summary-value {
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 850;
  white-space: nowrap;
}

.meal-estimate-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meal-nutrition-details {
  display: grid;
  gap: 9px;
  padding: 0 12px 12px;
  border-top: 1px solid rgba(37, 99, 235, 0.08);
}

.meal-nutrition-details-title {
  padding-top: 10px;
  font-size: 0.82rem;
}

.meal-nutrition-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.meal-nutrition-values > div {
  min-width: 0;
}

.meal-nutrition-values dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.meal-nutrition-values dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.meal-nutrition-empty,
.meal-nutrition-confidence,
.meal-nutrition-disclaimer {
  margin: 0;
}

.meal-nutrition-empty {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.meal-nutrition-confidence {
  color: var(--text);
  font-size: 0.78rem;
}

.meal-nutrition-disclaimer {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.meal-thumb-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

.meal-thumb {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: cover;
  background: rgba(127, 154, 161, 0.18);
}

.progress-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-filter-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.progress-filter-link.is-active,
.progress-filter-link:hover {
  background: rgba(37, 99, 235, 0.16);
}

.progress-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.progress-photo-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(77, 105, 145, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.8);
}

.progress-photo-link {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.progress-photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: rgba(127, 154, 161, 0.18);
}

.progress-photo-meta {
  display: grid;
  gap: 10px;
}

.progress-photo-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-photo-notes {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.progress-photo-notes.is-muted {
  color: var(--muted);
}

.stool-reanalyze-icon {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}

.stool-reanalyze-icon:hover {
  background: rgba(37, 99, 235, 0.16);
}

.meal-ai-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: -2px;
}

.meal-ai-button {
  min-height: 46px;
  padding: 12px 16px;
}

.meal-photo-picker {
  display: grid;
  gap: 10px;
}

.meal-photo-trigger {
  width: fit-content;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 18px;
  color: #f8fbff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.24);
}

.meal-photo-trigger-label,
.meal-photo-trigger-loading {
  font-weight: 800;
}

.meal-photo-trigger-loading {
  display: none;
}

.meal-photo-trigger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.meal-photo-trigger.is-processing {
  background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
}

.meal-photo-trigger.is-processing svg {
  animation: meal-photo-spin 1s linear infinite;
}

.meal-photo-trigger.is-processing .meal-photo-trigger-label {
  display: none;
}

.meal-photo-trigger.is-processing .meal-photo-trigger-loading {
  display: inline;
}

.meal-photo-selected {
  margin: 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.stool-photo-picker {
  display: grid;
  gap: 10px;
}

.stool-photo-trigger {
  width: fit-content;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 18px;
  color: #f8fbff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.24);
}

.stool-photo-trigger-label,
.stool-photo-trigger-loading {
  font-weight: 800;
}

.stool-photo-trigger-loading {
  display: none;
}

.stool-photo-trigger svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.stool-photo-trigger.is-processing {
  background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
}

.stool-photo-trigger.is-processing svg {
  animation: meal-photo-spin 1s linear infinite;
}

.stool-photo-trigger.is-processing .stool-photo-trigger-label {
  display: none;
}

.stool-photo-trigger.is-processing .stool-photo-trigger-loading {
  display: inline;
}

.stool-photo-selected {
  margin: 0;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.medication-photo-field {
  display: grid;
  gap: 10px;
}

.medication-photo-trigger {
  width: fit-content;
  gap: 10px;
}

.medication-photo-help {
  margin: 0;
}

.medication-photo-current {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.medication-photo-suggestion {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(37, 99, 235, 0.05);
}

.medication-photo-suggestion-copy {
  display: grid;
  gap: 4px;
}

.medication-photo-suggestion-title,
.medication-photo-suggestion-text {
  margin: 0;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text);
}

.checkbox-inline input {
  margin: 0;
}

@keyframes meal-photo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.meal-ai-button.is-recording {
  color: #fff6f2;
  background: linear-gradient(135deg, #9e4b3e 0%, #7c3425 100%);
  box-shadow: 0 14px 24px rgba(124, 52, 37, 0.18);
}

.meal-ai-status {
  margin: -2px 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
}

.meal-ai-status.is-error {
  color: #9e4b3e;
}

.stool-entry-form .meal-ai-status {
  min-height: 0;
  margin: -4px 0 0;
}

.stool-entry-form .meal-ai-status:empty {
  display: none;
}

.stool-ai-analysis-block {
  display: grid;
  gap: 10px;
}

.stool-ai-analysis-text {
  margin: 0;
}

.stool-ai-chip-list,
.stool-ai-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stool-ai-chip,
.stool-ai-alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  line-height: 1.2;
}

.stool-ai-chip {
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary-strong);
}

.stool-ai-alert-box {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(154, 56, 38, 0.15);
  background: rgba(253, 231, 226, 0.65);
}

.stool-ai-alert-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--error-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stool-ai-alert-chip {
  border: 1px solid rgba(154, 56, 38, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--error-text);
}

.exam-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exam-file-button {
  min-height: 42px;
  padding: 10px 14px;
}

.exam-question-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(39, 76, 60, 0.08);
}

.exam-question-actions {
  display: grid;
  gap: 8px;
}

.exam-ask-button {
  min-height: 44px;
}

.exam-answer-box {
  padding: 14px 16px;
}

.exam-answer-text {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.assistant-chat-card {
  gap: 16px;
}

.assistant-thread {
  display: grid;
  gap: 12px;
}

.assistant-bubble {
  max-width: min(100%, 720px);
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(39, 76, 60, 0.08);
}

.assistant-bubble-user {
  justify-self: end;
  background: rgba(37, 99, 235, 0.12);
  border-bottom-right-radius: 8px;
}

.assistant-bubble-assistant {
  justify-self: start;
  background: rgba(255, 255, 255, 0.82);
  border-bottom-left-radius: 8px;
}

.assistant-bubble-role {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.assistant-bubble-text {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-compose {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(39, 76, 60, 0.08);
}

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

.report-section-card {
  align-content: start;
}

.report-entry-list {
  display: grid;
  gap: 10px;
}

.report-entry-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(39, 76, 60, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
}

.report-entry-item strong {
  font-size: 0.95rem;
}

.report-entry-item span {
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
}

.medication-history-list {
  display: grid;
  gap: 10px;
}

.medication-history-item {
  padding: 14px;
  border: 1px solid rgba(39, 76, 60, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.dose-accordion {
  display: grid;
  gap: 0;
}

.dose-accordion-today {
  background: rgba(252, 244, 218, 0.72);
  border-color: rgba(214, 158, 46, 0.22);
}

.dose-accordion-ready {
  background: rgba(223, 246, 230, 0.9);
  border-color: rgba(34, 197, 94, 0.28);
}

.dose-accordion summary {
  list-style: none;
}

.dose-accordion summary::-webkit-details-marker {
  display: none;
}

.dose-accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.dose-summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.dose-summary-text {
  min-width: 0;
}

.medication-dose-photo-link {
  flex-shrink: 0;
}

.medication-dose-photo {
  width: 56px;
  height: 56px;
}

.dose-accordion-icon {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.dose-accordion[open] .dose-accordion-icon {
  transform: rotate(180deg);
}

.dose-accordion-content {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(39, 76, 60, 0.08);
}

.dose-edit-box {
  display: grid;
  gap: 12px;
}

.dose-edit-box summary {
  list-style: none;
}

.dose-edit-box summary::-webkit-details-marker {
  display: none;
}

.dose-edit-content {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.dose-edit-hint {
  margin: 0;
}

.dose-edit-actions,
.dose-edit-management {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dose-edit-management form {
  margin: 0;
}

.medication-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.medication-history-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.medication-history-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.medication-history-details {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(39, 76, 60, 0.08);
}

.medication-history-details div {
  display: grid;
  gap: 4px;
}

.medication-agenda-history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.medication-agenda-history-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.medication-agenda-history-photo {
  flex-shrink: 0;
  align-self: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.status-chip-pending,
.status-chip-processing {
  color: #9a6a16;
  background: rgba(176, 120, 28, 0.12);
}

.status-chip-sent {
  color: #176848;
  background: rgba(23, 104, 72, 0.12);
}

.status-chip-failed {
  color: #a13d31;
  background: rgba(161, 61, 49, 0.12);
}

.status-chip-disabled {
  color: #536478;
  background: rgba(96, 112, 134, 0.12);
}

.token-chip-field {
  display: grid;
  gap: 10px;
}

.token-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 20px;
}

.token-chip {
  gap: 8px;
  color: #255f4f;
  background: rgba(37, 95, 79, 0.12);
}

.token-chip-remove {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.token-chip-input {
  width: 100%;
}

.agenda-results-footer {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 14px;
}

#agenda-load-more-sentinel {
  width: 100%;
  height: 1px;
}

.load-more-sentinel {
  width: 100%;
  height: 1px;
}

.inline-form-table {
  width: min(560px, 92vw);
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(39, 76, 60, 0.1);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.96);
}

.card-actions form {
  margin: 0;
}

.edit-box summary {
  list-style: none;
}

.edit-box summary::-webkit-details-marker {
  display: none;
}

.edit-box[open] {
  display: grid;
  gap: 12px;
}

.panel-accordion {
  display: grid;
  gap: 16px;
}

.panel-accordion summary {
  list-style: none;
}

.panel-accordion summary::-webkit-details-marker {
  display: none;
}

.panel-accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.panel-accordion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  font-size: 1.4rem;
  transition: transform 0.18s ease;
}

.panel-accordion[open] .panel-accordion-icon {
  transform: rotate(180deg);
}

.panel-accordion-content {
  display: grid;
  gap: 14px;
}

.stool-entry-accordion {
  gap: 10px;
}

.stool-entry-accordion .section-kicker {
  margin-bottom: 0;
}

.stool-entry-accordion .panel-accordion-summary {
  align-items: center;
}

.stool-entry-accordion .panel-accordion-icon {
  width: 38px;
  height: 38px;
}

.stool-entry-form {
  gap: 10px;
}

.stool-photo-field {
  margin-top: 2px;
}

.stool-ai-analysis-field {
  margin-top: -2px;
}

.inline-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(39, 76, 60, 0.12);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(127, 154, 161, 0.14);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
}

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

.metrics-grid div:last-child {
  grid-column: 1 / -1;
}

.metrics-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.metrics-grid-single div:last-child {
  grid-column: auto;
}

dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.empty-state {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.54);
  border: 1px dashed rgba(39, 76, 60, 0.2);
}

.evolution-status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.evolution-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #a13d31;
  box-shadow: 0 0 0 4px rgba(161, 61, 49, 0.12);
}

.evolution-status-inline-label {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.evolution-status-inline-detail {
  margin: 0 0 8px;
}

.evolution-status-connected .evolution-status-dot {
  background: #176848;
  box-shadow: 0 0 0 4px rgba(23, 104, 72, 0.12);
}

.evolution-status-connected .evolution-status-inline-label {
  color: #176848;
}

.evolution-status-connecting .evolution-status-dot {
  background: #9a6a16;
  box-shadow: 0 0 0 4px rgba(176, 120, 28, 0.12);
}

.evolution-status-connecting .evolution-status-inline-label {
  color: #9a6a16;
}

.evolution-status-disconnected .evolution-status-inline-label,
.evolution-status-unavailable .evolution-status-inline-label,
.evolution-status-not_configured .evolution-status-inline-label {
  color: #a13d31;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 32px 24px 56px;
  }

  .auth-layout {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

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

  .stats-grid,
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

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

  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics-grid div:last-child {
    grid-column: auto;
  }

  .card-actions {
    justify-content: flex-start;
  }

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

@media (min-width: 1100px) {
  .filter-form {
    grid-template-columns: 160px repeat(3, minmax(0, 1fr)) auto;
  }

  .filter-form .button {
    width: auto;
  }

  .chart-grid,
  .stats-grid-analytics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 759px) {
  .stool-photo-trigger {
    width: fit-content;
    justify-content: center;
    min-height: 48px;
  }

  .stool-datetime-grid {
    gap: 10px;
  }

  .stool-datetime-field {
    padding: 9px 34px 9px 10px;
  }

  .stool-datetime-field input {
    font-size: 0.82rem;
  }

  .stool-datetime-field svg {
    right: 10px;
    width: 16px;
    height: 16px;
  }

  .stool-scale-card {
    padding: 18px;
    border-radius: 18px;
  }

  .stool-scale-head {
    align-items: flex-start;
  }

  .stool-range-value {
    max-width: 62%;
    font-size: 0.98rem;
  }

  .stats-grid-analytics {
    grid-template-columns: minmax(0, 1fr);
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tbody {
    display: grid;
    gap: 12px;
  }

  .data-table tr {
    overflow: hidden;
    border: 1px solid rgba(39, 76, 60, 0.1);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.6);
  }

  .data-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(39, 76, 60, 0.08);
    text-align: left;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    display: block;
    flex: 0 0 118px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .data-table td > * {
    min-width: 0;
    flex: 1 1 auto;
  }

  .data-table td[data-label="Descrição"],
  .data-table td[data-label="Estimativa nutricional"],
  .data-table td[data-label="Análise IA"],
  .data-table td[data-label="Observação"],
  .data-table td[data-label="Resumo da IA"],
  .data-table td[data-label="Arquivo"],
  .data-table td[data-label="Orientação"] {
    display: block;
  }

  .data-table td[data-label="Descrição"]::before,
  .data-table td[data-label="Estimativa nutricional"]::before,
  .data-table td[data-label="Análise IA"]::before,
  .data-table td[data-label="Observação"]::before,
  .data-table td[data-label="Resumo da IA"]::before,
  .data-table td[data-label="Arquivo"]::before,
  .data-table td[data-label="Orientação"]::before {
    margin-bottom: 6px;
  }

  .data-table td[data-label="Descrição"] > *,
  .data-table td[data-label="Estimativa nutricional"] > *,
  .data-table td[data-label="Análise IA"] > *,
  .data-table td[data-label="Observação"] > *,
  .data-table td[data-label="Resumo da IA"] > *,
  .data-table td[data-label="Arquivo"] > *,
  .data-table td[data-label="Orientação"] > * {
    width: 100%;
  }

  .data-table td[data-label="Foto"] > * {
    width: fit-content;
  }

  .table-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .data-table td[data-label="Ações"] {
    display: grid;
    gap: 10px;
    text-align: left;
  }

  .data-table td[data-label="Ações"]::before {
    margin-bottom: 0;
  }

  .inline-form-table {
    width: 100%;
  }

  .meal-thumb {
    width: 60px;
    height: 60px;
  }

  .meal-nutrition-cell {
    min-width: 0;
  }

  .medication-history-head {
    flex-direction: column;
  }

  .dose-accordion-summary {
    align-items: flex-start;
  }

  .dose-summary-main {
    align-items: flex-start;
  }
}

@media (min-width: 980px) {
  body.has-pwa-install-banner {
    padding-bottom: 48px;
  }

  .pwa-install-banner {
    max-width: 420px;
    left: auto;
  }

  .stool-scale-card {
    max-width: 720px;
  }

  .shell-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    box-shadow: none;
    transform: none;
  }

  .sidebar-overlay,
  .nav-open,
  .nav-close {
    display: none;
  }

  .app-shell-auth {
    padding: 28px 28px 56px;
  }

  .mobile-topbar {
    display: none;
  }
}
.health-agenda-page {
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
}

.health-hero {
  display: grid;
  gap: 24px;
  padding: 28px;
  color: #fff;
  border: 0;
  background:
    radial-gradient(circle at 88% 12%, rgba(255,255,255,.2), transparent 24%),
    linear-gradient(135deg, #123d8f 0%, #2563eb 56%, #0f766e 130%);
  box-shadow: 0 26px 54px rgba(30, 64, 175, .22);
}

.health-hero::after {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 66%);
}

.health-hero-copy,
.health-summary-copy,
.health-section-head,
.health-event-date,
.health-event-topline,
.health-card-actions,
.health-submit-row,
.health-form-section-title,
.health-exam-column-head {
  display: flex;
  align-items: center;
}

.health-hero-copy {
  position: relative;
  z-index: 1;
  gap: 18px;
}

.health-hero .section-kicker,
.health-hero .hero-text {
  color: rgba(255,255,255,.78);
}

.health-hero h1 {
  font-size: clamp(2.35rem, 5vw, 4.2rem);
}

.health-hero-icon {
  display: grid;
  place-items: center;
  width: 64px;
  min-width: 64px;
  height: 64px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 22px;
  background: rgba(255,255,255,.14);
  font-size: 2rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
}

.health-hero-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.health-stat {
  display: grid;
  gap: 2px;
  padding: 13px 15px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  color: #fff;
  background: rgba(255,255,255,.1);
  text-decoration: none;
}

.health-stat strong { font-size: 1.35rem; }
.health-stat span { color: rgba(255,255,255,.74); font-size: .78rem; }

.health-quick-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}

.health-quick-nav::-webkit-scrollbar { display: none; }

.health-quick-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(37,99,235,.12);
  border-radius: 999px;
  color: var(--primary-strong);
  background: rgba(255,255,255,.76);
  box-shadow: 0 8px 20px rgba(37,99,235,.06);
  font-size: .86rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.health-quick-nav a:hover { background: #fff; transform: translateY(-1px); }

.health-section-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.health-section-head-outside { margin: 4px 2px 14px; }
.health-head-action { min-width: 112px; }

.health-empty-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px dashed rgba(37,99,235,.22);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(37,99,235,.045), rgba(15,118,110,.04));
}

.health-empty-state h3,
.health-empty-state p { margin: 0; }
.health-empty-state p { margin-top: 4px; color: var(--muted); }

.health-empty-icon,
.health-summary-icon {
  display: grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--primary);
  background: rgba(37,99,235,.1);
  font-size: 1.35rem;
}

.health-summary-copy { gap: 14px; min-width: 0; }
.health-summary-copy .muted { margin-top: 5px; }
.health-doctor-icon { color: #7c3aed; background: rgba(124,58,237,.1); }
.health-clinic-icon { color: #0f766e; background: rgba(15,118,110,.1); }

.health-form-card { padding: 24px; }
.health-form-content { padding-top: 8px; }
.health-event-form { gap: 18px; }

.health-form-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(77,105,145,.12);
  border-radius: 22px;
  background: rgba(248,251,255,.78);
}

.health-form-section-title { align-items: flex-start; gap: 11px; }
.health-form-section-title > span {
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #4f86f7);
  font-size: .8rem;
  font-weight: 900;
}

.health-form-section-title h3,
.health-form-section-title p { margin: 0; }
.health-form-section-title p { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.health-form-section .field > span { font-weight: 750; }
.health-form-section .field small,
.health-registry-card .field small { color: var(--muted); font-weight: 500; }

.health-three-grid,
.health-notes-grid,
.health-date-row,
.health-reminder-options,
.health-registry-grid,
.health-exam-columns {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.health-date-list { display: grid; gap: 10px; }
.health-date-row { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; }
.health-add-date { justify-self: start; }
.health-remove-date { min-height: 52px; gap: 6px; color: #a13d31; }
.health-notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.health-notes-grid textarea { min-height: 126px; }

.health-reminder-box {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(37,99,235,.15);
  border-radius: 22px;
  background: rgba(37,99,235,.045);
}

.health-reminder-box legend { padding: 0 8px; color: var(--text); font-weight: 850; }
.health-reminder-box > p { margin: 0 0 12px; color: var(--muted); font-size: .85rem; }
.health-reminder-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.health-reminder-option {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(77,105,145,.12);
  border-radius: 17px;
  background: rgba(255,255,255,.78);
  cursor: pointer;
}

.health-reminder-option:has(input:checked) {
  border-color: rgba(37,99,235,.42);
  background: rgba(37,99,235,.08);
  box-shadow: 0 0 0 3px rgba(37,99,235,.06);
}

.health-reminder-option input { width: 18px; height: 18px; accent-color: var(--primary); }
.health-reminder-option span { display: grid; gap: 2px; }
.health-reminder-option strong { font-size: .86rem; }
.health-reminder-option small { color: var(--muted); font-size: .7rem; }

.health-submit-row {
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, #172554, #1e3a8a);
}

.health-submit-row p,
.health-submit-row span { margin: 0; }
.health-submit-row p { display: grid; gap: 3px; }
.health-submit-row p span { color: rgba(255,255,255,.7); font-size: .76rem; }
.health-primary-action { min-width: 210px; background: #fff; color: var(--primary-strong); box-shadow: none; }

.health-registry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.health-registry-card { height: fit-content; }
.health-registry-card .panel-accordion-content { padding-top: 10px; }

.health-event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.health-event-card,
.health-exam-item {
  border: 1px solid rgba(77,105,145,.13);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
}

.health-event-card { display: grid; gap: 12px; padding: 17px; border-top: 4px solid var(--primary); }
.health-event-return { border-top-color: #7c3aed; }
.health-event-exam { border-top-color: #0f766e; }
.health-event-procedure { border-top-color: #d97706; }
.health-event-topline { justify-content: space-between; gap: 8px; }
.health-type-badge,
.health-status-badge,
.health-total-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .69rem;
  font-weight: 850;
}
.health-type-badge { color: var(--primary-strong); background: rgba(37,99,235,.09); }
.health-status-badge { color: var(--success-text); background: var(--success-bg); }
.health-event-date { gap: 10px; color: var(--muted); font-size: .75rem; }
.health-event-date > span:last-child { display: grid; }
.health-event-date strong { color: var(--text); font-size: .95rem; }
.health-event-day { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; background: var(--primary); font-size: 1.15rem; font-weight: 900; }
.health-event-card h3 { font-size: 1.2rem; }
.health-event-meta { margin: 0; color: var(--muted); font-size: .83rem; }
.health-card-actions { gap: 8px; margin-top: 2px; }

.health-total-chip { color: var(--primary-strong); background: rgba(37,99,235,.09); }
.health-exam-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.health-exam-column { min-height: 176px; padding: 14px; border: 1px solid rgba(77,105,145,.12); border-radius: 20px; background: rgba(248,251,255,.76); }
.health-exam-column-head { gap: 10px; padding-bottom: 12px; border-bottom: 1px solid rgba(77,105,145,.1); }
.health-exam-column-head > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: var(--primary); background: rgba(37,99,235,.1); font-weight: 900; }
.health-exam-column-head h3 { font-size: 1rem; }
.health-exam-column-head small { color: var(--muted); font-size: .68rem; }
.health-exam-list { display: grid; gap: 8px; margin-top: 12px; }
.health-exam-item { display: grid; gap: 4px; padding: 11px; }
.health-exam-item span,
.health-exam-item small { color: var(--muted); font-size: .72rem; }
.health-column-empty { display: grid; place-items: center; gap: 4px; min-height: 76px; color: #9aa8ba; }
.health-column-empty span { font-size: 1.5rem; }
.health-column-empty p { margin: 0; font-size: .76rem; }

@media (min-width: 760px) {
  .health-hero { grid-template-columns: minmax(0, 1.5fr) minmax(360px, .8fr); align-items: center; }
  .health-three-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .health-exam-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .health-agenda-page { gap: 14px; }
  .health-hero { padding: 21px; }
  .health-hero-copy { align-items: flex-start; }
  .health-hero-icon { width: 48px; min-width: 48px; height: 48px; border-radius: 16px; font-size: 1.35rem; }
  .health-hero h1 { font-size: 2.25rem; }
  .health-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-section-head { align-items: flex-start; }
  .health-head-action { min-width: auto; }
  .health-empty-state { grid-template-columns: auto minmax(0, 1fr); }
  .health-empty-state .button { grid-column: 1 / -1; width: 100%; }
  .health-form-card { padding: 18px; }
  .health-form-section { padding: 14px; }
  .health-notes-grid,
  .health-reminder-options,
  .health-registry-grid,
  .health-exam-columns { grid-template-columns: 1fr; }
  .health-date-row { grid-template-columns: 1fr 1fr; }
  .health-remove-date { grid-column: 1 / -1; width: 100%; }
  .health-submit-row { display: grid; }
  .health-primary-action { width: 100%; min-width: 0; }
  .health-summary-copy { align-items: flex-start; }
  .health-section-head .health-total-chip { white-space: nowrap; }
}
