/* My Clinic — the clinic's home page (my_clinic/show): tiles select a section */

/* Tiles: numbers that describe the clinic, and the tabs of the page */
.clinic-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  /* Pinned under the page header (sticky-under-header sets `top`); the background
     and bottom padding keep the section scrolling cleanly beneath it. */
  position: sticky;
  z-index: 5;
  background: var(--c-app-bg);
  /* 20px to the navbar, both at rest and while pinned: the page's own top padding is
     zero here, this padding carries the gap and the background paints over it. */
  padding-top: 20px;
  padding-bottom: 20px;
}

.dashboard-content.my-clinic {
  padding-top: 0;
}

.clinic-overview__tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  /* A long meta line is cut, never allowed to widen the tile past its column */
  min-width: 0;
  max-width: 100%;
  padding: 1rem 1.25rem;
  background: var(--c-app-bg);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.clinic-overview__tile:hover {
  background: var(--c-surface-subtle);
}

.clinic-overview__tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--c-brand-highlight);
}

.clinic-overview__tile.is-selected {
  border-color: var(--c-brand);
  background: var(--c-brand-highlight);
}

.clinic-overview__tile.is-selected .clinic-overview__label {
  color: var(--c-brand);
}

.clinic-overview__tile--settings {
  border-style: dashed;
}

.clinic-overview__tile--settings.is-selected {
  border-style: solid;
}

.clinic-overview__value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--c-base-text);
  font-variant-numeric: tabular-nums;
}

.clinic-overview__value--text {
  font-size: 1.125rem;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.clinic-overview__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-base-text);
}

.clinic-overview__meta {
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* The section the selected tile opens */
.clinic-sections {
  margin-top: 0;
}

.clinic-section {
  background: var(--c-app-bg);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 1.5rem;
}

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

/* Detail Card (settings page) */
.detail-card {
  background: var(--c-app-bg);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 1.5rem;
}

.detail-card h3,
.clinic-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-base-text);
  margin: 0 0 1.25rem 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header__description {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
}

.card-header__count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: var(--c-surface-subtle);
  color: var(--c-base-subtitle-text);
}

.card-header__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* The items section: search and the clinic/global scope, for every kind tab */
.card-header__tools {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-header__tools .form-group {
  margin-bottom: 0;
}

.card-header__tools .base-searchbar {
  width: 14rem;
}

.card-header__tools .base-searchbar__input {
  padding: 0.4rem 0.75rem 0.4rem 2.25rem;
  font-size: 0.8125rem;
  border-radius: 999px;
}

.card-header__tools .base-searchbar__icon {
  left: 0.75rem;
  width: 0.9375rem;
  height: 0.9375rem;
}

.card-empty {
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--c-base-subtitle-text);
}

.card-footer-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-brand);
  text-decoration: none;
}

.card-footer-link:hover {
  text-decoration: underline;
}

/* Clinic details: a vertical list of label / value rows */
.detail-list {
  margin: 0;
}

/* Members: one under the other */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.member-entry {
  min-width: 0;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  transition: background-color 0.15s ease;
}

.member-item:hover {
  background: var(--c-surface-subtle);
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--c-brand-highlight);
  color: var(--c-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 500;
  color: var(--c-base-text);
  font-size: 0.9375rem;
  margin-bottom: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-meta {
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.member-email {
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.125rem;
}

.member-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.member-badge--role {
  background: var(--c-surface-subtle);
  color: var(--c-base-subtitle-text);
}

.member-badge--manager {
  background: var(--c-brand-highlight);
  color: var(--c-brand);
}

.member-badge--hot-login {
  background: var(--c-severity-good-highlight);
  color: var(--c-success);
}

.member-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.member-action-form {
  margin: 0;
}

.member-action-btn {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  color: var(--c-base-subtitle-text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.member-action-btn:hover,
.member-action-btn[aria-expanded="true"] {
  background: var(--c-app-bg);
  border-color: var(--c-base-subtitle-text);
  color: var(--c-base-text);
}

.member-action-btn--danger {
  color: var(--c-error);
  border-color: transparent;
}

.member-action-btn--danger:hover {
  background: var(--c-severity-critical-highlight);
  border-color: transparent;
  color: var(--c-error);
}

/* Clinic items: kind tabs, then one list per kind */
.kind-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--c-border);
}

.kind-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-base-subtitle-text);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.kind-tab:hover {
  background: var(--c-surface-subtle);
  color: var(--c-base-text);
}

.kind-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--c-brand-highlight);
}

.kind-tab.is-selected {
  background: var(--c-brand-highlight);
  border-color: var(--c-brand);
  color: var(--c-brand);
}

.kind-tab__count {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--c-surface-subtle);
  color: inherit;
}

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

.entity-kind__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.entity-kind__hint {
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
}


/* A global item's mark: the clinic uses it but does not own it */
.entity-list__badge {
  display: inline-block;
  margin-left: 0.375rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  vertical-align: middle;
  background: var(--c-surface-subtle);
  color: var(--c-base-subtitle-text);
}

/* The read-only view of a global item */
.item-view__note {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
}

.item-view {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-view__row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.item-view__label {
  color: var(--c-base-subtitle-text);
}

.item-view__value {
  margin: 0;
  color: var(--c-base-text);
}

.item-view__list {
  margin: 0;
  padding-left: 1rem;
}

.entity-list {
  display: flex;
  flex-direction: column;
}

.entity-list__entry {
  border-top: 1px solid var(--c-border);
}

.entity-list__entry:first-child {
  border-top: none;
}

.entity-list__row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem 0.25rem;
}

.entity-list__row:hover {
  background: var(--c-surface-subtle);
}

.entity-list__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.entity-list__name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--c-base-text);
}

.entity-list__unit {
  font-weight: 400;
  color: var(--c-base-subtitle-text);
}

.entity-list__meta {
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Which plans use the item */
.entity-list__usage {
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-list__usage--none {
  font-style: italic;
}

.entity-list__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.entity-list__actions form {
  margin: 0;
}

.table-action[aria-expanded="true"] {
  color: var(--c-brand);
  background-color: var(--c-brand-highlight);
}

/* Settings as a section: details first, then colours and the welcome message */
.clinic-section .clinic-settings-layout .detail-card {
  padding: 1.25rem;
}

/* The symptom form inside a folded panel: toolbar row holds the CTCAE button */
.symptom-form__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.symptom-form__toolbar h3 {
  margin: 0;
}

/* Settings Layout — see flex layout below */

/* Severity Colors */
/* As many grade columns as keep a whole hex code readable (two per row in a half-width
   card), never a clipped "#77BB". */
.severity-colors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.severity-color-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.severity-color-label {
  font-size: 0.875rem;
  color: var(--c-base-subtitle-text);
  font-weight: 500;
}

.severity-color-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.severity-color-input {
  width: 48px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

.severity-color-hex {
  /* Seven characters of hex, with the padding, whatever the column */
  min-width: 5.75rem;
  flex: 1;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: monospace;
  color: var(--c-base-text);
  text-transform: uppercase;
}

.severity-color-hex:focus {
  outline: none;
  border-color: var(--c-brand);
}

.severity-colors-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Welcome message */
.detail-card__description {
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.welcome-message__toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.welcome-message__toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-base-text);
}

.welcome-message__switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.welcome-message__switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.welcome-message__slider {
  position: absolute;
  inset: 0;
  background-color: var(--c-border);
  border-radius: 11px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.welcome-message__slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--c-app-bg);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.welcome-message__switch input:checked + .welcome-message__slider {
  background-color: var(--c-brand);
}

.welcome-message__switch input:checked + .welcome-message__slider::before {
  transform: translateX(18px);
}

/* Settings cards layout */
/* The settings: titled groups, each a two-column grid of cards (a wide card takes the
   row), so the page reads as rows of related settings, not as a mosaic. */
.clinic-settings-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.settings-group__title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-base-subtitle-text);
}

.settings-group__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.clinic-settings-layout .detail-card {
  min-width: 0;
}

/* Responsive */
@media (max-width: 600px) {
  .clinic-overview {
    grid-template-columns: 1fr 1fr;
  }

  .card-header {
    flex-wrap: wrap;
  }

  .clinic-items__row {
    flex-wrap: wrap;
  }

  .clinic-items__actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* --- Reminder settings: a grid of audiences (columns) by kinds (rows) --- */
.reminders-grid {
  display: grid;
  grid-template-columns: 7rem repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.reminders-grid__head {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-base-subtitle-text);
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--c-border);
}

.reminders-grid__kind {
  font-weight: 500;
  color: var(--c-base-text);
  padding-top: 0.125rem;
}

.reminders-grid__cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: 0.5rem;
  background-color: var(--c-surface-subtle);
}

.reminders-grid__leads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
  transition: opacity 0.15s ease;
}

.reminders-grid__leads-label {
  width: 100%;
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
}

/* The open-report nudge is for patients only: its cell spans both audience columns */
.reminders-grid__cell--wide {
  grid-column: 2 / -1;
}

.reminders-grid__hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
}

/* Only when the grid is one column: the audience, since the headings are gone */
.reminders-grid__cell-audience {
  display: none;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-base-subtitle-text);
}

@media (max-width: 720px) {
  .reminders-grid {
    grid-template-columns: 1fr;
  }

  .reminders-grid__corner,
  .reminders-grid__head {
    display: none;
  }

  .reminders-grid__cell--wide {
    grid-column: auto;
  }

  .reminders-grid__cell-audience {
    display: block;
  }
}

/* The report warning table: a grade per row, a prompt per column, a radio in each cell
   (the base_radio component's option markup). */
.emergency-warning-form {
  container-type: inline-size;
}

.warning-actions {
  display: grid;
  grid-template-columns: 6rem repeat(3, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* The header and each grade's row are grid children themselves, so the cells line up
   under the headings; in a narrow card they become real rows (below). */
.warning-actions__header,
.warning-actions__row {
  display: contents;
}

.warning-actions__cell-label {
  display: none;
}

.warning-actions__head {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-base-subtitle-text);
  text-align: center;
  align-self: end;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--c-border);
}

.warning-actions__grade {
  font-weight: 500;
  color: var(--c-base-text);
}

.warning-actions__cell {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0;
  border: 1px solid var(--c-border);
  border-radius: 0.5rem;
  background-color: var(--c-surface-subtle);
}

.warning-actions__cell .base-radio__option {
  gap: 0;
}

.warning-actions__na {
  color: var(--c-base-subtitle-text);
  line-height: 1.25rem;
}

.warning-actions__hint {
  font-size: 0.8125rem;
  color: var(--c-base-subtitle-text);
  margin: 0 0 1rem;
}

/* A card too narrow for three readable headings: no header, each grade a row of
   labelled options ("Stupeň 3: ( ) Bez výzvy ( ) Kontaktovat lékaře …"). */
@container (max-width: 30rem) {
  .warning-actions {
    display: block;
  }

  .warning-actions__header {
    display: none;
  }

  .warning-actions__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.625rem 0;
    border-top: 1px solid var(--c-border);
  }

  .warning-actions__row:last-child {
    border-bottom: 1px solid var(--c-border);
  }

  .warning-actions__grade {
    width: 100%;
  }

  .warning-actions__cell {
    padding: 0;
    border: 0;
    background: none;
    justify-content: flex-start;
  }

  .warning-actions__cell .base-radio__option {
    gap: 0.5rem;
  }

  .warning-actions__cell-label {
    display: inline;
  }

  .warning-actions__cell--na {
    display: none;
  }
}

/* A settings card that needs the whole row (the reminder grid). */
.clinic-section .clinic-settings-layout .detail-card--wide {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .settings-group__grid {
    grid-template-columns: 1fr;
  }
}
