:root {
  color-scheme: light;
  --ink: #071f3d;
  --muted: #607281;
  --line: #8fb2cb;
  --surface: #ffffff;
  --soft: #f4f9f9;
  --blue: #155c8d;
  --blue-dark: #074a7a;
  --teal: #43b39f;
  --teal-dark: #1f8d81;
  --accent: #155c8d;
  --mint: #e4f6f2;
  --coral: #fff1ed;
  --gold: #fff4d6;
  --danger: #155c8d;
  --danger-soft: #e4f6f2;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(7, 31, 61, 0.09);
  --shadow-hover: 0 18px 38px rgba(7, 74, 122, 0.15);
  --focus-ring: 0 0 0 3px rgba(21, 92, 141, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(244, 250, 250, 0.5) 0%, rgba(255, 255, 255, 0.42) 48%, rgba(231, 247, 243, 0.5) 100%),
    url("./assets/family-bubbles-background.png") center top / cover fixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 30px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(21, 92, 141, 0.34);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-brand {
  margin-bottom: 28px;
}

.auth-copy {
  margin-bottom: 18px;
}

.auth-copy h1 {
  margin: 0 0 8px;
}

.auth-copy p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-tab {
  display: grid;
  place-items: center;
  min-height: 40px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 750;
  text-decoration: none;
}

.auth-tab.active {
  color: var(--ink);
  background: #fff;
  border-color: rgba(67, 179, 159, 0.36);
  box-shadow: 0 8px 18px rgba(7, 31, 61, 0.05);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-submit {
  width: 100%;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: #a23a2a;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100vh;
  padding: 26px 18px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid rgba(21, 92, 141, 0.34);
  box-shadow: 12px 0 34px rgba(7, 31, 61, 0.06);
  backdrop-filter: blur(22px);
}

.brand,
.nav-item,
.topbar,
.section-heading,
.appointment-row,
.reminder-row,
.member-card,
.profile-hero,
.modal-card header,
.modal-card footer {
  display: flex;
  align-items: center;
}

.brand {
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 2px 4px 8px;
}

.brand strong {
  display: block;
  font-size: 1.12rem;
}

.brand-wordmark {
  font-weight: 850;
  letter-spacing: 0;
}

.brand-wordmark-dark {
  color: #071f3d;
}

.brand-wordmark-teal {
  color: var(--teal);
}

.brand small,
.eyebrow,
.summary-card span,
.field span,
dt,
small {
  color: var(--muted);
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid #8fb2cb;
  box-shadow: 0 8px 18px rgba(7, 74, 122, 0.1);
}

.brand-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.user-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.user-panel strong,
.user-panel small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-panel .text-button {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 28px;
}

.nav-item {
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  text-align: left;
  font-weight: 750;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(67, 179, 159, 0.13), rgba(21, 92, 141, 0.1));
  border-color: rgba(67, 179, 159, 0.28);
}

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

.sidebar-calendar {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(244, 249, 249, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(7, 31, 61, 0.05);
}

.calendar-picture {
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(7, 31, 61, 0.07);
}

.calendar-picture img {
  display: block;
  width: min(190px, 100%);
  aspect-ratio: 1;
}

.sidebar-about-link {
  margin-top: -10px;
}

.sidebar-calendar-heading {
  display: block;
}

.calendar-select-label {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.calendar-select-label span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.calendar-select-label select {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.calendar-select-label select:focus {
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
  outline: none;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
}

.calendar-day.muted {
  visibility: hidden;
}

.calendar-day.today {
  color: #fff;
  background: var(--blue-dark);
}

.calendar-day.has-event:not(.today) {
  color: #0f5f57;
  background: var(--mint);
}

.calendar-day:hover,
.calendar-day:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}

.nav-icon,
.search-icon,
.plus-mark,
.x-icon,
.trash-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.calendar-icon {
  border: 2px solid currentColor;
  border-radius: 4px;
}

.calendar-icon::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  width: 100%;
  border-top: 2px solid currentColor;
}

.clock-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.clock-icon::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 7px;
  height: 6px;
  border-left: 2px solid currentColor;
}

.clock-icon::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 7px;
  width: 5px;
  border-top: 2px solid currentColor;
}

.family-icon::before,
.family-icon::after,
.doctor-icon::before,
.doctor-icon::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
}

.family-icon::before {
  width: 8px;
  height: 8px;
  left: 1px;
  top: 1px;
  border-radius: 50%;
}

.family-icon::after {
  width: 16px;
  height: 8px;
  left: 1px;
  bottom: 1px;
  border-radius: 8px 8px 3px 3px;
}

.doctor-icon::before {
  width: 12px;
  height: 14px;
  left: 2px;
  top: 2px;
  border-radius: 4px;
}

.doctor-icon::after {
  width: 8px;
  left: 5px;
  top: 8px;
  border-top: 2px solid currentColor;
}

.search-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 7px;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

.about-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.about-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
}

.about-icon::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
}

.plus-mark::before,
.plus-mark::after,
.x-icon::before,
.x-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  height: 12px;
  border-left: 2px solid currentColor;
}

.plus-mark::after {
  transform: rotate(90deg);
}

.x-icon::before {
  transform: rotate(45deg);
}

.x-icon::after {
  transform: rotate(-45deg);
}

.trash-icon {
  width: 18px;
  height: 18px;
}

.trash-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 3px 3px;
}

.trash-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 12px;
  height: 2px;
  background: currentColor;
  box-shadow: 4px -3px 0 -1px currentColor;
}

.sidebar-action {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  padding: 34px;
}

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

.topbar h1,
.profile-hero h2,
.modal-card h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(660px, 100%);
}

.topbar-account {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
  width: 52px;
  height: 52px;
  max-width: none;
  min-height: 52px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(7, 31, 61, 0.08);
}

.topbar-account.open {
  width: max-content;
  min-width: 142px;
  height: 52px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
}

.account-toggle {
  display: grid;
  grid-template-columns: auto;
  width: 100%;
  height: 100%;
  justify-content: center;
  gap: 0;
  align-items: center;
  padding: 0 2px;
  color: inherit;
  text-align: center;
  background: transparent;
  border: 0;
}

.topbar-account.open .account-toggle {
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  gap: 8px;
}

.topbar-account .avatar.small {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.account-name {
  display: none;
  max-width: 112px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.1;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-account.open .account-name {
  display: block;
}

.topbar-account .text-button {
  min-height: 28px;
  margin-left: 0;
  padding: 0 6px;
  font-size: 0.78rem;
}

.topbar-account > .text-button {
  position: absolute;
  top: calc(100% + 7px);
  z-index: 5;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(7, 31, 61, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.topbar-account > .account-upload {
  right: 74px;
}

.topbar-account > #logoutButton {
  right: 10px;
}

.topbar-account.open:has(.account-name:hover) > .text-button,
.topbar-account.open:has(.account-name:focus-visible) > .text-button,
.topbar-account.open > .text-button:hover,
.topbar-account.open > .text-button:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.account-upload {
  align-items: center;
  cursor: pointer;
}

.search-field,
.large-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  box-shadow: 0 10px 24px rgba(7, 31, 61, 0.04);
}

.search-field input,
.large-search input {
  width: 100%;
  min-width: 0;
  height: 44px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.large-search {
  margin-bottom: 18px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 22px;
}

.dashboard-member-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: end;
  padding: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.dashboard-content {
  display: grid;
  gap: 22px;
  padding-top: 78px;
}

.dashboard-member-bar h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.dashboard-member-bar p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.member-switcher {
  display: grid;
  gap: 7px;
}

.member-switcher span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.member-switcher select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-card,
.panel,
.modal-card,
.profile-hero {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(21, 92, 141, 0.34);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.summary-card,
.panel {
  border-radius: var(--radius);
}

.summary-card {
  min-height: 150px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.summary-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.summary-card p,
.profile-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 22px;
}

.about-panel {
  justify-self: center;
  width: min(760px, 100%);
}

.about-content {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.about-content img {
  width: 100%;
}

.about-content h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.about-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: 0;
}

.section-title-link {
  color: inherit;
  text-decoration: none;
}

.section-title-link:hover,
.section-title-link:focus-visible {
  color: var(--teal-dark);
  outline: none;
}

.button-cluster {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.ghost-button,
.text-button,
.back-button,
.status-pill,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 750;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-dark), var(--teal-dark));
  box-shadow: 0 10px 22px rgba(7, 74, 122, 0.18);
}

.primary-button:hover {
  background: linear-gradient(135deg, #053a62, #187c72);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(7, 74, 122, 0.22);
}

.ghost-button,
.back-button {
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--line);
}

.ghost-button:hover,
.back-button:hover {
  border-color: rgba(67, 179, 159, 0.46);
  box-shadow: 0 10px 22px rgba(7, 31, 61, 0.07);
  transform: translateY(-1px);
}

.danger-button {
  color: var(--blue-dark);
  border-color: #8fb2cb;
  background: var(--mint);
}

.danger-button:hover {
  color: var(--ink);
  border-color: var(--teal);
}

.member-card-actions .ghost-button,
.doctor-card-actions .ghost-button,
.record-actions .ghost-button,
.reminder-entry-actions .ghost-button,
.profile-member-actions .ghost-button,
.document-actions .ghost-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 800;
}

.text-button {
  padding: 0 4px;
  color: var(--blue-dark);
  background: transparent;
}

.text-button:hover {
  color: var(--teal-dark);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  color: var(--muted);
  background: rgba(247, 254, 253, 0.9);
  border-color: var(--line);
}

.action-grid,
.member-grid,
.doctor-grid {
  display: grid;
  gap: 12px;
}

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

.action-card {
  min-height: 118px;
  padding: 16px;
  text-align: left;
  background: rgba(244, 249, 249, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.action-card strong,
.action-card span {
  display: block;
}

.action-card span {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.stack,
.table-list,
.reminder-list {
  display: grid;
  gap: 10px;
}

.appointment-row {
  gap: 14px;
  min-height: 88px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.appointment-row.done {
  opacity: 0.7;
}

.appointment-row > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.appointment-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.appointment-link > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.appointment-row h3,
.member-card h3,
.doctor-card h3,
.info-row h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.appointment-row p,
.member-card p,
.doctor-card p,
.info-row p {
  margin: 0;
  color: var(--muted);
}

.date-chip {
  display: grid;
  place-items: center;
  width: 54px;
  min-width: 54px;
  aspect-ratio: 1;
  color: var(--blue-dark);
  background: linear-gradient(135deg, #fff7dd, #e6f6f2);
  border: 1px solid rgba(67, 179, 159, 0.22);
  border-radius: var(--radius);
}

.date-chip span {
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1;
}

.status-pill {
  padding: 0 12px;
  color: #0f5f57;
  background: var(--mint);
  border-color: #8fb2cb;
}

.reminder-row {
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 12px 14px;
  color: inherit;
  background: linear-gradient(135deg, var(--coral), rgba(228, 246, 242, 0.85));
  border: 1px solid rgba(21, 92, 141, 0.28);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.reminder-entry {
  display: grid;
  gap: 8px;
}

.reminder-entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 12px;
}

.member-grid,
.doctor-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.member-card {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  min-height: 126px;
  padding: 16px;
  color: inherit;
  text-align: left;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.member-card-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.member-card-link > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.member-card-actions {
  display: none;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  padding-top: 0;
  border-top: 0 solid transparent;
}

.member-card:has(.member-card-link:hover) .member-card-actions,
.member-card:has(.member-card-actions:hover) .member-card-actions {
  display: flex;
  padding-top: 10px;
  border-top-width: 1px;
  border-top-color: var(--line);
}

.member-card:hover,
.member-card:focus-within,
.action-card:hover,
.doctor-card:hover,
.appointment-row:hover,
.summary-card:hover,
.summary-card:focus-visible,
.reminder-row:hover,
.reminder-row:focus-visible,
.info-row:hover,
.info-row:focus-visible,
.record-row:hover {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  outline: none;
}

.avatar {
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  aspect-ratio: 1;
  color: var(--blue-dark);
  background: linear-gradient(135deg, var(--mint), #edf4ff);
  border: 1px solid rgba(67, 179, 159, 0.24);
  border-radius: var(--radius);
  font-weight: 850;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.small {
  width: 36px;
}

.avatar.large {
  width: 86px;
  font-size: 1.4rem;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.mini-stats span {
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(244, 249, 249, 0.9);
  border: 1px solid rgba(21, 92, 141, 0.28);
  border-radius: 999px;
  font-size: 0.78rem;
}

.doctor-card,
.info-row,
.document-row {
  display: grid;
  gap: 12px;
  padding: 16px;
  color: inherit;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.doctor-card-link {
  display: grid;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.doctor-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  pointer-events: none;
  transform: translateY(-4px);
  transition: max-height 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.doctor-card:hover .doctor-card-actions,
.doctor-card:focus-within .doctor-card-actions {
  max-height: 52px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.doctor-card.selected {
  border-color: rgba(67, 179, 159, 0.52);
  box-shadow: var(--shadow-hover);
}

.search-result-link {
  color: inherit;
  text-decoration: none;
}

.search-result-link:hover,
.search-result-link:focus-visible {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.search-result-link h3 {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.document-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.document-icon {
  position: relative;
  width: 42px;
  aspect-ratio: 1;
  background: #eef8f6;
  border: 1px solid #8fb2cb;
  border-radius: var(--radius);
}

.document-icon::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 11px;
  width: 18px;
  height: 23px;
  background: #fff;
  border: 2px solid var(--blue-dark);
  border-radius: 3px;
}

.document-icon::after {
  content: "";
  position: absolute;
  top: 16px;
  left: 15px;
  width: 12px;
  box-shadow: 0 0 0 1px var(--teal-dark), 0 6px 0 1px var(--teal-dark), 0 12px 0 1px var(--teal-dark);
}

.document-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  text-decoration: none;
}

.document-actions {
  display: flex;
  gap: 8px;
}

.reminder-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 6px;
}

.dashboard-reminders-tile {
  cursor: pointer;
}

.dashboard-reminders-tile:hover,
.dashboard-reminders-tile:focus-visible {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.doctor-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.doctor-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

dt {
  font-size: 0.8rem;
}

dd {
  margin: 0;
  text-align: right;
}

.profile-hero {
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius);
}

.profile-hero > div:nth-child(2),
.profile-hero > div:first-child {
  flex: 1;
}

.profile-welcome {
  position: relative;
  justify-content: center;
  min-height: 132px;
  padding: 24px 82px 34px;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(120% 85% at 50% -10%, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.82) 44%, rgba(7, 31, 61, 0.2) 100%),
    rgba(255, 255, 255, 0.78);
}

.profile-overview-center {
  display: grid;
  gap: 0;
  margin-top: clamp(48px, 8vh, 96px);
}

.profile-detail-center {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.profile-welcome::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -58px;
  height: 104px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  pointer-events: none;
}

.profile-welcome > div,
.profile-edit-button {
  position: relative;
  z-index: 1;
}

.profile-welcome h2 {
  color: #000;
  font-size: clamp(1.65rem, 3.2vw, 2.5rem);
  font-weight: 500;
  line-height: 1.12;
}

.profile-edit-button {
  position: absolute;
  top: 18px;
  right: 34px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #2e3c46;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(21, 92, 141, 0.2);
  border-radius: 50%;
  box-shadow: 0 14px 28px rgba(7, 31, 61, 0.1);
}

.edit-pencil-icon {
  position: relative;
  width: 28px;
  height: 28px;
  transform: rotate(-42deg);
}

.edit-pencil-icon::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 2px;
  width: 8px;
  height: 21px;
  background: currentColor;
  border-radius: 3px 3px 1px 1px;
  box-shadow: inset 0 -5px 0 rgba(255, 255, 255, 0.9);
}

.edit-pencil-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 8px solid currentColor;
}

.profile-member-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.member-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(21, 92, 141, 0.34);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.appointments-tabs {
  margin-bottom: 16px;
  box-shadow: none;
}

.member-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.member-tab:hover,
.member-tab.active {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(67, 179, 159, 0.13), rgba(21, 92, 141, 0.1));
  border-color: rgba(67, 179, 159, 0.3);
}

.profile-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.profile-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 16px;
  width: min(700px, 100%);
  margin: -24px auto 0;
  position: relative;
  z-index: 1;
}

.profile-overview-tile {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 126px;
  padding: 18px 14px;
  color: inherit;
  text-align: center;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(21, 92, 141, 0.34);
  border-radius: 28px;
  box-shadow: 0 16px 28px rgba(7, 31, 61, 0.16);
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.profile-overview-tile strong {
  color: #000;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
}

.profile-tile-icon {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  color: #2e3c46;
}

.profile-calendar-icon {
  background: url("./assets/appointment-calendar-icon.svg") center / contain no-repeat;
  border: 0;
}

.profile-calendar-icon::before {
  content: none;
}

.profile-calendar-icon::after {
  content: none;
}

.profile-message-icon {
  background: url("./assets/reminder-watch-icon.svg") center / contain no-repeat;
  border: 0;
}

.profile-message-icon::before,
.profile-message-icon::after {
  content: none;
}

.profile-message-icon::before {
  content: none;
}

.profile-message-icon::after {
  content: none;
}

.profile-history-icon {
  background: url("./assets/medical-history-icon.svg") center / contain no-repeat;
  border: 0;
}

.profile-history-icon::before {
  content: none;
}

.profile-doctor-icon {
  background: url("./assets/doctor-shield-icon.svg") center / contain no-repeat;
  border: 0;
}

.profile-doctor-icon::before {
  content: none;
}

.profile-doctor-icon::after {
  content: none;
}

.profile-medication-icon {
  width: 64px;
  background: url("./assets/medication-bottle-icon.svg") center / contain no-repeat;
}

.profile-medication-icon::before,
.profile-medication-icon::after {
  content: none;
}

.profile-incident-icon::before {
  content: none;
}

.profile-incident-icon::after {
  content: none;
}

.profile-history-icon::after {
  content: none;
}

.profile-incident-icon {
  background: url("./assets/incident-alert-icon.svg") center / contain no-repeat;
}

.overview-entry-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.overview-entry-list li {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.overview-entry-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-overview-tile:hover,
.profile-overview-tile:focus-visible {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  outline: none;
}

.profile-single-tab {
  display: grid;
  gap: 18px;
}

.medical-history-section {
  grid-column: 1 / -1;
}

.medical-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

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

.medical-history-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px;
  color: inherit;
  background: rgba(244, 249, 249, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.medical-history-list-item span {
  font-weight: 850;
}

.medical-history-list-item:hover,
.medical-history-list-item:focus-visible {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  outline: none;
}

.diagnosis-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

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

.record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.record-row-link {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.record-row h3,
.record-row p {
  margin: 0;
}

.record-row p {
  color: var(--muted);
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.record-row:focus-within {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
}

.danger-button {
  color: var(--blue-dark);
  border-color: #8fb2cb;
  background: var(--mint);
}

.history-group {
  min-width: 0;
}

.history-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.history-group h3 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.history-group-box {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 12px;
  background: rgba(244, 249, 249, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-add-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--blue-dark);
  background: #fff;
  border: 1px solid #8fb2cb;
  border-radius: var(--radius);
  font-weight: 750;
  text-decoration: none;
}

.history-add-button:hover {
  border-color: var(--teal);
}

.secondary-history-action {
  color: #0f5f57;
  border-color: #8fb2cb;
  background: var(--mint);
}

.profile-single-tab .profile-section,
.profile-section:first-child {
  grid-column: 1 / -1;
}

.back-button {
  justify-self: start;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  color: var(--muted);
  background: rgba(244, 249, 249, 0.82);
  border: 1px dashed #8fb2cb;
  border-radius: var(--radius);
  text-align: center;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(7, 31, 61, 0.46);
  backdrop-filter: blur(3px);
}

.modal-card {
  padding: 24px;
  border-radius: var(--radius);
}

.empty-state-link {
  text-decoration: none;
}

.empty-state-link:hover,
.empty-state-link:focus-visible {
  border-color: rgba(67, 179, 159, 0.48);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.modal-card header,
.modal-card footer {
  justify-content: space-between;
  gap: 14px;
}

.modal-card header {
  margin-bottom: 20px;
}

.modal-card footer {
  margin-top: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

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

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

.field:has(textarea),
.field:has(select[multiple]) {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
}

.field input,
.field select {
  height: 44px;
  padding: 0 12px;
}

.field select[multiple] {
  height: 112px;
  padding: 8px;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field:focus-within,
.large-search:focus-within {
  border-color: var(--teal);
  box-shadow: var(--focus-ring);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

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

  .nav-item {
    justify-content: center;
    min-height: 48px;
    font-size: 0;
  }

  .nav-icon {
    margin: 0;
  }

  .sidebar-action {
    margin-top: 0;
  }

  .workspace {
    padding: 22px 16px;
  }

  .topbar,
  .topbar-actions,
  .dashboard-member-bar,
  .split-layout,
  .medical-history-grid,
  .medical-history-list-item,
  .profile-overview-grid,
  .profile-tabs,
  .record-row {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions {
    display: grid;
  }

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

@media (max-width: 640px) {
  .summary-grid,
  .action-grid,
  .form-grid,
  .member-grid,
  .doctor-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero,
  .appointment-row,
  .member-card,
  .reminder-row {
    align-items: flex-start;
  }

  .profile-hero,
  .member-card {
    display: grid;
  }

  .appointment-row {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .document-row {
    grid-template-columns: auto 1fr;
  }

  .document-actions {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .appointment-row .status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .mini-stats {
    margin-left: 0;
  }

  .profile-welcome {
    min-height: 164px;
    padding: 64px 22px 34px;
  }

  .profile-overview-center {
    margin-top: 38px;
  }

  .profile-welcome h2 {
    font-size: 1.5rem;
  }

  .profile-edit-button {
    top: 16px;
    right: calc(50% - 22px);
    width: 44px;
    height: 44px;
  }

  .edit-pencil-icon {
    width: 22px;
    height: 22px;
  }
}
