/* app.css — minimal overrides. All visual design is via Tailwind (loaded in the layout). */

:root {
  color-scheme: light;
}

body {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #B9CFE0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #93AEC4; }

/* Details/summary for reverse-payment UI */
details > summary {
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }

/* HTMX indicator — hides itself by default, Tailwind can't animate display: none elegantly */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Small: keep tabular numbers tight for money columns */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ---- Central HTMX skeleton (see partials/skeleton.html + js/skeleton.js) ----
 * .ordora-loading dims the swap target while a request is in flight.
 * .ordora-skeleton / .ordora-shimmer render the shimmer placeholder.
 * Markup uses classes only (never swap-target ids) so outerHTML swaps stay
 * rigid-safe. Honors prefers-reduced-motion.
 */
.ordora-loading {
  opacity: 0.75;
  pointer-events: none;
  transition: opacity 150ms ease-in;
}

.ordora-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
}

.ordora-skeleton-row,
.ordora-skeleton-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.ordora-skeleton-header {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(195, 207, 209, 0.4);
}

.ordora-skeleton-title,
.ordora-skeleton-line {
  display: flex;
}

.ordora-skeleton-card { gap: 0.75rem; }
.ordora-skeleton-list .ordora-skeleton-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(195, 207, 209, 0.25);
}

.ordora-shimmer {
  display: block;
  height: 0.85rem;
  border-radius: 0.375rem;
  background: linear-gradient(90deg, #E1EAF2 25%, #EDF3F8 50%, #E1EAF2 75%);
  background-size: 200% 100%;
  animation: ordora-shimmer 1.2s ease-in-out infinite;
}

/* ---- Field-level form errors (see partials/field_error.html) ---- */
.field-error {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: #ba1a1a;
}
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  outline: 2px solid #ba1a1a;
  outline-offset: -2px;
}

/* ---- Central button spinner (see js/forms.js) ----
 * .is-loading disables the button and shows a spinner; the label stays
 * so layout never shifts. Honors prefers-reduced-motion.
 */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}
.btn-loading .btn-label { visibility: hidden; }
.btn-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1rem;
  height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border-radius: 9999px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: ordora-spin 0.7s linear infinite;
}
@keyframes ordora-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-loading::after { animation: none; border-top-color: currentColor; }
}

/* ---- Central confirm modal (see partials/confirm_modal.html) ---- */
.ordora-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12, 34, 38, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ordora-modal-backdrop[hidden] { display: none; }
.ordora-modal {
  width: 100%;
  max-width: 26rem;
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1rem 2.5rem rgba(12, 34, 38, 0.25);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ---- Maestro-borrowed card patterns ----
 * .metric-card: icon disc + big number + label (dashboards).
 * .accent-card: left accent border for callouts/steps.
 * .pill-badge: uppercase pill status (pairs with statusLabel output).
 * .avatar-initials: tinted initials disc (lists, assignees).
 */
.metric-card {
  background: #ffffff;
  border: 1px solid #E1EAF2;
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 65, 74, 0.05);
}
.metric-card .metric-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.metric-card .metric-value {
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric-card .metric-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #44566A;
}
.accent-card {
  border-left: 4px solid #0077BE;
  border-radius: 0.5rem;
}
.pill-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.avatar-initials {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---- Stacked KPI cards (dashboard + reports): label on top, refined
 * numeral below, supporting line last. Numerals stay semibold and
 * tabular so columns of money scan cleanly without shouting. */
.metric-card-stacked {
  background: #ffffff;
  border: 1px solid #E1EAF2;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  box-shadow: 0 4px 12px rgba(0, 90, 140, 0.05);
}
.metric-number {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0B1C30;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-sub {
  font-size: 12px;
  line-height: 16px;
  color: #44566A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Categorical heading hues: one hue per card so cards are findable at a
 * glance. Deep shades only (all pass 4.5:1 on white). Red stays reserved
 * for risk/problems, green for money-in — color always means something. */
.hl-blue { color: #005A8C; }
.hl-green { color: #006E4B; }
.hl-amber { color: #92400E; }
.hl-red { color: #B91C1C; }
.hl-purple { color: #6D28D9; }

/* ---- Hover tooltips (aaPanel-style): any card with data-tip explains
 * itself on hover or keyboard focus. Pure CSS — no JS, nothing to break.
 * Non-focusable cards get tabindex="0" in markup so keyboard and touch
 * users can summon the tip too. */
[data-tip] { position: relative; }
[data-tip]:hover::after,
[data-tip]:focus-visible::after,
[data-tip]:focus-within::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 230px;
  white-space: normal;
  background: #fff;
  color: #0B1C30;
  border: 1px solid #C3D2DE;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 8px 20px -8px rgba(11, 28, 48, 0.25);
  z-index: 50;
  pointer-events: none;
}
[data-tip]:hover::before,
[data-tip]:focus-visible::before,
[data-tip]:focus-within::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #C3D2DE;
  border-bottom: none;
  z-index: 50;
  pointer-events: none;
}
[data-tip]:focus-visible { outline: 2px solid #0077BE; outline-offset: 2px; }

.ordora-skeleton-title .ordora-shimmer { height: 1.1rem; }

@keyframes ordora-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ordora-shimmer { animation: none; }
  .ordora-loading { transition: none; }
}

