/* Panel additions on top of Tabler. */

/* Accessibility (spec 12): contrast of at least 4.5:1 for the colors Tabler leaves
   below it, the skip link, links in text that do not rely on color alone, and
   targets of at least 24 px. */
:root {
  --tblr-danger: #cd3030;
  --tblr-danger-rgb: 205, 48, 48;
  --tblr-red: #cd3030;
  --tblr-red-rgb: 205, 48, 48;
  --access-green: #1e7b2f;
}

.bg-green-lt { color: var(--access-green) !important; }
.bg-yellow-lt { color: #8a5a00 !important; }
.bg-blue-lt,
.bg-primary-lt { color: #0559a9 !important; }
.bg-secondary-lt { color: #565c66 !important; }
.bg-red-lt { color: #b42828 !important; }
.bg-orange-lt { color: #a84303 !important; }
/* Buttons that look like links, on white and on the light card footers; Tabler
   sets their color directly, past its own variables. */
.btn-link { color: #0559a9; }
.btn-link:hover,
.btn-link:focus,
.btn-link:active { color: #044a8c; }

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1100;
  padding: 0.5rem 1rem;
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface);
  color: var(--tblr-primary);
  font-weight: var(--tblr-font-weight-medium);
  box-shadow: var(--tblr-box-shadow-dropdown);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* A visible focus everywhere (WCAG 2.4.7): Tabler takes the outline away from
   buttons and fields. White on the dark menu, for the contrast. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.page-link:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
  outline: 2px solid var(--tblr-primary);
  outline-offset: 2px;
}

[data-bs-theme="dark"] :is(a, button, .btn, .nav-link):focus-visible {
  outline-color: #fff;
}

/* The skip link's target takes the focus without a ring around the whole page. */
main[tabindex="-1"]:focus {
  outline: none;
}

/* The brand, which left the headings: the color and the size of the h3 it was. */
.navbar-brand > a,
.navbar-brand > a:hover {
  color: inherit;
  text-decoration: none;
}

.navbar-brand-title {
  display: block;
  font-size: 1rem;
  font-weight: var(--tblr-font-weight-bold);
  line-height: 1.5rem;
}

:where(p, li, dd, .form-hint, .alert, .page-intro) a:not(.btn, .nav-link, .page-link, .dropdown-item) {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* The icon buttons of each row of a list. */
.row-actions {
  white-space: nowrap;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--tblr-border-radius);
  background: none;
  color: var(--tblr-primary);
}

.row-action:hover {
  background: var(--tblr-bg-surface-secondary);
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
}

/* Narrower windows: as many day columns as fit, one per row on phones. */
@media (max-width: 1199.98px) {
  .week-grid {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  }
}

.week-day {
  container-type: inline-size;
}

.week-day .card-header {
  padding: 0.5rem 0.75rem;
  min-height: 0;
  gap: 0.5rem;
}

/* A narrow day has no room for the badge next to its title; its border and
   header color already mark today. */
@container (max-width: 10rem) {
  .week-day .today-badge {
    display: none;
  }
}

.week-day.is-today {
  border-color: var(--tblr-primary);
}

.week-day.is-today .card-header {
  background: var(--tblr-primary-lt);
}

.week-day .card-body {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.week-session {
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  padding: 0.5rem 0.625rem;
}

.week-session-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.week-session-patient {
  overflow-wrap: anywhere;
}

.week-session-meet,
.week-session-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
}

.week-session-confirmed {
  color: var(--tblr-green);
}

.week-empty {
  color: var(--tblr-secondary);
  font-size: 0.8125rem;
  padding: 0.25rem;
}

.free-times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

#panel-alert:empty {
  display: none;
}

/* flatpickr in Tabler colours. */
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: var(--tblr-primary);
  border-color: var(--tblr-primary);
}

.flatpickr-day.today {
  border-color: var(--tblr-primary);
}

/* Bot texts: show line breaks exactly as WhatsApp will. */
.bot-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A text and its Editar button beside it; on phones the button shares the title's
   line, and the text below it takes the whole width. */
.text-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.text-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 575.98px) {
  .text-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 0.75rem;
  }

  .text-item-body {
    display: contents;
  }

  .text-item-body > * {
    grid-column: 1 / -1;
  }

  .text-item-body > .text-item-title {
    grid-column: 1;
    align-self: center;
  }

  .text-item-edit {
    grid-column: 2;
    grid-row: 1;
  }
}

.word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Alerts span the whole row, like the cards next to them. */
.row-deck > [class*="col-"] > .alert {
  flex: 1 1 auto;
}

/* Cards stacked in one column of a row-deck keep their own height. */
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.row-deck .card-stack > .card {
  flex: 0 0 auto;
}

/* Form and record buttons: the main one at the right and first in the page, so the
   Enter key presses it; the others to its left, going back the leftmost. */
.form-buttons {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Three buttons do not fit a phone's line: one under the other, the main one on top. */
@media (max-width: 575.98px) {
  .form-buttons:has(> :nth-child(3)) {
    flex-direction: column;
  }
}

/* A record's fields (details and settings pages): the labels in a column as wide as
   the longest one, up to a limit, and the values beside them; stacked on phones. */
.record {
  display: grid;
  grid-template-columns: fit-content(16rem) minmax(0, 1fr);
  margin: 0;
}

.record-row {
  display: contents;
}

.record-row dt,
.record-row dd {
  margin: 0;
  padding: 0.625rem 0;
}

.record-row dt {
  padding-right: 1.5rem;
  font-weight: normal;
  color: var(--tblr-secondary);
}

.record-row dd {
  overflow-wrap: anywhere;
}

.record-row + .record-row > * {
  border-top: 1px solid var(--tblr-border-color);
}

.record-row:first-child > * {
  padding-top: 0;
}

.record-row:last-child > * {
  padding-bottom: 0;
}

@media (max-width: 575.98px) {
  .record {
    grid-template-columns: minmax(0, 1fr);
  }

  .record-row dt {
    padding-right: 0;
    padding-bottom: 0.125rem;
  }

  .record-row dd {
    padding-top: 0;
  }

  .record-row + .record-row > dd {
    border-top: 0;
  }

  .record-row:last-child > dt {
    padding-bottom: 0.125rem;
  }
}

/* SQLAdmin list pages put a container-fluid straight into the card grid: give it the
   gutters of .row-cards, which narrow on phones (the container redefines them on
   itself), so lists line up with the other pages and with the status banner. */
.row-cards > .container-fluid {
  --tblr-gutter-x: inherit;
  --tblr-gutter-y: inherit;
}

/* The columns that sort look like the others until hovered; the arrow shows the
   order chosen. */
.row-cards > .container-fluid .card-table thead th a {
  color: inherit;
}

.row-cards > .container-fluid .card-table thead th a:hover {
  color: var(--tblr-primary);
  text-decoration: none;
}

/* The list footer wraps instead of breaking its texts; on phones, one part per line. */
.row-cards > .container-fluid .card-footer {
  flex-wrap: wrap;
}

.row-cards > .container-fluid .card-footer > * {
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .row-cards > .container-fluid .card-footer {
    justify-content: flex-start !important;
  }

  .row-cards > .container-fluid .card-footer .pagination {
    margin-left: 0 !important;
  }
}

/* The actions button and the search share a line while the search has room; on
   phones the search takes a line of its own. Its field and buttons stay on one line. */
.row-cards > .container-fluid .card-body > .d-flex {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.row-cards > .container-fluid .card-body .d-flex > .dropdown {
  flex: 0 0 auto;
  width: auto;
}

.row-cards > .container-fluid .card-body .d-flex > .col-md-4 {
  flex: 1 1 18rem;
  max-width: 24rem;
  width: auto;
}

.row-cards > .container-fluid .card-body .input-group {
  flex-wrap: nowrap;
}

/* The list keeps a margin for a filter column even when there is none. */
.row-cards > .container-fluid .d-flex > .flex-grow-1.me-2:only-child {
  margin-right: 0 !important;
}

/* A bot text looks like the message the patient will see. */
.bot-bubble {
  display: inline-block;
  max-width: 42rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--tblr-bg-surface-secondary);
  border: 1px solid var(--tblr-border-color-translucent);
}

/* What to know before Meta's guided signup (spec 5.1). */
.signup-notes {
  padding-left: 1.25rem;
}

.signup-notes li + li {
  margin-top: 0.25rem;
}

/* Tabler's warning orange is too light for text on a white card. */
.request-warning {
  display: flex;
  gap: 0.375rem;
  align-items: baseline;
  max-width: 32rem;
  color: #8a5300;
}

/* File names and variables in help texts read badly when split at a hyphen. */
.card-body p code {
  white-space: nowrap;
}

.notice-hint {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin: 1rem 0 0;
  color: var(--tblr-secondary);
  font-size: 0.8125rem;
}

/* Login pages (spec 9.1). */
.auth-page .container-tight {
  padding-inline: 1rem;
}

.auth-brand {
  font-size: 1.25rem;
  font-weight: 600;
}

.auth-brand a,
.auth-brand a:hover {
  color: inherit;
  text-decoration: none;
}

.auth-page .card-body p {
  text-wrap: pretty;
}

/* The signup's field for robots: out of sight and out of the tab order. */
.auth-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.auth-documents {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.auth-documents li {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
}

.auth-documents li + li {
  margin-top: 0.5rem;
}

.auth-steps {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.auth-qr {
  display: block;
  width: 230px;
  height: 230px;
  margin: 0 auto 0.75rem;
}

.auth-secret {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.auth-code {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.25em;
  text-align: center;
}

/* The operator's area (spec 9.2): the same side gutter as the login on phones. */
.operator-page .container-xl {
  padding-inline: 1rem;
}

/* Each consultório: its name, state and actions, then a grid of facts. */
.operator-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

/* Four columns, so the eight facts make two full rows; two on phones. */
.operator-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 0.875rem 0 0;
}

@media (max-width: 767.98px) {
  .operator-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.operator-facts dt {
  font-weight: normal;
  font-size: 0.8125rem;
  color: var(--tblr-secondary);
}

.operator-facts dd {
  margin: 0;
}

/* The free period the operator gives (spec 9.2), under the facts. */
.operator-free {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.875rem;
}

/* The operator's search and pages (spec 9.2). */
.operator-search {
  display: flex;
  gap: 0.5rem;
  max-width: 32rem;
}

.operator-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.operator-free input {
  width: 7.5rem;
}

/* SQLAdmin hides the menu icons from 768px to 992px, made for a menu in a row; ours
   is a column with room for them. */
.navbar-vertical #navbar-menu .nav-link-icon.d-md-none {
  display: inline-block !important;
}

/* The end of the session, at the bottom of the panel's menu. */
.panel-sign-out {
  padding: 0.5rem 0.75rem;
}

/* Below 768px the menu is a bar on top: the menu button, the brand and "Sair" share
   one row, and the open menu is a column below them. SQLAdmin's own menu
   would otherwise lay out in a row from 576px and overflow the screen. */
@media (max-width: 767.98px) {
  .navbar-vertical > .container-fluid > #navbar-menu {
    display: contents;
  }

  .navbar-vertical #navbar-menu .navbar-toggler {
    display: inline-block;
    order: -1;
    margin-right: 0.5rem;
    padding-inline: 0.25rem;
  }

  .navbar-vertical .navbar-brand {
    margin-right: auto;
  }

  .navbar-vertical #navbar-menu .navbar-collapse {
    order: 1;
    flex-basis: 100%;
    align-items: stretch;
  }

  .navbar-vertical #navbar-menu .navbar-collapse:not(.show, .collapsing) {
    display: none !important;
  }

  .navbar-vertical #navbar-menu .navbar-nav {
    flex-direction: column;
  }
}

/* What a menu page is for, under its title: one line at a readable length. */
.page-intro {
  max-width: 48rem;
  margin: 0.25rem 0 0;
}

/* Where a reminder or notice text stands at Meta: the reason wraps as a whole. */
.template-review {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
}

/* First steps (spec 9): a numbered list, each step marked by the consultório's state. */
.first-steps {
  margin: 0;
  padding: 0;
}

.first-step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.875rem;
}

.first-step-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--tblr-secondary);
  background: var(--tblr-bg-surface-secondary);
  border: 1px solid var(--tblr-border-color);
}

.first-step.is-next .first-step-mark {
  color: #fff;
  background: var(--tblr-primary);
  border-color: var(--tblr-primary);
}

.first-step.is-done .first-step-mark {
  color: var(--access-green);
  background: var(--tblr-green-lt);
  border-color: transparent;
}

/* A step not available here: muted, but still readable. */
.first-step.is-off .first-step-body > .fw-medium {
  color: var(--tblr-secondary);
}

.first-step.is-off .first-step-mark {
  color: var(--tblr-secondary);
}

.first-step-body {
  padding-top: 0.25rem;
}

.first-step-action {
  margin-top: 0.125rem;
}

/* Phones: the button goes under the text, in line with it. */
@media (max-width: 575.98px) {
  .first-step {
    grid-template-columns: 2rem minmax(0, 1fr);
  }

  .first-step-action {
    grid-column: 2;
    justify-self: start;
    margin-top: 0.5rem;
  }
}

/* How she pays: the radio mark keeps its round shape beside long descriptions. */
.payment-methods .form-selectgroup-check {
  flex-shrink: 0;
}

/* The Pix Automático QR code beside its steps; stacked on phones (spec 9.3). */
.pix {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.pix-code {
  display: block;
  width: 13.75rem;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
}

.pix-steps ol {
  padding-left: 1.25rem;
}

.pix-other {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.5rem;
}

@media (max-width: 575.98px) {
  .pix {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .pix-steps {
    justify-self: stretch;
  }
}
