: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 {
  -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%);
}

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;
}

.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));
  font-size: 0.84rem;
  font-weight: 950;
}

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

.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;
}

.brand-mark {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 0 18px rgba(138, 92, 255, 0.45));
}

.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;
  margin-top: -4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: rgba(14, 17, 28, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

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

.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 small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.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 {
  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 {
  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__image {
  width: 100%;
  max-height: 150px;
  border-radius: calc(var(--radius) - 2px);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 620px) {
  .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(3, 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: flex;
  align-items: flex-start;
  justify-content: space-between;
  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-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 rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 9px;
  background: 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: rgba(255, 216, 77, 0.26);
  background: rgba(255, 255, 255, 0.07);
}

.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: #100d1a;
  background: linear-gradient(135deg, rgba(255, 216, 77, 0.95), rgba(138, 92, 255, 0.82));
  font-size: 0.76rem;
  font-weight: 900;
}

.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: repeat(2, minmax(0, 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;
}

.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-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 {
  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;
  }
}

@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;
}

.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,
.schedule-section {
  background: var(--panel);
  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%);
  }
}
