    :root {
      /* Non-colour tokens local to the pharmacy portal. Colour lives in tokens.css. */
      --radius-xl: 28px;
      --max-page: 1140px;

      /* Pharmacy cards sit flatter than the vet portal's. */
      --shadow: var(--vx-shadow-sm);
    }

    * {
      box-sizing: border-box;
    }

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

    body {
      margin: 0;
      font-family: Inter, ui-sans-serif, system-ui, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text);
      background: var(--page-bg-top);
      min-height: 100vh;
    }

    summary {
      font: inherit;
    }

    #verifyAccessBtn {
      width: 100%;
      margin-top: 14px;
    }

    a:focus-visible {
      outline: 3px solid var(--brand);
      outline-offset: 3px;
      border-radius: 4px;
    }

    .page {
      width: min(100%, var(--max-page));
      margin: 0 auto;
      padding: 28px 18px 60px;
    }



    .topbar-brand {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 24px;
    }

    .pharmacy-header-actions {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 18px;
      flex-shrink: 0;
    }

    .topbar-brand > :first-child {
      min-width: 0;
    }

    .pharmacy-header-actions [hidden] {
      display: none;
    }

    .pharmacy-session-action {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 48px;
      padding: 10px 16px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: var(--surface-solid);
      color: var(--brand-dark);
      font-size: inherit;
      font-weight: 800;
      text-decoration: none;
      cursor: pointer;
      box-shadow: none;
      white-space: nowrap;
    }

    .pharmacy-session-action:hover {
      background: var(--brand-soft);
      border-color: var(--border-purple);
      color: var(--brand-dark);
      transform: translateY(-1px);
      box-shadow: none;
    }

    .brand-wordmark {
      display: inline-flex;
      align-items: center;
      width: auto;
      height: auto;
      overflow: visible;
      margin-bottom: 0;
      transform: none;
    }

    .brand-logo {
      width: 185px;
      max-width: 54vw;
      height: auto;
      object-fit: contain;
      display: block;
      transform: none;
    }

    .eyebrow {
      margin: 8px 0 0;
      color: var(--brand);
      font-size: 0.74rem;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .title {
      margin: 8px 0 0;
      font-size: clamp(1.8rem, 4vw, 2.15rem);
      line-height: 1.02;
      letter-spacing: -0.045em;
      font-weight: 900;
    }

    .subtitle {
      margin: 4px 0 0;
      color: var(--text-soft);
      font-size: 1rem;
      line-height: 1.4;
    }

    .secure-label {
      flex: 0 0 auto;
      padding: 11px 16px;
      border-radius: 999px;
      background: var(--surface-solid);
      border: 1px solid var(--border);
      color: var(--text-soft);
      font-size: 0.82rem;
      font-weight: 800;
      white-space: nowrap;
      box-shadow: var(--shadow-soft);
    }

    #pharmacySignOutBtn {
      min-height: 44px;
    }

    .chips {
      display: flex;
      flex-wrap: wrap;
      gap: 0;
      margin: 10px 0 12px;
      color: var(--text-soft);
      font-size: 0.88rem;
      font-weight: 700;
    }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      min-height: 22px;
      padding: 0 14px;
      border-radius: 0;
      background: none;
      border: 0;
      color: var(--text);
      line-height: 1;
    }

    .chip:first-child {
      padding-left: 0;
    }

    .chip + .chip {
      border-left: 1px solid var(--border);
    }

    .chip.cd {
      color: var(--brand-dark);
      background: none;
    }

    .chip-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--brand);
      flex: 0 0 auto;
    }

    .chip.status .chip-dot {
      background: var(--success);
    }

    .chip.cd .chip-dot {
      background: var(--brand);
    }

    .card {
      background: var(--surface-solid);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow);
      padding: 24px;
      margin: 18px 0;
    }

    .card.prescription-details {
      padding: 0;
    }

    .section-title,
    .card h2 {
      margin: 0;
      font-size: clamp(1.55rem, 3vw, 1.95rem);
      line-height: 1.08;
      letter-spacing: -0.045em;
      font-weight: 900;
    }

    .muted,
    .card-intro {
      margin: 6px 0 0;
      color: var(--text-soft);
      font-size: 0.94rem;
      line-height: 1.5;
    }

    .fulfilment-note {
      margin: 8px 0 14px;
      color: var(--text-soft);
      font-size: 0.94rem;
      line-height: 1.5;
    }

    .field-group[hidden] {
      display: none;
    }

    .field-group {
      margin-top: 14px;
      display: grid;
      gap: 12px;
    }

    .supplier-type-field {
      grid-column: 1 / -1;
    }

    #vetPracticeFallbackHelp {
      margin: 20px 0 6px;
    }

    .field {
      display: grid;
      align-content: start;
      gap: 7px;
    }

    .field label {
      font-size: 0.9rem;
      font-weight: 700;
    }

    input::placeholder {
      color: var(--text-faint);
    }

    .field-error {
      border-color: var(--danger) !important;
    }

    .field-help {
      color: var(--danger);
      font-size: 12px;
      margin-top: 4px;
    }

    .med-line {
      margin: 0 0 12px;
      padding: 16px;
      border-radius: var(--radius-md);
      background: var(--surface-muted);
      border: 1px solid var(--border);
    }

    .med-line.detail-med {
      margin: 0;
      padding: 0;
      border: 0;
      border-radius: 0;
      background: none;
    }

    .detail-med + .detail-med {
      padding-top: 14px;
      border-top: 1px solid var(--border-soft);
    }

    .detail-med p {
      color: var(--text-soft);
      font-weight: 500;
    }

    .detail-med p strong {
      color: var(--text);
      font-weight: 700;
    }

    .med-line p {
      margin: 6px 0;
    }

    .med-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 12px;
    }

    .med-title {
      margin: 0;
      font-size: 1.18rem;
      line-height: 1.35;
      letter-spacing: -0.02em;
      font-weight: 900;
    }

    .med-subtitle {
      margin: 5px 0 0;
      color: var(--text-soft);
      font-size: 0.88rem;
      line-height: 1.4;
    }

    .line-pill {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      padding: 8px 10px;
      border-radius: 999px;
      background: var(--surface-strong);
      border: 1px solid var(--border);
      color: var(--text-soft);
      font-size: 0.8rem;
      font-weight: 700;
      white-space: nowrap;
    }

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

    .stat {
      padding: 12px;
      border-radius: 12px;
      background: var(--surface-muted);
      border: 1px solid var(--border);
    }

    .stat-label {
      display: block;
      margin-bottom: 6px;
      color: var(--text-soft);
      font-size: 0.74rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      line-height: 1.2;
    }

    .stat-value {
      display: block;
      color: var(--text);
      font-size: 1rem;
      font-weight: 800;
      line-height: 1.2;
      letter-spacing: -0.02em;
    }

    .previous-fulfilments {
      margin-top: 14px;
      padding: 12px 14px;
      border-radius: 16px;
      background: var(--surface-solid);
      border: 1px solid var(--border);
    }

    .previous-fulfilments-title {
      margin: 0 0 8px;
      font-size: 0.9rem;
      font-weight: 800;
    }

    .previous-fulfilments ul {
      margin: 0;
      padding-left: 18px;
      color: var(--text);
      line-height: 1.45;
    }

    .previous-fulfilments li + li {
      margin-top: 4px;
    }

    .quantity-box {
      margin-top: 14px;
      padding: 14px;
      border-radius: var(--radius-md);
      background: var(--surface-solid);
      border: 1px solid var(--border);
    }

    .quantity-box label {
      display: block;
      margin: 0 0 10px;
      font-size: 0.9rem;
      font-weight: 800;
    }

    .input-with-unit {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: center;
    }

    .unit-badge {
      padding: 12px;
      border-radius: var(--radius-md);
      background: var(--brand-soft);
      color: var(--brand-dark);
      font-size: 0.86rem;
      font-weight: 800;
      white-space: nowrap;
      min-height: 48px;
      display: inline-flex;
      align-items: center;
    }

    details {
      margin-top: 14px;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      background: var(--surface);
      overflow: hidden;
      box-shadow: var(--shadow);
    }

    summary {
      list-style: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 20px 24px;
      font-size: 1.18rem;
      font-weight: 800;
      color: var(--text);
    }

    summary::-webkit-details-marker {
      display: none;
    }

    .chevron {
      color: var(--text-faint);
      transition: transform 0.18s ease;
      flex: 0 0 auto;
    }

    details[open] .chevron {
      transform: rotate(180deg);
    }

    .details-body {
      padding: 0 24px 24px;
      border-top: 1px solid var(--border);
    }

    #morePrescriptionDetailsBody > .detail-section:first-child .detail-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #morePrescriptionDetailsBody > .detail-section:first-child .detail-row {
      grid-template-columns: 1fr;
      gap: 4px;
    }

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

    #compareBody > .detail-section {
      margin-top: 0;
      border-top: 0;
    }

    #compareBody > .detail-section:last-child {
      grid-column: 1 / -1;
      border-top: 1px solid var(--border-soft);
    }

    .detail-section {
      padding-top: 14px;
    }

    .detail-section + .detail-section {
      border-top: 1px solid var(--border-soft);
      margin-top: 14px;
    }

    .detail-heading {
      margin: 0 0 14px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border-soft);
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--brand);
      letter-spacing: 0;
    }

    .detail-grid {
      display: grid;
      gap: 10px;
    }

    .detail-row {
      display: grid;
      grid-template-columns: minmax(140px, 0.34fr) minmax(0, 1fr);
      gap: 10px;
      align-items: flex-start;
    }

    .detail-label {
      color: var(--text);
      font-weight: 700;
      font-size: 0.86rem;
      line-height: 1.4;
    }

    .detail-value {
      color: var(--text-soft);
      font-size: 0.9rem;
      font-weight: 500;
      line-height: 1.45;
      text-align: left;
      word-break: break-word;
    }

    .completed-grid {
      display: grid;
      gap: 10px;
      margin-top: 16px;
    }

    .completed-item {
      display: flex;
      justify-content: space-between;
      gap: 16px;
      align-items: flex-start;
      padding: 12px 14px;
      border-radius: var(--radius-md);
      background: var(--surface-muted);
      border: 1px solid var(--border);
    }

    .completed-item span {
      color: var(--text-faint);
      font-size: 0.82rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .completed-item strong {
      color: var(--text);
      font-size: 0.94rem;
      text-align: right;
      font-weight: 800;
    }

    #linkStateCard {
      display: grid;
      gap: 10px;
      padding: 0;
      border: 0;
      box-shadow: none;
      background: none;
    }

    #statusMessage {
      display: none;
      margin: 0;
      padding: 13px 16px;
      border-radius: var(--radius-md);
      font-size: 0.95rem;
      line-height: 1.45;
      font-weight: 700;
    }

    #statusMessage:not(:empty) {
      display: block;
    }

    #linkStateCard.error-state #statusMessage:not(:empty) {
      color: var(--danger);
      background: var(--error-bg);
      border: 1px solid var(--error-border);
    }

    #linkStateCard.warning-state #statusMessage:not(:empty) {
      color: var(--text-soft);
      background: var(--surface);
      border: 1px solid var(--border);
    }

    #issueWarning,
    #expiryWarning {
      margin: 0;
      padding: 13px 16px;
      border-radius: var(--radius-md);
      color: var(--danger);
      background: var(--error-bg);
      border: 1px solid var(--error-border);
      font-weight: 800;
      line-height: 1.45;
    }

    .state-banner {
      margin: 18px 0;
      padding: 24px;
      border-radius: var(--radius-xl);
      border: 1px solid var(--border);
      background: var(--surface-solid);
    }

    .state-banner[hidden],
    .state-banner-alert[hidden] {
      display: none;
    }

    .state-banner[data-tone="success"] {
      background: var(--surface-solid);
      border-color: var(--border);
    }

    .state-banner[data-tone="brand"] {
      background: var(--brand-soft);
      border-color: var(--border-purple);
    }

    .state-banner[data-tone="warning"] {
      background: var(--surface-solid);
      border-color: var(--border);
    }

    .state-banner[data-tone="danger"] {
      background: var(--surface-solid);
      border-color: var(--danger-border);
    }

    .action-notice {
      position: fixed;
      top: 16px;
      right: 16px;
      z-index: 1001;
      display: flex;
      align-items: flex-start;
      gap: 12px;
      width: min(440px, calc(100vw - 32px));
      padding: 16px;
      border: 1px solid var(--success-border);
      border-left: 4px solid var(--success);
      border-radius: var(--radius-xl);
      background: var(--surface-strong);
      color: var(--text);
      box-shadow: var(--shadow);
    }

    .action-notice[hidden] {
      display: none;
    }

    .action-notice h2 {
      margin: 0 0 6px;
      color: var(--success);
      font-size: 1rem;
      font-weight: 800;
    }

    .action-notice p {
      margin: 0;
      font-size: 0.9rem;
      line-height: 1.45;
    }

    #actionNoticeDismiss {
      min-height: 38px;
      padding: 8px 12px;
      flex-shrink: 0;
      border-radius: 999px;
      background: var(--surface-solid);
      color: var(--brand-dark);
    }

    #actionNoticeDismiss:hover {
      background: var(--brand-soft);
      border-color: var(--border-purple);
    }

    .state-banner-alert {
      margin: 0 0 6px;
      color: var(--danger);
      font-size: 1.15rem;
      font-weight: 900;
      letter-spacing: 0.06em;
    }

    .state-banner-title {
      display: flex;
      align-items: center;
      gap: 0.5em;
      margin: 0;
      font-size: 1rem;
      line-height: 1.2;
      font-weight: 800;
    }

    .state-banner-title::before {
      content: "";
      display: inline-block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--vx-success-indicator);
      flex: 0 0 auto;
    }

    .state-banner[data-tone="warning"] .state-banner-title::before {
      background: var(--vx-warning-indicator);
    }

    .state-banner[data-tone="danger"] .state-banner-title::before {
      background: var(--danger);
    }

    .state-banner[data-tone="success"] .state-banner-title {
      color: var(--brand-dark);
    }

    .state-banner[data-tone="brand"] .state-banner-title {
      color: var(--brand-dark);
    }

    .state-banner[data-tone="warning"] .state-banner-title {
      color: var(--brand-dark);
    }

    .state-banner[data-tone="danger"] .state-banner-title {
      color: var(--brand-dark);
    }

    .state-banner-message {
      margin: 6px 0 0;
      color: var(--text);
      line-height: 1.45;
    }

    .state-banner-quantities {
      display: grid;
      gap: 6px;
      margin: 10px 0 0;
      padding: 0;
      list-style: none;
      font-size: 0.92rem;
    }

    .state-banner-quantities:empty {
      display: none;
    }

    .state-banner-quantities li {
      display: grid;
      gap: 2px;
    }

    .record-identifiers {
      font-size: 1rem;
      margin: 10px 0 0;
      padding-top: 10px;
      border-top: 1px solid var(--border-soft);
      gap: 10px 24px;
    }

    .record-identifiers .chip {
      padding: 0;
      border: 0;
      line-height: 1.45;
      overflow-wrap: anywhere;
      min-width: 0;
    }

    .state-banner-quantities {
      font-size: 1rem;
      gap: 10px;
      margin-top: 10px;
    }

    .state-banner-quantities li + li {
      padding-top: 14px;
      border-top: 1px solid var(--border-soft);
    }

    .remaining-quantity {
      color: var(--text);
      font-size: 1rem;
      font-weight: 800;
      line-height: 1.4;
    }

    .supply-balance {
      color: var(--text-soft);
    }

    #stateDeadline {
      font-size: 1rem;
      margin: 10px 0 0;
    }

    .state-banner-quantities li {
      display: flex;
      flex-wrap: wrap;
      gap: 4px 16px;
      align-items: baseline;
    }

    .state-banner-quantities li > strong {
      flex-basis: 100%;
    }

    #correctionCard[hidden],
    #correctionForm[hidden],
    .correction-start[hidden] {
      display: none;
    }

    .correction-start {
      margin-top: 14px;
    }

    .account-panel {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      margin-top: 12px;
      padding: 14px 16px;
      border-radius: var(--radius-xl);
      border: 1px solid var(--border);
      background: var(--surface-muted);
    }

    .account-panel-details {
      display: grid;
      gap: 6px;
    }

    .account-panel[hidden],
    .account-suggestion[hidden] {
      display: none;
    }

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

    .account-panel p {
      margin: 0;
    }

    .account-panel-label {
      color: var(--text-soft);
      font-size: 0.85rem;
      font-weight: 600;
    }

    .account-panel-name {
      margin-top: 2px;
      color: var(--brand-dark);
      font-size: 1.05rem;
      font-weight: 800;
    }

    .account-panel-premises {
      color: var(--text);
      font-weight: 700;
    }

    .account-panel-note {
      margin-top: 4px;
      color: var(--text-soft);
      font-size: 0.85rem;
    }

    .account-suggestion {
      margin: 16px 4px 0;
      font-size: 0.88rem;
    }

    .compare-instruction {
      margin: 6px 0 12px;
      color: var(--text);
      font-weight: 700;
      line-height: 1.45;
    }

    #fulfilBtn {
      width: 100%;
      margin-top: 16px;
    }

    #fulfilledSummary {
      border-color: var(--success-border);
    }

    .modal-backdrop {
      display: flex;
    }

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

    .modal-card h2 {
      margin: 0;
      font-size: 1.12rem;
      line-height: 1.2;
      font-weight: 800;
    }

    .modal-card p {
      margin: 10px 0 0;
      color: var(--text-soft);
      line-height: 1.45;
    }

    .modal-items {
      display: grid;
      gap: 8px;
      margin-top: 14px;
    }

    .modal-item {
      padding: 12px;
      border-radius: var(--radius-md);
      background: var(--surface-muted);
      border: 1px solid var(--border);
      font-weight: 700;
    }

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

    .modal-secondary,
    .modal-primary {
      min-height: 44px;
      padding: 10px 16px;
    }

    .modal-secondary {
      border: 1px solid var(--border);
      background: var(--surface-solid);
      color: var(--brand-dark);
      box-shadow: none;
    }

    @media (min-width: 720px) {

      .field-group.two-col {
        grid-template-columns: 1fr 1fr;
      }
    }

    @media (max-width: 520px) {
      .account-panel {
        flex-direction: column;
        align-items: stretch;
      }

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


      .brand-wordmark {
        margin-bottom: 0;
        transform: none;
      }


      .chips {
        row-gap: 8px;
      }

      .chip {
        padding: 0 10px;
      }

      .page {
        padding-top: 16px;
      }

      .detail-row {
        grid-template-columns: 1fr;
        gap: 2px;
      }

      #compareBody,
      #morePrescriptionDetailsBody > .detail-section:first-child .detail-grid {
        grid-template-columns: 1fr;
      }
    }
  

    @media (max-width: 760px) {
      .page {
        padding: calc(14px + env(safe-area-inset-top)) 10px calc(36px + env(safe-area-inset-bottom));
      }

      .topbar-brand {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 14px;
      }

      .pharmacy-header-actions {
        width: 100%;
        align-items: flex-start;
      }

      .brand-logo {
        width: 160px;
        max-width: 58vw;
      }
    }

    .modal-secondary:hover {
      background: var(--brand-soft);
      border-color: var(--border-purple);
      color: var(--brand-dark);
      transform: translateY(-1px);
      box-shadow: none;
    }

    #actionNoticeDismiss {
      border-color: var(--border);
      box-shadow: none;
    }

    #pharmacyRefreshBtn,
    #correctionStartBtn {
      min-height: 42px;
    }

    @media (max-width: 760px) {
      .card {
        padding: 14px;
        border-radius: 18px;
      }

      .card.prescription-details {
        padding: 0;
      }

      .state-banner {
        padding: 14px;
        border-radius: 18px;
      }

      summary {
        padding: 18px 14px;
      }

      .details-body {
        padding: 0 14px 14px;
      }

      .modal-actions {
        flex-direction: column;
        align-items: stretch;
      }
    }

    .disclosure-action {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      min-height: 42px;
      font-size: 0.94rem;
      font-weight: 800;
      white-space: nowrap;
    }

    .disclosure-hide,
    details[open] .disclosure-show {
      display: none;
    }

    details[open] .disclosure-hide {
      display: inline;
    }

    summary:hover .disclosure-action {
      background: var(--brand-soft);
      border-color: var(--border-purple);
    }

    .details-guidance {
      margin: 0;
      padding: 18px 24px 24px;
      border-top: 1px solid var(--border-soft);
    }

    @media (max-width: 760px) {
      .details-guidance {
        padding: 14px;
      }

      .prescription-details summary {
        font-size: 1.05rem;
        flex-wrap: wrap;
      }
    }

    .state-banner-quantities {
      margin-top: 14px;
      padding: 16px;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      background: var(--surface-muted);
    }
