/* ============================================================================
   Barmaso — the new look (2026-11)
   ----------------------------------------------------------------------------
   Loaded last, so it re-dresses every page without touching the pages' own
   files: one palette for both token sets, softer cards, pill tabs, calmer
   tables, and boxes that open smoothly. Remove this one <link> to go back.
   ============================================================================ */

:root {
  /* One palette. tokens.css and portal.css each had their own greys and
     greens; both now point at the same ones. */
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-alt: #F1F4F8;
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-faint: #64748B;
  --border: #E3E8EF;
  --border-strong: #CBD3DE;

  --accent: #059669;
  --accent-soft: #E7F7F0;
  --accent-deep: #047857;

  --action: #047857;
  --action-hover: #065F46;
  --action-ink: #FFFFFF;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -6px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, 0.05), 0 24px 56px -12px rgba(15, 23, 42, 0.24);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --pt-bg: var(--bg);
  --pt-line: var(--border);
  --pt-line-soft: var(--surface-alt);
  --pt-slate: var(--ink-soft);
  --pt-muted: var(--ink-faint);
  --pt-ink: var(--ink);
  --pt-green-50: var(--accent-soft);
}

body { background: var(--bg); }

::selection { background: #BDEBD8; color: var(--ink); }

/* --- Buttons ---------------------------------------------------------------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.005em;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, transform 0.12s var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary {
  background: var(--action);
  box-shadow: 0 1px 2px rgba(4, 120, 87, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn--primary:hover:not(:disabled) {
  background: var(--action-hover);
  box-shadow: 0 4px 12px -2px rgba(4, 120, 87, 0.35);
}

.btn--outline {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn--outline:hover:not(:disabled) { border-color: var(--border-strong); background: #FAFBFC; }

.btn--ghost:hover:not(:disabled) { background: var(--surface-alt); }

/* --- Fields ----------------------------------------------------------------- */
.field-input {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.field-input:hover:not(:focus):not(:disabled) { border-color: var(--border-strong); }
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.14);
}
.field-input:disabled, .field-input[readonly] { background: var(--surface-alt); }

.field-label { color: var(--ink-soft); font-weight: 600; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-deep); }

/* --- Tabs: a pill strip ------------------------------------------------------ */
.tab-strip {
  width: fit-content;
  max-width: 100%;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}
.tab-btn {
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  font-size: 13.5px;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.tab-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.tab-btn.is-active {
  color: var(--ink);
  background: var(--surface);
  border-bottom-color: transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 1px 1px rgba(15, 23, 42, 0.04);
}
.ast-strip { width: 100%; }

@media (max-width: 860px) {
  .route-outlet .tab-strip:not(.ast-strip) {
    gap: 4px;
    padding: 4px;
    width: 100%;
  }
  .route-outlet .tab-strip:not(.ast-strip) .tab-btn {
    min-height: 38px;
    border-radius: 9px;
    background: transparent;
  }
  .route-outlet .tab-strip:not(.ast-strip) .tab-btn.is-active {
    background: var(--surface);
    color: var(--ink);
  }
}

/* --- Tables ----------------------------------------------------------------- */
.fin-table-wrap, .table-wrap {
  border-color: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.fin-table th, .data-table th {
  background: #F8FAFC;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.fin-table thead th { background: #F8FAFC; }
.fin-table td, .data-table td { border-bottom-color: #EDF1F5; }
.fin-table tbody tr, .data-table tbody tr { transition: background-color 0.12s ease; }
.fin-table tbody tr:hover > td, .data-table tbody tr:hover > td { background-color: #F8FAFC; }
.fin-table tbody tr:last-child > td, .data-table tbody tr:last-child > td { border-bottom: 0; }

/* --- Cards ------------------------------------------------------------------ */
.editor-card, .ann-card, .row-item, .login-card {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.login-card { box-shadow: var(--shadow-md); border-radius: var(--radius-xl); }

/* --- Boxes (every <dialog>) -------------------------------------------------- */
@keyframes bm-box-in {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to { opacity: 1; transform: none; }
}
@keyframes bm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

dialog[open] { animation: bm-box-in 0.26s var(--ease-out); }
dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: bm-fade-in 0.2s ease;
}

.confirm-dialog, .ucx-sheet, .paper-dialog {
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.confirm-title { font-family: var(--font-display); letter-spacing: -0.01em; }

/* On a phone a big box rises from the bottom, like the phone's own sheets. */
@keyframes bm-sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (max-width: 640px) {
  .ucx-sheet[open] { animation-name: bm-sheet-up; }
}

/* --- Sidebar ---------------------------------------------------------------- */
.sidebar { background: #FCFDFE; border-right-color: var(--border); }
.sidebar-link {
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.sidebar-link:hover { background: var(--surface-alt); color: var(--ink); }
.sidebar-link.is-active {
  position: relative;
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: none;
}
.sidebar-link.is-active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

/* --- Pages arrive, they do not blink in ------------------------------------- */
@keyframes bm-page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.route-outlet > *:not(.lazy-view),
.route-outlet > .lazy-view > * { animation: bm-page-in 0.28s var(--ease-out) both; }

/* --- Loading: a soft shimmer instead of a bare word -------------------------- */
@keyframes bm-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
.page-loading::before {
  content: '';
  display: block;
  max-width: 560px;
  height: 14px;
  margin: 0 auto 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #E9EDF2 30%, #F5F7FA 50%, #E9EDF2 70%);
  background-size: 300% 100%;
  animation: bm-shimmer 1.3s ease-in-out infinite;
  box-shadow: 0 26px 0 -2px #EEF1F5, 0 52px 0 -4px #F1F4F7;
}
.page-loading { padding-bottom: 72px; }

/* --- Scrollbars that do not shout ------------------------------------------- */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: #CBD3DE transparent; }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog::backdrop, .route-outlet > *, .route-outlet > .lazy-view > * { animation: none !important; }
}
