/* ============================================================
   IPAC Admin — Brand Stylesheet
   Colors come from the palette tokens in app/assets/tailwind/application.css
   (the same as the public site, labipac-site). Use var(--color-…) here, never hex.
   ============================================================ */

/* ── Poppins, served from this app (no Google Fonts request; same weights as the site) ── */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/poppins-latin-400-normal-d360be31.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/poppins-latin-500-normal-afc692de.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/poppins-latin-600-normal-765bd6dc.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/poppins-latin-700-normal-96729a37.woff2") format("woff2"); }

/* ── DaisyUI theme → palette. Without this DaisyUI falls back to its own purple/teal
      (status stepper, checkboxes, badges). Unlayered, so it wins over DaisyUI's base layer. ── */

:root,
:root[data-theme="light"] {
  --color-primary: var(--color-brand);
  --color-primary-content: #ffffff;
  --color-secondary: var(--color-brand-deep);
  --color-secondary-content: #ffffff;
  --color-accent: #f8a41b;
  --color-accent-content: var(--color-on-accent);
  --color-neutral: var(--color-ink);
  --color-neutral-content: #ffffff;
  --color-base-100: #ffffff;
  --color-base-200: var(--color-band);
  --color-base-300: var(--color-line);
  --color-base-content: var(--color-ink);
  /* Strong tones: DaisyUI uses these as text/border too (text-error, btn-error).
     Light status backgrounds come from the *-soft tokens (badges, alerts, calendar chips). */
  --color-info: var(--color-brand);
  --color-info-content: #ffffff;
  --color-success: #1e7e45;
  --color-success-content: #ffffff;
  --color-warning: #a85f00;
  --color-warning-content: #ffffff;
  --color-error: #c0392b;
  --color-error-content: #ffffff;
}

/* ── Typography ── */

body {
  font-family: "Poppins", sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Poppins", sans-serif;
}

.font-mono {
  font-family: "Poppins", sans-serif !important;
}

/* ============================================================
   Drawer layout — replaces DaisyUI drawer component
   (DaisyUI classes not processed by tailwindcss-rails standalone)
   ============================================================ */

/* Base: sidebar hidden on mobile */
.drawer {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.drawer-toggle {
  display: none;
}

.drawer-content {
  flex: 1;
  min-width: 0; /* prevent flex overflow */
}

.drawer-side {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 20;
  transform: translateX(-100%);
  transition: transform 0.2s ease-in-out;
}

/* When checkbox is checked (mobile hamburger), show sidebar */
.drawer-toggle:checked ~ .drawer-side {
  transform: translateX(0);
}

/* Overlay behind sidebar on mobile */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.drawer-toggle:checked ~ .drawer-side .drawer-overlay {
  opacity: 1;
  z-index: 0;
}

/* Desktop: sidebar always visible, push content */
@media (min-width: 1024px) {
  .drawer-side {
    position: sticky;
    top: 0;
    transform: translateX(0);
    flex-shrink: 0;
  }

  .drawer-overlay {
    display: none;
  }
}

/* ── Sidebar nav ── */

/* Group names like the site's orange "eyebrow" (Desde 1983…); items as pills. */
.ipac-nav-group {
  color: var(--color-accent-ink);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 14px 12px 4px;
  margin: 0;
}

.ipac-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--color-ink);
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none !important;
  transition: background-color 0.15s;
  margin: 1px 0;
  line-height: 1.4;
}

.ipac-nav-item:hover {
  background-color: var(--color-brand-soft);
  color: var(--color-brand);
}

/* Active item: light-blue pill, blue text, orange icon. */
.ipac-nav-item.active {
  background-color: var(--color-brand-soft);
  color: var(--color-brand);
  font-weight: 600;
}

.ipac-nav-item.active svg {
  color: var(--color-accent);
}

/* When another nav item is being hovered, dim the active highlight
   so the hover target reads as the primary visual cue. */
nav:has(.ipac-nav-item:hover) .ipac-nav-item.active:not(:hover) {
  background-color: transparent;
  font-weight: 400;
}

/* ── Page title ── */

/* Bigger, with the short orange stroke underneath. */
.ipac-page-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--color-brand);
  line-height: 1.2;
  text-wrap: balance;
}

.ipac-page-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-accent);
  margin-top: 10px;
}

.ipac-page-subtitle {
  font-size: 13px;
  color: var(--color-text);
  margin-top: 2px;
}

/* ── Cards ── */

/* Cards as on the site's home: no border, rounder corners, a soft blue shadow. */
.ipac-card,
.ipac-filter-card,
.ipac-metric-card,
.ipac-financial-card {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 10px 40px color-mix(in srgb, var(--color-brand-deep) 9%, transparent);
}

.ipac-card-body {
  padding: 20px;
}

.ipac-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 16px;
}

/* Extras next to the title ("(opcional)", a count badge) keep normal case. */
.ipac-card-header > span {
  text-transform: none;
  letter-spacing: normal;
}

.ipac-card-header::before {
  content: "";
  flex-shrink: 0;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--color-accent);
}

/* Footer of the order's status cards (Pagamentos · Entrega de laudo · Notificações): the
   main action on one row and a reserved row under it ("Ver recibo"), filled or empty, so
   the three buttons line up whatever each card has below. */
.ipac-card-actions {
  margin-top: auto;
  padding-top: 0.75rem;
}

.ipac-card-action-main {
  min-height: 2.25rem;
  display: flex;
  align-items: center;
}

.ipac-card-action-extra {
  min-height: 1.75rem;
  margin-top: 0.25rem;
}

@media (pointer: coarse) {
  .ipac-card-action-extra { min-height: 2.25rem; }
}

/* ── Filter card ── */

.ipac-filter-card {
  padding: 16px;
  margin-bottom: 16px;
}

/* ── Table ── */

/* Plain DaisyUI tables (exam items on the forms) draw headers at 60% of the text color. */
.table thead th {
  color: var(--color-text);
}

/* Light-blue header with blue text and rounded ends; rows split by a hairline, no stripes. */
.ipac-table {
  border-collapse: separate;
  border-spacing: 0;
}

.ipac-table thead th {
  color: var(--color-brand) !important;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background-color: var(--color-brand-soft) !important;
}

.ipac-table thead th:first-child { border-radius: 12px 0 0 12px; }
.ipac-table thead th:last-child  { border-radius: 0 12px 12px 0; }

.ipac-table tbody td,
.ipac-table tbody th {
  border-bottom: 1px solid var(--color-line);
}

.ipac-table tbody tr:hover td,
.ipac-table tbody tr:hover th {
  background-color: var(--color-brand-soft) !important;
}

/* Clickable rows (row-link): keyboard focus looks like hover, plus a visible ring. */
.ipac-table tbody tr[data-controller~="row-link"]:focus-visible td {
  background-color: var(--color-brand-soft) !important;
}

.ipac-table tbody tr[data-controller~="row-link"]:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: -2px;
}

/* ── Action links ── */

.ipac-action-link {
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
}

.ipac-action-form {
  display: inline;
}

.ipac-action-ver  { color: var(--color-brand) !important; }
.ipac-action-editar { color: var(--color-ink) !important; }
.ipac-action-excluir { color: var(--color-danger) !important; }

.ipac-action-link:hover {
  text-decoration: underline;
}

/* ── Field labels & values (show pages) ── */

.ipac-field-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--color-text);
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.ipac-field-value {
  font-size: 14px;
  color: var(--color-ink);
  overflow-wrap: anywhere; /* long e-mails/addresses must not push past a phone screen */
}

/* ── Financial card (teal accent border) ── */

.ipac-financial-card {
  padding: 20px;
}

/* ── Metric cards (dashboard) ── */

.ipac-metric-card {
  padding: 20px 22px;
}

.ipac-metric-number {
  font-size: 34px;
  font-weight: 700;
  color: var(--color-brand);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.ipac-metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-accent-ink);
  letter-spacing: 0.1em;
}

.ipac-metric-sub {
  font-size: 12px;
  color: var(--color-text);
  margin-top: 4px;
}

/* Card do dashboard que abre a lista filtrada. */
.ipac-metric-card-link {
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ipac-metric-card-link:hover,
.ipac-metric-card-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.12);
}

.ipac-metric-money {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-brand);
}

/* Datas do período, sobre a faixa azul do dashboard. */
.ipac-period-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #ffffff;
}

/* DaisyUI's .input paints a white background but inherits the text color, which is
   white on the blue band — without this the chosen dates are invisible. */
.ipac-period-field .input {
  color: var(--color-ink);
}

/* ── Flash messages ── */

.ipac-flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 1rem;
  margin-bottom: 16px;
  font-size: 14px;
}

.ipac-flash-success {
  background-color: var(--color-success-soft);
  color: var(--color-success);
}

.ipac-flash-error {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
}

.ipac-flash-notice {
  background-color: var(--color-brand-soft);
  color: var(--color-brand);
}

.ipac-flash-dismiss {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  opacity: 0.6;
  flex-shrink: 0;
  color: inherit;
}

.ipac-flash-dismiss:hover { opacity: 1; }

/* ── Badge color overrides ── */

.badge.badge-warning {
  background-color: var(--color-warning-soft) !important;
  color: var(--color-warning) !important;
  border-color: var(--color-warning-soft) !important;
}

.badge.badge-info {
  background-color: var(--color-brand-soft) !important;
  color: var(--color-brand-deep) !important;
  border-color: var(--color-brand-soft) !important;
}

.badge.badge-success {
  background-color: var(--color-success-soft) !important;
  color: var(--color-success) !important;
  border-color: var(--color-success-soft) !important;
}

.badge.badge-neutral {
  background-color: var(--color-line) !important;
  color: var(--color-ink) !important;
  border-color: var(--color-line) !important;
}

.badge.badge-ghost {
  background-color: var(--color-line) !important;
  color: var(--color-text) !important;
  border-color: var(--color-line) !important;
}

.badge.badge-error {
  background-color: var(--color-danger-soft) !important;
  color: var(--color-danger) !important;
  border-color: var(--color-danger-soft) !important;
}

/* Parcialmente liberado: o verde do "Liberado" com borda tracejada — "meio pronto". */
.badge.badge-partial {
  background-color: #ffffff !important;
  color: var(--color-success) !important;
  border: 1px dashed var(--color-success) !important;
}

/* Recoleta: o laranja do "Em Coleta" com borda tracejada — "coleta de novo". */
.badge.badge-recollection {
  background-color: #ffffff !important;
  color: var(--color-warning) !important;
  border: 1px dashed var(--color-warning) !important;
}

.badge.badge-primary {
  background-color: var(--color-brand-soft) !important;
  color: var(--color-brand) !important;
  border-color: var(--color-brand-soft) !important;
}

/* ── Button color overrides ── */

.btn.btn-primary {
  background-color: var(--color-brand) !important;
  border-color: var(--color-brand) !important;
  color: #ffffff !important;
}

.btn.btn-primary:hover,
.btn.btn-primary:focus {
  background-color: var(--color-brand-deep) !important;
  border-color: var(--color-brand-deep) !important;
}

.btn.btn-secondary {
  background-color: var(--color-brand) !important;
  border-color: var(--color-brand) !important;
  color: #ffffff !important;
}

.btn.btn-secondary:hover {
  background-color: var(--color-brand-deep) !important;
  border-color: var(--color-brand-deep) !important;
}

/* Outline buttons (Etiqueta, Editar, PDF…): IPAC blue border and text, solid blue on hover —
   the site's .btn-outline. Status outlines (btn-error etc.) keep their own color. */
.btn.btn-outline:not(.btn-error):not(.btn-success):not(.btn-warning):not(.btn-info) {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.btn.btn-outline:not(.btn-error):not(.btn-success):not(.btn-warning):not(.btn-info):hover {
  background-color: var(--color-brand);
  border-color: var(--color-brand);
  color: #ffffff;
}

.btn.btn-accent {
  background-color: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
  color: var(--color-on-accent) !important;
}

.btn.btn-accent:hover {
  background-color: var(--color-accent-dark) !important;
  border-color: var(--color-accent-dark) !important;
}

/* ── Link overrides ── */

.link.link-primary {
  color: var(--color-brand) !important;
}

.link.link-primary:hover {
  color: var(--color-brand-deep) !important;
}

/* ── Checkbox ── */

.checkbox.checkbox-primary,
.checkbox.checkbox-sm {
  border-color: var(--color-brand) !important;
}

.checkbox.checkbox-primary:checked,
.checkbox.checkbox-sm:checked {
  background-color: var(--color-brand) !important;
  border-color: var(--color-brand) !important;
}

/* ── Input / select focus ── */

.input:focus,
.select:focus,
.textarea:focus {
  outline-color: var(--color-brand) !important;
  border-color: var(--color-brand) !important;
}

/* ── Shapes from the site: pill buttons and badges, rounder fields ── */

.btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.btn.btn-sm:not(.btn-circle):not(.btn-square) {
  padding-inline: 1.1rem;
}

.btn.btn-outline {
  border-width: 2px;
}

/* Status in one line: "Em Coleta" broke into two in the narrow ETAPA column of the
   order list, with the pill background behind only part of it. */
.badge {
  border-radius: 999px;
  white-space: nowrap;
}

.input,
.select,
.textarea {
  border-radius: 12px;
}

/* ── Alert overrides ── */

.alert.alert-success {
  background-color: var(--color-success-soft);
  color: var(--color-success);
  border-color: var(--color-success-soft);
}

.alert.alert-error {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: var(--color-danger-soft);
}

/* Warning (duplicate patient, Casa Lab time conflict): DaisyUI paints it solid dark
   orange with white text, unreadable with the gray secondary text inside. */
.alert.alert-warning {
  background-color: var(--color-warning-soft);
  color: var(--color-warning);
  border-color: var(--color-accent);
}

.alert.alert-info {
  background-color: var(--color-brand-soft);
  color: var(--color-brand);
  border-color: var(--color-brand-soft);
}

/* ── Pagination active page ── */

.join .btn.btn-active,
.join .btn[aria-current="page"] {
  background-color: var(--color-brand) !important;
  border-color: var(--color-brand) !important;
  color: white !important;
}

/* ── Code pill ── */

.ipac-code {
  background: var(--color-panel);
  color: var(--color-ink);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

/* ── Warning box (internal notes) ── */

.ipac-warning-box {
  background: var(--color-warning-soft);
  border: 1px solid var(--color-accent);
  border-radius: 0.5rem;
  padding: 12px 16px;
}

/* ── Mobile responsive ── */

@media (max-width: 1023px) {
  .ipac-filter-card .flex-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .ipac-filter-card .form-control {
    min-width: 0;
  }
}

/* ── Tables that don't fit become stacked cards (table_labels_controller adds .ipac-stacked
      when the table overflows its container: phones, tablets, a narrow laptop) ── */

table.ipac-stacked,
table.ipac-stacked tbody,
table.ipac-stacked tr,
table.ipac-stacked td,
table.ipac-stacked th {
  display: block;
  width: 100%;
}

table.ipac-stacked thead {
  display: none;
}

table.ipac-stacked tbody tr {
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  background: #FFFFFF;
}

table.ipac-stacked tbody tr td,
table.ipac-stacked tbody tr th,
table.ipac-stacked.table-zebra tbody tr:nth-child(even) td,
table.ipac-stacked tbody tr:hover td {
  background: transparent !important;
}

/* Caption floats left, value stays right-aligned (stacked children keep stacking). */
table.ipac-stacked tbody td {
  padding: 0.25rem 0.875rem;
  border: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

table.ipac-stacked tbody td::after {
  content: "";
  display: block;
  clear: both;
}

table.ipac-stacked tbody td::before {
  content: attr(data-label);
  float: left;
  max-width: 45%;
  margin-right: 0.75rem;
  padding-top: 0.15rem;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text);
}

/* Cells without a header (actions, remove button) and full-width rows (colspan). */
table.ipac-stacked tbody td[data-label=""]::before,
table.ipac-stacked tbody td:not([data-label])::before {
  display: none;
}

table.ipac-stacked tbody td:not([data-label]) {
  text-align: center;
}

/* Columns that add nothing on a card (e.g. the "#" row number). */
table.ipac-stacked .ipac-stack-hide {
  display: none;
}

/* The first column (code, name, exam) is the card's title. */
table.ipac-stacked tbody td:first-child:not(.ipac-stack-hide),
table.ipac-stacked tbody td.ipac-stack-hide + td {
  font-weight: 600;
  text-align: left;
}

table.ipac-stacked tbody td:first-child::before,
table.ipac-stacked tbody td.ipac-stack-hide + td::before {
  display: none;
}

table.ipac-stacked td .max-w-xs,
table.ipac-stacked td .truncate {
  max-width: 100%;
}

/* Room for two cards side by side (tablet): a grid instead of one long column. */
@media (min-width: 640px) {
  table.ipac-stacked tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
  }

  table.ipac-stacked tbody tr {
    margin-bottom: 0;
  }

  /* "Nenhum registro" rows (colspan) span the whole grid. */
  table.ipac-stacked tbody tr:has(> td:not([data-label])) {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   Forms — one look for every form in the app.
   The views are written in the DaisyUI 4 vocabulary (form-control, label, label-text,
   label-text-alt); DaisyUI 5 dropped those classes, so without this the captions fell
   back to the browser's 16px and every form looked different. Markup:

     <div class="form-control">
       <label class="label"><span class="label-text">Nome <span class="text-error">*</span></span>
                            <span class="label-text-alt">dica curta</span></label>
       <input class="input w-full">
       <p class="ipac-hint">dica longa, embaixo do campo</p>
     </div>

   Long hints go UNDER the field (.ipac-hint), so fields side by side stay aligned.
   ============================================================ */

/* Unlayered, so it beats DaisyUI — and Tailwind's .hidden too: every rule here that sets
   display skips .hidden ("Desconto (%)" is a form-control hidden until the type changes). */
.form-control:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Caption above the field: compact, ink, never the browser's 16px. DaisyUI labels are
   white-space: nowrap; long captions pushed forms past the screen. */
.label {
  white-space: normal;
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.form-control > .label {
  padding: 0 0 6px;
  min-height: 0;
}

/* Caption + short hint on one line ("Notas internas · Não visível ao paciente"); the hint
   drops to the next line instead of squeezing both. */
.label:not(:has(input)):not(.hidden) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.5rem;
  row-gap: 0;
}

.label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-ink);
}

.label-text-alt,
.ipac-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text);
  text-transform: none;
  letter-spacing: normal;
}

.ipac-hint {
  margin-top: 6px;
  line-height: 1.4;
}

/* Checkbox / radio rows: box and text together, text at body size. */
.label:has(input[type="checkbox"]):not(.hidden),
.label:has(input[type="radio"]):not(.hidden) {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 4px 0;
}

.label:has(input[type="checkbox"]) .label-text,
.label:has(input[type="radio"]) .label-text {
  font-size: 14px;
  font-weight: 400;
}

/* A lone checkbox next to a field in a grid row (Status | Solicitar recibo): sits at the
   field's height instead of at the caption's. */
.ipac-form-check:not(.hidden) {
  align-self: end;
  justify-content: center;
  min-height: 2.625rem;
}

/* Fields fill their column. DaisyUI 5 gives .input/.select a fixed 20rem, which made
   a status select 320px wide next to a full-width textarea. */
.form-control > .input,
.form-control > .select,
.form-control > .textarea,
.form-control > div > .input,
.form-control > div > .select {
  width: 100%;
}

/* List filters (.ipac-filter-card) lay fields out in a row sized by DaisyUI: keep that.
   revert-layer hands display/width back to the Tailwind utilities and DaisyUI. */
.ipac-filter-card .form-control:not(.hidden) {
  display: revert-layer;
}

.ipac-filter-card .form-control > .input,
.ipac-filter-card .form-control > .select,
.ipac-filter-card .form-control > div > .input,
.ipac-filter-card .form-control > div > .select {
  width: revert-layer;
}

/* Default-size fields only: the compact ones (input-sm in filters and in Recoleta) keep
   DaisyUI's size. */
.input:not(.input-xs):not(.input-sm):not(.input-lg),
.select:not(.select-xs):not(.select-sm):not(.select-lg) {
  height: 2.625rem;
  font-size: 14px;
}

.textarea:not(.textarea-xs):not(.textarea-sm) {
  font-size: 14px;
  min-height: 5.5rem;
}

.input::placeholder,
.textarea::placeholder {
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

/* Read-only fields (Atendente): the band gray, no border, so they don't look clickable. */
.input:disabled,
.input[readonly]:not([data-controller]) {
  background: var(--color-band);
  border-color: var(--color-line);
  color: var(--color-text);
}

/* Field-level error (simple_form f.error / our own <p class="text-error">). */
.form-control .text-error.text-xs {
  margin-top: 4px;
}

/* ── Form page: one width for every form ── */

.ipac-form {
  max-width: 64rem;
}

.ipac-form-narrow {
  max-width: 40rem;
}

/* A grid of fields inside a card. */
.ipac-form-grid:not(.hidden) {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 1.25rem;
  align-items: start;
}

@media (min-width: 640px) {
  .ipac-form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ipac-form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ipac-form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ipac-form-grid .span-2 { grid-column: span 2 / span 2; }
  .ipac-form-grid .span-3 { grid-column: span 3 / span 3; }
  .ipac-form-grid .span-full { grid-column: 1 / -1; }
}

/* Running totals next to the money fields (Desconto e valores): a light box, figures to
   the right, the net total in bold. */
.ipac-totals {
  align-self: start;
  padding: 14px 16px;
  border-radius: 0.75rem;
  background: var(--color-band);
  font-size: 14px;
}

/* A divider between groups inside one card. */
.ipac-form-divider {
  border-top: 1px solid var(--color-line);
  margin: 1.25rem 0;
}

/* Buttons at the end of the form: a white bar that sticks to the bottom of the screen on
   long forms (Novo pedido), primary action on the right like the Casa Lab modal. */
.ipac-form-actions:not(.hidden) {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 12px 20px;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 -4px 24px color-mix(in srgb, var(--color-brand-deep) 9%, transparent);
}

.ipac-form-actions .ipac-form-actions-note {
  margin-right: auto;
  font-size: 12px;
  color: var(--color-text);
}

/* ── Touch screens: tap targets of at least ~36px (Ver/Editar/Excluir, small buttons,
      top bar). Mouse users keep the compact look. ── */

@media (pointer: coarse) {
  .ipac-action-link {
    min-height: 2.25rem;
    padding: 0.375rem 0.625rem;
  }

  .btn-xs {
    height: auto;
    min-height: 2.25rem;
    min-width: 2.25rem;
  }

  .ipac-topbar-link {
    min-height: 2.5rem;
    padding: 0 0.5rem;
  }
}

/* ── Paginação das listas (pagy series_nav + info_tag, partial admin/_pagination) ── */

.ipac-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagy.series-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
}

.pagy.series-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: 0.5rem;
  background: #FFFFFF;
  color: var(--color-ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.pagy.series-nav a[href]:hover {
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.pagy.series-nav a[href]:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Página atual */
.pagy.series-nav a[aria-current="page"] {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #FFFFFF;
  font-weight: 600;
}

/* Reticências entre blocos de páginas */
.pagy.series-nav a[role="separator"] {
  min-width: auto;
  padding: 0 0.25rem;
  border-color: transparent;
  background: transparent;
  color: var(--color-text);
}

/* "Anterior" na 1ª página / "Próxima" na última */
.pagy.series-nav a[aria-disabled="true"]:not([aria-current]):not([role="separator"]) {
  background: var(--color-band);
  color: var(--color-text);
  cursor: default;
}

.pagy.info {
  font-size: 0.75rem;
  color: var(--color-text);
}

/* ── Casa Lab: arrastar coleta no calendário (calendar_drag_controller) ── */
.hv-dragging {
  opacity: 0.5;
}

.hv-drop-target {
  background: var(--color-brand-soft) !important;
  box-shadow: inset 0 0 0 2px var(--color-brand);
}

/* ── Blue photo band, as at the top of the site (dashboard and sign-in) ──
   The photo is the site's own, kept grayscale in the file; the blue goes on top. */

.ipac-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 1.25rem;
  background: var(--color-brand);
  color: #ffffff;
  padding: 28px 32px 72px;
}

.ipac-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("/assets/ipac-banner-dashboard-aacc8beb.jpg") 70% center / cover;
}

.ipac-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--color-brand) 96%, transparent),
    color-mix(in srgb, var(--color-brand) 78%, transparent) 60%,
    color-mix(in srgb, var(--color-brand) 50%, transparent));
}

.ipac-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.ipac-hero-title {
  color: #ffffff;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 4px;
  text-wrap: balance;
}

.ipac-hero-lead {
  color: color-mix(in srgb, #ffffff 90%, transparent);
  font-size: 15px;
  margin-top: 4px;
}

/* White outline button on the blue band (the site's .btn-outline-light). */
.btn.ipac-btn-light {
  background: transparent;
  border: 2px solid #ffffff;
  color: #ffffff;
}

.btn.ipac-btn-light:hover {
  background: #ffffff;
  color: var(--color-brand);
}

/* The day's numbers sit over the bottom of the band, like the cards on the site's home. */
.ipac-hero-cards {
  position: relative;
  z-index: 1;
  margin-top: -48px;
  padding-inline: 16px;
}

/* Sign-in: photo in blue on the left, the form on the right (stacked on a phone). */
.ipac-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

.ipac-auth-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 56px;
  color: #ffffff;
}

.ipac-auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("/assets/ipac-hero-laboratorio-55ec738e.jpg") 30% center / cover;
}

.ipac-auth-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg,
    color-mix(in srgb, var(--color-brand-deep) 95%, transparent),
    color-mix(in srgb, var(--color-brand) 60%, transparent));
}

.ipac-auth-hero-title {
  color: #ffffff;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.15;
}

.ipac-auth-hero p:not(.ipac-auth-hero-title) {
  margin-top: 10px;
  max-width: 26rem;
  color: color-mix(in srgb, #ffffff 90%, transparent);
}

.ipac-auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--color-band);
}

@media (max-width: 767px) {
  .ipac-hero { padding: 22px 20px 64px; }
  .ipac-hero-title { font-size: 24px; }
  .ipac-hero-cards { padding-inline: 8px; }
  .ipac-metric-card { padding: 14px; }
  .ipac-metric-number { font-size: 26px; }
  .ipac-metric-label { font-size: 10px; }
  .ipac-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ipac-auth-hero { min-height: 200px; padding: 24px; }
  .ipac-auth-hero-title { font-size: 24px; }
}

/* ── Floating buttons: "voltar ao topo" (every page) and Casa Lab (dashboard) ── */

.ipac-back-to-top,
.ipac-fab {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 15;
}

.btn.ipac-back-to-top {
  background: #ffffff;
  color: var(--color-brand);
  border: 2px solid var(--color-brand);
}

.btn.ipac-back-to-top:hover {
  background: var(--color-brand);
  color: #ffffff;
}

/* On the dashboard the Casa Lab button takes the corner; "voltar ao topo" sits above it. */
body:has(.ipac-fab) .ipac-back-to-top {
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

/* .btn's display would beat the [hidden] attribute. */
.ipac-back-to-top[hidden] {
  display: none;
}

/* ── WhatsApp next to a mobile number (phone_with_whatsapp): a small green round button ── */
.ipac-whatsapp-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--color-success-soft);
  color: var(--color-success);
  transition: background-color 0.15s, color 0.15s;
}

.ipac-whatsapp-link:hover,
.ipac-whatsapp-link:focus-visible {
  background: var(--color-success);
  color: #ffffff;
}

@media (pointer: coarse) {
  .ipac-whatsapp-link {
    width: 2.25rem;
    height: 2.25rem;
  }
}
