:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #667085;
  --primary: #1250e6;
  --primary-dark: #0d46d0;
  --border: #e8eaf2;
  --shadow-soft: 0 6px 18px rgba(41, 47, 76, 0.06);
  --error-bg: #fef2f2;
  --error-text: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
}

a,
button {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

.assign-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  padding: 18px 16px 14px;
  background:
    radial-gradient(circle at top right, rgba(18, 80, 230, 0.16), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f7f8fd 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 14px;
}

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

.topbar__nav .back-link {
  justify-self: start;
}

.topbar__nav .support-link {
  justify-self: end;
}

.brand--centered {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.brand__logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(18, 80, 230, 0.18);
  flex-shrink: 0;
}

.brand__name {
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.title-strip {
  padding: 14px 16px;
  border-radius: 18px;
  background: #eceff3;
  border: 1px solid #dde3eb;
}

.title-strip h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.assign-main {
  padding: 18px 16px 124px;
  display: grid;
  gap: 18px;
}

.patients-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft);
}

.patients-panel {
  padding: 18px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.screen-message {
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
}

.screen-message--error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid rgba(180, 35, 24, 0.12);
}

.empty-state {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed #d5dbe5;
  color: var(--muted);
  text-align: center;
}

.patients-grid {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.patient-select-button {
  appearance: none;
  border: 1px solid rgba(37, 211, 102, 0.24);
  border-radius: 20px;
  min-height: 74px;
  padding: 18px 56px 18px 22px;
  background:
    linear-gradient(180deg, rgba(237, 252, 242, 0.96), rgba(228, 249, 236, 0.98));
  color: #166534;
  font-weight: 700;
  font-size: 21px;
  line-height: 1.15;
  text-align: left;
  box-shadow:
    0 10px 24px rgba(22, 101, 52, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  position: relative;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.patient-select-button::after {
  content: "›";
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(22, 101, 52, 0.72);
  font-size: 28px;
  font-weight: 500;
}

.patient-select-button:hover,
.patient-select-button:focus-visible {
  border-color: rgba(37, 211, 102, 0.36);
  background:
    linear-gradient(135deg, rgba(37, 211, 102, 0.14), rgba(22, 163, 74, 0.09)),
    linear-gradient(180deg, rgba(241, 253, 246, 0.99), rgba(231, 249, 238, 0.98));
  color: #14532d;
  box-shadow:
    0 16px 36px rgba(22, 163, 74, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  transform: translateY(-1px);
}

.patient-select-button:focus-visible {
  outline: none;
}

.patient-select-button:hover::after,
.patient-select-button:focus-visible::after {
  color: #14532d;
}

.patient-select-button:active {
  transform: scale(0.992);
}

.task-choice-modal[hidden] {
  display: none !important;
}

.task-choice-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.task-choice-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.task-choice-modal__card {
  position: relative;
  z-index: 1;
  width: min(calc(100vw - 24px), 560px);
  margin: 10vh auto 0;
  padding: 20px;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: grid;
  gap: 18px;
}

.task-choice-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-choice-modal__label {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.task-choice-modal__header h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.15;
}

.task-choice-modal__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.task-choice-modal__close {
  border: none;
  background: #f2f4f7;
  color: #344054;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.task-choice-modal__options {
  display: grid;
  gap: 12px;
}

.task-choice-modal__actions {
  display: flex;
  justify-content: center;
}

.task-choice-option {
  border: 1px solid rgba(18, 80, 230, 0.14);
  border-radius: 18px;
  padding: 18px 20px;
  background:
    radial-gradient(circle at top right, rgba(18, 80, 230, 0.1), transparent 35%),
    linear-gradient(180deg, #ffffff 0%, #f7f8fd 100%);
  color: #1f2430;
  font-weight: 800;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
}

.task-choice-option:active {
  transform: scale(0.99);
}

.task-choice-cancel {
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 12px 28px;
  background: #ffffff;
  color: #344054;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px 24px 0 0;
  background: rgba(35, 48, 70, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 28px rgba(20, 24, 38, 0.18);
  z-index: 30;
}

.bottom-nav__item {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  min-height: 58px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  position: relative;
}

.bottom-nav__item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.bottom-nav__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bottom-nav__label {
  font-size: 11px;
  line-height: 1;
}

.bottom-nav__menu-wrap {
  position: relative;
  display: flex;
  width: 100%;
}

.bottom-nav__menu-wrap .bottom-nav__item {
  width: 100%;
}

.bottom-nav__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  min-width: 180px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(35, 48, 70, 0.98);
  box-shadow: 0 18px 38px rgba(20, 24, 38, 0.22);
  backdrop-filter: blur(16px);
}

.bottom-nav__menu[hidden] {
  display: none !important;
}

.bottom-nav__menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav__menu-item {
  appearance: none;
  display: block;
  border: none;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  padding: 14px 14px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav__menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.bottom-nav__menu-item--current {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  cursor: default;
}

.bottom-nav__menu-item--danger {
  color: #fecaca;
}

.bottom-nav__menu-item--danger:hover {
  background: rgba(185, 28, 28, 0.16);
}

@media (min-width: 768px) {
  .topbar,
  .assign-main {
    max-width: 980px;
    margin: 0 auto;
  }

  .assign-main {
    padding-top: 24px;
  }

}

@media (max-width: 640px) {
  .topbar__nav {
    grid-template-columns: auto 1fr auto;
  }

  .brand__name {
    font-size: 16px;
  }

  .title-strip h1 {
    font-size: 20px;
  }

  .section-header h2 {
    font-size: 24px;
  }

  .patient-card__alias {
    font-size: 22px;
  }

  .patient-select-button {
    width: 100%;
    font-size: 20px;
  }

  .task-choice-modal__card {
    margin-top: 8vh;
    padding: 18px;
  }

  .task-choice-modal__header h3 {
    font-size: 21px;
  }

  .task-choice-option {
    font-size: 17px;
  }
}
