:root {
  color-scheme: dark;
  --bg: #0b0911;
  --panel: rgba(22, 18, 34, 0.82);
  --panel-strong: rgba(34, 28, 52, 0.92);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f6f1ff;
  --muted: #aaa1bc;
  --violet: #8a5cff;
  --violet-soft: rgba(138, 92, 255, 0.22);
  --gold: #ffd84d;
  --gold-soft: rgba(255, 216, 77, 0.2);
  --danger: #ff677d;
  --warning: #ffcf68;
  --success: #7ee6b0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 216, 77, 0.16), #00000070 28%), radial-gradient(circle at 82% 8%, rgb(72 0 255 / 18%), transparent 32%), linear-gradient(145deg, #08070d 0%, #141020 48%, #000000 100%);
}

html.is-modal-locked {
  overflow: hidden;
  overscroll-behavior: none;
}

body.is-modal-locked {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

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

input,
select,
textarea {
  font-size: 16px;
}

button {
  cursor: pointer;
}
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: grid;
  place-items: center;

  padding: 20px;

  background: rgba(3, 2, 7, 0.72);
  backdrop-filter: blur(12px);
}

.auth-card {
  width: min(100%, 420px);

  border: 1px solid var(--line);
  border-radius: var(--radius);

  padding: 24px;

  background: rgba(22, 18, 34, 0.92);

  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);

  display: grid;
  gap: 18px;

  animation: panelReveal 420ms var(--ease-spring);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

.auth-form[hidden] {
  display: none;
}

.app-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

body.has-schedule-page .app-shell {
  width: min(100%, 1240px);
}

.topbar,
.section-heading,
.form-heading,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-menu {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  gap: 6px;
  border: 1px solid rgba(255, 216, 77, 0.16);
  border-radius: var(--radius);
  padding: 5px;
  background: rgba(53, 57, 72, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.module-menu-button {
  display: inline-flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 3px);
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 950;
  text-align: center;
  white-space: nowrap;
  transition:
    border-color 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.module-menu-button span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  color: #111521;
  background: var(--gold);
  font-size: 0.82rem;
  line-height: 1;
}

.module-menu-button:hover {
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
}

.module-menu-button[aria-pressed="true"] {
  border-color: rgba(255, 216, 77, 0.36);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.16), rgba(138, 92, 255, 0.18));
}

.module-menu-button[aria-pressed="true"] span {
  background: linear-gradient(135deg, var(--gold), #9bb6ff);
}

body.has-dashboard-module .app-view-switch,
body.has-dashboard-module .mobile-view-switch,
body.has-dashboard-module .app-view-switch,
body.has-dashboard-module .mobile-view-switch,
body.has-tasks-module .app-view-switch,
body.has-tasks-module .mobile-view-switch,
body.has-reminders-module .app-view-switch,
body.has-reminders-module .mobile-view-switch {
  display: none;
}

.account-button {
  display: inline-flex;
  min-height: 42px;
  max-width: 190px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px 0 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
  transition:
    border-color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.account-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 216, 77, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.account-button__text {
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 216, 77, 0.34);
  border-radius: 50%;
  color: #100d1a;
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.96), rgba(138, 92, 255, 0.84));
  background-position: center;
  background-size: cover;
  font-size: 0.84rem;
  font-weight: 950;
}

.account-avatar.has-image {
  color: transparent;
}

.account-avatar--large {
  width: 54px;
  height: 54px;
  font-size: 1.2rem;
}

.account-avatar-edit {
  position: relative;
  padding: 0;
  cursor: pointer;
}

.account-avatar-edit::after {
  content: "+";
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--color-surface);
  border-radius: 999px;
  color: #ffffff;
  background: var(--color-primary);
  font-size: 0.8rem;
  font-weight: 950;
}

.push-toast-host {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 9000;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.push-toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid rgba(255, 216, 77, 0.28);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text);
  background: rgba(22, 18, 34, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  animation: softRise 220ms var(--ease-spring) both;
}

.push-toast p,
.push-toast span {
  margin: 0;
}

.push-toast p {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.push-toast span {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--text);
  line-height: 1.4;
}

.push-toast button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 1.1rem;
  line-height: 1;
}

.app-view-switch,
.mobile-view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(108px, 1fr));
  gap: 4px;

  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 4px;
  background: rgba(10, 8, 16, 0.48);
}

.app-view-button {
  min-height: 36px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 4px);
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  transition:
    border-color 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.app-view-button:hover {
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
}

.app-view-button[aria-pressed="true"] {
  border-color: rgba(255, 216, 77, 0.34);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.14), rgba(138, 92, 255, 0.18));
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

button.brand-lockup {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  color: var(--color-primary);
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--color-primary) 32%, transparent));
  transition: color 180ms ease, filter 180ms ease;
}

html[data-theme="dark"] .brand-mark {
  color: color-mix(in srgb, var(--color-primary) 68%, #34d399);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2.5rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.icon-button,
.primary-button,
.ghost-button,
.summary-settings-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  will-change: transform;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out),
    filter 180ms var(--ease-out);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 auto;
  font-size: 1.35rem;
}

.primary-button,
.ghost-button,
.summary-settings-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  font-weight: 800;
}

.primary-button {
  border-color: rgba(255, 216, 77, 0.42);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.95), rgba(138, 92, 255, 0.86));
  color: #100d1a;
  box-shadow: 0 14px 34px rgba(138, 92, 255, 0.26);
}

.install-app-button[hidden] {
  display: none;
}

.ghost-button {
  color: var(--danger);
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.summary-settings-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
}

.icon-button:active,
.primary-button:active,
.ghost-button:active,
.summary-settings-button:active,
.small-button:active {
  transform: translateY(0) scale(0.98);
}

main {
  display: grid;
  gap: 16px;
}

.sidebar {
  display: grid;
  gap: 16px;
}

.sidebar[hidden],
.inventory-section[hidden] {
  display: none;
}

.compact-sidebar {
  display: none;
}

.summary-panel,
.controls-panel,
.compact-sidebar,
.medicine-dialog,
.details-dialog,
.fields-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(10 8 14 / 82%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.summary-panel,
.controls-panel,
.inventory-section {
  animation: panelReveal 520ms var(--ease-spring) both;
}

.controls-panel {
  animation-delay: 70ms;
}

.inventory-section {
  animation-delay: 110ms;
}

.summary-panel {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  padding: 22px;
}

.summary-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-settings-button {
  position: relative;
  z-index: 2;
  min-height: 36px;
  padding: 0 12px;
  color: #fff5c6;
  background: rgba(255, 216, 77, 0.1);
}

.summary-settings-button[aria-expanded="true"] {
  border-color: rgba(255, 216, 77, 0.42);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.14), rgba(138, 92, 255, 0.18));
}

.summary-panel::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(110deg, rgba(255, 216, 77, 0.1), transparent 42%, rgba(138, 92, 255, 0.14));
  pointer-events: none;
}

.orbital-visual {
  position: absolute;
  inset: 14px 16px auto;
  height: 170px;
  opacity: 0.9;
}

.bulb-line {
  position: absolute;
  left: 50%;
  top: 2px;
  width: min(72vw, 360px);
  height: 196px;
  transform: translateX(-50%);
  border: 3px solid transparent;
  border-left-color: var(--gold);
  border-right-color: var(--violet);
  border-top-color: rgba(176, 139, 255, 0.74);
  border-bottom: 0;
  border-radius: 52% 52% 42% 42%;
  filter:
    drop-shadow(-10px 0 15px rgba(255, 216, 77, 0.45))
    drop-shadow(10px 0 15px rgba(138, 92, 255, 0.5));
}

.infinity-line {
  position: absolute;
  left: 50%;
  top: 76px;
  width: 138px;
  height: 50px;
  transform: translateX(-50%) rotate(-2deg);
}

.infinity-line::before,
.infinity-line::after {
  position: absolute;
  top: 0;
  width: 58px;
  height: 42px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 50%;
}

.infinity-line::before {
  left: 9px;
  transform: rotate(38deg);
  box-shadow: 0 0 20px rgba(255, 216, 77, 0.22);
}

.infinity-line::after {
  right: 9px;
  transform: rotate(-38deg);
  box-shadow: 0 0 20px rgba(138, 92, 255, 0.26);
}

.stem {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 52px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
}

.stem-left {
  left: calc(50% - 38px);
}

.stem-right {
  left: calc(50% + 38px);
  background: rgba(138, 92, 255, 0.72);
}

.summary-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 132px;
}

.summary-card,
.medicine-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.summary-card {
  display: block;
  width: 100%;
  color: inherit;
  text-align: left;
  padding: 12px;
  animation: softRise 420ms var(--ease-spring) both;
  cursor: pointer;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.summary-card:nth-child(2) {
  animation-delay: 70ms;
}

.summary-card:nth-child(3) {
  animation-delay: 120ms;
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.075);
}

.summary-card:active {
  transform: translateY(0) scale(0.985);
}

.summary-card[aria-pressed="true"] {
  border-color: rgba(255, 216, 77, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 216, 77, 0.08), 0 12px 28px rgba(138, 92, 255, 0.14);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.1), rgba(138, 92, 255, 0.12));
}

.metric {
  display: block;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 900;
}

.metric.danger {
  color: var(--danger);
}

.metric.warning {
  color: var(--warning);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.controls-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.controls-panel[hidden] {
  display: none;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text);
  background: rgba(10, 8, 16, 0.76);
  font-size: 16px;
  line-height: 1.25;
  outline: none;
  touch-action: manipulation;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    background 180ms var(--ease-out),
    transform 180ms var(--ease-spring);
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(138, 92, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(138, 92, 255, 0.16);
  transform: translateY(-1px);
}

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

.name-field {
  position: relative;
}

.name-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.scan-button {
  min-width: 86px;
  padding-inline: 14px;
}

.catalog-suggestions {
  display: grid;
  gap: 8px;
  max-height: min(360px, 42dvh);
  margin-top: -4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(14, 17, 28, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  -webkit-overflow-scrolling: touch;
}

.catalog-suggestions[hidden] {
  display: none;
}

.catalog-suggestions::-webkit-scrollbar {
  width: 7px;
}

.catalog-suggestions::-webkit-scrollbar-track {
  background: transparent;
}

.catalog-suggestions::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.catalog-suggestion {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
}

.catalog-suggestion:hover {
  border-color: rgba(255, 216, 77, 0.38);
  background: rgba(255, 255, 255, 0.08);
}

.catalog-suggestion img,
.catalog-suggestion__mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.catalog-suggestion__mark {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 900;
}

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

.catalog-suggestion__meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.catalog-suggestion__meta em {
  display: inline-flex;
  max-width: 42%;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  overflow: hidden;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-suggestion small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.catalog-suggestion__meta small {
  flex: 1;
  margin-top: 0;
}

.scanner-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 216, 77, 0.22);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 216, 77, 0.06);
}

.scanner-panel[hidden] {
  display: none;
}

.scanner-video {
  width: 100%;
  max-height: 280px;
  border-radius: calc(var(--radius) - 2px);
  background: #080b14;
  object-fit: cover;
}

.scanner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scanner-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.medicine-image-preview,
.details-image,
.medicine-card-media {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: rgba(255, 255, 255, 0.045);
}

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

.medicine-image-preview img,
.details-image img,
.medicine-card-media img {
  display: block;
  width: 100%;
  max-height: 260px;
  border-radius: calc(var(--radius) - 2px);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
}

.medicine-card-media {
  position: relative;
  display: grid;
  min-height: 118px;
  place-items: center;
  overflow: hidden;
}

.medicine-card-media img {
  height: 118px;
  max-height: 118px;
  object-fit: cover;
}

.medicine-card-media.is-generated,
.details-image.is-generated {
  padding: 0;
  background: transparent;
}

.medicine-card-media.is-generated img,
.details-image.is-generated img {
  height: 100%;
  max-height: none;
  border-radius: inherit;
  object-fit: cover;
}

.details-image {
  display: grid;
  min-height: 180px;
  place-items: center;
}

.medicine-media-fallback {
  display: none;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 18px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.medicine-media-fallback .ui-icon {
  width: 28px;
  height: 28px;
}

.medicine-card-media.is-empty .medicine-media-fallback,
.medicine-card-media.is-broken .medicine-media-fallback,
.details-image.is-empty .medicine-media-fallback,
.details-image.is-broken .medicine-media-fallback {
  display: grid;
}

.medicine-row-card {
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 104px;
}

.medicine-list-media {
  position: relative;
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--color-primary, #2563eb) 16%, var(--line));
  border-radius: 24px;
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.46), transparent 34%),
    linear-gradient(145deg, var(--medicine-art-a, #60a5fa), var(--medicine-art-b, #22c55e));
}

.medicine-list-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.medicine-list-media.has-image {
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-border));
}

.medicine-list-media.has-image.is-broken {
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.46), transparent 34%),
    linear-gradient(145deg, #60a5fa, #22c55e);
}

.medicine-list-media.has-image .medicine-pill-art {
  display: none;
}

.medicine-list-media.has-image.is-broken .medicine-pill-art {
  display: grid;
}

.medicine-pill-art {
  position: relative;
  display: grid;
  width: 42px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.18);
  transform: rotate(-22deg);
}

.medicine-pill-art::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 1px;
  content: "";
  background: color-mix(in srgb, var(--medicine-art-a, #2563eb) 52%, transparent);
}

.medicine-pill-art span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--medicine-art-a, #2563eb) 24%, transparent);
  transform: translateX(-8px);
}

.medicine-row-body {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.medicine-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.medicine-row-head h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medicine-row-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.medicine-row-meta strong {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 950;
}

.medicine-row-meta span,
.medicine-row-note {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medicine-row-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.medicine-row-extra {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.medicine-row-extra > span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.055);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medicine-row-actions {
  gap: 6px;
  justify-content: flex-end;
}

.medicine-row-actions .quantity-stepper {
  grid-template-columns: 28px minmax(28px, auto) 28px;
  gap: 2px;
  min-height: 28px;
  border-radius: 10px;
  padding: 2px;
}

.medicine-row-actions .quantity-button {
  width: 28px;
  height: 24px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.medicine-row-actions .quantity-value {
  min-width: 28px;
  font-size: 0.76rem;
}

.medicine-row-actions .small-button {
  min-height: 28px;
  border-radius: 10px;
  padding: 0 8px;
  font-size: 0.78rem;
}

@media (max-width: 620px) {
  .medicine-row-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    min-height: 92px;
  }

  .medicine-list-media {
    width: 64px;
    height: 64px;
    border-radius: 20px;
  }

  .medicine-row-actions {
    grid-column: 2;
    gap: 6px;
    justify-content: flex-start;
  }

  .medicine-row-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .medicine-row-head .pill {
    width: max-content;
  }

  .medicine-row-extra {
    display: none;
  }

  .name-search-row,
  .scanner-actions {
    grid-template-columns: 1fr;
  }

  .name-search-row {
    display: grid;
  }

  .scan-button,
  .scanner-actions .ghost-button {
    width: 100%;
  }

  .scanner-actions {
    display: grid;
  }
}

.dynamic-filter-grid {
  margin-top: 2px;
}

.view-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 4px;
  background: rgba(10, 8, 16, 0.64);
}

.view-mode-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 4px);
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.view-mode-button:hover {
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
}

.view-mode-button[aria-pressed="true"] {
  border-color: rgba(255, 216, 77, 0.34);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.14), rgba(138, 92, 255, 0.18));
  box-shadow: 0 10px 24px rgba(138, 92, 255, 0.16);
}

.compact-nav-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.compact-nav-button:hover {
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
}

.compact-nav-button[aria-pressed="true"] {
  border-color: rgba(255, 216, 77, 0.34);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.14), rgba(138, 92, 255, 0.18));
  box-shadow: 0 10px 24px rgba(138, 92, 255, 0.16);
}

.compact-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid rgba(255, 216, 77, 0.42);
  border-radius: 999px;
  padding: 0 14px;
  color: #100d1a;
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.95), rgba(138, 92, 255, 0.86));
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 14px 34px rgba(138, 92, 255, 0.26);
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.compact-add-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
}

.inventory-section {
  display: grid;
  gap: 14px;
  padding: 6px 0 90px;
}

.schedule-section {
  display: grid;
  gap: 14px;
  padding: 6px 0 90px;
  animation: panelReveal 520ms var(--ease-spring) both;
}

.schedule-section[hidden] {
  display: none;
}

.week-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-filter-switch {
  display: inline-grid;
  grid-template-columns: repeat(5, minmax(0, auto));
  justify-self: start;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 4px;
  background: rgba(10, 8, 16, 0.56);
}

.schedule-filter-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 4px);
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  transition:
    border-color 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.schedule-filter-button:hover {
  color: var(--text);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
}

.schedule-filter-button[aria-pressed="true"] {
  border-color: rgba(255, 216, 77, 0.34);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.14), rgba(138, 92, 255, 0.18));
}

.schedule-kanban {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  padding-bottom: 6px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.schedule-day-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  min-height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.schedule-day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px auto;
  align-items: flex-start;
  gap: 8px;
}

.schedule-day-head span {
  display: block;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
}

.schedule-day-head strong {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.schedule-day-add {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  color: var(--color-primary, #ffd84d);
  background: color-mix(in srgb, var(--color-primary, #ffd84d) 10%, transparent);
  cursor: pointer;
}

.schedule-day-add .ui-icon {
  width: 18px;
  height: 18px;
}

.schedule-day-items {
  display: grid;
  gap: 8px;
}

.schedule-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--schedule-color, #ffd84d) 26%, transparent);
  border-radius: var(--radius);
  padding: 9px;
  background: color-mix(in srgb, var(--schedule-soft, rgba(255, 216, 77, 0.14)) 74%, rgba(10, 8, 16, 0.54));
  cursor: pointer;
  transition:
    border-color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.schedule-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--schedule-color, #ffd84d) 52%, transparent);
  background: color-mix(in srgb, var(--schedule-soft, rgba(255, 216, 77, 0.14)) 92%, rgba(255, 255, 255, 0.07));
}

.schedule-item:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--schedule-color, #ffd84d) 34%, transparent);
  outline-offset: 2px;
}

.schedule-item.is-task {
  --schedule-color: var(--module-tasks, #2563eb);
  --schedule-soft: var(--module-tasks-soft, #dbeafe);
}

.schedule-item.is-reminder {
  --schedule-color: var(--module-reminders, #f59e0b);
  --schedule-soft: var(--module-reminders-soft, #fef3c7);
}

.schedule-item.is-medicine {
  --schedule-color: var(--module-medicine, #22c55e);
  --schedule-soft: var(--module-medicine-soft, #dcfce7);
}

.schedule-item.is-shopping {
  --schedule-color: var(--module-shopping, #ec4899);
  --schedule-soft: var(--module-shopping-soft, #fce7f3);
}

.schedule-item.is-document {
  --schedule-color: var(--module-documents, #8b5cf6);
  --schedule-soft: var(--module-documents-soft, #ede9fe);
}

.schedule-item.is-expenses {
  --schedule-color: var(--module-expenses, #06b6d4);
  --schedule-soft: var(--module-expenses-soft, #cffafe);
}

.schedule-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #ffffff;
  background: var(--schedule-color, #ffd84d);
}

.schedule-time {
  display: inline-grid;
  min-width: 44px;
  max-width: 100%;
  min-height: 30px;
  justify-self: start;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--schedule-color, #100d1a);
  background: color-mix(in srgb, var(--schedule-color, #ffd84d) 14%, #ffffff);
  font-size: 0.76rem;
  font-weight: 900;
}

.schedule-status-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  justify-items: start;
  border: 1px solid var(--color-border);
  border-radius: var(--family-radius, 16px);
  padding: 18px;
  background: var(--color-surface);
}

.schedule-status-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-weight: 700;
}

.schedule-item-skeleton {
  min-height: 82px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.26), rgba(148, 163, 184, 0.12));
  background-size: 220% 100%;
  animation: family-skeleton 1.2s ease-in-out infinite;
}

.schedule-item h3,
.schedule-item p {
  min-width: 0;
  margin: 0;
}

.schedule-item h3 {
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.schedule-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.medicine-list {
  display: grid;
  gap: 12px;
}

.medicine-list.is-grid {
  grid-template-columns: 1fr;
  align-items: start;
}

.medicine-list.is-kanban {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.kanban-column {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.kanban-column.is-valid {
  border-color: rgba(126, 230, 176, 0.18);
}

.kanban-column.is-soon {
  border-color: rgba(255, 207, 104, 0.22);
}

.kanban-column.is-expired {
  border-color: rgba(255, 103, 125, 0.22);
}

.kanban-column__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 900;
}

.kanban-count {
  display: inline-flex;
  min-width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  background: rgba(10, 8, 16, 0.56);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transform: translateY(1px);
}

.kanban-items {
  display: grid;
  gap: 10px;
}

.kanban-empty {
  margin: 0;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.schedule-empty {
  display: grid;
  gap: 10px;
  text-align: left;
}

.schedule-empty p {
  margin: 0;
  text-align: center;
}

.schedule-empty > .small-button {
  width: 100%;
  min-height: 40px;
}

.quick-schedule-form {
  display: grid;
  gap: 10px;
}

.quick-schedule-form[hidden] {
  display: none;
}

.quick-schedule-row {
  display: grid;
  gap: 8px;
}

.quick-schedule-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.quick-schedule-actions .ghost-button,
.quick-schedule-actions .primary-button {
  min-height: 40px;
  padding: 0 10px;
}

.medicine-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  animation: cardReveal 360ms var(--ease-spring) both;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.medicine-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

.medicine-card[role="button"] {
  cursor: pointer;
}

.medicine-card:focus-visible {
  outline: 3px solid rgba(255, 216, 77, 0.34);
  outline-offset: 3px;
}

.medicine-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.medicine-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.card-meta,
.card-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0 10px;
  color: #ddd5ee;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.expired {
  border-color: rgba(255, 103, 125, 0.38);
  color: #ffc4ce;
  background: rgba(255, 103, 125, 0.12);
}

.pill.soon {
  border-color: rgba(255, 207, 104, 0.4);
  color: #ffe4aa;
  background: rgba(255, 207, 104, 0.12);
}

.pill.valid {
  border-color: rgba(126, 230, 176, 0.36);
  color: #c3ffdd;
  background: rgba(126, 230, 176, 0.1);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quantity-stepper {
  display: inline-grid;
  grid-template-columns: 34px minmax(34px, auto) 34px;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  padding: 3px;
  background: rgba(10, 8, 16, 0.5);
}

.quantity-button {
  display: grid;
  width: 34px;
  height: 28px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 3px);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.quantity-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 216, 77, 0.34);
  background: rgba(255, 216, 77, 0.12);
  box-shadow: 0 8px 18px rgba(138, 92, 255, 0.12);
}

.quantity-button:active {
  transform: translateY(0) scale(0.96);
}

.quantity-value {
  min-width: 34px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 900;
  text-align: center;
}

.medicine-list.is-grid .card-actions,
.medicine-list.is-kanban .card-actions {
  align-items: stretch;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.small-button {
  min-height: 34px;
  border: 1px solid rgba(138, 92, 255, 0.34);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--text);
  background: rgba(138, 92, 255, 0.12);
  font-weight: 800;
  transition:
    border-color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.small-button:hover {
  transform: translateY(-1px);
  border-color: rgba(138, 92, 255, 0.58);
  background: rgba(138, 92, 255, 0.2);
}

.empty-state {
  margin: 10px 0 0;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog {
  width: min(calc(100% - 28px), 560px);
  padding: 0;
  color: var(--text);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition:
    display 220ms allow-discrete,
    overlay 220ms allow-discrete,
    opacity 220ms var(--ease-out),
    transform 220ms var(--ease-spring);
}

.medicine-dialog[open],
.details-dialog[open],
.fields-dialog[open],
.account-dialog[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.medicine-dialog::backdrop,
.details-dialog::backdrop,
.fields-dialog::backdrop,
.account-dialog::backdrop {
  background: rgba(3, 2, 7, 0);
  backdrop-filter: blur(8px);
  transition: background 220ms var(--ease-out);
}

.medicine-dialog[open]::backdrop,
.details-dialog[open]::backdrop,
.fields-dialog[open]::backdrop,
.account-dialog[open]::backdrop {
  background: rgba(3, 2, 7, 0.72);
}

.medicine-form,
.details-panel,
.fields-form,
.account-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.account-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.08), rgba(138, 92, 255, 0.12));
}

.account-summary p,
.account-summary span {
  margin: 0;
}

.account-summary p {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 900;
}

.account-summary span {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.account-info-grid div {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.account-info-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.account-info-grid strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.9rem;
}

.password-form {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.password-form .primary-button {
  justify-self: start;
}

.account-message {
  min-height: 1.1em;
  margin: 0;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 800;
}

.account-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.account-menu button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.88rem;
  font-weight: 850;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  border-color: rgba(111, 149, 255, 0.42);
  background: rgba(111, 149, 255, 0.14);
}

.account-section {
  scroll-margin-top: 14px;
}

.account-notifications-section {
  display: grid;
  gap: 12px;
}

.account-notification-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(42, 121, 255, 0.16), rgba(28, 199, 132, 0.1));
}

.account-notification-status__icon,
.ios-settings-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #2f80ed, #1cc784);
  box-shadow: 0 10px 24px rgba(47, 128, 237, 0.22);
}

.account-notification-status__icon .ui-icon,
.ios-settings-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.account-notification-status strong,
.account-notification-status span {
  display: block;
}

.account-notification-status strong {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 900;
}

.account-notification-status span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.account-notification-status .push-button {
  min-width: 128px;
  white-space: nowrap;
}

.ios-settings-list {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.065);
}

.ios-settings-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px;
  cursor: pointer;
}

.ios-settings-row + .ios-settings-row {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.ios-settings-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ios-settings-copy strong {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 900;
}

.ios-settings-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.28;
}

.ios-switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 32px;
  flex: 0 0 auto;
}

.ios-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ios-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.55);
  transition: background 180ms var(--ease-out);
}

.ios-switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.24);
  transition: transform 180ms var(--ease-spring);
  content: "";
}

.ios-switch input:checked + span {
  background: #34c759;
}

.ios-switch input:checked + span::after {
  transform: translateX(20px);
}

.ios-switch input:focus-visible + span {
  outline: 3px solid rgba(47, 128, 237, 0.38);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .account-notification-status {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-notification-status .push-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .ios-settings-row {
    min-height: 74px;
    padding: 12px 10px;
  }
}

.install-app-message {
  margin: 0 0 -4px;
  color: var(--muted);
  line-height: 1.45;
}

.group-panel {
  gap: 12px;
}

.group-helper {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.group-tools {
  display: grid;
  gap: 10px;
}

.group-active-info {
  display: grid;
  gap: 10px;
}

.group-primary-action {
  width: 100%;
  min-height: 50px;
}

.group-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.group-code span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.group-code strong {
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.group-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-members span,
.shared-pill {
  border: 1px solid rgba(111, 149, 255, 0.34);
  border-radius: 999px;
  padding: 6px 10px;
  color: #c8d6ff;
  background: rgba(111, 149, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 800;
}

.medicine-card.is-shared {
  border-style: dashed;
}

.details-content {
  display: grid;
  gap: 12px;
}

.details-hero {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.08), rgba(138, 92, 255, 0.12));
}

.details-hero p,
.details-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.details-grid div {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.details-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.details-grid strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.92rem;
}

.details-note {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 12px;
}

.schedule-editor {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.schedule-form-grid {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1fr;
  gap: 10px;
}

.schedule-form-grid[hidden] {
  display: none;
}

.schedule-toggle-button {
  justify-self: start;
}

.schedule-form-grid .primary-button {
  align-self: end;
  min-height: 44px;
}

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

.schedule-rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 9px;
  background: rgba(10, 8, 16, 0.44);
}

.schedule-rule strong,
.schedule-rule span {
  display: block;
}

.schedule-rule strong {
  color: var(--text);
  font-size: 0.88rem;
}

.schedule-rule span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.dynamic-form-fields {
  display: grid;
  gap: 12px;
}

.fields-dialog {
  width: min(calc(100% - 28px), 900px);
}

.fields-settings-layout {
  display: grid;
  gap: 14px;
}

.fields-list {
  display: grid;
  gap: 12px;
  max-height: 42vh;
  overflow: auto;
  padding-right: 2px;
}

.field-config-card,
.field-builder {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  animation: softRise 320ms var(--ease-spring) both;
}

.field-config-card .ghost-button,
.field-builder .ghost-button {
  justify-self: start;
}

.config-card-title {
  margin: 0;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state.compact {
  margin: 0;
  padding: 14px;
  font-size: 0.88rem;
}

.segmented-field,
.multi-choice-field {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 0;
  padding: 0;
}

.segmented-field {
  grid-template-columns: 1fr;
}

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

.segmented-field legend,
.multi-choice-field legend {
  grid-column: 1 / -1;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.segmented-field label,
.choice-grid label {
  position: relative;
}

.segmented-field input,
.choice-grid input {
  position: absolute;
  opacity: 0;
}

.segmented-field span,
.choice-grid span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(10, 8, 16, 0.76);
  font-weight: 800;
  transition:
    border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    background 180ms var(--ease-out);
}

.segmented-field label:hover span,
.choice-grid label:hover span {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
}

.segmented-field input:checked + span,
.choice-grid input:checked + span {
  border-color: rgba(255, 216, 77, 0.48);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.16), rgba(138, 92, 255, 0.2));
  box-shadow: 0 10px 24px rgba(138, 92, 255, 0.16);
}

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

.choice-grid span {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0.82rem;
  text-align: center;
}

.custom-category-field {
  margin-top: 4px;
}

body.pulse .bulb-line {
  animation: pulseGlow 650ms ease;
}

@keyframes pulseGlow {
  50% {
    filter:
      drop-shadow(-14px 0 22px rgba(255, 216, 77, 0.68))
      drop-shadow(14px 0 22px rgba(138, 92, 255, 0.72));
  }
}

/* Final mobile UX layer */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(111, 149, 255, 0.28), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(255, 216, 77, 0.12), transparent 26%),
    rgba(29, 34, 51, 0.96);
  backdrop-filter: blur(14px);
}

.auth-card {
  display: grid;
  width: min(100%, 440px);
  gap: 18px;
  border: 1px solid rgba(210, 218, 235, 0.18);
  border-radius: 12px;
  padding: 22px;
  color: var(--text);
  background: #353948;
  box-shadow: 0 28px 80px rgba(8, 12, 22, 0.42);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand img {
  width: 54px;
  height: 54px;
}

.auth-kicker {
  margin: 0;
  color: #8fb0ff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-title {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 1.45rem;
}

.auth-copy {
display:none;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid rgba(210, 218, 235, 0.14);
  border-radius: 10px;
  padding: 4px;
  background: #2a2f3f;
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #aeb9d0;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.auth-tab[aria-pressed="true"] {
  color: #ffffff;
  background: #4f75d8;
}

.auth-form,
.auth-field {
  display: grid;
}

.auth-form {
  gap: 12px;
}

.auth-form[hidden] {
  display: none;
}

.auth-field {
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.auth-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(210, 218, 235, 0.18);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #262b3a;
  font-size: 16px;
  outline: none;
}

.auth-input:focus {
  border-color: #8fb0ff;
  background: #293044;
  box-shadow: 0 0 0 3px rgba(111, 149, 255, 0.16);
}

.auth-button {
  min-height: 48px;
  border: 1px solid #6f95ff;
  border-radius: 8px;
  color: #ffffff;
  background: #4f75d8;
  font-weight: 900;
  cursor: pointer;
}

.auth-message {
  min-height: 1.2em;
  margin: 0;
  color: #ffd58a;
  font-size: 0.86rem;
  font-weight: 800;
}

@media (max-width: 759px) {
  body {
    min-height: 100svh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell,
  body.has-schedule-page .app-shell {
    width: 100%;
    padding: max(8px, env(safe-area-inset-top, 0px)) 10px 0;
  }

  main {
    gap: 10px;
  }

  .topbar {
    display: none;
  }

  .mobile-scroll-header {
    position: fixed;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    left: 10px;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 62px;
    margin: 0;
    border: 1px solid rgba(210, 218, 235, 0.16);
    border-radius: 14px;
    padding: 7px;
    background: rgba(53, 57, 72, 0.96);
    box-shadow: 0 18px 44px rgba(6, 9, 18, 0.38);
    backdrop-filter: blur(16px);
  }

  .mobile-view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    border: 0;
    padding: 0;
    background: transparent;
  }

  .mobile-view-switch .app-view-button {
    min-height: 48px;
    border-radius: 10px;
    padding: 0 8px;
    font-size: 0.92rem;
  }

  .mobile-account-button {
    width: 50px;
    min-width: 50px;
    min-height: 48px;
    border-radius: 10px;
    padding: 0;
  }

  .mobile-account-button .account-button__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .sidebar {
    gap: 10px;
  }

  .summary-panel {
    min-height: auto;
    border-radius: 10px;
    padding: 12px;
  }

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

  .summary-settings-button {
    min-height: 44px;
    padding: 0 10px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
  }

  .summary-card {
    min-height: 66px;
    padding: 8px 6px;
  }

  .metric {
    font-size: 1.15rem;
  }

  .metric-label {
    font-size: 0.68rem;
    line-height: 1.15;
  }

  .controls-panel,
  .inventory-section,
  .schedule-section {
    border-radius: 10px;
    padding: 12px;
  }

  .inventory-section,
  .schedule-section {
    padding-bottom: 88px;
  }

  .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .section-heading h2 {
    font-size: 1.2rem;
  }

  .section-heading .primary-button {
    min-height: 44px;
    padding: 0 12px;
  }

  .filter-grid,
  .dynamic-filter-grid,
  .form-row,
  .account-info-grid,
  .segmented-options,
  .choice-grid,
  .schedule-form-grid {
    grid-template-columns: 1fr;
  }

  .medicine-list,
  .medicine-list.is-grid,
  .medicine-list.is-kanban {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .medicine-card {
    border-radius: 10px;
    padding: 12px;
  }

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

  .card-actions,
  .medicine-list.is-grid .card-actions,
  .medicine-list.is-kanban .card-actions {
    grid-template-columns: 1fr;
  }

  .quantity-stepper {
    grid-template-columns: 48px minmax(48px, 1fr) 48px;
    width: 100%;
    min-height: 48px;
  }

  .quantity-button,
  .small-button,
  .primary-button,
  .ghost-button {
    min-height: 44px;
  }

  .pill-row {
    gap: 6px;
  }

  .pill {
    max-width: 100%;
    min-height: 30px;
    white-space: normal;
  }

  .week-controls {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 8px;
  }

  .schedule-section .section-heading {
    grid-template-columns: 1fr;
  }

  .schedule-filter-switch {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .schedule-filter-button {
    min-height: 44px;
    padding: 0 6px;
    font-size: 0.8rem;
  }

  .schedule-kanban {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: visible;
    background: transparent;
  }

  .schedule-day-column {
    min-height: auto;
    border-radius: 12px;
    padding: 10px;
  }

  .schedule-day-head {
    position: static;
    border-radius: 10px;
    padding: 10px;
  }

  .schedule-day-items {
    gap: 8px;
  }

  .schedule-item {
    grid-template-columns: minmax(52px, auto) minmax(0, 1fr);
    min-height: 56px;
    border-radius: 10px;
    padding: 10px;
  }

  .medicine-dialog,
  .details-dialog,
  .fields-dialog,
  .account-dialog {
    width: min(calc(100vw - 20px), 560px);
    max-height: calc(100svh - 20px);
    border-radius: 14px;
  }

  .medicine-dialog[open],
  .details-dialog[open],
  .fields-dialog[open],
  .account-dialog[open] {
    padding: 12px;
  }

  .account-panel,
  .medicine-form,
  .details-panel,
  .fields-panel {
    gap: 12px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .form-actions .primary-button,
  .form-actions .ghost-button {
    width: 100%;
  }

  .group-tools {
    gap: 9px;
  }

  .group-code {
    display: grid;
    gap: 4px;
  }

  .auth-overlay {
    align-items: start;
    padding: max(14px, env(safe-area-inset-top, 0px)) 12px max(14px, env(safe-area-inset-bottom, 0px));
  }

  .auth-card {
    width: 100%;
    gap: 14px;
    border-radius: 14px;
    padding: 16px;
  }

  .auth-brand img {
    width: 46px;
    height: 46px;
  }

  .auth-title {
    font-size: 1.22rem;
  }

  .auth-copy {
    font-size: 0.9rem;
  }
}

@keyframes panelReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@starting-style {
  .medicine-dialog[open],
  .details-dialog[open],
  .fields-dialog[open],
  .account-dialog[open] {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  .medicine-dialog[open]::backdrop,
  .details-dialog[open]::backdrop,
  .fields-dialog[open]::backdrop,
  .account-dialog[open]::backdrop {
    background: rgba(3, 2, 7, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

.mobile-scroll-header {
  display: none;
}

.mobile-scroll-header {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-scroll-header__brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

  .mobile-scroll-header__brand .brand-mark {
    width: 38px;
    height: 38px;
  }

.mobile-scroll-header__title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 759px) {
  body {
    background:
      radial-gradient(circle at 18% 0%, rgba(255, 216, 77, 0.12), transparent 30%),
      radial-gradient(circle at 88% 6%, rgba(138, 92, 255, 0.14), transparent 34%),
      linear-gradient(145deg, #08070d 0%, #141020 52%, #09070f 100%);
  }

  .app-shell {
    width: 100%;
    padding: max(10px, env(safe-area-inset-top, 0px)) clamp(10px, 3.6vw, 14px) max(22px, env(safe-area-inset-bottom, 0px));
  }

  main {
    gap: 12px;
  }

  .topbar {
    display: none;
  }

  .mobile-scroll-header {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 104px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(22, 18, 34, 0.9);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px) saturate(140%);
  }

  .mobile-scroll-header__brand {
    justify-content: center;
  }

  .mobile-view-switch {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 5px;
  }

  body.has-schedule-page .mobile-scroll-header {
    grid-template-columns: 1fr;
  }

  .mobile-view-switch .app-view-button {
    min-height: 50px;
    padding: 0 12px;
    font-size: 0.92rem;
  }

  .mobile-account-button {
    width: 100%;
    max-width: none;
    min-height: 48px;
    justify-content: center;
  }

  .mobile-account-button .account-button__text {
    max-width: min(220px, 58vw);
    font-size: 0.9rem;
  }

  .mobile-scroll-header[hidden] {
    display: none;
  }

  .sidebar {
    gap: 12px;
  }

  .summary-panel {
    min-height: 214px;
    padding: 14px;
  }

  .summary-actions {
    justify-content: space-between;
  }

  .summary-settings-button {
    flex: 1 1 130px;
    min-height: 46px;
    padding: 0 10px;
  }

  .orbital-visual {
    inset: 54px 12px auto;
    height: 118px;
    opacity: 0.72;
  }

  .bulb-line {
    width: min(84vw, 286px);
    height: 138px;
  }

  .infinity-line {
    top: 52px;
    transform: translateX(-50%) rotate(-2deg) scale(0.82);
  }

  .stem {
    height: 34px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 110px;
  }

  .summary-card {
    min-height: 72px;
    padding: 9px 7px;
  }

  .metric {
    font-size: 1.28rem;
  }

  .metric-label {
    font-size: 0.68rem;
    line-height: 1.15;
  }

  .controls-panel {
    gap: 12px;
    padding: 12px;
  }

  .filter-grid,
  .dynamic-filter-grid,
  .form-row,
  .account-info-grid,
  .segmented-options,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .view-mode-switch {
    gap: 5px;
  }

  .view-mode-button {
    min-height: 44px;
    padding: 0 6px;
    font-size: 0.76rem;
  }

  .compact-sidebar {
    display: none;
  }

  .inventory-section {
    gap: 12px;
    padding: 0 0 max(72px, env(safe-area-inset-bottom, 0px));
  }

  .schedule-section {
    gap: 12px;
    padding: 0 0 max(72px, env(safe-area-inset-bottom, 0px));
  }

  .section-heading {
    align-items: center;
    gap: 10px;
  }

  .schedule-section .section-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .week-controls {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
  }

  .week-controls .icon-button,
  .week-controls .ghost-button {
    min-height: 46px;
  }

  .schedule-filter-switch {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .schedule-filter-button {
    padding: 0 8px;
  }

  .schedule-kanban {
    grid-template-columns: 1fr;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .schedule-day-column {
    min-height: 0;
    padding: 9px;
  }

  .schedule-day-head {
    position: sticky;
    top: calc(72px + env(safe-area-inset-top, 0px));
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 9px;
    background: rgba(22, 18, 34, 0.92);
    backdrop-filter: blur(14px);
  }

  .schedule-item {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 58px;
  }

  .schedule-empty > .small-button,
  .quick-schedule-actions .ghost-button,
  .quick-schedule-actions .primary-button {
    min-height: 46px;
  }

  .section-heading .primary-button {
    min-height: 46px;
    padding: 0 13px;
  }

  .medicine-list,
  .medicine-list.is-grid,
  .medicine-list.is-kanban {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .medicine-card {
    gap: 10px;
    padding: 12px;
  }

  .medicine-card__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .medicine-card h3 {
    font-size: 1rem;
    line-height: 1.2;
  }

  .card-meta,
  .card-note {
    font-size: 0.82rem;
  }

  .pill-row {
    gap: 6px;
  }

  .pill {
    min-height: 30px;
    overflow: hidden;
    padding: 0 9px;
    font-size: 0.72rem;
    text-overflow: ellipsis;
  }

  .card-actions,
  .medicine-list.is-grid .card-actions,
  .medicine-list.is-kanban .card-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
  }

  .quantity-stepper {
    grid-template-columns: 44px minmax(38px, 1fr) 44px;
    min-height: 46px;
    padding: 4px;
  }

  .quantity-button {
    width: 44px;
    height: 36px;
    font-size: 1rem;
  }

  .quantity-value {
    align-self: center;
    min-width: 38px;
    font-size: 0.92rem;
  }

  .small-button {
    min-height: 46px;
    padding: 0 12px;
  }

  .kanban-column {
    padding: 9px;
  }

  .kanban-column__head {
    min-height: 36px;
    font-size: 0.9rem;
  }

  .field input,
  .field select,
  .field textarea,
  .segmented-field span,
  .choice-grid span {
    min-height: 48px;
  }

  .choice-grid span {
    padding: 0 10px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-actions .primary-button,
  .form-actions .ghost-button {
    width: 100%;
    min-height: 48px;
  }

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

  .schedule-toggle-button {
    width: 100%;
    min-height: 46px;
  }

  .schedule-rule {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

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

  main {
    grid-template-columns: 1fr;
    row-gap: 16px;
    align-items: start;
  }

  .sidebar {
    grid-column: 1;
    display: grid;
    grid-template-columns: 1fr;
    position: sticky;
    top: 28px;
    z-index: 5;
    align-self: start;
    gap: 0;
    max-height: none;
    overflow: visible;
    isolation: isolate;
    transition:
      grid-template-columns 260ms var(--ease-spring),
      max-height 260ms var(--ease-spring),
      transform 260ms var(--ease-spring);
  }

  body.has-controls-open .sidebar {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }

  .compact-sidebar {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: auto auto minmax(112px, auto);
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 68px;
    max-height: 100px;
    padding: 10px 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px) scale(0.985);
    transition:
      opacity 220ms var(--ease-out),
      transform 260ms var(--ease-spring);
  }

  .compact-sidebar__group,
  .compact-add-button {
    position: relative;
    z-index: 1;
  }

  .compact-sidebar__group {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 4px;
    background: rgba(10, 8, 16, 0.64);
  }

  .summary-panel,
  .controls-panel {
    transition:
      opacity 220ms var(--ease-out),
      transform 260ms var(--ease-spring),
      filter 220ms var(--ease-out);
  }

  body.has-compact-sidebar .sidebar {
    grid-template-columns: 1fr;
    max-height: 100px;
    min-height: 0;
    overflow: hidden;
  }

  body.has-compact-sidebar .compact-sidebar {
    position: relative;
    inset: auto;
    z-index: 2;
    width: 100%;
    max-height: 100px;
    min-height: 0;
    gap: 10px;
    padding: 8px 10px;
    opacity: 1;
    pointer-events: auto;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    transform: translateY(0) scale(1);
    -webkit-overflow-scrolling: touch;
  }

  body.has-compact-sidebar .compact-nav-button,
  body.has-compact-sidebar .compact-add-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.76rem;
  }

  body.has-compact-sidebar .compact-sidebar::-webkit-scrollbar {
    display: none;
  }

  body.has-compact-sidebar .summary-panel,
  body.has-compact-sidebar .controls-panel {
    display: none;
  }

  body.has-controls-open .summary-panel {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  .controls-panel {
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
    align-items: end;
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .search-field {
    grid-column: 1;
  }

  .controls-panel .filter-grid {
    grid-column: 2;
  }

  .controls-panel .dynamic-filter-grid,
  .controls-panel .view-mode-switch {
    grid-column: 1 / -1;
  }

  .inventory-section {
    grid-column: 1;
    grid-row: 2;
    padding-top: 0;
  }

  .fields-settings-layout {
    grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
    align-items: start;
    gap: 16px;
  }

  .fields-list {
    max-height: min(62vh, 620px);
  }

  .field-builder {
    position: sticky;
    top: 18px;
  }

  .kanban-column__head {
    min-height: 40px;
    font-size: 1.08rem;
  }

  .kanban-count {
    min-width: 32px;
    min-height: 28px;
    font-size: 0.92rem;
  }
}

/* Tasks module */
.dashboard-section {
  display: grid;
  gap: 14px;
  padding: 6px 0 90px;
  animation: panelReveal 520ms var(--ease-spring) both;
}

.dashboard-section[hidden] {
  display: none;
}

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

.weekly-dashboard {
  display: grid;
  grid-template-columns: repeat(7, minmax(168px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.dashboard-day-column {
  display: grid;
  min-width: 0;
  min-height: 260px;
  gap: 10px;
  border: 1px solid rgba(210, 218, 235, 0.16);
  border-radius: var(--radius);
  padding: 12px;
  background: #353948;
  scroll-snap-align: start;
}

.dashboard-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-day-head span {
  color: #9bb6ff;
  font-size: 1rem;
  font-weight: 950;
  text-transform: uppercase;
}

.dashboard-day-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-day-items {
  display: grid;
  gap: 9px;
}

.dashboard-empty-day {
  margin: 0;
  border: 1px dashed rgba(210, 218, 235, 0.16);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  background: rgba(24, 28, 42, 0.54);
  font-size: 0.86rem;
}

.dashboard-event-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(210, 218, 235, 0.14);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(24, 28, 42, 0.72);
}

.dashboard-event-card.is-task {
  border-left-color: #9bb6ff;
}

.dashboard-event-card.is-reminder {
  border-left-color: #ffcf68;
}

.dashboard-event-card.is-medicine {
  border-left-color: #7ee6b0;
}

.dashboard-event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-event-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.dashboard-event-type span {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #151927;
  background: #ffd84d;
}

.dashboard-event-top strong {
  color: var(--text);
  font-size: 0.8rem;
}

.dashboard-event-card h3,
.dashboard-event-card p {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.dashboard-event-card h3 {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.2;
}

.dashboard-event-card p {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.dashboard-card-actions > * {
  min-height: 32px;
  padding-inline: 8px;
  font-size: 0.74rem;
}

.tasks-section,
.reminders-section {
  display: grid;
  gap: 14px;
  padding: 6px 0 90px;
  animation: panelReveal 520ms var(--ease-spring) both;
}

.tasks-section[hidden],
.reminders-section[hidden] {
  display: none;
}

.today-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
}

.today-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
  background: #353948;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.today-card span,
.task-meta span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.today-card strong {
  color: #ffffff;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1;
}

.today-card p,
.today-card ul {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.today-card ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

.tasks-list {
  display: grid;
  gap: 18px;
}

.list-filter-switch {
  display: flex;
  gap: 8px;
  margin: 4px 0 -2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.list-filter-switch::-webkit-scrollbar {
  display: none;
}

.list-filter-button {
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
  font-weight: 900;
}

.list-filter-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-primary, #2563eb) 42%, var(--line));
  color: #ffffff;
  background: color-mix(in srgb, var(--color-primary, #2563eb) 24%, rgba(255, 255, 255, 0.06));
}

.list-filter-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary, #2563eb) 24%, transparent);
  outline-offset: 2px;
}

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

.google-calendar-sync-button {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  font-size: 0.82rem;
  font-weight: 900;
}

.google-calendar-sync-button .ui-icon {
  width: 17px;
  height: 17px;
}

.google-calendar-sync-button.is-secondary {
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-border));
}

.google-calendar-sync-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 24%, transparent);
  outline-offset: 2px;
}

.task-list-group__items {
  display: grid;
  gap: 12px;
}

.task-list-divider {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(28px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-list-divider::after {
  content: "";
  height: 1px;
  background: color-mix(in srgb, var(--line) 72%, transparent);
}

.task-list-divider strong {
  display: inline-grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--color-primary, #2563eb) 18%, var(--line));
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.74rem;
  letter-spacing: 0;
}

.task-list-group__empty {
  margin: 0;
  border: 1px dashed color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.9rem;
}

.today-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.today-card li {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reminder-card {
  border-color: rgba(126, 160, 255, 0.22);
}

.task-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-raised);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.task-card.is-completed {
  opacity: 0.72;
}

.task-card.is-highlighted {
  border-color: color-mix(in srgb, var(--color-primary) 68%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 18%, transparent), 0 18px 46px rgba(0, 0, 0, 0.18);
  animation: taskTargetPulse 1100ms ease-out 1;
}

.task-card:hover {
  border-color: color-mix(in srgb, var(--color-primary, #2563eb) 28%, var(--line));
  transform: translateY(-1px);
}

.task-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary, #2563eb) 22%, transparent);
  outline-offset: 3px;
}

@keyframes taskTargetPulse {
  0% {
    transform: scale(0.985);
  }
  55% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

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

.task-status-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--color-primary, #2563eb) 18%, var(--line));
  border-radius: 16px;
  color: transparent;
  background: color-mix(in srgb, var(--color-primary, #2563eb) 9%, var(--surface-raised));
}

.task-status-mark .ui-icon {
  width: 19px;
  height: 19px;
}

.task-status-mark.valid {
  color: #ffffff;
  background: var(--color-success, #22c55e);
}

.task-status-mark.warning {
  color: #111827;
  background: var(--color-warning, #f59e0b);
}

.task-status-mark.soon {
  color: #ffffff;
  background: color-mix(in srgb, var(--module-reminder, #7e7cff) 72%, var(--color-primary, #2563eb));
}

.task-status-mark.expired {
  color: #ffffff;
  background: var(--color-danger, #ef4444);
}

.task-card-content {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.task-card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.task-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.task-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-due-badge {
  display: inline-flex;
  min-height: 28px;
  max-width: 148px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.task-due-badge.is-overdue {
  color: #ffffff;
  background: var(--color-danger, #ef4444);
}

.task-due-badge.is-today {
  color: #111827;
  background: var(--color-warning, #f59e0b);
}

.task-due-badge.is-tomorrow,
.task-due-badge.is-planned {
  color: color-mix(in srgb, var(--color-primary, #2563eb) 78%, var(--text));
  background: color-mix(in srgb, var(--color-primary, #2563eb) 12%, transparent);
}

.task-card-tags,
.schedule-item-tags {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.assignment-tag {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--color-primary, #2563eb) 18%, var(--line));
  border-radius: 999px;
  padding: 4px 9px;
  color: color-mix(in srgb, var(--color-primary, #2563eb) 76%, var(--text));
  background: color-mix(in srgb, var(--color-primary, #2563eb) 10%, var(--surface-raised));
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1;
}

.assignment-tag .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.assignment-tag > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-tag.is-compact {
  min-height: 22px;
  gap: 4px;
  padding: 3px 7px;
  font-size: 0.64rem;
}

.dashboard-event-card .assignment-tag {
  width: max-content;
}

.task-meta,
.task-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-meta span {
  border: 1px solid rgba(210, 218, 235, 0.12);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.045);
}

.task-meta strong {
  color: var(--text);
}

.task-card-footer {
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.task-status-label {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.72rem;
  font-weight: 900;
}

.task-status-label.valid {
  color: var(--color-success, #22c55e);
}

.task-status-label.warning {
  color: var(--color-warning, #f59e0b);
}

.task-status-label.soon {
  color: color-mix(in srgb, var(--module-reminder, #7e7cff) 82%, var(--text));
}

.task-status-label.expired {
  color: var(--color-danger, #ef4444);
}

.reminder-card .task-due-badge {
  max-width: 190px;
}

.task-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.05fr) minmax(0, 0.85fr);
  gap: 8px;
}

.compact-action {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 0.8rem;
}

.task-dialog,
.quick-event-dialog {
  width: min(calc(100% - 28px), 620px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  padding: 0;
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-dialog::backdrop,
.quick-event-dialog::backdrop {
  background: rgba(3, 2, 7, 0.72);
}

.task-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

@media (min-width: 760px) {
  body.has-dashboard-page .app-shell,
  body.has-tasks-page .app-shell,
  body.has-reminders-page .app-shell {
    width: min(100%, 1500px);
  }
}

@media (max-width: 759px) {
  body.has-dashboard-page .app-shell,
  body.has-tasks-page .app-shell,
  body.has-reminders-page .app-shell {
    width: 100%;
  }

  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-actions .ghost-button,
  .dashboard-actions .primary-button {
    width: 100%;
    min-height: 46px;
  }

  .weekly-dashboard {
    grid-auto-columns: minmax(250px, 86vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .dashboard-day-column {
    min-height: 360px;
  }

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

  .task-card__main {

    gap: 10px;
  }

  .task-status-mark {
    width: 38px;
    height: 38px;
    border-radius: 14px;
  }

  .task-card-title-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .task-due-badge {
    width: max-content;
    max-width: 100%;
  }

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

  .task-card .card-actions > * {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    font-size: 0.74rem;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100%;
    padding: max(10px, env(safe-area-inset-top, 0px)) clamp(10px, 3.6vw, 14px) max(22px, env(safe-area-inset-bottom, 0px));
  }

  .medicine-dialog,
  .details-dialog,
  .fields-dialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 18px - env(safe-area-inset-top, 0px));
    margin: auto auto 10px;
    overflow: auto;
    border-radius: 14px 14px var(--radius) var(--radius);
    overscroll-behavior: contain;
  }

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

  .fields-settings-layout {
    gap: 18px;
  }

  .field-builder {
    position: relative;
  }

  .field-builder::before {
    position: absolute;
    top: -10px;
    right: 0;
    left: 0;
    height: 1px;
    content: "";
    background: linear-gradient(90deg, transparent, rgba(255, 216, 77, 0.36), rgba(138, 92, 255, 0.32), transparent);
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 48px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .filter-grid,
  .dynamic-filter-grid,
  .form-row,
  .segmented-options,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 110px;
  }

  .summary-panel {
    min-height: 214px;
  }

  .section-heading {
    align-items: center;
  }

  .medicine-list.is-grid,
  .medicine-list.is-kanban {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 561px) and (max-width: 980px) {
  .medicine-list.is-grid,
  .medicine-list.is-kanban {
    grid-template-columns: 1fr;
  }
}

/* Masterhost-inspired light refresh */
:root {
  color-scheme: light;
  --bg: #f3f7fc;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #dbe5f1;
  --text: #10243f;
  --muted: #667891;
  --violet: #1d59d8;
  --violet-soft: rgba(29, 89, 216, 0.1);
  --gold: #ffcf21;
  --gold-soft: rgba(255, 207, 33, 0.22);
  --danger: #d92d42;
  --warning: #c77700;
  --success: #138a54;
  --shadow: 0 18px 48px rgba(24, 54, 96, 0.1);
}

body {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 207, 33, 0.18) 0, rgba(255, 255, 255, 0) 260px),
    linear-gradient(135deg, #f7faff 0%, #eef4fb 58%, #f8fbff 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(29, 89, 216, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 89, 216, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, #000 0, transparent 520px);
  pointer-events: none;
}

.app-shell {
  width: min(100%, 1120px);
}

body.has-schedule-page .app-shell {
  width: min(100%, 1320px);
}

.topbar {
  min-height: 76px;
  border: 1px solid rgba(219, 229, 241, 0.86);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(24, 54, 96, 0.08);
  backdrop-filter: blur(14px);
}

.brand-mark {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 8px 18px rgba(29, 89, 216, 0.16));
}

.eyebrow,
.config-card-title {
  color: #1d59d8;
  letter-spacing: 0.04em;
}

h1,
h2,
.section-heading h2,
.medicine-card h3,
.schedule-item h3 {
  color: #fff;
  letter-spacing: 0;
}

.account-button,
.icon-button,
.ghost-button,
.summary-settings-button,
.small-button,
.quantity-button,
.compact-nav-button,
.view-mode-button,
.app-view-button,
.schedule-filter-button {
  color: var(--text);
  background: #ffffff;
  border-color: var(--line);
  box-shadow: none;
}

.account-button:hover,
.icon-button:hover,
.ghost-button:hover,
.summary-settings-button:hover,
.small-button:hover,
.quantity-button:hover,
.compact-nav-button:hover,
.view-mode-button:hover,
.app-view-button:hover,
.schedule-filter-button:hover {
  border-color: rgba(29, 89, 216, 0.28);
  background: #f8fbff;
}

.avatar-crop-dialog {
  border: 0;
  border-radius: 28px;
  padding: 0;
  color: var(--color-text);
  background: transparent;
  box-shadow: none;
}

.avatar-crop-dialog::backdrop {
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(8px);
}

.avatar-crop-panel {
  display: grid;
  position: relative;
  width: min(380px, calc(100vw - 28px));
  gap: 18px;
  border: 1px solid var(--color-border);
  border-radius: 28px;
  padding: 22px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.26);
  transition: transform 160ms ease, opacity 160ms ease;
}

.details-panel,
.fields-panel,
.account-panel {
  position: relative;
  transition: transform 160ms ease, opacity 160ms ease;
}

.quick-event-form.is-dragging,
.task-form.is-dragging,
.medicine-form.is-dragging,
.expense-form.is-dragging,
.details-panel.is-dragging,
.fields-panel.is-dragging,
.account-panel.is-dragging,
.avatar-crop-panel.is-dragging {
  transition: none;
}

.details-panel::before,
.fields-panel::before,
.account-panel::before,
.avatar-crop-panel::before {
  display: block;
  width: 46px;
  height: 5px;
  justify-self: center;
  border-radius: 999px;
  content: "";
  background: color-mix(in srgb, var(--color-text-muted) 34%, transparent);
  cursor: grab;
  touch-action: none;
}

.avatar-crop-stage {
  display: grid;
  place-items: center;
  padding: 8px 0;
}

#avatarCropCanvas {
  width: min(280px, 72vw);
  height: min(280px, 72vw);
  border: 5px solid color-mix(in srgb, var(--color-primary) 18%, var(--color-border));
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
  cursor: grab;
  touch-action: none;
}

#avatarCropCanvas:active {
  cursor: grabbing;
}

.avatar-zoom-field input {
  accent-color: var(--color-primary);
}

.avatar-crop-panel .form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 10px;
}

.primary-button,
.compact-add-button {
  border-color: #f0b900;
  color: #10243f;
  background: linear-gradient(180deg, #ffe56b 0%, #ffcf21 100%);
  box-shadow: 0 12px 22px rgba(255, 207, 33, 0.24);
}

.ghost-button {
  color: #1d59d8;
}

.app-view-switch,
.mobile-view-switch,
.view-mode-switch,
.schedule-filter-switch,
.compact-sidebar__group {
  border-color: #dbe5f1;
  background: #eef4fb;
}

.app-view-button,
.view-mode-button,
.schedule-filter-button,
.compact-nav-button {
  color: #667891;
}

.app-view-button[aria-pressed="true"],
.view-mode-button[aria-pressed="true"],
.schedule-filter-button[aria-pressed="true"],
.compact-nav-button[aria-pressed="true"],
.summary-settings-button[aria-expanded="true"] {
  border-color: rgba(29, 89, 216, 0.18);
  color: #10243f;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(24, 54, 96, 0.08);
}

.account-avatar {
  border-color: #ffcf21;
  color: #10243f;
  background: linear-gradient(180deg, #ffe56b 0%, #ffcf21 100%);
}

.summary-panel,
.controls-panel,
.compact-sidebar,
.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog,
.schedule-day-column,
.kanban-column,
.medicine-card,
.summary-card,
.schedule-item,
.password-form,
.schedule-editor,
.field-config-card,
.field-builder,
.account-summary,
.account-info-grid div,
.details-hero,
.details-grid div,
.schedule-rule {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.summary-panel {
  min-height: auto;
  padding: 18px;
  overflow: visible;
}

.summary-panel::before,
.orbital-visual {
  display: none;
}

.summary-grid {
  margin-top: 16px;
}

.summary-actions {
  gap: 10px;
}

.summary-settings-button {
  min-height: 40px;
  color: #1d59d8;
}

.summary-card {
  min-height: 94px;
  background: #f8fbff;
}

.summary-card[aria-pressed="true"] {
  border-color: rgba(29, 89, 216, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #edf5ff 100%);
  box-shadow: 0 12px 24px rgba(29, 89, 216, 0.1);
}

.metric {
  color: #10243f;
}

.metric.danger {
  color: var(--danger);
}

.metric.warning {
  color: var(--warning);
}

.controls-panel {
  background: #ffffff;
}

.field input,
.field select,
.field textarea,
.auth-input {
  border-color: #cfdbea;
  color: #10243f;
  background: #f8fbff;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.auth-input:focus {
  border-color: #1d59d8;
  box-shadow: 0 0 0 3px rgba(29, 89, 216, 0.12);
}

.schedule-kanban {
  gap: 12px;
}

.schedule-day-column,
.kanban-column {
  background: #f8fbff;
}

.schedule-item {
  background: #ffffff;
}

.schedule-time {
  color: #10243f;
  background: #ffcf21;
}

.medicine-card {
  background: #ffffff;
}

.medicine-card:hover,
.schedule-item:hover,
.summary-card:hover {
  border-color: rgba(29, 89, 216, 0.22);
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(24, 54, 96, 0.12);
}

.pill {
  border-color: #dbe5f1;
  color: #314967;
  background: #eef4fb;
}

.pill.valid {
  border-color: rgba(19, 138, 84, 0.22);
  color: #0f7448;
  background: rgba(19, 138, 84, 0.08);
}

.pill.soon {
  border-color: rgba(199, 119, 0, 0.28);
  color: #9b5d00;
  background: rgba(255, 207, 33, 0.18);
}

.pill.expired {
  border-color: rgba(217, 45, 66, 0.28);
  color: #b42335;
  background: rgba(217, 45, 66, 0.08);
}

.quantity-stepper,
.kanban-count,
.empty-state,
.kanban-empty,
.details-note,
.schedule-rule,
.segmented-field span,
.choice-grid span {
  border-color: #dbe5f1;
  color: var(--text);
  background: #f8fbff;
}

.segmented-field input:checked + span,
.choice-grid input:checked + span {
  border-color: rgba(29, 89, 216, 0.28);
  color: #10243f;
  background: #edf5ff;
  box-shadow: 0 10px 18px rgba(29, 89, 216, 0.08);
}

.card-meta,
.card-note,
.metric-label,
.field,
.schedule-item p,
.schedule-day-head strong,
.account-summary span,
.details-hero p,
.details-note,
.details-grid span,
.account-info-grid span,
.schedule-rule span,
.empty-state,
.kanban-empty {
  color: var(--muted);
}

.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog {
  border: 1px solid #dbe5f1;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(24, 54, 96, 0.22);
}

.medicine-dialog[open]::backdrop,
.details-dialog[open]::backdrop,
.fields-dialog[open]::backdrop,
.account-dialog[open]::backdrop {
  background: rgba(16, 36, 63, 0.34);
}

.auth-overlay {
  background: rgba(242, 247, 252, 0.78);
}

.auth-card {
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(24, 54, 96, 0.18);
}

.auth-card h2 {
  color: #10243f;
}

.auth-button {
  color: #10243f;
  background: linear-gradient(180deg, #ffe56b 0%, #ffcf21 100%);
}

.auth-secondary {
  color: #1d59d8;
  background: #eef4fb;
}

.push-toast {
  border-color: rgba(29, 89, 216, 0.18);
  color: #10243f;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(24, 54, 96, 0.16);
}

.push-toast p {
  color: #1d59d8;
}

.push-toast span,
.push-toast button {
  color: #10243f;
}

@media (max-width: 759px) {
  body {
    background:
      linear-gradient(180deg, rgba(255, 207, 33, 0.2) 0, rgba(255, 255, 255, 0) 210px),
      linear-gradient(135deg, #f7faff 0%, #eef4fb 100%);
  }

  .mobile-scroll-header {
    border-color: #dbe5f1;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 28px rgba(24, 54, 96, 0.1);
    backdrop-filter: blur(12px);
  }

  .summary-panel {
    min-height: 0;
  }

  .summary-grid {
    margin-top: 12px;
  }

  .summary-card {
    min-height: 78px;
  }

  .schedule-day-head {
    border-color: #dbe5f1;
    background: rgba(255, 255, 255, 0.94);
  }
}

@media (min-width: 760px) {
  body.has-controls-open .summary-panel {
    border-right-color: transparent;
  }

  .controls-panel {
    border-left-color: transparent;
  }

  .inventory-section,
  .schedule-section {
    padding-bottom: 70px;
  }
}

/* Masterhost control panel dark refresh */
:root {
  color-scheme: dark;
  --bg: #1d2233;
  --panel: #ffffff;
  --panel-strong: #f3f3f4;
  --line: #e3e5ea;
  --text: #4f5562;
  --muted: #9297a2;
  --violet: #4d7fe5;
  --violet-soft: rgba(77, 127, 229, 0.12);
  --gold: #4d7fe5;
  --gold-soft: rgba(77, 127, 229, 0.12);
  --danger: #ff6b5f;
  --warning: #8f939b;
  --success: #24b874;
  --shadow: 0 12px 30px rgba(8, 12, 22, 0.18);
}

body {
  color: var(--text);
  background: #1d2233;
}

body::before {
  display: none;
}

.app-shell {
  width: min(100%, 1280px);
  padding-top: 22px;
}

body.has-schedule-page .app-shell {
  width: min(100%, 1420px);
}

.topbar {
  min-height: 74px;
  margin-bottom: 18px;
  border: 0;
  padding: 10px 28px;
  color: #f6f7fb;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.brand-lockup h1,
.topbar h1 {
  color: #f6f7fb;
}

.brand-mark {
  filter: none;
}

.eyebrow {
  color: #8990a2;
}

.account-button,
.icon-button {
  border-color: rgba(255, 255, 255, 0.08);
  color: #f6f7fb;
  background: rgba(255, 255, 255, 0.12);
}

.account-button:hover,
.icon-button:hover {
  border-color: rgba(77, 127, 229, 0.55);
  background: rgba(255, 255, 255, 0.16);
}

.account-avatar {
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  background: #4d7fe5;
}

main {
  gap: 18px;
}

.sidebar {
  background: #353948;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 18px 46px rgba(8, 12, 22, 0.22);
}

.summary-panel,
.controls-panel,
.compact-sidebar {
  border-color: rgba(255, 255, 255, 0.06);
  background: #353948;
  box-shadow: none;
}

.summary-panel {
  min-height: 156px;
  padding: 18px;
}

.summary-actions {
  align-items: center;
}

.summary-settings-button,
.compact-nav-button,
.compact-add-button {
  border-color: rgba(255, 255, 255, 0.08);
  color: #f6f7fb;
  background: transparent;
}

.summary-settings-button:hover,
.compact-nav-button:hover,
.compact-add-button:hover {
  border-color: rgba(77, 127, 229, 0.44);
  color: #ffffff;
  background: rgba(77, 127, 229, 0.12);
}

.summary-settings-button[aria-expanded="true"],
.compact-nav-button[aria-pressed="true"] {
  border-color: #4d7fe5;
  color: #ffffff;
  background: #4d7fe5;
  box-shadow: none;
}

.compact-add-button,
.primary-button {
  border-color: #4d7fe5;
  color: #ffffff;
  background: #4d7fe5;
  box-shadow: none;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.summary-card {
  min-height: 82px;
  border-color: rgba(255, 255, 255, 0.06);
  color: #f6f7fb;
  background: #2e3240;
  box-shadow: none;
}

.summary-card:hover {
  border-color: rgba(77, 127, 229, 0.44);
  background: #303646;
}

.summary-card[aria-pressed="true"] {
  border-color: #4d7fe5;
  background: #4d7fe5;
  box-shadow: none;
}

.summary-card[aria-pressed="true"] .metric,
.summary-card[aria-pressed="true"] .metric-label {
  color: #ffffff;
}

.summary-card .metric {
  color: #ffffff;
}

.summary-card .metric-label {
  color: #b7bdca;
}

.controls-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.controls-panel .field {
  color: #c7ccda;
}

.field input,
.field select,
.field textarea,
.auth-input {
  border-color: #dfe2e8;
  color: #4f5562;
  background: #f3f3f4;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.auth-input:focus {
  border-color: #4d7fe5;
  box-shadow: 0 0 0 3px rgba(77, 127, 229, 0.14);
}

.app-view-switch,
.mobile-view-switch,
.view-mode-switch,
.schedule-filter-switch {
  border-color: #dfe2e8;
  background: #eeeeef;
}

.app-view-button,
.view-mode-button,
.schedule-filter-button {
  color: #737986;
  background: transparent;
}

.app-view-button:hover,
.view-mode-button:hover,
.schedule-filter-button:hover {
  color: #4d7fe5;
  background: #ffffff;
}

.app-view-button[aria-pressed="true"],
.view-mode-button[aria-pressed="true"],
.schedule-filter-button[aria-pressed="true"] {
  border-color: #4d7fe5;
  color: #ffffff;
  background: #4d7fe5;
  box-shadow: none;
}

.inventory-section,
.schedule-section {
  border-radius: 0 8px 8px 8px;
  padding: 26px 32px 80px;
  background: #353b51;
  box-shadow: 0 18px 52px rgba(8, 12, 22, 0.28);
}

.section-heading {
  gap: 14px;
  margin-bottom: 4px;
}

.section-heading h2,
.medicine-card h3,
.schedule-day-head span,
.schedule-item h3,
.kanban-column__head,
.details-grid strong,
.account-info-grid strong,
.schedule-rule strong {
  color: #515762;
}

.medicine-list {
  gap: 14px;
}

.medicine-card,
.schedule-day-column,
.schedule-item,
.kanban-column,
.password-form,
.schedule-editor,
.field-config-card,
.field-builder,
.account-summary,
.account-info-grid div,
.details-hero,
.details-grid div,
.schedule-rule,
.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog {
  border-color: #e1e4ea;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(31, 38, 56, 0.08);
}

.schedule-kanban {
  gap: 12px;
  padding: 16px;
  border-radius: 4px;
  background: #f1f1f2;
}

@media (min-width: 760px) {
  .schedule-kanban {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: start;
  }

  .schedule-day-column,
  .schedule-day-items,
  .schedule-item {
    min-width: 0;
    max-width: 100%;
  }

  .schedule-day-column {
    overflow: hidden;
    padding: 8px;
  }

  .schedule-day-items {
    overflow: hidden;
  }

  .schedule-item {
    width: 100%;
    padding: 8px;
  }

  .schedule-item h3,
  .schedule-item p {
    display: block;
    width: 100%;
  }
}

.schedule-day-column,
.kanban-column {
  background: #ffffff;
}

.schedule-item {
  background: #ffffff;
}

.medicine-card:hover,
.schedule-item:hover,
.summary-card:hover {
  transform: translateY(-1px);
  border-color: rgba(77, 127, 229, 0.36);
  box-shadow: 0 6px 18px rgba(31, 38, 56, 0.12);
}

.schedule-time {
  min-width: 48px;
  color: #ffffff;
  background: #4d7fe5;
}

.pill {
  border-color: #e1e4ea;
  color: #5f6570;
  background: #f3f3f4;
}

.pill.valid {
  border-color: rgba(36, 184, 116, 0.24);
  color: #1aa065;
  background: rgba(36, 184, 116, 0.08);
}

.pill.soon {
  border-color: #dfe2e8;
  color: #7b808a;
  background: #f3f3f4;
}

.pill.expired {
  border-color: rgba(255, 107, 95, 0.28);
  color: #ff6b5f;
  background: rgba(255, 107, 95, 0.08);
}

.quantity-stepper,
.kanban-count,
.empty-state,
.kanban-empty,
.details-note,
.segmented-field span,
.choice-grid span {
  border-color: #e1e4ea;
  color: #515762;
  background: #f3f3f4;
}

.quantity-button,
.small-button,
.ghost-button {
  border-color: #4d7fe5;
  color: #4d7fe5;
  background: #ffffff;
}

.quantity-button:hover,
.small-button:hover,
.ghost-button:hover {
  border-color: #336fe0;
  color: #336fe0;
  background: #f5f8ff;
}

.ghost-button {
  color: #4d7fe5;
}

.form-heading {
  border-bottom: 1px solid #e8eaf0;
  padding-bottom: 10px;
}

.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog {
  color: #515762;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(8, 12, 22, 0.34);
}

.medicine-dialog[open]::backdrop,
.details-dialog[open]::backdrop,
.fields-dialog[open]::backdrop,
.account-dialog[open]::backdrop {
  background: rgba(19, 24, 38, 0.72);
}

.account-summary,
.details-hero {
  background: #f3f3f4;
}

.auth-overlay {
  background: rgba(29, 34, 51, 0.88);
}

.auth-card {
  border-color: #e1e4ea;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(8, 12, 22, 0.34);
}

.auth-button {
  color: #ffffff;
  background: #4d7fe5;
}

.auth-secondary {
  color: #4d7fe5;
  background: #ffffff;
  border: 1px solid #4d7fe5;
}

.push-toast {
  border-color: #e1e4ea;
  color: #515762;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(8, 12, 22, 0.2);
}

.push-toast p {
  color: #4d7fe5;
}

@media (max-width: 759px) {
  body {
    background: #1d2233;
  }

  .app-shell {
    padding: max(10px, env(safe-area-inset-top, 0px)) clamp(10px, 3.6vw, 14px) max(18px, env(safe-area-inset-bottom, 0px));
  }

  .mobile-scroll-header {
    min-height: 112px;
    border-color: rgba(255, 255, 255, 0.08);
    background: #2f3444;
    box-shadow: 0 14px 34px rgba(8, 12, 22, 0.26);
  }

  .mobile-account-button {
    border-color: rgba(255, 255, 255, 0.1);
    color: #f6f7fb;
    background: rgba(255, 255, 255, 0.1);
  }

  .sidebar {
    border-radius: 8px;
  }

  .summary-panel {
    padding: 14px;
  }

  .inventory-section,
  .schedule-section {
    border-radius: 8px;
    padding: 14px 12px max(72px, env(safe-area-inset-bottom, 0px));
  }

  .section-heading {
    margin-bottom: 0;
  }

  .schedule-kanban {
    gap: 18px;
    padding: 0;
    background: transparent;
  }

  .schedule-day-column {
    position: relative;
    gap: 12px;
    border: 1px solid rgba(77, 127, 229, 0.28);
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(8, 12, 22, 0.18);
  }

  .schedule-day-column + .schedule-day-column {
    margin-top: 4px;
  }

  .schedule-day-head {
    border-color: #e1e4ea;
    border-radius: 10px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.94);
  }

  .schedule-day-head span {
    font-size: 1rem;
  }

  .schedule-day-head strong {
    font-size: 0.78rem;
  }

  .schedule-day-items {
    gap: 10px;
  }

  .schedule-item {
    grid-template-columns: minmax(52px, auto) minmax(0, 1fr);
    align-items: start;
    border-radius: 10px;
    padding: 10px;
  }
}

@media (min-width: 760px) {
  body.has-controls-open .summary-panel {
    border-right-color: rgba(255, 255, 255, 0.06);
  }

  .controls-panel {
    border-left-color: rgba(255, 255, 255, 0.06);
  }

  body.has-controls-open .sidebar {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }
}

/* Dark polished palette pass */
:root {
  --bg: #202536;
  --panel: #353948;
  --panel-strong: #3f4456;
  --surface: #2b3040;
  --surface-soft: #303545;
  --surface-raised: #3b4051;
  --line: rgba(210, 218, 235, 0.16);
  --text: #f2f5fb;
  --muted: #b5bdcc;
  --subtle: #8892a5;
  --violet: #6f95ff;
  --violet-soft: rgba(111, 149, 255, 0.16);
  --gold: #6f95ff;
  --gold-soft: rgba(111, 149, 255, 0.16);
  --danger: #ff7b72;
  --warning: #f0c56a;
  --success: #5ee0a0;
  --shadow: 0 16px 42px rgba(6, 9, 18, 0.28);
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 22% 0%, rgba(111, 149, 255, 0.12), transparent 32%),
    linear-gradient(180deg, #1d2233 0%, #202536 100%);
}

.topbar,
.mobile-scroll-header {
  color: var(--text);
}

.brand-lockup h1,
.topbar h1,
.mobile-scroll-header__title,
.section-heading h2,
.medicine-card h3,
.schedule-day-head span,
.schedule-item h3,
.kanban-column__head,
.details-grid strong,
.account-info-grid strong,
.schedule-rule strong,
.account-summary p,
.details-hero strong {
  color: var(--text);
}

.eyebrow,
.config-card-title,
.push-toast p {
  color: #8fb0ff;
}

.sidebar,
.summary-panel,
.controls-panel,
.compact-sidebar {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.inventory-section {
  background: var(--panel);
  box-shadow: var(--shadow);
}

.schedule-section {
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.summary-card,
.medicine-card,
.schedule-day-column,
.schedule-item,
.kanban-column,
.password-form,
.schedule-editor,
.field-config-card,
.field-builder,
.account-summary,
.account-info-grid div,
.details-hero,
.details-grid div,
.schedule-rule,
.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog,
.push-toast {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(6, 9, 18, 0.18);
}

.schedule-kanban {
  background: var(--surface-soft);
}

.schedule-day-column,
.kanban-column,
.account-summary,
.details-hero {
  background: var(--surface-raised);
}

.schedule-item,
.medicine-card {
  background: #303545;
}

.medicine-card:hover,
.schedule-item:hover,
.summary-card:hover {
  border-color: rgba(111, 149, 255, 0.48);
  background: #363c4f;
  box-shadow: 0 12px 28px rgba(6, 9, 18, 0.24);
}

.summary-card {
  background: #303545;
}

.summary-card[aria-pressed="true"] {
  border-color: rgba(111, 149, 255, 0.72);
  background: #4f75d8;
}

.summary-card .metric,
.summary-card .metric-label,
.summary-card[aria-pressed="true"] .metric,
.summary-card[aria-pressed="true"] .metric-label {
  color: #ffffff;
}

.card-meta,
.card-note,
.metric-label,
.field,
.schedule-item p,
.schedule-day-head strong,
.account-summary span,
.details-hero p,
.details-note,
.details-grid span,
.account-info-grid span,
.schedule-rule span,
.empty-state,
.kanban-empty {
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.auth-input {
  border-color: rgba(210, 218, 235, 0.18);
  color: var(--text);
  background: #262b3a;
}

.field input::placeholder,
.field textarea::placeholder,
.auth-input::placeholder {
  color: #7f899b;
}

.field select option {
  color: var(--text);
  background: #262b3a;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.62;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.auth-input:focus {
  border-color: #7ea0ff;
  box-shadow: 0 0 0 3px rgba(111, 149, 255, 0.16);
  background: #293044;
}

.app-view-switch,
.mobile-view-switch,
.view-mode-switch,
.schedule-filter-switch,
.compact-sidebar__group,
.quantity-stepper,
.kanban-count,
.empty-state,
.kanban-empty,
.details-note,
.segmented-field span,
.choice-grid span {
  border-color: rgba(210, 218, 235, 0.14);
  color: var(--text);
  background: #2a2f3f;
}

.app-view-button,
.view-mode-button,
.schedule-filter-button,
.compact-nav-button {
  color: var(--muted);
}

.app-view-button:hover,
.view-mode-button:hover,
.schedule-filter-button:hover,
.compact-nav-button:hover {
  color: #ffffff;
  background: rgba(111, 149, 255, 0.12);
}

.app-view-button[aria-pressed="true"],
.view-mode-button[aria-pressed="true"],
.schedule-filter-button[aria-pressed="true"],
.compact-nav-button[aria-pressed="true"],
.summary-settings-button[aria-expanded="true"] {
  border-color: #6f95ff;
  color: #ffffff;
  background: #4f75d8;
}

.primary-button,
.compact-add-button,
.auth-button {
  border-color: #6f95ff;
  color: #ffffff;
  background: #4f75d8;
}

.ghost-button,
.small-button,
.quantity-button,
.summary-settings-button,
.auth-secondary,
.schedule-toggle-button {
  border-color: rgba(111, 149, 255, 0.54);
  color: #a9c0ff;
  background: transparent;
}

.ghost-button:hover,
.small-button:hover,
.quantity-button:hover,
.summary-settings-button:hover,
.auth-secondary:hover,
.schedule-toggle-button:hover {
  border-color: #8fb0ff;
  color: #ffffff;
  background: rgba(111, 149, 255, 0.12);
}

.push-button.is-enabled {
  border-color: rgba(255, 123, 114, 0.72);
  color: #ffffff;
  background: rgba(255, 123, 114, 0.18);
}

.push-button.is-enabled:hover {
  border-color: #ff7b72;
  background: rgba(255, 123, 114, 0.28);
}

.push-button.is-unavailable {
  border-color: rgba(255, 189, 89, 0.48);
  color: #ffd58a;
  background: rgba(255, 189, 89, 0.1);
}

.push-button.is-unavailable:hover {
  border-color: rgba(255, 213, 138, 0.72);
  color: #ffe2a8;
  background: rgba(255, 189, 89, 0.16);
}

.schedule-time {
  color: #ffffff;
  background: #4f75d8;
}

.pill {
  border-color: rgba(210, 218, 235, 0.14);
  color: #d7deec;
  background: #272d3c;
}

.pill.valid {
  border-color: rgba(94, 224, 160, 0.3);
  color: #8df0bd;
  background: rgba(94, 224, 160, 0.1);
}

.pill.soon {
  border-color: rgba(240, 197, 106, 0.34);
  color: #f2cf83;
  background: rgba(240, 197, 106, 0.1);
}

.pill.expired {
  border-color: rgba(255, 123, 114, 0.34);
  color: #ffaaa4;
  background: rgba(255, 123, 114, 0.1);
}

.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog,
.auth-card {
  border-color: rgba(210, 218, 235, 0.18);
  color: var(--text);
  background: var(--panel);
}

.form-heading {
  border-bottom-color: rgba(210, 218, 235, 0.14);
}

.auth-card h2 {
  color: var(--text) !important;
}

.auth-overlay {
  background: rgba(20, 24, 38, 0.88);
}

.push-toast span,
.push-toast button {
  color: var(--text);
}

@media (max-width: 759px) {
  .mobile-scroll-header {
    border-color: var(--line);
    background: var(--panel);
  }

  .mobile-account-button {
    border-color: rgba(210, 218, 235, 0.16);
    color: var(--text);
    background: #2a2f3f;
  }

  .schedule-kanban {
    background: transparent;
  }

  .schedule-day-column {
    border-color: rgba(111, 149, 255, 0.3);
    background: var(--surface-raised);
  }

  .schedule-day-head {
    border-color: rgba(210, 218, 235, 0.14);
    background: #2a2f3f;
  }
}

@media (min-width: 760px) {
  .app-shell,
  body.has-schedule-page .app-shell {
    width: min(100%, 1420px);
  }
}

@media (max-width: 759px) {
  .app-shell,
  body.has-schedule-page .app-shell {
    width: 100%;
  }
}

@media (min-width: 760px) {
  .app-shell,
  body.has-schedule-page .app-shell {
    width: min(100%, 1500px);
  }

  .kanban-column__head {
    min-width: 0;
    gap: 10px;
  }

  .kanban-column__head > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kanban-count {
    position: relative;
    display: inline-block;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    flex: 0 0 36px;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
    text-align: center;
    transform: none;
  }

  .kanban-count > span {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    line-height: 1;
    transform: translate(-50%, -52%);
  }
}

.module-menu {
  border-color: rgba(210, 218, 235, 0.16);
  background: #353948;
}

.module-menu-button {
  color: #c5cce0;
}

.module-menu-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.module-menu-button[aria-pressed="true"] {
  border-color: rgba(126, 160, 255, 0.52);
  color: var(--text);
  background: #4d6fdc;
}

.module-menu-button[aria-pressed="true"] span {
  color: #151927;
  background: #ffd84d;
}

body.has-tasks-module .app-view-switch,
body.has-tasks-module .mobile-view-switch,
body.has-reminders-module .app-view-switch,
body.has-reminders-module .mobile-view-switch {
  display: none;
}

@media (min-width: 760px) {
  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 759px) {
  .mobile-scroll-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 0;
  }

  .mobile-module-menu {
    grid-column: 1 / -1;
    width: 100%;
  }

  .mobile-view-switch {
    grid-column: 1 / 2;
  }

  .mobile-account-button {
    grid-column: 2 / 3;
  }

  .module-menu,
  .mobile-view-switch {
    gap: 6px;
  }

  .module-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .module-menu-button,
  .mobile-view-switch .app-view-button {
    min-height: 48px;
    font-size: 0.72rem;
  }

  .module-menu-button {
    gap: 5px;
    padding-inline: 6px;
  }

  .module-menu-button span {
    width: 18px;
    height: 18px;
    font-size: 0.74rem;
  }
}

/* Family Hub 2026 visual layer */
:root {
  --color-primary: #2563eb;
  --color-primary-light: #3b82f6;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-purple: #8b5cf6;
  --color-pink: #ec4899;
  --color-cyan: #06b6d4;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-soft: #f1f5f9;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --radius-card: 18px;
  --radius-button: 14px;
  --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
  --family-bg: #f8fafc;
  --family-card: #ffffff;
  --family-card-soft: #f1f5f9;
  --family-border: #e2e8f0;
  --family-text: #0f172a;
  --family-muted: #64748b;
  --family-primary: #2563eb;
  --family-primary-soft: rgba(37, 99, 235, 0.12);
  --family-success: #22c55e;
  --family-warning: #f59e0b;
  --family-purple: #8b5cf6;
  --family-danger: #ec4899;
  --module-home: #2563eb;
  --module-home-gradient: linear-gradient(135deg, var(--color-primary), #22c55e);
  --module-home-soft: #dbeafe;
  --module-tasks: #2563eb;
  --module-tasks-soft: #dbeafe;
  --module-schedule: #2563eb;
  --module-schedule-soft: #dbeafe;
  --module-reminders: #f59e0b;
  --module-reminders-soft: #fef3c7;
  --module-medicine: #22c55e;
  --module-medicine-soft: #dcfce7;
  --module-shopping: #ec4899;
  --module-shopping-soft: #fce7f3;
  --module-documents: #8b5cf6;
  --module-documents-soft: #ede9fe;
  --module-expenses: #06b6d4;
  --module-expenses-soft: #cffafe;
  --module-more: #64748b;
  --module-more-soft: #f1f5f9;
  --family-radius: 16px;
  --family-shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
  --family-shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.07);
  color-scheme: light;
}

html[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-soft: #162033;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-primary: #3b82f6;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.22);
  --family-bg: #0f172a;
  --family-card: #1e293b;
  --family-card-soft: #172033;
  --family-border: #334155;
  --family-text: #f8fafc;
  --family-muted: #94a3b8;
  --family-primary: #3b82f6;
  --family-primary-soft: rgba(59, 130, 246, 0.16);
  --family-success: #22c55e;
  --family-warning: #f59e0b;
  --family-purple: #8b5cf6;
  --family-danger: #ec4899;
  --module-home: #3b82f6;
  --module-home-gradient: linear-gradient(135deg, var(--color-primary), #22c55e);
  --module-home-soft: rgba(59, 130, 246, 0.16);
  --module-tasks: #3b82f6;
  --module-tasks-soft: rgba(59, 130, 246, 0.16);
  --module-schedule: #3b82f6;
  --module-schedule-soft: rgba(59, 130, 246, 0.16);
  --module-reminders: #f59e0b;
  --module-reminders-soft: rgba(245, 158, 11, 0.16);
  --module-medicine: #22c55e;
  --module-medicine-soft: rgba(34, 197, 94, 0.16);
  --module-shopping: #ec4899;
  --module-shopping-soft: rgba(236, 72, 153, 0.16);
  --module-documents: #8b5cf6;
  --module-documents-soft: rgba(139, 92, 246, 0.16);
  --module-expenses: #22d3ee;
  --module-expenses-soft: rgba(6, 182, 212, 0.16);
  --module-more: #94a3b8;
  --module-more-soft: rgba(148, 163, 184, 0.14);
  --family-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  --family-shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
}

body {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  color: var(--family-text);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.08), transparent 260px),
    var(--family-bg);
}

* {
  transition:
    background-color 180ms var(--ease-out),
    border-color 180ms var(--ease-out),
    color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out);
}

html[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.13), transparent 280px),
    var(--family-bg);
}

.app-shell,
body.has-dashboard-page .app-shell,
body.has-schedule-page .app-shell,
body.has-tasks-page .app-shell,
body.has-reminders-page .app-shell,
body.has-shopping-page .app-shell {
  width: min(100%, 1100px);
  padding: 18px clamp(12px, 3vw, 22px) 18px;
}

.topbar,
.summary-panel,
.controls-panel,
.medicine-card,
.details-panel,
.account-panel,
.task-card,
.today-card,
.hub-placeholder-card,
.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog,
.task-dialog,
.quick-event-dialog,
.auth-card {
  border-color: var(--family-border);
  border-radius: var(--family-radius);
  color: var(--family-text);
  background: color-mix(in srgb, var(--family-card) 94%, transparent);
  box-shadow: var(--family-shadow-soft);
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 35;
  min-height: 76px;
  margin-bottom: 18px;
  padding: 12px;
  backdrop-filter: blur(18px);
}

.brand-lockup h1,
.auth-title,
.section-heading h2,
.dashboard-heading h2,
.family-hero h2,
.hub-placeholder-card h2,
.medicine-card h3,
.dashboard-event-card h3,
.task-card h3 {
  color: var(--family-text);
  letter-spacing: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--family-card);
  box-shadow: var(--family-shadow-soft);
}

.eyebrow,
.config-card-title {
  color: var(--family-primary);
  letter-spacing: 0.02em;
}

.module-menu,
.app-view-switch,
.mobile-view-switch,
.view-mode-switch,
.schedule-filter-switch,
.compact-sidebar__group,
.quantity-stepper,
.auth-tabs {
  border-color: var(--family-border);
  border-radius: var(--family-radius);
  background: var(--family-card-soft);
}

.module-menu {
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  box-shadow: none;
}

.module-menu-button,
.app-view-button,
.view-mode-button,
.schedule-filter-button,
.compact-nav-button,
.auth-tab {
  border-radius: 12px;
  color: var(--family-muted);
}

.module-icon,
.module-menu-button span,
.dashboard-event-type span,
.stat-icon {
  color: #ffffff;
  background: var(--module-home);
}

.module-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  flex: 0 0 auto;
  font-weight: 950;
  line-height: 1;
}

.module-icon.is-home,
.today-stat-card.is-home .stat-icon {
  background: var(--module-home-gradient);
}

.module-icon.is-task,
.today-stat-card.is-task .stat-icon,
.dashboard-event-card.is-task .dashboard-event-type span,
.upcoming-event-row.is-task .dashboard-event-type span {
  background: var(--module-tasks);
}

.module-icon.is-reminder,
.today-stat-card.is-reminder .stat-icon,
.dashboard-event-card.is-reminder .dashboard-event-type span,
.upcoming-event-row.is-reminder .dashboard-event-type span {
  background: var(--module-reminders);
}

.module-icon.is-medicine,
.today-stat-card.is-medicine .stat-icon,
.dashboard-event-card.is-medicine .dashboard-event-type span,
.upcoming-event-row.is-medicine .dashboard-event-type span {
  background: var(--module-medicine);
}

.module-icon.is-shopping,
.today-stat-card.is-shopping .stat-icon {
  background: var(--module-shopping);
}

.module-icon.is-document,
.today-stat-card.is-document .stat-icon {
  background: var(--module-documents);
}

.module-icon.is-more {
  background: var(--module-more);
}

.module-menu-button[aria-pressed="true"],
.app-view-button[aria-pressed="true"],
.view-mode-button[aria-pressed="true"],
.schedule-filter-button[aria-pressed="true"],
.compact-nav-button[aria-pressed="true"],
.auth-tab[aria-pressed="true"],
.theme-choice-button[aria-pressed="true"] {
  border-color: transparent;
  color: #ffffff;
  background: var(--family-primary);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--family-primary) 24%, transparent);
}

.account-button,
.icon-button,
.ghost-button,
.small-button,
.quantity-button,
.summary-settings-button,
.theme-choice-button {
  border-color: var(--family-border);
  border-radius: 14px;
  color: var(--family-text);
  background: var(--family-card);
  box-shadow: none;
}

.primary-button,
.compact-add-button,
.auth-button {
  border-color: transparent;
  border-radius: 14px;
  color: #ffffff;
  background: var(--family-primary);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--family-primary) 24%, transparent);
}

body.has-dashboard-module .family-fab,
body.has-dashboard-module #openDashboardAddButton {
  background: var(--module-home-gradient);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--module-home) 24%, transparent);
}

body.has-medkit-module .family-fab,
body.has-medkit-module #openFormButton,
body.has-medkit-module #addScheduleButton,
body.has-medkit-module #takeMedicineButton {
  background: var(--module-medicine);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--module-medicine) 24%, transparent);
}

body.has-tasks-module .family-fab,
body.has-tasks-module #openTaskFormButton,
body.has-tasks-module #taskSubmitButton {
  background: var(--module-tasks);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--module-tasks) 24%, transparent);
}

body.has-schedule-page .family-fab,
body.has-schedule-page .schedule-day-add,
body.has-schedule-page [data-schedule-add] {
  border-color: transparent;
  color: #ffffff;
  background: var(--module-schedule);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--module-schedule) 24%, transparent);
}

body.has-reminders-module .family-fab,
body.has-reminders-module #openReminderFormButton,
body.has-reminders-module .reminder-form .primary-button {
  background: var(--module-reminders);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--module-reminders) 24%, transparent);
}

body.has-expenses-module .family-fab,
body.has-expenses-module #openExpenseFormButton,
body.has-expenses-module #openExpenseEmptyButton,
body.has-expenses-module #expenseSubmitButton {
  background: var(--module-expenses);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--module-expenses) 24%, transparent);
}

.ghost-button:hover,
.small-button:hover,
.icon-button:hover,
.account-button:hover,
.summary-settings-button:hover,
.theme-choice-button:hover {
  border-color: color-mix(in srgb, var(--family-primary) 38%, var(--family-border));
  color: var(--family-primary);
  background: var(--family-primary-soft);
}

.family-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--family-border);
  border-radius: 24px;
  padding: 18px;
  background: var(--family-card);
  box-shadow: var(--family-shadow);
}

.family-hero h2 {
  margin: 0 0 6px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.family-hero span {
  color: var(--family-muted);
  font-size: 1rem;
  font-weight: 750;
}

.family-hero img {
  width: clamp(74px, 12vw, 118px);
  height: clamp(74px, 12vw, 118px);
  border-radius: 24px;
  box-shadow: var(--family-shadow-soft);
}

.today-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.today-stat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 112px;
  border: 1px solid var(--family-border);
  border-radius: var(--family-radius);
  padding: 14px;
  background: var(--family-card);
  box-shadow: var(--family-shadow-soft);
  animation: softRise 260ms var(--ease-spring) both;
}

.today-stat-card.is-task {
  background: linear-gradient(135deg, var(--module-tasks-soft), var(--family-card) 64%);
}

.today-stat-card.is-reminder {
  background: linear-gradient(135deg, var(--module-reminders-soft), var(--family-card) 64%);
}

.today-stat-card.is-medicine {
  background: linear-gradient(135deg, var(--module-medicine-soft), var(--family-card) 64%);
}

.today-stat-card.is-document {
  background: linear-gradient(135deg, var(--module-documents-soft), var(--family-card) 64%);
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  font-weight: 950;
}

.today-stat-card.is-reminder .stat-icon,
.dashboard-event-card.is-reminder .dashboard-event-type span {
  background: var(--module-reminders);
}

.today-stat-card.is-medicine .stat-icon,
.dashboard-event-card.is-medicine .dashboard-event-type span {
  background: var(--module-medicine);
}

.today-stat-card.is-document .stat-icon,
.dashboard-event-card.is-document .dashboard-event-type span {
  background: var(--module-documents);
}

.today-stat-card p,
.today-stat-card small {
  margin: 0;
  color: var(--family-muted);
}

.today-stat-card strong {
  display: block;
  color: var(--family-text);
  font-size: 2rem;
  line-height: 1;
}

.dashboard-section,
.tasks-section,
.reminders-section,
.hub-placeholder-section {
  gap: 14px;
  padding-bottom: 24px;
}

.dashboard-heading {
  align-items: center;
}

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

.panel-heading h3 {
  margin: 0;
  color: var(--family-text);
  font-size: 1.05rem;
}

.text-button {
  border: 0;
  color: var(--family-primary);
  background: transparent;
  font-weight: 850;
}

.upcoming-events-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--family-border);
  border-radius: var(--family-radius);
  padding: 14px;
  background: var(--family-card);
  box-shadow: var(--family-shadow-soft);
}

.upcoming-events-list {
  display: grid;
}

.upcoming-event-row {
  display: grid;
  grid-template-columns: minmax(112px, auto) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--family-border);
  padding: 10px 0;
}

.upcoming-event-row:last-child {
  border-bottom: 0;
}

.upcoming-event-row h3,
.upcoming-event-row p,
.upcoming-empty p {
  margin: 0;
}

.upcoming-event-row h3 {
  color: var(--family-text);
  font-size: 0.94rem;
}

.upcoming-event-row p,
.upcoming-empty p {
  color: var(--family-muted);
  font-size: 0.82rem;
}

.upcoming-event-row > strong {
  color: var(--family-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.upcoming-empty {
  display: grid;
  gap: 10px;
  border: 1px dashed var(--family-border);
  border-radius: var(--family-radius);
  padding: 14px;
  background: var(--family-card-soft);
}

.week-day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-day-pill {
  display: grid;
  min-width: 0;
  min-height: 58px;
  place-items: center;
  border: 1px solid var(--family-border);
  border-radius: 16px;
  color: var(--family-text);
  background: var(--family-card);
  box-shadow: var(--family-shadow-soft);
}

.week-day-pill span {
  color: var(--family-muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.week-day-pill strong {
  color: inherit;
  font-size: 1rem;
  line-height: 1;
}

.week-day-pill[aria-pressed="true"] {
  border-color: transparent;
  color: #ffffff;
  background: var(--module-home-gradient);
}

.week-day-pill[aria-pressed="true"] span {
  color: rgba(255, 255, 255, 0.82);
}

.dashboard-actions {
  display: none;
}

.weekly-dashboard {
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 12px;
}

.dashboard-day-column {
  min-height: 300px;
  border-color: var(--family-border);
  border-radius: var(--family-radius);
  background: var(--family-card);
  box-shadow: var(--family-shadow-soft);
}

.dashboard-day-column.is-today {
  border-color: color-mix(in srgb, var(--family-primary) 42%, var(--family-border));
  box-shadow: 0 18px 42px color-mix(in srgb, var(--family-primary) 12%, transparent);
}

.dashboard-day-column.is-selected {
  outline: 3px solid var(--family-primary-soft);
}

.dashboard-day-head span {
  color: var(--family-primary);
}

.dashboard-day-head strong,
.dashboard-event-top strong {
  color: var(--family-text);
}

.dashboard-empty-day {
  border-color: var(--family-border);
  color: var(--family-muted);
  background: var(--family-card-soft);
}

.dashboard-event-card {
  border-color: var(--family-border);
  border-left-width: 5px;
  border-radius: 14px;
  background: var(--family-card-soft);
  box-shadow: none;
  animation: softRise 260ms var(--ease-spring) both;
}

.dashboard-event-card.is-task {
  border-left-color: var(--module-tasks);
  background: linear-gradient(135deg, var(--module-tasks-soft), var(--family-card-soft) 68%);
}

.dashboard-event-card.is-reminder {
  border-left-color: var(--module-reminders);
  background: linear-gradient(135deg, var(--module-reminders-soft), var(--family-card-soft) 68%);
}

.dashboard-event-card.is-medicine {
  border-left-color: var(--module-medicine);
  background: linear-gradient(135deg, var(--module-medicine-soft), var(--family-card-soft) 68%);
}

.dashboard-event-card p,
.dashboard-event-type,
.task-meta,
.card-meta,
.card-note,
.empty-state,
.group-helper,
.auth-copy {
  color: var(--family-muted);
}

.dashboard-card-actions {
  grid-template-columns: 1fr;
}

.bottom-navigation {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: 16px;
  left: max(12px, env(safe-area-inset-left, 0px));
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  max-width: 620px;
  margin: 0 auto;
  border: 1px solid var(--family-border);
  border-radius: 22px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--family-card) 90%, transparent);
  box-shadow: var(--family-shadow);
  backdrop-filter: blur(20px);
}

.bottom-nav-button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 50px;
  place-items: center;
  gap: 5px;
  border: 0;
  border-radius: 16px;
  color: var(--family-muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 10px;
  overflow: hidden;
  transform: translateY(0) scale(1);
  transition:
    background 220ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-spring),
    box-shadow 220ms var(--ease-out);
}

.bottom-nav-button:hover,
.bottom-nav-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.bottom-nav-button span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  line-height: 1;
  transform: translateY(0) scale(1);
  transition:
    color 180ms var(--ease-out),
    transform 220ms var(--ease-spring);
}

.bottom-nav-button .ui-icon {
  transition: transform 220ms var(--ease-spring);
}

.bottom-nav-button[aria-pressed="true"] {
  color: #ffffff;
  background: var(--module-home-gradient);
  transform: scale(1);
}

.bottom-nav-button.is-task[aria-pressed="true"] {
  color: var(--module-tasks);
  background: var(--module-tasks-soft);
}

.bottom-nav-button.is-medicine[aria-pressed="true"] {
  color: var(--module-medicine);
  background: var(--module-medicine-soft);
}

.bottom-nav-button.is-reminder[aria-pressed="true"] {
  color: var(--module-reminders);
  background: var(--module-reminders-soft);
}

.bottom-nav-button.is-shopping[aria-pressed="true"] {
  color: var(--module-shopping);
  background: var(--module-shopping-soft);
}

.bottom-nav-button.is-more[aria-pressed="true"] {
  color: var(--module-more);
  background: var(--module-more-soft);
}

.bottom-nav-button[aria-pressed="true"] span {
  color: inherit;
  transform: scale(1.04);
  animation: bottomNavIconPop 220ms var(--ease-spring) both;
}

.bottom-nav-button[aria-pressed="true"] .ui-icon {
  transform: scale(1.08);
}

@keyframes bottomNavIconPop {
  0% {
    transform: scale(0.94);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav-button,
  .bottom-nav-button span,
  .bottom-nav-button .ui-icon {
    transition: none;
  }

  .bottom-nav-button[aria-pressed="true"] span {
    animation: none;
  }
}

.family-fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(105px + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 0;
  border-radius: 22px;
  color: #ffffff;
  background: var(--family-primary);
  box-shadow: 0 18px 34px color-mix(in srgb, var(--family-primary) 34%, transparent);
  font-size: 1.35rem;
  line-height: 1;
}

.family-fab:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--family-primary) 28%, transparent);
  outline-offset: 3px;
}

.family-fab .ui-icon {
  width: 22px;
  height: 22px;
}

.theme-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-choice-button {
  min-height: 48px;
  font-weight: 850;
}

.hub-placeholder-card {
  display: grid;
  max-width: 560px;
  gap: 10px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
}

.field input,
.field select,
.field textarea,
.auth-input {
  border-color: var(--family-border);
  border-radius: 14px;
  color: var(--family-text);
  background: var(--family-card);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.auth-input:focus {
  border-color: var(--family-primary);
  box-shadow: 0 0 0 4px var(--family-primary-soft);
}

@media (min-width: 760px) {
  .bottom-navigation {
    display: none;
  }

  .family-fab {
    right: 28px;
    bottom: 28px;
  }
}

@media (max-width: 759px) {
  body {
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell,
  body.has-dashboard-page .app-shell,
  body.has-schedule-page .app-shell,
  body.has-tasks-page .app-shell,
  body.has-reminders-page .app-shell,
  body.has-shopping-page .app-shell {
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px 0;
  }

  .topbar,
  .mobile-scroll-header {
    display: none !important;
  }

  .family-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 16px;
  }

  .family-hero h2 {
    font-size: 2rem;
  }

  .family-hero img {
    width: 70px;
    height: 70px;
    border-radius: 18px;
  }

  .today-stats {
    grid-template-columns: repeat(4, minmax(116px, 1fr));
    margin-inline: -12px;
    overflow-x: auto;
    padding: 0 12px 4px;
    scroll-snap-type: x proximity;
  }

  .today-stat-card {
    min-height: 104px;
    scroll-snap-align: start;
  }

  .dashboard-heading {
    gap: 10px;
  }

  .upcoming-event-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .upcoming-event-row .dashboard-event-type {
    grid-column: 1 / -1;
  }

  .week-day-strip {
    grid-auto-columns: 64px;
    grid-auto-flow: column;
    grid-template-columns: none;
    margin-inline: -12px;
    overflow-x: auto;
    padding: 0 12px 4px;
    scroll-snap-type: x proximity;
  }

  .week-day-pill {
    scroll-snap-align: start;
  }

  .week-controls {
    width: 100%;
  }

  .week-controls .ghost-button {
    flex: 1 1 auto;
  }

  .weekly-dashboard {
    grid-auto-columns: minmax(268px, 88vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    margin-inline: -12px;
    padding: 0 12px 8px;
  }

  .dashboard-day-column {
    min-height: 390px;
  }

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

  .quick-event-dialog,
  .task-dialog,
  .medicine-dialog,
  .details-dialog,
  .fields-dialog,
  .account-dialog {
    width: min(100vw - 16px, 620px);
    max-height: calc(100dvh - 20px);
    margin: auto auto 8px;
    border-radius: 24px;
  }

  .quick-event-form,
  .task-form {
    padding: 16px;
  }

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

/* Minimal quick-add sheets */
.quick-event-dialog {
  width: min(calc(100vw - 24px), 360px);
}

.quick-event-dialog .form-heading {
  border-bottom: 0;
  padding-bottom: 0;
}

.quick-event-form {
  gap: 16px;
  min-height: 430px;
  padding: 20px;
}

.quick-type-screen,
.quick-form-screen {
  display: grid;
  gap: 12px;
}

.quick-type-screen[hidden],
.quick-form-screen[hidden] {
  display: none;
}

.quick-type-screen > p {
  margin: 0 0 2px;
  color: var(--family-text);
  font-size: 0.78rem;
  font-weight: 800;
}

.quick-action-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--family-border);
  border-radius: 16px;
  background: var(--family-card);
  box-shadow: var(--family-shadow-soft);
}

.quick-action-button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--family-border);
  padding: 10px 12px;
  color: var(--family-text);
  background: transparent;
  font-weight: 850;
  text-align: left;
}

.quick-action-button:last-child {
  border-bottom: 0;
}

.quick-action-button span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--family-primary);
  font-weight: 950;
}

.quick-action-button.is-reminder span {
  background: var(--family-warning);
}

.quick-action-button.is-medicine span {
  background: var(--family-success);
}

.quick-action-button.is-shopping span {
  background: var(--family-primary);
}

.quick-action-button.is-document span {
  background: var(--family-purple);
}

.quick-action-button:hover {
  background: var(--family-card-soft);
}

.quick-event-dialog .field span {
  color: var(--family-text);
  font-size: 0.8rem;
  font-weight: 850;
}

.quick-event-dialog .field input,
.quick-event-dialog .field select,
.quick-event-dialog .field textarea {
  min-height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--family-card) 88%, var(--family-card-soft));
}

.quick-event-dialog .field textarea {
  min-height: 78px;
}

.quick-event-dialog .form-row {
  gap: 10px;
}

.quick-event-dialog .form-actions {
  gap: 10px;
}

.quick-event-dialog .form-actions .primary-button,
.quick-event-dialog .form-actions .ghost-button {
  min-height: 46px;
  border-radius: 12px;
}

.quick-event-dialog[data-quick-theme="task"] .primary-button {
  background: var(--module-tasks);
}

.quick-event-dialog[data-quick-theme="reminder"] .primary-button {
  background: var(--module-reminders);
}

.quick-event-dialog[data-quick-theme="medicine"] .primary-button {
  background: var(--module-medicine);
}

.quick-event-dialog[data-quick-theme="document"] .primary-button {
  background: var(--family-purple);
}

.quick-event-dialog[data-quick-theme="shopping"] .primary-button {
  background: var(--module-shopping);
}

.quick-event-dialog[data-quick-theme="expenses"] .primary-button {
  background: var(--module-expenses);
}

@media (max-width: 759px) {
  .quick-event-dialog {
    width: min(calc(100vw - 16px), 390px);
  }

  .quick-event-form {
    padding: 16px;
  }
}

/* Account UX grouping */
.account-dialog {
  width: min(calc(100vw - 24px), 620px);
}

.account-panel {
  gap: 14px;
}

.account-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.account-profile-section {
  grid-template-columns: minmax(0, 1fr);
}

.account-summary {
  align-items: center;
}

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

.account-info-grid div {
  border-radius: 14px;
  background: var(--color-surface-soft);
}

.account-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-section-heading span {
  display: block;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.35;
}

.group-current-card {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-radius: 16px;
  padding: 12px;
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
}

.group-current-card strong,
.group-current-card p,
.group-members p {
  margin: 0;
}

.group-current-card strong {
  color: var(--color-text);
  font-size: 0.98rem;
  font-weight: 900;
}

.group-current-card p {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.38;
}

.group-status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--color-text-muted);
}

.group-current-card.is-family .group-status-dot {
  background: var(--color-success);
}

.group-code {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 12px;
  background: var(--color-surface-soft);
}

.group-code strong {
  letter-spacing: 0.08em;
}

.group-members {
  display: grid;
  gap: 8px;
}

.group-members p {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.group-members span {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 8px 10px;
  background: var(--color-surface);
}

.group-members b {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 900;
}

.group-members em {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-details {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 0;
  background: var(--color-surface-soft);
}

.account-details summary {
  cursor: pointer;
  padding: 12px;
  color: var(--color-text);
  font-weight: 900;
  list-style: none;
}

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

.account-details summary::after {
  content: "+";
  float: right;
  color: var(--color-text-muted);
}

.account-details[open] summary::after {
  content: "-";
}

.account-details[open] {
  padding-bottom: 12px;
}

.account-details .group-tools,
.account-details .password-form,
.account-actions-grid {
  padding: 0 12px;
}

.account-actions-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.account-footer-actions {
  display: flex;
  justify-content: flex-end;
}

.danger-action {
  color: #dc2626;
}

html[data-theme="dark"] .account-section,
html[data-theme="dark"] .group-members span,
html[data-theme="dark"] .account-details {
  border-color: var(--color-border);
  background: var(--color-surface);
}

html[data-theme="dark"] .account-info-grid div,
html[data-theme="dark"] .group-code {
  background: var(--color-surface-soft);
}

.app-toast {
  border-left: 4px solid var(--color-success);
}

.app-toast.is-error {
  border-left-color: #ef4444;
}

.app-toast.is-error p {
  color: #ef4444;
}

@media (max-width: 759px) {
  .account-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }

  .account-panel {
    max-height: calc(100dvh - 12px);
    border-radius: 24px 24px 0 0;
    padding: 14px 14px max(16px, env(safe-area-inset-bottom, 0px));
  }

  .account-info-grid {
    grid-template-columns: 1fr;
  }

  .group-tools {
    grid-template-columns: 1fr;
  }
}

/* Expenses module */
.module-icon.is-expenses,
.quick-action-button.is-expenses span {
  color: #ffffff;
  background: var(--module-expenses);
}

.monthly-expenses-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.monthly-expenses-card p,
.monthly-expenses-card strong {
  margin: 0;
}

.monthly-expenses-card p {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.monthly-expenses-card strong {
  display: block;
  margin-top: 2px;
  color: var(--module-expenses);
  font-size: 1.35rem;
  font-weight: 950;
}

.expenses-section[hidden] {
  display: none;
}

.expenses-section {
  display: grid;
  gap: 16px;
}

.expenses-summary-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
}

.expense-summary-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.expense-summary-card.is-total {
  background: linear-gradient(135deg, var(--module-expenses-soft), var(--color-surface) 72%);
}

.expense-summary-card span {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.expense-summary-card strong {
  color: var(--module-expenses);
  font-size: clamp(1.55rem, 4vw, 2.2rem);
  font-weight: 950;
  line-height: 1;
}

.expense-summary-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

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

.expense-owner-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.expense-owner-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 12px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 88%, var(--module-expenses-soft));
}

.expense-owner-card.is-shared {
  background: color-mix(in srgb, var(--color-surface) 86%, var(--color-border));
}

.expense-owner-card span {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-owner-card strong {
  color: var(--module-expenses);
  font-size: 1.05rem;
  font-weight: 950;
}

.expense-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.expense-card h3,
.expense-card p,
.expense-card small {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-card h3 {
  color: var(--color-text);
  font-size: 0.98rem;
  font-weight: 900;
}

.expense-card p,
.expense-card small {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.expense-card strong {
  color: var(--module-expenses);
  font-size: 1rem;
  font-weight: 950;
  white-space: nowrap;
}

.expenses-empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  border: 1px dashed var(--color-border);
  border-radius: 18px;
  padding: 16px;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

.expenses-empty-state[hidden] {
  display: none;
}

.expenses-empty-state p {
  margin: 0;
  font-weight: 750;
}

.onboarding-dialog {
  width: min(calc(100% - 28px), 430px);
  border: 0;
  border-radius: 28px;
  padding: 0;
  color: var(--family-text);
  background: transparent;
}

.onboarding-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(10px);
}

.onboarding-panel {
  position: relative;
  display: grid;
  gap: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 28px;
  padding: 18px;
  background: var(--family-card, var(--color-surface));
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24);
}

.onboarding-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: none;
}

.onboarding-close-button .ui-icon {
  width: 20px;
  height: 20px;
}

.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-inline: 44px;
}

.onboarding-progress span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-primary) 18%, var(--color-border));
  transition:
    width 180ms ease,
    background 180ms ease;
}

.onboarding-progress span.is-active {
  width: 26px;
  background: var(--color-primary);
}

.onboarding-visual {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  justify-self: center;
  border-radius: 28px;
  color: #ffffff;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(135deg, var(--color-primary), var(--module-reminders, #f59e0b));
  box-shadow: 0 18px 40px color-mix(in srgb, var(--color-primary) 22%, transparent);
}

.onboarding-visual .ui-icon {
  width: 36px;
  height: 36px;
}

.onboarding-panel .eyebrow {
  margin: 0;
  text-align: center;
}

.onboarding-panel h2 {
  margin: -4px 0 0;
  color: var(--color-text);
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  line-height: 1.08;
  text-align: center;
}

.onboarding-panel > p:not(.eyebrow) {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.48;
  text-align: center;
}

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

.onboarding-points li {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 10px 12px 10px 36px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
  font-weight: 760;
}

.onboarding-points li::before {
  position: absolute;
  top: 12px;
  left: 13px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  content: "";
  background: var(--color-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.onboarding-next-button {
  min-height: 48px;
  margin-top: 2px;
}

.expense-dialog .primary-button,
.expenses-add-button {
  background: var(--module-expenses);
}

html[data-theme="dark"] .expense-summary-card.is-total {
  background: linear-gradient(135deg, var(--module-expenses-soft), var(--color-surface) 72%);
}

@media (max-width: 759px) {
  .expenses-summary-grid {
    grid-template-columns: 1fr;
  }

  .expense-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .expense-card strong {
    grid-column: 2;
  }
}

/* Family Hub auth splash */
.auth-overlay {
  overflow: auto;
  place-items: start center;
  align-items: start;
  padding: max(18px, env(safe-area-inset-top, 0px)) 14px max(18px, env(safe-area-inset-bottom, 0px));
  color: var(--family-text);
  background:
    radial-gradient(circle at 50% 22%, rgba(37, 99, 235, 0.08), transparent 30%),
    var(--family-bg);
  backdrop-filter: none;
}

html[data-theme="dark"] .auth-overlay {
  background:
    radial-gradient(circle at 50% 12%, rgba(59, 130, 246, 0.18), transparent 34%),
    linear-gradient(180deg, #102033 0%, #0f172a 100%);
}

.auth-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 430px);
  min-height: min(720px, calc(100dvh - 28px));
  align-content: start;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.86);
  border-radius: 28px;
  padding: clamp(18px, 3vh, 30px) 22px 22px;
  color: var(--family-text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.96)),
    var(--family-card);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .auth-card {
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--family-text);
  background:
    linear-gradient(180deg, rgba(15, 30, 50, 0.96), rgba(15, 23, 42, 0.98)),
    var(--family-card);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.auth-card::before {
  position: absolute;
  inset: 18px;
  z-index: -1;
  content: "";
  opacity: 0.72;
  background-image:
    url("data:image/svg+xml,%3Csvg width='92' height='92' viewBox='0 0 92 92' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg stroke='%23CBD5E1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='.62'%3E%3Cpath d='M21 28c-4-5-12-2-12 5 0 8 12 14 12 14s12-6 12-14c0-7-8-10-12-5Z'/%3E%3Crect x='62' y='12' width='17' height='21' rx='3'/%3E%3Cpath d='M67 18h7M67 24h6'/%3E%3Cpath d='M15 70h4l3-16h18l-3 11H23'/%3E%3Ccircle cx='25' cy='75' r='1.8'/%3E%3Ccircle cx='37' cy='75' r='1.8'/%3E%3Cpath d='M62 70h18M71 61v18'/%3E%3Crect x='57' y='56' width='28' height='28' rx='7'/%3E%3Cpath d='M45 15h15M52.5 7.5v15'/%3E%3Crect x='38' y='1' width='28' height='28' rx='7'/%3E%3Cpath d='m8 9 6 6M14 9l-6 6'/%3E%3Crect x='2' y='3' width='18' height='18' rx='5'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center top;
  background-repeat: repeat;
  background-size: 138px 138px;
  pointer-events: none;
}

html[data-theme="dark"] .auth-card::before {
  opacity: 0.34;
  filter: brightness(0.82);
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: clamp(0px, 1.5vh, 14px);
  text-align: center;
}

.auth-brand .auth-brand-mark {
  width: clamp(104px, 25vw, 148px);
  height: clamp(104px, 25vw, 148px);
  color: var(--family-primary);
  filter: drop-shadow(0 18px 42px rgba(15, 23, 42, 0.12));
}

html[data-theme="dark"] .auth-brand .auth-brand-mark {
  color: color-mix(in srgb, var(--family-primary) 62%, #34d399);
  filter: drop-shadow(0 18px 44px rgba(0, 0, 0, 0.34));
}

.auth-kicker {
  margin: 0 0 4px;
  color: var(--family-primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: none;
}

.auth-title {
  margin: 0;
  color: var(--family-text);
  font-size: clamp(2.1rem, 9vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.auth-copy {
  width: min(100%, 250px);
  margin: 0 auto clamp(2px, 1vh, 8px);
  color: var(--family-text);
  font-size: clamp(1rem, 4vw, 1.18rem);
  font-weight: 650;
  line-height: 1.48;
  text-align: center;
}

.auth-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
}

.auth-legal-links a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 34%, transparent);
  text-underline-offset: 3px;
}

.auth-legal-links a:hover,
.auth-legal-links a:focus-visible {
  color: var(--color-primary);
}

.about-app-button {
  width: fit-content;
  max-width: 100%;
  display:flex;
  align-self: center;
  gap:10px;
  align-items: center;
  align-self: center;
  margin: -2px auto 0;
  min-height: 36px;
  padding: 6px 13px 6px 8px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 16%, transparent);
  border-radius: 999px;
  color: color-mix(in srgb, var(--color-text) 72%, var(--color-primary));
  background: color-mix(in srgb, var(--color-primary) 5%, transparent);
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 620;
  line-height: 1;
  opacity: 0.86;
}

.about-app-button:hover,
.about-app-button:focus-visible {
  border-color: color-mix(in srgb, var(--color-primary) 28%, transparent);
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--color-primary) 8%, transparent);
  opacity: 1;
  transform: translateY(-1px);
}

.about-app-button .forgot-password-icon {
  width: 24px;
  height: 24px;
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  box-shadow: none;
  color: var(--color-primary);
}

.about-app-button .forgot-password-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.auth-about-modal {
  gap: 14px;
}

.auth-about-copy {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.94rem;
  font-weight: 560;
  line-height: 1.45;
}

.auth-about-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-about-grid span {
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.auth-tabs,
.auth-form {
  position: relative;
  z-index: 1;
}

.auth-tabs {
  margin-top: 0;
  border-color: var(--family-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--family-card-soft) 86%, transparent);
}

.auth-tab {
  border-radius: 12px;
}

.auth-tab[aria-pressed="true"] {
  background: var(--family-primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.auth-field {
  color: var(--family-muted);
}

.auth-input {
  border-radius: 14px;
  background: color-mix(in srgb, var(--family-card) 92%, var(--family-card-soft));
}

.auth-button {
  border-radius: 14px;
  background: var(--family-primary);
}

@media (max-width: 420px) {
  .auth-card {
    min-height: calc(100dvh - 20px);
    border-radius: 24px;
    gap: 12px;
    padding: 16px 18px 18px;
  }

  .auth-brand {
    margin-top: 8px;
  }

  .auth-brand img {
    width: 104px;
    height: 104px;
  }
}

@media (max-height: 720px) {
  .auth-card {
    min-height: auto;
    gap: 12px;
    padding-top: 20px;
  }

  .auth-brand {
    margin-top: 0;
  }

  .auth-brand img {
    width: 104px;
    height: 104px;
  }

  .auth-title {
    font-size: 2rem;
  }

  .auth-copy {
    font-size: 0.98rem;
  }
}

/* SVG icons and modal sizing guards */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon {
  width: 1.08em;
  height: 1.08em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module-icon .ui-icon,
.stat-icon .ui-icon,
.module-menu-button .ui-icon,
.bottom-nav-button .ui-icon,
.quick-action-button .ui-icon,
.icon-button .ui-icon {
  width: 1em;
  height: 1em;
}

.icon-button {
  font-size: 1rem;
}

.today-stat-card > div {
  min-width: 0;
}

.today-stat-card p,
.today-stat-card small {
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.quick-event-dialog,
.task-dialog,
.medicine-dialog,
.details-dialog,
.fields-dialog,
.account-dialog {
  width: min(620px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.quick-event-dialog {
  width: min(390px, calc(100vw - 24px));
}

.fields-dialog {
  width: min(900px, calc(100vw - 24px));
}

.quick-event-form,
.task-form,
.medicine-form,
.details-panel,
.fields-form,
.account-panel {
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.quick-event-dialog .field,
.task-dialog .field,
.medicine-dialog .field,
.details-dialog .field,
.fields-dialog .field,
.account-dialog .field,
.quick-event-dialog .form-row,
.task-dialog .form-row,
.medicine-dialog .form-row,
.details-dialog .schedule-form-grid,
.fields-dialog .fields-settings-layout,
.account-dialog .account-info-grid,
.quick-event-dialog .form-actions,
.task-dialog .form-actions,
.medicine-dialog .form-actions,
.details-dialog .form-actions,
.fields-dialog .form-actions,
.account-dialog .form-actions {
  min-width: 0;
  max-width: 100%;
}

.quick-event-dialog .field input,
.quick-event-dialog .field select,
.quick-event-dialog .field textarea,
.task-dialog .field input,
.task-dialog .field select,
.task-dialog .field textarea,
.medicine-dialog .field input,
.medicine-dialog .field select,
.medicine-dialog .field textarea,
.details-dialog .field input,
.details-dialog .field select,
.details-dialog .field textarea,
.fields-dialog .field input,
.fields-dialog .field select,
.fields-dialog .field textarea,
.account-dialog .field input,
.account-dialog .field select,
.account-dialog .field textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.quick-event-dialog .field textarea,
.task-dialog .field textarea,
.medicine-dialog .field textarea,
.fields-dialog .field textarea,
.account-dialog .field textarea {
  resize: none;
}

.details-dialog .schedule-form-grid {
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.72fr) minmax(0, 1fr) minmax(132px, auto);
  align-items: end;
}

.details-dialog .schedule-form-grid .primary-button {
  width: 100%;
  min-width: 0;
  white-space: normal;
}

@media (max-width: 759px) {
  .today-stats {
    grid-template-columns: repeat(4, minmax(86px, 1fr));
    gap: 10px;
    margin-inline: -12px;
    padding: 0 12px 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .today-stat-card {
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    gap: 6px;
    min-height: 124px;
    padding: 12px 8px;
    text-align: center;
    scroll-snap-align: start;
  }

  .today-stat-card .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .today-stat-card p {
    width: 100%;
    color: var(--family-text);
    font-size: clamp(0.72rem, 2.9vw, 0.82rem);
    font-weight: 900;
    line-height: 1.15;
  }

  .today-stat-card strong {
    font-size: 1.72rem;
  }

  .today-stat-card small {
    width: 100%;
    font-size: 0.72rem;
    line-height: 1.15;
  }

  .quick-event-dialog,
  .task-dialog,
  .medicine-dialog,
  .details-dialog,
  .fields-dialog,
  .account-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: auto;
    overflow: hidden;
  }

  .quick-event-dialog[open],
  .task-dialog[open],
  .medicine-dialog[open],
  .details-dialog[open],
  .fields-dialog[open],
  .account-dialog[open] {
    padding: 0;
  }

  .quick-event-form,
  .task-form,
  .medicine-form,
  .details-panel,
  .fields-form,
  .account-panel {
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }

  .task-dialog .form-row,
  .medicine-dialog .form-row,
  .details-dialog .schedule-form-grid,
  .fields-dialog .fields-settings-layout,
  .account-dialog .account-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .today-stats {
    grid-template-columns: repeat(4, minmax(80px, 1fr));
  }
}

@media (max-height: 720px) {
  .quick-event-form,
  .task-form,
  .medicine-form,
  .details-panel,
  .fields-form,
  .account-panel {
    gap: 10px;
    padding: 12px;
  }

  .quick-event-dialog .field input,
  .quick-event-dialog .field select,
  .task-dialog .field input,
  .task-dialog .field select,
  .medicine-dialog .field input,
  .medicine-dialog .field select,
  .details-dialog .field input,
  .details-dialog .field select,
  .fields-dialog .field input,
  .fields-dialog .field select,
  .account-dialog .field input,
  .account-dialog .field select {
    min-height: 40px;
  }

  .quick-event-dialog .field textarea,
  .task-dialog .field textarea,
  .medicine-dialog .field textarea,
  .fields-dialog .field textarea,
  .account-dialog .field textarea {
    min-height: 58px;
  }
}

/* Family Hub main screen polish: stage 1 */
.app-shell,
body.has-dashboard-page .app-shell,
body.has-schedule-page .app-shell,
body.has-tasks-page .app-shell,
body.has-reminders-page .app-shell,
body.has-shopping-page .app-shell {
  width: min(100%, 1100px);
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 35;
  display: grid;
  grid-template-columns: 48px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  margin-bottom: 18px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.mobile-module-trigger {
  display: none;
}

.family-header-brand {
  grid-column: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
}

.family-header-brand:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 62%, white);
  outline-offset: 4px;
  border-radius: 18px;
}

.family-header-brand .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.family-header-title {
  grid-column: 2;
  margin: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: clamp(1.08rem, 3vw, 1.32rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-header-actions {
  grid-column: 4;
  justify-content: flex-end;
  gap: 8px;
}

.desktop-module-menu {
  grid-column: 3;
  grid-auto-columns: max-content;
  grid-auto-flow: column;
  grid-template-columns: none;
  justify-self: center;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.desktop-module-menu::-webkit-scrollbar {
  display: none;
}

.family-notification-button,
.family-avatar-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 0;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.family-avatar-button {
  display: grid;
  place-items: center;
}

.family-avatar-button .account-avatar {
  width: 32px;
  height: 32px;
}

.family-avatar-button .account-button__text {
  display: none;
}

.mobile-scroll-header {
  display: none !important;
}

.mobile-module-sheet {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 45;
  display: grid;
  width: min(260px, calc(100vw - 32px));
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.mobile-module-sheet[hidden] {
  display: none;
}

.mobile-module-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 12px;
  color: var(--color-text);
  background: transparent;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 850;
  text-align: left;
}

.mobile-module-option span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 11px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.mobile-module-option[aria-pressed="true"] {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.today-welcome-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 22px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.today-welcome-card p,
.today-welcome-card time {
  margin: 0;
}

.today-welcome-card p {
  color: var(--color-text);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.today-welcome-card time {
  display: block;
  margin-top: 5px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.today-welcome-card strong {
  color: var(--color-text);
  font-size: clamp(1.02rem, 2.6vw, 1.2rem);
  font-weight: 850;
  line-height: 1.24;
}

.today-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  overflow: visible;
  padding: 0;
}

.today-stat-card {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 148px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px 12px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.today-stat-card.is-task,
.today-stat-card.is-reminder,
.today-stat-card.is-medicine,
.today-stat-card.is-document {
  background: var(--color-surface);
}

.today-stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.today-stat-card .stat-icon .ui-icon {
  width: 24px;
  height: 24px;
}

.today-stat-card p,
.today-stat-card small {
  width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--color-text);
  font-weight: 850;
  line-height: 1.18;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.today-stat-card p {
  font-size: clamp(0.82rem, 1.8vw, 0.95rem);
}

.today-stat-card strong {
  display: block;
  color: var(--module-color, var(--color-primary));
  font-size: clamp(2rem, 4vw, 2.45rem);
  font-weight: 950;
  line-height: 0.96;
}

.today-stat-card small {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.today-stat-card.is-task {
  --module-color: #2563eb;
}

.today-stat-card.is-reminder {
  --module-color: #f59e0b;
}

.today-stat-card.is-medicine {
  --module-color: #22c55e;
}

.today-stat-card.is-document {
  --module-color: #8b5cf6;
}

.today-stat-card .stat-icon,
.today-stat-card.is-task .stat-icon,
.today-stat-card.is-reminder .stat-icon,
.today-stat-card.is-medicine .stat-icon,
.today-stat-card.is-document .stat-icon {
  color: #ffffff;
  background: var(--module-color);
}

html[data-theme="dark"] .today-welcome-card,
html[data-theme="dark"] .today-stat-card,
html[data-theme="dark"] .family-notification-button,
html[data-theme="dark"] .family-avatar-button,
html[data-theme="dark"] .mobile-module-trigger,
html[data-theme="dark"] .mobile-module-sheet,
html[data-theme="dark"] .notification-card {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.notifications-section {
  display: grid;
  gap: 16px;
}

.notifications-section[hidden] {
  display: none;
}

.notifications-read-all-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: var(--shadow-soft);
}

.notifications-read-all-button .ui-icon {
  width: 22px;
  height: 22px;
  stroke-width: 2.6;
}

.notifications-read-all-button:hover,
.notifications-read-all-button:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
}

.notifications-read-all-button[hidden] {
  display: none;
}

.notifications-list {
  display: grid;
  gap: 16px;
}

.notification-group {
  display: grid;
  gap: 8px;
}

.notification-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-text);
}

.notification-group-heading strong {
  font-size: 1rem;
  font-weight: 950;
}

.notification-group-heading span {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  font-size: 0.74rem;
  font-weight: 950;
}

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

.notification-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  touch-action: pan-y;
}

.notification-card-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 14px;
  border-radius: inherit;
  background: var(--color-surface);
  transform: translateX(var(--swipe-x, 0));
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  cursor: pointer;
}

.notification-card.is-unread {
  border-color: color-mix(in srgb, var(--color-primary) 32%, var(--color-border));
}

.notification-card.is-unread .notification-card-inner::after {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  content: "";
}

.notification-card.is-read .notification-card-inner {
  opacity: 0.62;
}

.notification-delete-action {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 0;
  display: grid;
  width: 84px;
  place-items: center;
  border: 0;
  color: #fff;
  background: #ef4444;
  cursor: pointer;
}

.notification-delete-action .ui-icon {
  width: 22px;
  height: 22px;
}

.notification-card p,
.notification-card time {
  margin: 0;
}

.notification-card p {
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 650;
  line-height: 1.28;
  max-height: 3.9em;
  overflow: hidden;
  white-space: pre-wrap;
}

.notification-card time {
  display: block;
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.family-notification-button,
[data-module="notifications"] {
  position: relative;
}

.family-notification-button.has-unread-notifications::after,
[data-module="notifications"].has-unread-notifications::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  background: #ef4444;
  content: "";
}

.notification-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 12, 24, 0.46);
  backdrop-filter: blur(10px);
}

.notification-detail-popup {
  display: grid;
  width: min(520px, 100%);
  max-height: min(680px, calc(100dvh - 36px));
  gap: 14px;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 18px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 28px 90px rgba(8, 12, 24, 0.34);
}

.notification-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notification-detail-heading p,
.notification-detail-heading h2,
.notification-detail-popup time {
  margin: 0;
}

.notification-detail-heading p {
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.notification-detail-heading h2 {
  margin-top: 3px;
  font-size: 1.35rem;
  line-height: 1.12;
}

.notification-detail-message {
  max-height: min(440px, calc(100dvh - 220px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  border-radius: 18px;
  padding: 14px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-background));
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.notification-detail-popup time {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.notification-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.notification-detail-actions .primary-button,
.notification-detail-actions .ghost-button {
  min-height: 44px;
  padding-inline: 18px;
}

@media (max-width: 560px) {
  .notification-detail-actions {
    flex-direction: column;
  }

  .notification-detail-actions .primary-button,
  .notification-detail-actions .ghost-button {
    width: 100%;
  }
}

@media (min-width: 760px) {
  .app-shell,
  body.has-dashboard-page .app-shell,
  body.has-schedule-page .app-shell,
  body.has-tasks-page .app-shell,
  body.has-reminders-page .app-shell,
  body.has-shopping-page .app-shell {
    padding: 24px;
  }
}

@media (min-width: 1100px) {
  .app-shell,
  body.has-dashboard-page .app-shell,
  body.has-schedule-page .app-shell,
  body.has-tasks-page .app-shell,
  body.has-reminders-page .app-shell,
  body.has-shopping-page .app-shell {
    padding: 32px;
  }
}

@media (max-width: 759px) {
  body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    display: grid !important;
    grid-template-columns: 44px 40px minmax(0, 1fr) 96px;
    gap: 8px;
    min-height: 54px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 8px;
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
  }

  .mobile-module-trigger {
    grid-column: 1;
    display: grid;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0;
    color: var(--color-text);
    background: transparent;
    box-shadow: none;
  }

  .family-header-brand {
    grid-column: 2;
    display: grid;
    width: 40px;
    height: 44px;
    min-width: 40px;
    place-items: center;
  }

  .family-header-brand .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .family-header-title {
    grid-column: 3;
    font-size: 1.1rem;
  }

  .family-header-actions {
    grid-column: 4;
  }

  .desktop-module-menu {
    display: none;
  }

  .today-welcome-card {
    padding: 20px;
  }

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

  .today-stat-card {
    min-height: 138px;
    padding: 15px 10px;
  }
}

/* Family Hub upcoming events polish */
.upcoming-events-panel {
  display: grid;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.upcoming-events-panel .panel-heading {
  align-items: center;
}

.upcoming-events-panel .panel-heading h3 {
  color: var(--color-text);
  font-size: clamp(1.05rem, 2.4vw, 1.22rem);
  font-weight: 900;
  letter-spacing: 0;
}

.upcoming-events-panel .text-button {
  color: var(--color-primary);
  font-size: 0.86rem;
  font-weight: 850;
  white-space: nowrap;
}

.panel-kicker {
  margin: 0 0 4px;
  color: var(--color-primary);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
}

.upcoming-events-list {
  display: block;
  min-width: 0;
}

.upcoming-card {
  border: 1px solid var(--color-border);
  border-radius: 18px;
  overflow: hidden;
  padding: 16px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.upcoming-event-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(42px, auto) 18px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 66px;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.upcoming-event-row:hover,
.upcoming-event-row:focus-visible {
  background: color-mix(in srgb, var(--module-color) 8%, transparent);
}

.upcoming-event-row:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--module-color) 34%, transparent);
  outline-offset: -3px;
}

.upcoming-event-row:active {
  transform: scale(0.99);
}

.upcoming-event-row:first-child {
  padding-top: 0;
}

.upcoming-event-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.upcoming-event-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  color: var(--module-color);
  background: color-mix(in srgb, var(--module-color) 14%, transparent);
}

.upcoming-event-icon .ui-icon {
  width: 24px;
  height: 24px;
}

.upcoming-event-row.is-task {
  --module-color: #2563eb;
}

.upcoming-event-row.is-reminder {
  --module-color: #f59e0b;
}

.upcoming-event-row.is-medicine {
  --module-color: #22c55e;
}

.upcoming-event-row.is-document {
  --module-color: #8b5cf6;
}

.upcoming-event-row.is-shopping {
  --module-color: #ec4899;
}

.upcoming-event-copy {
  min-width: 0;
}

.upcoming-event-row h3,
.upcoming-event-row p,
.upcoming-empty p {
  margin: 0;
}

.upcoming-event-row h3 {
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-event-row p {
  overflow: hidden;
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-event-time {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upcoming-event-chevron {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--color-text-muted);
  opacity: 0.62;
}

.upcoming-event-chevron .ui-icon {
  width: 16px;
  height: 16px;
}

.upcoming-empty {
  display: grid;
  gap: 12px;
  justify-items: start;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.upcoming-empty p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.upcoming-event-skeleton {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
}

.upcoming-event-skeleton:first-child {
  padding-top: 0;
}

.upcoming-event-skeleton:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.upcoming-event-skeleton span,
.upcoming-event-skeleton i,
.upcoming-event-skeleton b,
.upcoming-event-skeleton em {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-border) 70%, transparent), color-mix(in srgb, var(--color-surface) 72%, var(--color-border)), color-mix(in srgb, var(--color-border) 70%, transparent));
  background-size: 220% 100%;
  animation: family-skeleton 1.4s ease-in-out infinite;
}

.upcoming-event-skeleton span {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.upcoming-event-skeleton i {
  width: min(180px, 72%);
  height: 14px;
}

.upcoming-event-skeleton b {
  width: min(132px, 54%);
  height: 11px;
  margin-top: 8px;
}

.upcoming-event-skeleton em {
  width: 42px;
  height: 12px;
}

@keyframes family-skeleton {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

html[data-theme="dark"] .upcoming-card {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .upcoming-event-icon {
  background: color-mix(in srgb, var(--module-color) 18%, var(--color-surface));
}

@media (min-width: 760px) {
  .upcoming-card {
    padding: 20px;
  }

  .upcoming-event-row {
    grid-template-columns: 42px minmax(0, 1fr) minmax(54px, auto) 18px;
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .upcoming-card {
    padding: 14px;
  }

  .upcoming-event-row {
    grid-template-columns: 42px minmax(0, 1fr) 40px 14px;
    gap: 8px;
  }

  .upcoming-event-time {
    font-size: 0.78rem;
  }
}

/* Family Hub weekly planner polish */
.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-heading h2 {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(1.08rem, 2.6vw, 1.28rem);
  font-weight: 900;
  letter-spacing: 0;
}

.week-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-week-period {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-current-week-button {
  display: none;
}

.week-controls .icon-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.week-day-strip {
  display: grid;
  grid-auto-columns: 74px;
  grid-auto-flow: column;
  grid-template-columns: none;
  gap: 8px;
  min-width: 0;
  margin-inline: -4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding: 0 4px 6px;
  scroll-padding-inline: 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.week-day-strip::-webkit-scrollbar {
  display: none;
}

.week-day-pill {
  position: relative;
  display: grid;
  min-width: 74px;
  min-height: 64px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 8px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  scroll-snap-align: start;
  touch-action: pan-x;
  user-select: none;
  white-space: nowrap;
}

.week-day-pill span,
.week-day-pill strong,
.week-day-pill em {
  margin: 0;
  line-height: 1;
}

.week-day-pill span {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.week-day-pill strong {
  color: inherit;
  font-size: 1.1rem;
  font-weight: 950;
}

.week-day-pill em {
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
}

.week-day-pill[aria-pressed="true"] {
  border-color: transparent;
  color: #ffffff;
  background: var(--module-home-gradient);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--color-primary) 28%, transparent);
}

.week-day-pill[aria-pressed="true"] span,
.week-day-pill[aria-pressed="true"] strong {
  color: #ffffff;
}

.week-day-pill[aria-pressed="true"] em {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
}

.weekly-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: stretch;
  overflow: visible;
  padding-bottom: 0;
}

.dashboard-day-column {
  display: grid;
  min-width: 0;
  min-height: 248px;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.dashboard-day-column.is-today {
  border-color: color-mix(in srgb, var(--color-primary) 34%, var(--color-border));
}

.dashboard-day-column.is-selected {
  outline: 2px solid color-mix(in srgb, var(--color-primary) 24%, transparent);
}

.dashboard-day-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-day-head span {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.98rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-day-head em {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.dashboard-day-items {
  display: grid;
  gap: 8px;
}

.dashboard-empty-day {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin: 0;
  border: 1px dashed var(--color-border);
  border-radius: 16px;
  padding: 14px;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 82%, var(--color-border));
}

.dashboard-empty-day p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.dashboard-event-card {
  --module-color: #2563eb;
  display: grid;
  gap: 7px;
  margin: 0;
  border: 0;
  border-radius: 14px;
  padding: 12px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--module-color) 12%, var(--color-surface));
  box-shadow: none;
  cursor: pointer;
}

.dashboard-event-card.is-task {
  --module-color: #2563eb;
}

.dashboard-event-card.is-reminder {
  --module-color: #f59e0b;
}

.dashboard-event-card.is-medicine {
  --module-color: #22c55e;
}

.dashboard-event-card.is-document {
  --module-color: #8b5cf6;
}

.dashboard-event-card.is-shopping {
  --module-color: #ec4899;
}

.dashboard-event-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-event-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #ffffff;
  background: var(--module-color);
}

.dashboard-event-icon .ui-icon {
  width: 17px;
  height: 17px;
}

.dashboard-event-top strong {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-event-card h3,
.dashboard-event-card p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-event-card h3 {
  color: var(--color-text);
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.24;
}

.dashboard-event-card p {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.dashboardStatusState {
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.week-day-skeleton,
.dashboard-day-skeleton span,
.dashboard-day-skeleton strong,
.dashboard-day-skeleton .dashboard-day-items div {
  color: transparent;
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-border) 70%, transparent), color-mix(in srgb, var(--color-surface) 72%, var(--color-border)), color-mix(in srgb, var(--color-border) 70%, transparent));
  background-size: 220% 100%;
  animation: family-skeleton 1.4s ease-in-out infinite;
}

.week-day-skeleton {
  border-color: var(--color-border);
  box-shadow: none;
}

.week-day-skeleton span,
.week-day-skeleton strong {
  width: 70%;
  height: 10px;
  border-radius: 999px;
}

.dashboard-day-skeleton .dashboard-day-head span {
  width: 120px;
  height: 16px;
  border-radius: 999px;
}

.dashboard-day-skeleton .dashboard-day-head strong {
  width: 64px;
  height: 12px;
  border-radius: 999px;
}

.dashboard-day-skeleton .dashboard-day-items div {
  height: 72px;
  border-radius: 14px;
}

html[data-theme="dark"] .dashboard-day-column,
html[data-theme="dark"] .week-day-pill,
html[data-theme="dark"] .week-controls .icon-button,
html[data-theme="dark"] .dashboardStatusState {
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

html[data-theme="dark"] .dashboard-event-card {
  background: color-mix(in srgb, var(--module-color) 16%, var(--color-surface));
}

@media (max-width: 759px) {
  .dashboard-heading {
    align-items: flex-start;
  }

  .week-controls {
    flex: 0 0 auto;
  }

  .dashboard-week-period {
    max-width: 104px;
    font-size: 0.8rem;
  }

  .week-day-strip {
    grid-auto-columns: 66px;
    margin-inline: -16px;
    overflow-x: scroll;
    padding: 0 16px 4px;
    scroll-padding-inline: 16px;
    scroll-snap-type: x proximity;
  }

  .week-day-pill {
    min-width: 66px;
  }

  .weekly-dashboard {
    display: block;
  }

  .dashboard-day-column {
    display: none;
    min-height: 260px;
  }

  .dashboard-day-column.is-selected,
  .dashboard-day-column.dashboard-day-skeleton {
    display: grid;
  }
}

@media (max-width: 360px) {
  .dashboard-heading {
    gap: 10px;
  }

  .week-controls {
    gap: 6px;
  }

  .week-controls .icon-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .dashboard-week-period {
    max-width: 86px;
  }

  .dashboard-day-column {
    padding: 14px;
  }
}

/* Quick Create simplification */
.quick-event-dialog {
  width: min(calc(100vw - 24px), 420px);
}

.quick-event-form {
  min-height: auto;
}

.quick-type-screen > p {
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 900;
}

.quick-action-list {
  border-color: var(--color-border);
  border-radius: 18px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.quick-action-button {
  grid-template-columns: 42px minmax(0, 1fr);
  min-height: 62px;
  border-bottom-color: var(--color-border);
  padding: 10px 14px;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 850;
}

.quick-action-button span {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.quick-action-button.is-task span {
  background: #2563eb;
}

.quick-action-button.is-reminder span {
  background: #f59e0b;
}

.quick-action-button.is-medicine span {
  background: #22c55e;
}

.quick-action-button.is-shopping span {
  background: #ec4899;
}

.quick-when-group {
  display: grid;
  gap: 10px;
}

.quick-when-group > span {
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 850;
}

.quick-date-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-date-button {
  min-height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 0 10px;
  color: var(--color-text);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 850;
}

.quick-date-button[aria-pressed="true"] {
  border-color: transparent;
  color: #ffffff;
  background: var(--color-primary);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--color-primary) 24%, transparent);
  transform: translateY(-1px);
}

.quick-date-selected {
  min-height: 22px;
  margin: -2px 0 0;
  color: var(--color-primary);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.25;
}

.quick-date-custom[hidden] {
  display: none;
}

.quick-event-dialog .form-actions {
  grid-template-columns: 0.8fr 1.2fr;
}

html[data-theme="dark"] .quick-action-list,
html[data-theme="dark"] .quick-date-button {
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

html[data-theme="dark"] .quick-date-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 90%, #ffffff);
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 72%, #0f172a));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--color-primary) 34%, transparent);
}

@media (max-width: 759px) {
  .quick-event-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }

  .quick-event-dialog[open] {
    padding: 0;
  }

  .quick-event-dialog::backdrop {
    background: rgba(15, 23, 42, 0.38);
  }

  .quick-event-form {
    max-height: calc(100dvh - 12px);
    border-radius: 24px 24px 0 0;
    padding: 16px 16px max(16px, env(safe-area-inset-bottom, 0px));
  }

  .quick-event-dialog .form-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -16px -16px 0;
    padding: 16px 16px 8px;
    background: var(--color-surface);
  }
}

/* Light theme contrast pass */
html:not([data-theme="dark"]) {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-raised: #ffffff;
  --line: #d7e0ea;
  --text: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-border: #d7e0ea;
  --family-text: #0f172a;
  --family-muted: #475569;
  --family-border: #d7e0ea;
}

html:not([data-theme="dark"]) body {
  color: var(--color-text);
}

html:not([data-theme="dark"]) .brand-lockup h1,
html:not([data-theme="dark"]) .topbar h1,
html:not([data-theme="dark"]) .family-header-title,
html:not([data-theme="dark"]) .section-heading h2,
html:not([data-theme="dark"]) .dashboard-heading h2,
html:not([data-theme="dark"]) .medicine-card h3,
html:not([data-theme="dark"]) .schedule-day-head span,
html:not([data-theme="dark"]) .schedule-item h3,
html:not([data-theme="dark"]) .kanban-column__head,
html:not([data-theme="dark"]) .details-grid strong,
html:not([data-theme="dark"]) .account-info-grid strong,
html:not([data-theme="dark"]) .schedule-rule strong,
html:not([data-theme="dark"]) .account-summary p,
html:not([data-theme="dark"]) .account-notification-status strong,
html:not([data-theme="dark"]) .ios-settings-copy strong,
html:not([data-theme="dark"]) .details-hero strong,
html:not([data-theme="dark"]) .auth-title,
html:not([data-theme="dark"]) .auth-card h2 {
  color: var(--color-text) !important;
}

html:not([data-theme="dark"]) .card-meta,
html:not([data-theme="dark"]) .card-note,
html:not([data-theme="dark"]) .metric-label,
html:not([data-theme="dark"]) .field,
html:not([data-theme="dark"]) .schedule-item p,
html:not([data-theme="dark"]) .schedule-day-head strong,
html:not([data-theme="dark"]) .account-summary span,
html:not([data-theme="dark"]) .details-hero p,
html:not([data-theme="dark"]) .details-note,
html:not([data-theme="dark"]) .details-grid span,
html:not([data-theme="dark"]) .account-info-grid span,
html:not([data-theme="dark"]) .schedule-rule span,
html:not([data-theme="dark"]) .account-notification-status span,
html:not([data-theme="dark"]) .ios-settings-copy small,
html:not([data-theme="dark"]) .empty-state,
html:not([data-theme="dark"]) .kanban-empty,
html:not([data-theme="dark"]) .dashboard-week-period,
html:not([data-theme="dark"]) .dashboard-empty-day,
html:not([data-theme="dark"]) .dashboard-empty-day p,
html:not([data-theme="dark"]) .dashboard-event-card p,
html:not([data-theme="dark"]) .dashboard-event-top strong,
html:not([data-theme="dark"]) .upcoming-event-row p,
html:not([data-theme="dark"]) .upcoming-event-time,
html:not([data-theme="dark"]) .upcoming-empty p,
html:not([data-theme="dark"]) .today-welcome-card time,
html:not([data-theme="dark"]) .today-stat-card small,
html:not([data-theme="dark"]) .notification-card time,
html:not([data-theme="dark"]) .auth-copy {
  color: var(--color-text-muted);
}

html:not([data-theme="dark"]) .topbar,
html:not([data-theme="dark"]) .mobile-module-sheet,
html:not([data-theme="dark"]) .summary-panel,
html:not([data-theme="dark"]) .controls-panel,
html:not([data-theme="dark"]) .compact-sidebar,
html:not([data-theme="dark"]) .medicine-card,
html:not([data-theme="dark"]) .schedule-day-column,
html:not([data-theme="dark"]) .schedule-item,
html:not([data-theme="dark"]) .kanban-column,
html:not([data-theme="dark"]) .task-card,
html:not([data-theme="dark"]) .today-card,
html:not([data-theme="dark"]) .today-welcome-card,
html:not([data-theme="dark"]) .today-stat-card,
html:not([data-theme="dark"]) .upcoming-card,
html:not([data-theme="dark"]) .dashboard-day-column,
html:not([data-theme="dark"]) .notification-card,
html:not([data-theme="dark"]) .account-panel,
html:not([data-theme="dark"]) .account-notification-status,
html:not([data-theme="dark"]) .ios-settings-list,
html:not([data-theme="dark"]) .quick-event-dialog,
html:not([data-theme="dark"]) .task-dialog,
html:not([data-theme="dark"]) .medicine-dialog,
html:not([data-theme="dark"]) .details-dialog,
html:not([data-theme="dark"]) .fields-dialog,
html:not([data-theme="dark"]) .account-dialog,
html:not([data-theme="dark"]) .auth-card {
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

html:not([data-theme="dark"]) .module-menu,
html:not([data-theme="dark"]) .app-view-switch,
html:not([data-theme="dark"]) .mobile-view-switch,
html:not([data-theme="dark"]) .view-mode-switch,
html:not([data-theme="dark"]) .schedule-filter-switch,
html:not([data-theme="dark"]) .compact-sidebar__group,
html:not([data-theme="dark"]) .quantity-stepper,
html:not([data-theme="dark"]) .kanban-count,
html:not([data-theme="dark"]) .details-note,
html:not([data-theme="dark"]) .segmented-field span,
html:not([data-theme="dark"]) .choice-grid span {
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-surface-soft);
}

html:not([data-theme="dark"]) .module-menu-button,
html:not([data-theme="dark"]) .app-view-button,
html:not([data-theme="dark"]) .view-mode-button,
html:not([data-theme="dark"]) .schedule-filter-button,
html:not([data-theme="dark"]) .compact-nav-button,
html:not([data-theme="dark"]) .auth-tab,
html:not([data-theme="dark"]) .bottom-nav-button {
  color: var(--color-text-muted);
}

html:not([data-theme="dark"]) .module-menu-button[aria-pressed="true"],
html:not([data-theme="dark"]) .app-view-button[aria-pressed="true"],
html:not([data-theme="dark"]) .view-mode-button[aria-pressed="true"],
html:not([data-theme="dark"]) .schedule-filter-button[aria-pressed="true"],
html:not([data-theme="dark"]) .compact-nav-button[aria-pressed="true"],
html:not([data-theme="dark"]) .auth-tab[aria-pressed="true"],
html:not([data-theme="dark"]) .theme-choice-button[aria-pressed="true"] {
  border-color: transparent;
  color: #ffffff;
  background: var(--color-primary);
}

html:not([data-theme="dark"]) .account-button,
html:not([data-theme="dark"]) .icon-button,
html:not([data-theme="dark"]) .ghost-button,
html:not([data-theme="dark"]) .small-button,
html:not([data-theme="dark"]) .quantity-button,
html:not([data-theme="dark"]) .summary-settings-button,
html:not([data-theme="dark"]) .theme-choice-button,
html:not([data-theme="dark"]) .quick-date-button {
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

html:not([data-theme="dark"]) .quick-date-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 88%, #ffffff);
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 78%, #0f172a));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

html:not([data-theme="dark"]) .field input,
html:not([data-theme="dark"]) .field select,
html:not([data-theme="dark"]) .field textarea,
html:not([data-theme="dark"]) .auth-input {
  border-color: var(--color-border);
  color: var(--color-text);
  background: #ffffff;
}

html:not([data-theme="dark"]) .field input::placeholder,
html:not([data-theme="dark"]) .field textarea::placeholder,
html:not([data-theme="dark"]) .auth-input::placeholder {
  color: #64748b;
}

/* Family Hub simplified home */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

body.has-dashboard-page main {
  gap: 0;
}

.dashboard-section {
  gap: clamp(22px, 4vw, 34px);
}

.today-welcome-card {
  min-height: 136px;
  align-content: center;
  gap: 18px;
  border-radius: 24px;
  padding: clamp(22px, 4vw, 30px);
  background: var(--color-surface);
}

.today-welcome-card p {
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  letter-spacing: 0;
}

.today-welcome-card strong {
  max-width: 32rem;
  color: var(--color-text-muted);
  font-size: clamp(1rem, 2.8vw, 1.16rem);
  font-weight: 750;
}

.home-sections-panel {
  display: grid;
  gap: 14px;
}

.home-calendar-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 22px;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  padding: 18px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

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

.home-calendar-card strong {
  color: var(--color-text);
  font-size: clamp(1.05rem, 2.4vw, 1.22rem);
  font-weight: 900;
}

.home-calendar-card small {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.home-calendar-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 18px;
  color: #ffffff;
  background: var(--color-primary);
}

.home-calendar-icon .ui-icon {
  width: 25px;
  height: 25px;
}

.home-calendar-chevron {
  color: var(--color-text-muted);
}

.home-sections-panel .panel-heading h3 {
  color: var(--color-text);
  font-size: clamp(1.05rem, 2.4vw, 1.22rem);
  font-weight: 900;
}

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

.home-section-card {
  display: flex;
  min-width: 0;
  min-height: 132px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  padding: 18px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

.home-section-card > span:last-child {
  display: grid;
  min-width: 0;
  gap: 6px;
  align-self: end;
}

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

.home-section-card strong {
  color: var(--color-text);
  font-size: clamp(1rem, 2.2vw, 1.16rem);
  font-weight: 900;
}

.home-section-card small {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.home-section-card small span {
  color: inherit;
}

.home-section-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
}

.home-section-icon .ui-icon {
  width: 24px;
  height: 24px;
}

.home-section-card[aria-disabled="true"] {
  cursor: default;
}

.home-section-card:not([aria-disabled="true"]):hover {
  border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

body.has-dashboard-page .monthly-expenses-card,
body.has-dashboard-page .dashboard-heading,
body.has-dashboard-page .week-day-strip,
body.has-dashboard-page .dashboard-actions,
body.has-dashboard-page .weekly-dashboard,
body.has-dashboard-page .dashboardStatusState,
body.has-dashboard-page #dashboardEmptyState {
  display: none !important;
}

body.has-dashboard-page .upcoming-events-panel {
  gap: 14px;
}

body.has-dashboard-page .upcoming-card {
  border-radius: 22px;
  padding: clamp(16px, 3vw, 22px);
  box-shadow: var(--shadow-soft);
}

body.has-dashboard-page .upcoming-event-row {
  min-height: 68px;
}

html[data-theme="dark"] .home-section-card,
html[data-theme="dark"] .home-calendar-card,
html[data-theme="dark"] .today-welcome-card,
html[data-theme="dark"] body.has-dashboard-page .upcoming-card {
  border-color: var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
}

@media (max-width: 759px) {
  .dashboard-section {
    gap: 22px;
  }

  .today-welcome-card {
    min-height: 122px;
    border-radius: 22px;
    padding: 22px;
  }

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

  .home-calendar-card {
    min-height: 86px;
    border-radius: 22px;
    padding: 16px;
  }

  .home-section-card {
    display: grid;
    min-height: 128px;
    gap: 12px;
    padding: 16px;
  }

  .home-section-card > span:last-child {
    align-self: end;
  }

  .home-section-icon {
    width: 42px;
    height: 42px;
    border-radius: 15px;
  }
}

@media (max-width: 360px) {
  .home-section-card {
    min-height: 118px;
    padding: 14px;
  }

  .home-section-card strong {
    font-size: 0.98rem;
  }

  .home-section-card small {
    font-size: 0.78rem;
  }
}

/* Family zones dashboard */
.family-zones-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.family-zones-hero p,
.family-zones-hero strong {
  display: block;
  margin: 0;
}

.family-zones-hero p {
  color: var(--color-text-muted);
  font-size: 0.96rem;
  font-weight: 850;
}

.family-zones-hero strong {
  margin-top: 4px;
  color: var(--color-text);
  font-size: clamp(2rem, 7vw, 3.1rem);
  line-height: 1;
}

.family-zones-actions {
  display: inline-flex;
  gap: 12px;
}

.family-setup-cta {
  flex: 1 0 100%;
  min-height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: 18px;
  padding: 0 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), #22c55e);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--color-primary) 24%, transparent);
  font-weight: 950;
}

.family-setup-cta[hidden] {
  display: none;
}

.family-icon-action {
  display: inline-grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.family-icon-action .ui-icon {
  width: 25px;
  height: 25px;
}

.family-member-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  margin: 2px 0 0;
  padding: 4px 2px 12px;
  scroll-padding-inline: 2px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.family-member-strip::-webkit-scrollbar {
  display: none;
}

.family-member-card {
  display: grid;
  width: 116px;
  min-width: 116px;
  min-height: 142px;
  scroll-snap-align: start;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  padding: 14px 10px 12px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.family-member-card.is-active {
  border-color: color-mix(in srgb, var(--color-success) 70%, var(--color-border));
  box-shadow: 0 14px 28px rgba(19, 138, 84, 0.16);
}

.family-member-card.is-loading {
  pointer-events: none;
  box-shadow: none;
}

.family-member-card.is-loading .family-member-avatar,
.family-member-card.is-loading strong,
.family-member-card.is-loading .family-member-metrics em,
.family-focus-row.is-loading .family-focus-icon,
.family-focus-row.is-loading strong,
.family-focus-row.is-loading em {
  color: transparent;
  background: linear-gradient(90deg, color-mix(in srgb, var(--color-border) 70%, transparent), color-mix(in srgb, var(--color-surface) 72%, var(--color-border)), color-mix(in srgb, var(--color-border) 70%, transparent));
  background-size: 220% 100%;
  animation: family-skeleton 1.4s ease-in-out infinite;
}

.family-member-card.is-loading strong {
  width: 70%;
  height: 14px;
  border-radius: 999px;
}

.family-member-card.is-loading .family-member-metrics em {
  width: 24px;
  height: 12px;
  border-radius: 999px;
}

.family-member-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #1d59d8, #22c55e);
  font-size: 1.28rem;
  font-weight: 950;
}

.family-member-avatar.has-image {
  color: transparent;
  background-color: #eef4f2;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

.family-member-card.is-shared .family-member-avatar {
  color: #0b1f44;
  background: #dff7e8;
}

.family-member-avatar .ui-icon {
  width: 28px;
  height: 28px;
}

.family-member-card strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-member-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: var(--color-text-muted);
}

.family-member-metrics em {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 850;
}

.family-member-metrics .ui-icon {
  width: 14px;
  height: 14px;
}

.family-focus-row.is-loading {
  pointer-events: none;
}

.family-focus-row.is-loading strong {
  display: block;
  width: 62%;
  height: 15px;
  border-radius: 999px;
}

.family-focus-row.is-loading em {
  display: block;
  width: 44%;
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
}

.family-focus-card,
.family-shared-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--color-border);
  border-radius: 26px;
  padding: clamp(16px, 4vw, 24px);
  background: var(--color-surface);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--color-text) 7%, transparent);
}

.family-focus-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.family-focus-heading h3,
.family-shared-panel h3 {
  margin: 0;
  color: var(--color-text);
  font-size: clamp(1.45rem, 5vw, 2rem);
  line-height: 1.05;
}

.family-focus-kicker {
  margin: 0 0 4px;
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
}

.family-status-pill {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: #176a3d;
  background: #e7f8ed;
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
}

.family-status-pill::before {
  margin-right: 7px;
  content: "✓";
}

.family-status-pill.is-warning {
  color: #9b5d00;
  background: #fff4d8;
}

.family-status-pill.is-warning::before {
  content: "!";
}

.family-focus-list {
  display: grid;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  overflow: hidden;
}

.family-focus-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px;
  background: var(--color-surface);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.family-focus-row:hover,
.family-focus-row:focus-visible {
  background: color-mix(in srgb, var(--module-color, var(--color-primary)) 8%, var(--color-surface));
}

.family-focus-row:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--module-color, var(--color-primary)) 30%, transparent);
  outline-offset: -3px;
}

.family-focus-row:active {
  transform: scale(0.99);
}

.family-focus-row + .family-focus-row {
  border-top: 1px solid var(--color-border);
}

.family-focus-row.is-task {
  --module-color: #2563eb;
}

.family-focus-row.is-reminder {
  --module-color: #f59e0b;
}

.family-focus-row.is-medicine {
  --module-color: #22c55e;
}

.family-focus-row.is-shopping {
  --module-color: #ec4899;
}

.family-focus-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
}

.family-focus-row span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.family-focus-row small,
.family-focus-row strong,
.family-focus-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-focus-row small {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.family-focus-row strong {
  color: var(--color-text);
  font-size: 1.08rem;
  font-weight: 860;
}

.family-focus-row em {
  color: var(--color-text-muted);
  font-style: normal;
  font-size: 0.9rem;
  font-weight: 620;
}

.family-focus-row b,
.family-shared-row em {
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 11%, transparent);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.family-focus-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  color: var(--color-primary);
  background: transparent;
  font-weight: 950;
}

.family-focus-link .ui-icon {
  width: 18px;
  height: 18px;
}

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

.family-shared-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 12px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-border));
  text-align: left;
  transition: background 0.18s ease, transform 0.18s ease;
}

.family-shared-row:hover,
.family-shared-row:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 7%, var(--color-surface));
}

.family-shared-row:active {
  transform: scale(0.99);
}

.family-shared-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.family-shared-row strong,
.family-shared-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-shared-row strong {
  color: var(--color-text);
  font-size: 1.08rem;
  font-weight: 860;
}

.family-shared-row small {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  font-weight: 620;
}

.family-row-chevron {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
}

.family-upcoming-panel {
  display: grid;
  gap: 12px;
}

.bottom-nav-button.is-calendar[aria-pressed="true"] {
  color: var(--module-schedule);
  background: var(--module-schedule-soft);
}

html[data-theme="dark"] .family-member-card,
html[data-theme="dark"] .family-focus-card,
html[data-theme="dark"] .family-shared-panel,
html[data-theme="dark"] .family-focus-row,
html[data-theme="dark"] .family-shared-row,
html[data-theme="dark"] .family-icon-action {
  border-color: var(--color-border);
  background: var(--color-surface);
}

html[data-theme="dark"] .family-status-pill {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.14);
}

html[data-theme="dark"] .family-status-pill.is-warning {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
}

@media (max-width: 759px) {
  .dashboard-section {
    gap: 18px;
    padding-top: 16px;
  }

  .family-zones-hero {
    align-items: flex-start;
    padding: 14px 2px 0;
  }

  .family-zones-hero > div:first-child {
    flex: 1 1 min(52%, 190px);
  }

  .family-setup-cta {
    order: 3;
    width: 100%;
  }

  .family-icon-action {
    width: 54px;
    height: 54px;
    border-radius: 20px;
  }

  .family-member-strip {
    margin-right: 0;
    margin-left: 0;
    padding-right: 2px;
    padding-left: 2px;
  }

  .family-focus-card,
  .family-shared-panel {
    border-radius: 24px;
  }

  .family-focus-card {
    gap: 12px;
    padding: 16px;
  }

  .family-focus-heading {
    align-items: flex-start;
  }

  .family-focus-heading h3 {
    font-size: 2rem;
  }

  .family-status-pill {
    max-width: 52%;
    white-space: normal;
  }

  .family-focus-row {
    grid-template-columns: 44px minmax(0, 1fr);
    min-height: 74px;
    gap: 12px;
    padding: 10px 12px;
  }

  .family-focus-icon {
    width: 44px;
    height: 44px;
    border-radius: 15px;
  }

  .family-focus-row b {
    display: none;
  }

  .family-focus-link {
    display: none;
  }

  .family-shared-row {
    grid-template-columns: 50px minmax(0, 1fr) auto 16px;
    gap: 12px;
  }

  body.has-dashboard-page .upcoming-events-panel.family-upcoming-panel {
    margin-bottom: 8px;
  }
}

@media (max-width: 370px) {
  .family-member-card {
    width: 104px;
    min-width: 104px;
  }

  .family-shared-row em {
    display: none;
  }

  .family-shared-row {
    grid-template-columns: 48px minmax(0, 1fr) 16px;
  }
}

/* Family zones create sheets */
.quick-event-dialog,
.task-dialog,
.medicine-dialog,
.expense-dialog {
  border: 0;
  border-radius: 28px;
  width: min(640px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 0;
  color: var(--color-text);
  background: transparent;
  box-shadow: none;
  overflow-x: hidden;
}

.quick-event-dialog [hidden],
.task-dialog [hidden],
.medicine-dialog [hidden],
.expense-dialog [hidden] {
  display: none !important;
}

.quick-event-dialog::backdrop,
.task-dialog::backdrop,
.medicine-dialog::backdrop,
.expense-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.quick-event-form,
.task-form,
.medicine-form,
.expense-form {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: 18px;
  max-height: min(86vh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  border: 1px solid var(--color-border);
  border-radius: 28px;
  padding: 22px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.26);
  transition: transform 160ms ease;
}

.quick-event-form *,
.task-form *,
.medicine-form *,
.expense-form * {
  min-width: 0;
}

.quick-event-form::before,
.task-form::before,
.medicine-form::before,
.expense-form::before {
  display: block;
  width: 46px;
  height: 5px;
  justify-self: center;
  border-radius: 999px;
  content: "";
  background: color-mix(in srgb, var(--color-text-muted) 34%, transparent);
  cursor: grab;
  touch-action: none;
}

.quick-event-dialog .form-heading,
.task-dialog .form-heading,
.medicine-dialog .form-heading,
.expense-dialog .form-heading {
  align-items: flex-start;
  border-bottom: 0;
  padding-bottom: 0;
}

.quick-event-dialog .form-heading h2,
.task-dialog .form-heading h2,
.medicine-dialog .form-heading h2,
.expense-dialog .form-heading h2 {
  margin: 2px 0 0;
  color: var(--color-text);
  font-size: clamp(1.55rem, 5vw, 2.05rem);
  line-height: 1.04;
}

.quick-event-dialog .eyebrow,
.task-dialog .eyebrow,
.medicine-dialog .eyebrow,
.expense-dialog .eyebrow {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

.quick-event-dialog .icon-button,
.task-dialog .icon-button,
.medicine-dialog .icon-button,
.expense-dialog .icon-button {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 84%, var(--color-border));
}

.quick-type-screen > p {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.quick-action-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.quick-action-button {
  grid-template-columns: 1fr;
  min-height: 112px;
  align-content: space-between;
  justify-items: start;
  gap: 14px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  padding: 14px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  font-size: 0.96rem;
}

.quick-action-button:last-child {
  border-bottom: 1px solid var(--color-border);
}

.quick-action-button span {
  width: 46px;
  height: 46px;
  border-radius: 16px;
}

.quick-action-button strong,
.quick-action-button small {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.quick-action-button strong {
  color: var(--color-text);
  font-size: 0.98rem;
  font-weight: 950;
  line-height: 1.12;
}

.quick-action-button small {
  display: -webkit-box;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.24;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.quick-action-button:hover {
  border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  background: var(--color-surface);
  transform: translateY(-1px);
}

.quick-event-dialog .field,
.task-dialog .field,
.medicine-dialog .field,
.expense-dialog .field {
  gap: 8px;
  color: var(--color-text-muted);
}

.quick-event-dialog .field span,
.task-dialog .field span,
.medicine-dialog .field span,
.expense-dialog .field span,
.quick-when-group > span {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.quick-event-dialog .field input,
.quick-event-dialog .field select,
.quick-event-dialog .field textarea,
.task-dialog .field input,
.task-dialog .field select,
.task-dialog .field textarea,
.medicine-dialog .field input,
.medicine-dialog .field select,
.medicine-dialog .field textarea,
.expense-dialog .field input,
.expense-dialog .field select,
.expense-dialog .field textarea {
  min-height: 50px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 0 14px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 84%, var(--color-border));
  box-shadow: none;
}

.quick-event-dialog .field textarea,
.task-dialog .field textarea,
.medicine-dialog .field textarea,
.expense-dialog .field textarea {
  min-height: 78px;
  padding-top: 13px;
}

.task-dialog .form-row,
.reminder-dialog .form-row {
  gap: 10px;
}

.user-tag-picker,
.notification-picker {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  position: relative;
  display: inline-flex;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.choice-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.task-dialog .field .choice-chip span,
.reminder-dialog .field .choice-chip span {
  display: inline-flex;
  min-height: 38px;
  max-width: 100%;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-border));
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.choice-chip input:checked + span {
  border-color: color-mix(in srgb, var(--color-primary) 52%, var(--color-border));
  color: color-mix(in srgb, var(--color-primary) 78%, var(--color-text));
  background: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface));
}

.choice-chip[aria-pressed="true"] span {
  border-color: color-mix(in srgb, var(--color-primary) 52%, var(--color-border));
  color: color-mix(in srgb, var(--color-primary) 78%, var(--color-text));
  background: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface));
}

.choice-chip input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
  outline-offset: 2px;
}

.choice-chip:focus-visible span {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
  outline-offset: 2px;
}

.choice-chip input:disabled + span {
  opacity: 0.72;
}

.choice-chip:disabled {
  cursor: default;
}

.choice-chip:disabled span {
  opacity: 0.72;
}

.empty-chip {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px dashed var(--color-border);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.quick-date-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-date-button {
  min-height: 42px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--color-surface) 84%, var(--color-border));
}

.quick-date-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 88%, #ffffff);
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 78%, #0f172a));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

html[data-theme="dark"] .quick-date-button[aria-pressed="true"],
html:not([data-theme="dark"]) .quick-date-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 90%, #ffffff);
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 72%, #0f172a));
  box-shadow: 0 12px 26px color-mix(in srgb, var(--color-primary) 34%, transparent);
}

.quick-event-dialog .form-actions,
.task-dialog .form-actions,
.medicine-dialog .form-actions,
.expense-dialog .form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 10px;
}

@media (max-width: 520px) {
  .task-dialog .form-row,
  .reminder-dialog .form-row {
    grid-template-columns: 1fr;
  }

  .quick-event-form,
  .task-form,
  .medicine-form,
  .expense-form {
    max-height: 88vh;
    gap: 14px;
    padding: 18px;
  }

  .task-dialog .field .choice-chip span,
  .reminder-dialog .field .choice-chip span {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 0.74rem;
  }
}

.task-assigned-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.task-view-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.task-assigned-actions button:last-child {
  grid-column: 1 / -1;
}

.task-form[data-mode="assigned-view"] .form-actions,
.task-form[data-mode="view"] .form-actions,
.reminder-form[data-mode="view"] .form-actions {
  display: none;
}

.task-form[data-mode="assigned-view"] .field input,
.task-form[data-mode="assigned-view"] .field textarea,
.task-form[data-mode="view"] .field input,
.task-form[data-mode="view"] .field textarea,
.task-form[data-mode="view"] .field select,
.reminder-form[data-mode="view"] .field input,
.reminder-form[data-mode="view"] .field textarea,
.reminder-form[data-mode="view"] .field select {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-border));
}

.quick-event-dialog .primary-button,
.quick-event-dialog .ghost-button,
.task-dialog .primary-button,
.task-dialog .ghost-button,
.medicine-dialog .primary-button,
.medicine-dialog .ghost-button,
.expense-dialog .primary-button,
.expense-dialog .ghost-button {
  min-height: 52px;
  border-radius: 18px;
  font-weight: 950;
}

html[data-theme="dark"] .quick-event-form,
html[data-theme="dark"] .task-form,
html[data-theme="dark"] .medicine-form,
html[data-theme="dark"] .expense-form,
html[data-theme="dark"] .quick-action-button {
  border-color: var(--color-border);
  background: var(--color-surface);
}

@media (max-width: 759px) {
  .quick-event-dialog,
  .task-dialog,
  .medicine-dialog,
  .expense-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 10px);
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
  }

  .quick-event-form,
  .task-form,
  .medicine-form,
  .expense-form {
    max-height: calc(100dvh - 10px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 28px 28px 0 0;
    padding: 12px 16px max(18px, env(safe-area-inset-bottom, 0px));
    scrollbar-gutter: auto;
  }

  .quick-event-dialog .form-heading,
  .task-dialog .form-heading,
  .medicine-dialog .form-heading,
  .expense-dialog .form-heading {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: 0 -16px;
    padding: 0 16px 10px;
    background: var(--color-surface);
  }

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

  .quick-action-button {
    min-height: 104px;
    border-radius: 20px;
    padding: 13px;
  }

  .quick-event-dialog .quick-field--assignee {
    gap: 10px;
  }

  .quick-event-dialog .quick-field--assignee .field {
    gap: 9px;
  }

  .quick-event-dialog .quick-field--assignee .field > span {
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 950;
  }

  .quick-event-dialog .user-tag-picker {
    gap: 10px;
  }

  .quick-event-dialog .user-tag-picker .choice-chip span,
  .task-dialog .user-tag-picker .choice-chip span,
  .reminder-dialog .user-tag-picker .choice-chip span {
    min-height: 46px;
    border-width: 1.5px;
    padding: 0 16px;
    font-size: 0.9rem;
    font-weight: 950;
    border: 1px solid var(--color-border);
            align-content: center;
        border-radius: 16px;
  }

  .quick-event-dialog .user-tag-picker .choice-chip[aria-pressed="true"] span,
  .task-dialog .user-tag-picker .choice-chip[aria-pressed="true"] span,
  .reminder-dialog .user-tag-picker .choice-chip[aria-pressed="true"] span {
    border-color: color-mix(in srgb, var(--color-primary) 86%, #ffffff);
    color: #ffffff;
    background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 76%, #0f172a));
    box-shadow: 0 10px 22px color-mix(in srgb, var(--color-primary) 24%, transparent);
    align-content: center;
            border-radius: 16px;
  }

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

  .quick-event-dialog .form-actions,
  .task-dialog .form-actions,
  .medicine-dialog .form-actions,
  .expense-dialog .form-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 720px) {
  .quick-event-form,
  .task-form,
  .medicine-form,
  .expense-form {
    gap: 12px;
  }

  .quick-action-button {
    min-height: 92px;
  }
}

/* Standalone calendar module */
.schedule-filter-switch {
  grid-template-columns: repeat(5, minmax(0, auto));
}

.schedule-day-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px auto;
  align-items: start;
  min-width: 0;
}

.schedule-day-add {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  cursor: pointer;
}

.schedule-day-head > div,
.schedule-day-head span,
.schedule-day-head strong {
  min-width: 0;
}

.schedule-item.is-task {
  --schedule-color: var(--module-tasks);
  --schedule-soft: var(--module-tasks-soft);
}

.schedule-item.is-reminder {
  --schedule-color: var(--module-reminders);
  --schedule-soft: var(--module-reminders-soft);
}

.schedule-item.is-medicine {
  --schedule-color: var(--module-medicine);
  --schedule-soft: var(--module-medicine-soft);
}

.schedule-item.is-shopping {
  --schedule-color: var(--module-shopping);
  --schedule-soft: var(--module-shopping-soft);
}

.schedule-item.is-document {
  --schedule-color: var(--module-documents);
  --schedule-soft: var(--module-documents-soft);
}

.schedule-item.is-expenses {
  --schedule-color: var(--module-expenses);
  --schedule-soft: var(--module-expenses-soft);
}

.schedule-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 8px;
  border-color: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 28%, var(--color-border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--schedule-soft, var(--family-primary-soft)) 78%, var(--color-surface));
}

.schedule-item:hover,
.schedule-item:focus-visible {
  border-color: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 52%, var(--color-border));
  background: color-mix(in srgb, var(--schedule-soft, var(--family-primary-soft)) 92%, var(--color-surface));
}

.schedule-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 6px;
}

.schedule-type-tag {
  display: inline-flex;
  min-width: 0;
  max-width: calc(100% - 48px);
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 7px 3px 3px;
  color: var(--schedule-color, var(--color-primary));
  background: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 12%, #ffffff);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.schedule-type-tag > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-item-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--schedule-color, var(--color-primary));
}

.schedule-item-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.schedule-time {
  min-width: 42px;
  max-width: 52px;
  flex: 0 0 auto;
  padding: 4px 6px;
  color: var(--schedule-color, var(--color-primary));
  background: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 13%, #ffffff);
  font-size: 0.68rem;
  line-height: 1;
  text-align: center;
}

.schedule-item-tags {
  margin-top: 0;
}

.schedule-item .assignment-tag {
  color: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 78%, var(--color-text));
  background: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 10%, #ffffff);
  border-color: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 20%, var(--color-border));
}

.schedule-item-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.schedule-item-copy h3,
.schedule-item-copy p {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.schedule-item-copy h3 {
  -webkit-line-clamp: 2;
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.16;
}

.schedule-item-copy p {
  -webkit-line-clamp: 2;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.2;
}

.schedule-status-card {
  grid-column: 1 / -1;
}

@media (max-width: 759px) {
  .schedule-filter-switch {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-filter-button:first-child {
    grid-column: 1 / -1;
  }

  .schedule-day-head {
    grid-template-columns: minmax(0, 1fr) 34px auto;
  }

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

/* Calendar density pass */
.schedule-section .section-heading {
  gap: 10px;
}

.schedule-section .section-heading h2 {
  font-size: clamp(1.05rem, 3vw, 1.45rem);
  line-height: 1.1;
}

.schedule-section .week-controls {
  gap: 6px;
}

.schedule-section .week-controls .icon-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 14px;
}

.schedule-section .week-controls .ghost-button {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 14px;
}

.schedule-filter-switch {
  display: flex;
  width: 100%;
  max-width: 100%;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  scroll-padding-inline: 4px;
  scrollbar-width: none;
}

.schedule-view-switch {
  display: flex;
  flex-wrap: wrap;
  justify-self: start;
  gap: 4px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 4px;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
}

.schedule-view-button {
  min-height: 34px;
  flex: 1 1 auto;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  color: var(--color-text-muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.schedule-view-button[aria-pressed="true"] {
  color: #ffffff;
  background: var(--color-primary);
}

.schedule-filter-switch::-webkit-scrollbar {
  display: none;
}

.schedule-filter-button {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.74rem;
}

.schedule-filter-button[aria-pressed="true"] {
  min-width: auto;
}

.schedule-kanban.is-day-view {
  grid-template-columns: minmax(0, 1fr);
}

.schedule-kanban.is-day-view .schedule-day-column {
  max-width: none;
  min-height: min(520px, calc(100dvh - 260px));
}

.schedule-kanban.is-week-view {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 34%);
  grid-template-columns: none;
  gap: 12px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 12px;
  scroll-padding-inline: 2px;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.schedule-kanban.is-week-view .schedule-day-column {
  min-width: 260px;
  max-width: none;
  min-height: min(560px, calc(100dvh - 250px));
  cursor: pointer;
  scroll-snap-align: start;
}

.schedule-kanban.is-week-view .schedule-day-column:hover,
.schedule-kanban.is-week-view .schedule-day-column:focus-visible {
  border-color: color-mix(in srgb, var(--color-primary) 42%, var(--color-border));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--color-primary) 10%, transparent);
  outline: none;
}

.schedule-kanban.is-week-view .schedule-day-items {
  max-height: min(440px, calc(100dvh - 360px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.schedule-kanban.is-month-view {
  display: grid;
  grid-auto-flow: row;
  grid-auto-columns: initial;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  touch-action: pan-y;
}

.schedule-kanban.is-month-view.is-sliding-next {
  animation: scheduleMonthSlideNext 260ms var(--ease-out) both;
}

.schedule-kanban.is-month-view.is-sliding-prev {
  animation: scheduleMonthSlidePrev 260ms var(--ease-out) both;
}

.schedule-kanban.is-day-view {
  touch-action: pan-y;
}

.schedule-kanban.is-day-view.is-sliding-next {
  animation: scheduleDaySlideNext 280ms var(--ease-out) both;
}

.schedule-kanban.is-day-view.is-sliding-prev {
  animation: scheduleDaySlidePrev 280ms var(--ease-out) both;
}

@keyframes scheduleMonthSlideNext {
  from {
    opacity: 0.58;
    transform: translateX(42px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scheduleMonthSlidePrev {
  from {
    opacity: 0.58;
    transform: translateX(-42px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scheduleDaySlideNext {
  from {
    opacity: 0.64;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scheduleDaySlidePrev {
  from {
    opacity: 0.64;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.schedule-month-weekday {
  display: grid;
  min-width: 0;
  min-height: 36px;
  place-items: center;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 86%, var(--color-background));
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.schedule-month-weekday:nth-child(7) {
  border-right: 0;
}

.schedule-month-cell {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  min-height: 118px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 7px 5px 6px;
  overflow: visible;
  background: var(--color-surface);
  cursor: pointer;
}

.schedule-month-cell:hover,
.schedule-month-cell:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
  outline: none;
}

.schedule-month-cell:nth-child(7n) {
  border-right: 0;
}

.schedule-month-cell:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.schedule-month-cell.is-outside-month {
  background: color-mix(in srgb, var(--color-surface) 72%, var(--color-background));
}

.schedule-month-cell.is-outside-month .schedule-month-date {
  color: color-mix(in srgb, var(--color-text-muted) 58%, transparent);
}

.schedule-month-cell.is-today {
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
}

.schedule-month-date {
  justify-self: center;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--color-text);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
}

.schedule-month-cell.is-today .schedule-month-date {
  color: #ffffff;
  background: var(--color-primary);
}

.schedule-month-strips {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
  padding-top: 4px;
  overflow: visible;
}

.schedule-month-strip,
.schedule-month-more {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: flex-start;
  gap: 4px;
  border: 0;
  border-left: 3px solid var(--schedule-color, var(--color-primary));
  border-radius: 4px;
  padding: 2px 4px;
  color: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 80%, var(--color-text));
  background: color-mix(in srgb, var(--schedule-soft, var(--color-primary-soft)) 82%, transparent);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1.15;
}

.schedule-month-strip {
  cursor: pointer;
}

.schedule-month-strip span {
  display: block;
  min-width: 0;
  overflow: visible;
  text-overflow: initial;
  white-space: normal;
  overflow-wrap: anywhere;
}

.schedule-month-strip strong {
  min-width: 18px;
  max-width: 42%;
  flex: 0 1 auto;
  overflow: hidden;
  border-radius: 999px;
  padding: 1px 4px;
  color: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 76%, var(--color-text));
  background: color-mix(in srgb, var(--schedule-color, var(--color-primary)) 12%, #ffffff);
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-month-strip em {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 850;
}

.schedule-month-strip.is-task {
  --schedule-color: var(--module-tasks, #2563eb);
  --schedule-soft: var(--module-tasks-soft, #dbeafe);
}

.schedule-month-strip.is-reminder {
  --schedule-color: var(--module-reminders, #f59e0b);
  --schedule-soft: var(--module-reminders-soft, #fef3c7);
}

.schedule-month-strip.is-medicine {
  --schedule-color: var(--module-medkit, #10b981);
  --schedule-soft: var(--module-medkit-soft, #d1fae5);
}

.schedule-month-strip.is-shopping {
  --schedule-color: var(--module-shopping, #ec4899);
  --schedule-soft: var(--module-shopping-soft, #fce7f3);
}

.schedule-month-strip.is-expenses {
  --schedule-color: var(--module-expenses, #06b6d4);
  --schedule-soft: var(--module-expenses-soft, #cffafe);
}

.schedule-month-more {
  justify-content: center;
  border-left: 0;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-border) 34%, transparent);
}

.schedule-day-head {
  min-height: 62px;
  padding: 8px;
}

.schedule-day-title {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.schedule-day-title span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.schedule-day-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 13%, transparent);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 950;
}

@media (max-width: 759px) {
  .schedule-section {
    gap: 10px;
  }

  .schedule-section .section-heading {
    gap: 8px;
  }

  .schedule-view-switch {
    width: 100%;
    justify-content: stretch;
  }

  .schedule-view-button {
    flex: 1 1 0;
    padding: 0 8px;
  }

  .schedule-section .week-controls {
    gap: 6px;
  }

  .schedule-section .week-controls .ghost-button {
    flex: 1 1 auto;
  }

  .schedule-filter-switch {
    display: flex;
    grid-template-columns: none;
    margin-right: -16px;
    width: calc(100% + 16px);
  }

  .schedule-filter-button:first-child {
    grid-column: auto;
  }

  .schedule-day-head {
    grid-template-columns: minmax(0, 1fr) 32px;
    min-height: 58px;
    padding: 8px;
  }

  .schedule-day-add {
    width: 32px;
    height: 32px;
    border-radius: 11px;
  }
}

@media (max-width: 759px) {
  body.has-schedule-page .app-shell {
    overflow-x: hidden;
  }

  .schedule-section {
    min-width: 0;
    overflow: hidden;
  }

  .schedule-section .section-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .schedule-section .week-controls {
    width: 100%;
    justify-content: space-between;
  }

  .schedule-section .week-controls .ghost-button {
    flex: 1 1 auto;
  }

  .schedule-kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(156px, 42vw, 196px);
    grid-template-columns: none;
    align-items: stretch;
    gap: 10px;
    margin: 0 -16px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    background: transparent;
    scroll-padding-inline: 16px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .schedule-kanban.is-day-view {
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding: 4px 0 12px;
    overflow-x: hidden;
  }

  .schedule-kanban.is-day-view .schedule-day-column {
    max-width: none;
    min-height: calc(100dvh - 310px);
  }

  .schedule-kanban.is-week-view {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 82vw);
    grid-template-columns: none;
    gap: 10px;
    margin: 0 -16px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
  }

  .schedule-kanban.is-week-view .schedule-day-column {
    min-width: 240px;
    max-width: none;
    min-height: calc(100dvh - 300px);
  }

  .schedule-kanban.is-week-view .schedule-day-head {
    grid-template-columns: minmax(0, 1fr) 30px;
    min-height: 48px;
    padding: 6px;
  }

  .schedule-kanban.is-week-view .schedule-day-add {
    width: 30px;
    height: 30px;
  }

  .schedule-kanban.is-week-view .schedule-day-title span {
    font-size: 0.68rem;
  }

  .schedule-kanban.is-week-view .schedule-day-title strong {
    font-size: 0.68rem;
  }

  .schedule-kanban.is-week-view .schedule-day-items {
    max-height: calc(100dvh - 420px);
    overflow-y: auto;
  }

  .schedule-kanban.is-month-view {
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: repeat(7, minmax(82px, 1fr));
    gap: 6px;
    margin: 0 -16px;
    padding: 4px 16px 12px;
    overflow-x: auto;
  }

  .schedule-kanban.is-month-view .schedule-day-column {
    max-width: none;
    min-height: 154px;
    padding: 6px;
  }

  .schedule-kanban.is-month-view .schedule-day-head {
    grid-template-columns: minmax(0, 1fr) 28px;
    min-height: 48px;
    padding: 6px;
  }

  .schedule-kanban.is-month-view .schedule-day-add {
    width: 28px;
    height: 28px;
  }

  .schedule-kanban.is-month-view .schedule-day-count {
    min-width: 18px;
    height: 18px;
    font-size: 0.62rem;
  }

  .schedule-kanban.is-month-view .schedule-day-title span {
    gap: 4px;
    font-size: 0.72rem;
  }

  .schedule-kanban.is-month-view .schedule-day-title strong {
    font-size: 0.58rem;
  }

  .schedule-kanban.is-month-view .schedule-day-items {
    max-height: 88px;
  }

  .schedule-kanban::-webkit-scrollbar {
    height: 0;
  }

  .schedule-day-column {
    min-width: 0;
    max-width: 196px;
    min-height: 342px;
    overflow: hidden;
    scroll-snap-align: start;
  }

  .schedule-day-column + .schedule-day-column {
    margin-top: 0;
  }

  .schedule-day-head {
    position: static;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 8px;
  }

  .schedule-day-head .kanban-count {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .schedule-day-items {
    align-content: start;
    max-height: 258px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .schedule-item {
    min-height: 92px;
  }

  .schedule-empty {
    min-height: 132px;
    align-content: center;
  }

  .schedule-empty p {
    font-size: 0.74rem;
  }

  .schedule-empty .small-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.72rem;
  }
}

.schedule-kanban.is-agenda-view,
.schedule-kanban.is-day-view {
  display: grid;
  grid-auto-flow: row;
  grid-auto-columns: initial;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  overflow-x: hidden;
}

.schedule-agenda-day,
.schedule-agenda-empty,
.schedule-day-view {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.schedule-agenda-day {
  display: grid;
  grid-template-columns: minmax(116px, 0.22fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.schedule-agenda-date {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.schedule-agenda-date span {
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.schedule-agenda-date strong {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1.15;
}

.schedule-agenda-date em {
  width: max-content;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 950;
}

.schedule-agenda-items {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.schedule-agenda-empty {
  padding: 12px;
}

.schedule-day-view {
  overflow: hidden;
}

.schedule-day-overview,
.schedule-day-all-day {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
}

.schedule-day-overview span,
.schedule-day-all-day > span {
  display: block;
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.schedule-day-overview strong {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 950;
}

.schedule-day-all-day {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
}

.schedule-day-placeholder {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.schedule-day-timeline {
  display: grid;
  min-width: 0;
}

.schedule-hour-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  min-height: 68px;
  border-top: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
}

.schedule-hour-row:first-child {
  border-top: 0;
}

.schedule-hour-label {
  padding: 10px 8px 0 12px;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: right;
}

.schedule-hour-events {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 7px 10px;
  border-left: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
}

.schedule-hour-slots {
  display: grid;
  grid-template-rows: repeat(2, minmax(30px, 1fr));
  min-height: 60px;
  border-radius: 12px;
  overflow: hidden;
}

.schedule-hour-slot {
  display: grid;
  min-width: 0;
  min-height: 30px;
  align-items: center;
  border: 0;
  border-top: 1px dashed color-mix(in srgb, var(--color-border) 68%, transparent);
  padding: 0 10px;
  color: transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.schedule-hour-slot:first-child {
  border-top: 0;
}

.schedule-hour-slot span {
  width: max-content;
  border-radius: 999px;
  padding: 3px 7px;
  color: color-mix(in srgb, var(--color-text-muted) 82%, transparent);
  background: transparent;
  font-size: 0.66rem;
  font-weight: 900;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.schedule-hour-slot:hover,
.schedule-hour-slot:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  outline: none;
}

.schedule-hour-slot:hover span,
.schedule-hour-slot:focus-visible span {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  opacity: 1;
  transform: translateY(0);
}

.schedule-kanban.is-month-view .schedule-item {
  min-height: 62px;
  height: auto;
  padding: 7px;
  border-radius: 12px;
}

.schedule-kanban.is-month-view .schedule-item-top {
  gap: 4px;
}

.schedule-kanban.is-month-view .schedule-type-tag {
  max-width: 100%;
  padding: 3px 6px;
  font-size: 0.58rem;
}

.schedule-kanban.is-month-view .schedule-time {
  font-size: 0.58rem;
}

.schedule-kanban.is-month-view .schedule-item-copy h3 {
  display: block;
  overflow: visible;
  font-size: 0.72rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.schedule-kanban.is-month-view .schedule-item-copy p {
  display: none;
}

.schedule-kanban.is-day-view .schedule-item {
  min-height: 76px;
  height: auto;
}

.schedule-kanban.is-day-view .schedule-item-copy h3 {
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
}

@media (max-width: 759px) {
  .schedule-kanban.is-agenda-view,
  .schedule-kanban.is-day-view {
    margin: 0;
    padding: 4px 0 12px;
    overflow-x: hidden;
  }

  .schedule-agenda-day {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .schedule-agenda-date {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .schedule-agenda-date strong {
    flex: 1 1 auto;
  }

  .schedule-day-all-day {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .schedule-hour-row {
    grid-template-columns: 52px minmax(0, 1fr);
    min-height: 62px;
  }

  .schedule-hour-label {
    padding: 9px 6px 0 0;
    font-size: 0.66rem;
  }

  .schedule-hour-events {
    padding: 6px 0 6px 8px;
  }

  .schedule-hour-slots {
    min-height: 58px;
  }

  .schedule-hour-slot span {
    opacity: 1;
    transform: none;
  }

  .schedule-kanban.is-month-view .schedule-item {
    padding: 6px;
  }
}

@media (max-width: 759px) {
  .schedule-kanban.is-week-view {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 82vw);
    grid-template-columns: none;
    gap: 10px;
    margin: 0 -16px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding-inline: 16px;
    scroll-snap-type: x mandatory;
  }

  .schedule-kanban.is-week-view .schedule-day-column {
    min-width: 240px;
    min-height: calc(100dvh - 300px);
  }

  .schedule-kanban.is-week-view .schedule-day-items {
    max-height: calc(100dvh - 420px);
    overflow-y: auto;
  }

  .schedule-kanban.is-month-view {
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
  }

  .schedule-month-weekday {
    min-height: 30px;
    font-size: 0.62rem;
  }

  .schedule-month-cell {
    min-height: clamp(104px, 18dvh, 136px);
    padding: 5px 3px 4px;
  }

  .schedule-month-date {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  .schedule-month-strips {
    gap: 2px;
    padding-top: 3px;
  }

  .schedule-month-strip,
  .schedule-month-more {
    min-height: 32px;
    border-left-width: 2px;
    border-radius: 3px;
    padding: 1px 3px;
    font-size: 0.52rem;
  }

  .schedule-month-strip em {
    display: none;
  }
}

/* Google-like week calendar */
.schedule-kanban.is-week-view {
  display: block;
  width: min(100vw, 100%);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
  overscroll-behavior-x: contain;
  scroll-padding-inline: 0;
  scroll-snap-type: none;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.schedule-week-timeline-view {
  --schedule-week-time-width: 62px;
  --schedule-week-day-width: minmax(96px, 1fr);
  display: grid;
  min-width: 790px;
  background: var(--color-surface);
}

.schedule-week-timeline-header,
.schedule-week-all-day-row,
.schedule-week-hour-row {
  display: grid;
  grid-template-columns: var(--schedule-week-time-width) repeat(7, var(--schedule-week-day-width));
  min-width: 0;
}

.schedule-week-timeline-header {
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.schedule-week-time-spacer,
.schedule-week-day-button,
.schedule-week-hour-label,
.schedule-week-all-day-cell,
.schedule-week-hour-cell {
  min-width: 0;
  border-right: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
}

.schedule-week-day-button {
  display: grid;
  min-height: 66px;
  justify-items: center;
  align-content: center;
  gap: 2px;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
}

.schedule-week-day-button span {
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.schedule-week-day-button strong {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  color: var(--color-text);
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
}

.schedule-week-day-button em {
  min-width: 18px;
  border-radius: 999px;
  padding: 2px 5px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
}

.schedule-week-day-button.is-today strong,
.schedule-week-day-button:hover strong,
.schedule-week-day-button:focus-visible strong {
  color: #ffffff;
  background: var(--color-primary);
}

.schedule-week-day-button:focus-visible {
  outline: none;
}

.schedule-week-all-day-row {
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-border));
}

.schedule-week-hour-label {
  display: block;
  padding: 8px 8px 0 6px;
  color: var(--color-text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.schedule-week-all-day-cell {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 42px;
  padding: 5px;
  cursor: pointer;
}

.schedule-week-empty-mark {
  color: color-mix(in srgb, var(--color-text-muted) 48%, transparent);
  font-size: 0.66rem;
  font-weight: 850;
  text-align: center;
}

.schedule-week-hour-row {
  min-height: 58px;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
}

.schedule-week-hour-row:last-child {
  border-bottom: 0;
}

.schedule-week-hour-cell {
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 58px;
  padding: 3px;
  cursor: pointer;
}

.schedule-week-slot {
  display: grid;
  min-width: 0;
  min-height: 27px;
  align-items: center;
  border: 0;
  border-top: 1px dashed color-mix(in srgb, var(--color-border) 58%, transparent);
  padding: 0 4px;
  color: transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.schedule-week-slot:first-child {
  border-top: 0;
}

.schedule-week-slot span {
  width: max-content;
  border-radius: 999px;
  padding: 2px 5px;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-surface) 74%, transparent);
  font-size: 0.55rem;
  font-weight: 900;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, color 160ms ease;
}

.schedule-week-slot:hover,
.schedule-week-slot:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 7%, transparent);
  outline: none;
}

.schedule-week-slot:hover span,
.schedule-week-slot:focus-visible span {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  opacity: 1;
  transform: translateY(0);
}

.schedule-week-event.schedule-item {
  gap: 4px;
  min-height: 58px;
  height: auto;
  padding: 6px;
  border-radius: 7px;
}

.schedule-week-event .schedule-item-top {
  gap: 3px;
}

.schedule-week-event .schedule-type-tag {
  max-width: 100%;
  padding: 2px 4px;
  font-size: 0.54rem;
}

.schedule-week-event .schedule-item-icon {
  display: none;
}

.schedule-week-event .schedule-time {
  max-width: 100%;
  min-width: 0;
  padding: 2px 4px;
  font-size: 0.54rem;
}

.schedule-week-event .schedule-item-tags,
.schedule-week-event .schedule-item-copy p {
  display: none;
}

.schedule-week-event .schedule-item-copy h3 {
  display: block;
  overflow: visible;
  font-size: 0.61rem;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

@media (min-width: 760px) {
  body.has-schedule-page .schedule-kanban.is-week-view {
    width: calc(100vw - 24px);
    margin-left: calc(50% - 50vw + 12px);
    margin-right: calc(50% - 50vw + 12px);
  }
}

@media (max-width: 759px) {
  body.has-schedule-page .schedule-kanban.is-week-view {
    width: 100vw;
    margin: 0 calc(50% - 50vw);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .schedule-week-timeline-view {
    --schedule-week-time-width: 52px;
    --schedule-week-day-width: 76px;
    min-width: 584px;
  }

  .schedule-week-day-button {
    min-height: 58px;
  }

  .schedule-week-day-button strong {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .schedule-week-hour-row,
  .schedule-week-hour-cell {
    min-height: 60px;
  }

  .schedule-week-slot span {
    opacity: 1;
    transform: none;
  }
}

.oauth-actions {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.oauth-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
}

.oauth-button:hover,
.oauth-button:focus-visible {
  border-color: color-mix(in srgb, var(--color-primary) 42%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  outline: none;
}

.oauth-button span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 950;
}

.oauth-button.is-google span {
  background: #4285f4;
}

.oauth-button.is-yandex span {
  background: #fc3f1d;
}

.oauth-message:empty {
  display: none;
}

.forgot-password-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  border-color: color-mix(in srgb, var(--color-primary) 24%, var(--color-border));
  border-radius: 16px;
  color: var(--color-primary);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 10%, transparent), transparent 64%),
    color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
  font-weight: 800;
  letter-spacing: 0;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.forgot-password-button:hover,
.forgot-password-button:focus-visible {
  border-color: color-mix(in srgb, var(--color-primary) 48%, var(--color-border));
  color: var(--color-primary);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 16%, transparent), transparent 68%),
    color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--color-primary) 14%, transparent);
  transform: translateY(-1px);
  outline: none;
}

.forgot-password-button:active {
  transform: translateY(0) scale(0.99);
}

.forgot-password-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--color-primary);
  box-shadow: 0 8px 16px color-mix(in srgb, var(--color-primary) 24%, transparent);
}

.forgot-password-icon .ui-icon {
  width: 17px;
  height: 17px;
}

.auth-reset-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(10px);
}

.auth-reset-backdrop[hidden] {
  display: none;
}

.auth-reset-modal {
  width: min(100%, 420px);
  display: grid;
  gap: 16px;
  border: 1px solid var(--color-border);
  border-radius: 28px;
  padding: 20px;
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

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

.auth-reset-modal[data-sent="true"] .auth-field,
.auth-reset-modal[data-sent="true"] > .auth-copy,
.auth-reset-modal[data-sent="true"] #passwordResetSubmitButton {
  display: none;
}

.auth-reset-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.auth-reset-heading h3 {
  margin: 0;
  color: var(--color-text);
  font-size: 1.45rem;
  line-height: 1.08;
}

.auth-reset-heading .icon-button {
  flex: 0 0 auto;
}

.auth-reset-sent {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--color-success) 42%, var(--color-border));
  border-radius: 22px;
  padding: 14px;
  background: color-mix(in srgb, var(--color-success) 12%, var(--color-surface));
  animation: authResetSentIn 0.36s var(--ease-spring) both;
}

.auth-reset-sent[hidden] {
  display: none;
}

.auth-reset-sent-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--color-success);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--color-success) 28%, transparent);
}

.auth-reset-sent-icon .ui-icon {
  width: 24px;
  height: 24px;
  animation: authResetCheckPop 0.52s var(--ease-spring) both;
}

.auth-reset-sent strong {
  display: block;
  margin: 0 0 4px;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.15;
}

.auth-reset-sent p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

@keyframes authResetSentIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes authResetCheckPop {
  0% {
    opacity: 0;
    transform: scale(0.35) rotate(-18deg);
  }

  65% {
    opacity: 1;
    transform: scale(1.12) rotate(4deg);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@media (max-width: 520px) {
  .auth-reset-backdrop {
    align-items: end;
    padding: 12px;
  }

  .auth-reset-modal {
    border-radius: 26px;
    padding: 18px;
  }
}

.success-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 24, 0.42);
  backdrop-filter: blur(10px);
  animation: successOverlayIn 0.18s ease-out;
}

.success-popup {
  display: grid;
  width: min(340px, 100%);
  gap: 14px;
  justify-items: center;
  border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border));
  border-radius: 22px;
  padding: 22px;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  text-align: center;
  animation: successPopupIn 0.2s ease-out;
}

.success-popup-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--color-primary);
  box-shadow: 0 14px 32px color-mix(in srgb, var(--color-primary) 32%, transparent);
}

.success-popup-icon .ui-icon {
  width: 30px;
  height: 30px;
  stroke-width: 3;
}

.success-popup.is-error {
  border-color: color-mix(in srgb, #ef4444 32%, var(--color-border));
}

.success-popup.is-error .success-popup-icon {
  background: #ef4444;
  box-shadow: 0 14px 32px rgba(239, 68, 68, 0.24);
}

.success-popup.is-error p {
  color: #ef4444;
}

.success-popup p,
.success-popup h2,
.success-popup span {
  margin: 0;
}

.success-popup p {
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.success-popup h2 {
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 950;
  letter-spacing: 0;
}

.success-popup span {
  display: block;
  margin-top: 6px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.35;
}

.success-popup .primary-button {
  width: 100%;
  min-height: 42px;
}

.quick-event-form.is-dragging,
.task-form.is-dragging,
.medicine-form.is-dragging,
.expense-form.is-dragging,
.details-panel.is-dragging,
.fields-panel.is-dragging,
.account-panel.is-dragging,
.avatar-crop-panel.is-dragging {
  transition: none;
}

.account-avatar.has-image {
  background-position: center center !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
}

@keyframes successOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes successPopupIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.medicine-list,
.medicine-list.is-grid,
.medicine-list.is-kanban {
  grid-template-columns: 1fr;
}

.medicine-card.medicine-row-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

@media (max-width: 620px) {
  .medicine-card.medicine-row-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }
}

/* Apple-like visual softening */
:root {
  --color-bg: #f5f5f7;
  --color-surface: rgba(255, 255, 255, 0.88);
  --color-surface-soft: #f2f2f7;
  --color-border: rgba(60, 60, 67, 0.12);
  --color-text: #1d1d1f;
  --color-text-muted: rgba(60, 60, 67, 0.72);
  --family-bg: #f5f5f7;
  --family-card: rgba(255, 255, 255, 0.88);
  --family-card-soft: #f2f2f7;
  --family-border: rgba(60, 60, 67, 0.12);
  --family-text: #1d1d1f;
  --family-muted: rgba(60, 60, 67, 0.72);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 26px rgba(0, 0, 0, 0.045);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.028);
  --family-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 12px 28px rgba(0, 0, 0, 0.045);
  --family-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.028);
}

html[data-theme="dark"] {
  --family-dark-gradient:
    radial-gradient(circle at 12% 0%, rgba(34, 197, 94, 0.16), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(37, 99, 235, 0.18), transparent 34%),
    radial-gradient(circle at 50% 92%, rgba(20, 184, 166, 0.10), transparent 36%),
    linear-gradient(160deg, #07111f 0%, #0a1627 44%, #071b18 100%);
  --color-bg: #07111f;
  --color-surface: rgba(28, 28, 30, 0.88);
  --color-surface-soft: #1c1c1e;
  --color-border: rgba(235, 235, 245, 0.14);
  --color-text: #f5f5f7;
  --color-text-muted: rgba(235, 235, 245, 0.68);
  --family-bg: #07111f;
  --family-card: rgba(28, 28, 30, 0.88);
  --family-card-soft: #1c1c1e;
  --family-border: rgba(235, 235, 245, 0.14);
  --family-text: #f5f5f7;
  --family-muted: rgba(235, 235, 245, 0.68);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-soft: none;
  --family-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  --family-shadow-soft: none;
}

body {
  background: var(--family-bg);
}

html[data-theme="dark"] body {
  background:
    var(--family-dark-gradient);
  background-attachment: fixed;
}

.app-shell {
  padding-inline: clamp(14px, 3vw, 22px);
}

.dashboard-section,
.tasks-section,
.reminders-section,
.medkit-section,
.expenses-section,
.schedule-section,
.notifications-section,
.account-panel {
  gap: clamp(18px, 4vw, 28px);
}

.summary-panel,
.controls-panel,
.details-panel,
.fields-panel,
.account-panel,
.group-panel,
.scanner-panel,
.field-config-card,
.today-card,
.today-welcome-card,
.today-stat-card,
.upcoming-card,
.home-calendar-card,
.home-section-card,
.family-member-card,
.family-focus-card,
.family-shared-panel,
.task-card,
.reminder-card,
.medicine-card,
.medicine-row-card,
.notification-card,
.schedule-status-card,
.schedule-day-column,
.schedule-month-grid,
.schedule-month-cell,
.dashboard-day-column,
.success-popup {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.family-focus-card,
.family-shared-panel,
.upcoming-card,
.task-card,
.reminder-card,
.medicine-card,
.home-section-card,
.home-calendar-card,
.notification-card {
  border-radius: 24px;
}

.summary-panel,
.controls-panel,
.details-panel,
.fields-panel,
.account-panel,
.quick-event-form,
.task-form,
.medicine-form,
.expense-form,
.avatar-crop-panel {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.family-focus-list,
.quick-action-list,
.task-meta span,
.task-status-label,
.task-due-badge,
.assignment-tag,
.family-shared-row,
.family-focus-row,
.quick-action-button,
.quick-date-button,
.choice-chip span,
.empty-chip {
  border-color: var(--color-border);
  background: color-mix(in srgb, var(--color-surface-soft) 72%, var(--color-surface));
  box-shadow: none;
}

.family-focus-row + .family-focus-row,
.upcoming-event-row,
.dashboard-event-card + .dashboard-event-card {
  border-color: var(--color-border);
}

.family-member-card.is-active {
  border-color: color-mix(in srgb, var(--color-primary) 34%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
  box-shadow: none;
}

.family-focus-icon,
.home-section-icon,
.home-calendar-icon,
.upcoming-event-icon,
.dashboard-event-icon,
.task-status-mark,
.module-icon,
.stat-icon {
  box-shadow: none;
}

.family-status-pill,
.family-focus-row b,
.family-shared-row em,
.task-due-badge,
.task-status-label,
.assignment-tag,
.schedule-chip,
.schedule-event-tag {
  border: 0;
}

.primary-button,
.auth-button,
.family-setup-cta,
.quick-date-button[aria-pressed="true"],
html[data-theme="dark"] .quick-date-button[aria-pressed="true"],
html:not([data-theme="dark"]) .quick-date-button[aria-pressed="true"] {
  box-shadow: none;
}

.bottom-navigation {
  border-color: var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 12px 34px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px) saturate(1.4);
}

.family-fab {
  box-shadow: 0 10px 28px color-mix(in srgb, var(--color-primary) 18%, transparent);
}

.home-section-card:not([aria-disabled="true"]):hover,
.task-card:hover,
.medicine-card:hover,
.summary-card:hover {
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .summary-panel,
html[data-theme="dark"] .controls-panel,
html[data-theme="dark"] .details-panel,
html[data-theme="dark"] .fields-panel,
html[data-theme="dark"] .account-panel,
html[data-theme="dark"] .quick-event-form,
html[data-theme="dark"] .task-form,
html[data-theme="dark"] .medicine-form,
html[data-theme="dark"] .expense-form,
html[data-theme="dark"] .avatar-crop-panel,
html[data-theme="dark"] .family-member-card,
html[data-theme="dark"] .family-focus-card,
html[data-theme="dark"] .family-shared-panel,
html[data-theme="dark"] .family-focus-row,
html[data-theme="dark"] .family-shared-row,
html[data-theme="dark"] .quick-action-button {
  border-color: var(--color-border);
  background: var(--color-surface);
}

.auth-overlay {
  background: var(--family-bg);
}

html[data-theme="dark"] .auth-overlay {
  background:
    var(--family-dark-gradient);
}

.auth-card {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(1.25);
}

html[data-theme="dark"] .auth-card {
  border-color: var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  box-shadow: var(--shadow-card);
backdrop-filter: blur(24px) saturate(1.4);
}

.auth-card::before {
  display: none;
}

.auth-brand img {
  box-shadow: none;
}

.auth-tabs {
  border: 0;
  background: var(--color-surface-soft);
}

/* Theme-aware app mark */
.brand-mark {
  color: var(--color-primary);
}

html[data-theme="dark"] .brand-mark {
  color: color-mix(in srgb, var(--color-primary) 68%, #34d399);
}

.auth-brand .auth-brand-mark {
  width: clamp(104px, 25vw, 148px);
  height: clamp(104px, 25vw, 148px);
  color: var(--family-primary);
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 18px 42px rgba(15, 23, 42, 0.12));
}

html[data-theme="dark"] .auth-brand .auth-brand-mark {
  color: color-mix(in srgb, var(--family-primary) 62%, #34d399);
  filter: drop-shadow(0 18px 44px rgba(0, 0, 0, 0.34));
}

.auth-tab[aria-pressed="true"] {
  box-shadow: none;
}

.auth-input {
  border-color: var(--color-border);
  background: var(--color-surface-soft);
  box-shadow: none;
}

.quick-event-dialog:focus,
.task-dialog:focus,
.medicine-dialog:focus,
.expense-dialog:focus {
  outline: none;
}

.schedule-section,
.schedule-kanban,
.schedule-day-column,
.schedule-month-grid,
.schedule-month-cell,
.schedule-agenda-day,
.schedule-agenda-empty,
.schedule-day-view,
.schedule-day-overview,
.schedule-day-all-day,
.schedule-day-timeline,
.schedule-status-card {
  background: var(--color-surface);
}

.mobile-module-sheet {
  gap: 4px;
  border-color: var(--color-border);
  border-radius: 22px;
  padding: 6px;
  background: color-mix(in srgb, var(--color-surface) 94%, transparent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 12px 34px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px) saturate(1.4);
}

html[data-theme="dark"] .mobile-module-sheet {
  border-color: rgba(235, 235, 245, 0.18);
  background: rgba(22, 31, 42, 0.96);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 18px 44px rgba(0, 0, 0, 0.34);
}

.mobile-module-option {
  min-height: 50px;
  border-radius: 16px;
  color: var(--family-muted);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 900;
}

.mobile-module-option span {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  color: inherit;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.mobile-module-option[data-module="dashboard"] {
  --mobile-module-color: var(--module-home);
  --mobile-module-soft: var(--module-home-soft);
  --mobile-module-active-bg: var(--module-home-gradient);
  --mobile-module-active-color: #ffffff;
}

.mobile-module-option[data-module="tasks"] {
  --mobile-module-color: var(--module-tasks);
  --mobile-module-soft: var(--module-tasks-soft);
}

.mobile-module-option[data-module="medkit"] {
  --mobile-module-color: var(--module-medicine);
  --mobile-module-soft: var(--module-medicine-soft);
}

.mobile-module-option[data-module="schedule"] {
  --mobile-module-color: var(--module-home);
  --mobile-module-soft: var(--module-home-soft);
}

.mobile-module-option[data-module="reminders"] {
  --mobile-module-color: var(--module-reminders);
  --mobile-module-soft: var(--module-reminders-soft);
}

.mobile-module-option[data-module="expenses"] {
  --mobile-module-color: var(--module-expenses);
  --mobile-module-soft: var(--module-expenses-soft);
}

.mobile-module-option:hover,
.mobile-module-option:focus-visible,
.mobile-module-option[aria-pressed="true"] {
  color: var(--mobile-module-color, var(--module-home));
  background: var(--mobile-module-soft, var(--module-home-soft));
}

.mobile-module-option[data-module="dashboard"][aria-pressed="true"] {
  color: var(--mobile-module-active-color);
  background: var(--mobile-module-active-bg);
}

.mobile-module-option[data-module="dashboard"][aria-pressed="true"] span {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .mobile-module-option:hover,
html[data-theme="dark"] .mobile-module-option:focus-visible {
  background: var(--mobile-module-soft, var(--module-home-soft));
}

html[data-theme="dark"] .mobile-module-option[aria-pressed="true"] {
  color: var(--mobile-module-color, var(--module-home));
  background: var(--mobile-module-soft, var(--module-home-soft));
}

html[data-theme="dark"] .mobile-module-option[data-module="dashboard"][aria-pressed="true"] {
  color: var(--mobile-module-active-color);
  background: var(--mobile-module-active-bg);
}

/* Full-width calendar page */
body.has-schedule-page .app-shell {
  width: 100%;
  max-width: none;
}

body.has-schedule-page main {
  width: 100%;
  max-width: none;
}

body.has-schedule-page .schedule-section {
  width: calc(100vw - max(0px, env(safe-area-inset-left)) - max(0px, env(safe-area-inset-right)));
  max-width: none;
  margin-right: calc(50% - 50vw);
  margin-left: calc(50% - 50vw);
  padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
}

body.has-schedule-page .schedule-section > .section-heading,
body.has-schedule-page .schedule-view-switch,
body.has-schedule-page .schedule-filter-switch,
body.has-schedule-page .google-calendar-sync-button,
body.has-schedule-page #scheduleEmptyState {
  width: min(100%, 1320px);
  max-width: 1320px;
  margin-inline: auto;
}

body.has-schedule-page .schedule-kanban {
  width: 100%;
  max-width: none;
}

body.has-schedule-page .schedule-kanban.is-week-view,
body.has-schedule-page .schedule-kanban.is-month-view,
body.has-schedule-page .schedule-kanban.is-day-view,
body.has-schedule-page .schedule-kanban.is-agenda-view {
  margin-right: 0;
  margin-left: 0;
}

.schedule-kanban.is-day-view .schedule-time,
.schedule-kanban.is-week-view .schedule-time {
  display: none;
}

@media (max-width: 759px) {
  body.has-schedule-page .app-shell {
    padding-right: 0;
    padding-left: 0;
  }

  body.has-schedule-page .topbar,
  body.has-schedule-page main > section:not(.schedule-section) {
    margin-right: 12px;
    margin-left: 12px;
  }

  body.has-schedule-page .schedule-section {
    width: 100vw;
    margin-right: 0;
    margin-left: 0;
    padding-inline: 0;
  }

body.has-schedule-page .schedule-section > .section-heading,
body.has-schedule-page .schedule-view-switch,
body.has-schedule-page .schedule-filter-switch,
body.has-schedule-page .google-calendar-sync-button,
body.has-schedule-page .empty-state {
  margin-right: 12px;
    margin-left: 12px;
    width: calc(100% - 24px);
  }

  body.has-schedule-page .schedule-kanban.is-week-view,
  body.has-schedule-page .schedule-kanban.is-month-view {
    width: 100%;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }
}

/* Typography refinement, bottom navigation intentionally excluded */
body :where(h1, h2, h3, h4, strong, b):not(.bottom-navigation *) {
  font-weight: 800;
}

body :where(
  .primary-button,
  .ghost-button,
  .small-button,
  .text-button,
  .icon-button,
  .module-menu-button,
  .mobile-module-option,
  .app-view-button,
  .view-mode-button,
  .schedule-filter-button,
  .quick-date-button,
  .family-setup-cta,
  .family-focus-link
):not(.bottom-navigation *) {
  font-weight: 760;
}

body :where(
  .assignment-tag,
  .schedule-type-tag,
  .family-status-pill,
  .schedule-time,
  .panel-kicker,
  .family-focus-kicker,
  .dashboard-event-type,
  .upcoming-event-time
):not(.bottom-navigation *) {
  font-weight: 700;
}

body.has-dashboard-page .family-zones-hero p {
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.25;
}

body.has-dashboard-page .family-zones-hero strong {
  margin-top: 3px;
  font-size: clamp(1.82rem, 6vw, 2.48rem);
  font-weight: 800;
  line-height: 1.08;
}

body.has-dashboard-page .panel-heading h3,
body.has-dashboard-page .upcoming-events-panel .panel-heading h3,
body.has-dashboard-page .family-focus-heading h3,
body.has-dashboard-page .family-shared-panel h3,
body.has-dashboard-page .home-sections-panel .panel-heading h3 {
  font-size: clamp(1.12rem, 3.4vw, 1.28rem);
  font-weight: 760;
  line-height: 1.18;
}

body.has-dashboard-page .panel-kicker,
body.has-dashboard-page .family-focus-kicker {
  margin-bottom: 5px;
  font-size: 0.72rem;
  font-weight: 680;
  line-height: 1.2;
}

body.has-dashboard-page .upcoming-event-row h3,
body.has-dashboard-page .dashboard-event-card h3,
body.has-dashboard-page .family-focus-row strong,
body.has-dashboard-page .family-shared-row strong,
body.has-dashboard-page .home-calendar-card strong,
body.has-dashboard-page .home-section-card strong,
body.has-dashboard-page .family-member-card strong {
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.24;
}

body.has-dashboard-page .upcoming-event-row p,
body.has-dashboard-page .dashboard-event-card p,
body.has-dashboard-page .family-focus-row small,
body.has-dashboard-page .family-focus-row em,
body.has-dashboard-page .family-shared-row small,
body.has-dashboard-page .home-calendar-card small,
body.has-dashboard-page .home-section-card small {
  font-size: 0.84rem;
  font-weight: 560;
  line-height: 1.32;
}

body.has-dashboard-page .family-member-avatar {
  font-weight: 780;
}

body.has-dashboard-page .family-member-metrics em,
body.has-dashboard-page .family-focus-row b,
body.has-dashboard-page .family-shared-row em,
body.has-dashboard-page .family-status-pill {
  font-weight: 700;
}

@media (max-width: 759px) {
  body.has-dashboard-page .family-zones-hero strong {
    font-size: clamp(1.72rem, 8vw, 2.2rem);
  }

  body.has-dashboard-page .panel-heading h3,
  body.has-dashboard-page .upcoming-events-panel .panel-heading h3,
  body.has-dashboard-page .family-focus-heading h3,
  body.has-dashboard-page .family-shared-panel h3,
  body.has-dashboard-page .home-sections-panel .panel-heading h3 {
    font-size: 1.18rem;
  }

  body.has-dashboard-page .family-focus-row strong,
  body.has-dashboard-page .family-shared-row strong,
  body.has-dashboard-page .upcoming-event-row h3 {
    font-size: 0.98rem;
  }
}

/* Active family member selection */
.family-member-card {
  position: relative;
  isolation: isolate;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms var(--ease-spring);
}

.family-member-card::after {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), #22c55e);
  box-shadow: 0 5px 12px color-mix(in srgb, var(--color-primary) 26%, transparent);
  content: "✓";
  font-size: 0.68rem;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 160ms ease, transform 180ms var(--ease-spring);
}

.family-member-card.is-active {
  border-color: color-mix(in srgb, var(--color-primary) 58%, var(--color-border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 11%, transparent), transparent 72%),
    color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--color-primary) 9%, transparent);
  transform: translateY(-2px);
}

.family-member-card.is-active::after {
  opacity: 1;
  transform: scale(1);
}

.family-member-card.is-active .family-member-avatar {
  box-shadow: 0 5px 12px color-mix(in srgb, var(--color-primary) 14%, transparent);
  transform: scale(1.04);
}

.family-member-avatar {
  transition: box-shadow 180ms ease, transform 180ms var(--ease-spring);
}

.family-member-card.is-switching {
  animation: familyMemberSwitch 260ms var(--ease-spring) both;
}

@keyframes familyMemberSwitch {
  0% {
    transform: scale(0.97);
  }
  70% {
    transform: translateY(-3px) scale(1.035);
  }
  100% {
    transform: translateY(-2px) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .family-member-card,
  .family-member-card::after,
  .family-member-card.is-switching {
    transition: none;
    animation: none;
  }
}
