/*
 * Pink Blossom — theme for Klasyfikator Budżetowy.
 * Priorities: readability > aesthetics > decoration.
 * Floral motifs appear only on the login screen and as one ornament in the sidebar.
 * Data surfaces (tables, forms) stay neutral white.
 */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --pb-cream: #FBF8F4;
  --pb-cream-2: #F5EFE8;
  --pb-surface: #FFFFFF;

  --pb-ink: #2F2A2C;      /* body text        — 13.9:1 on cream */
  --pb-ink-2: #5E5559;    /* secondary text   —  7.0:1 on cream */
  --pb-ink-3: #736A6E;    /* meta / captions  —  5.0:1 on cream */

  --pb-line: #ECE3DE;
  --pb-line-strong: #DCCFC9;

  --pb-rose-50: #FCF3F3;
  --pb-rose-100: #F7E3E4;
  --pb-rose-200: #EFCACD;
  --pb-rose-400: #D59AA3;
  --pb-rose-600: #A8586A; /* primary button bg — 4.9:1 with white */
  --pb-rose-700: #8E4557; /* links, active nav — 6.3:1 on rose-50 */

  --pb-sage-50: #F1F5EE;
  --pb-sage-100: #E3EBDD;
  --pb-sage-400: #9CAF88;
  --pb-sage-700: #4F6A49; /* success text — 5.1:1 on sage-100 */

  --pb-lav-50: #F5F2F9;
  --pb-lav-100: #EAE4F2;
  --pb-lav-400: #B6A8CC;
  --pb-lav-700: #5F4F7A;  /* info text, focus outline — 6.9:1 on lav-50 */

  --pb-danger-bg: #FBECEC;
  --pb-danger: #A12F3C;   /* error text — 6.1:1 on danger-bg */

  --pb-radius: .75rem;
  --pb-radius-lg: 1rem;
  --pb-shadow: 0 1px 2px rgba(47, 42, 44, .04), 0 6px 20px rgba(47, 42, 44, .05);
  --pb-sidebar-w: 272px;

  /* Bootstrap 5.3 variables */
  --bs-body-font-family: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-line-height: 1.55;
  --bs-body-color: var(--pb-ink);
  --bs-body-color-rgb: 47, 42, 44;
  --bs-body-bg: var(--pb-cream);
  --bs-secondary-color: var(--pb-ink-2);
  --bs-tertiary-color: var(--pb-ink-3);
  --bs-emphasis-color: var(--pb-ink);
  --bs-border-color: var(--pb-line);
  --bs-border-radius: .6rem;
  --bs-border-radius-lg: var(--pb-radius);
  --bs-link-color: var(--pb-rose-700);
  --bs-link-color-rgb: 142, 69, 87;
  --bs-link-hover-color: #6F3242;
  --bs-link-hover-color-rgb: 111, 50, 66;
  --bs-primary: var(--pb-rose-600);
  --bs-primary-rgb: 168, 88, 106;
  --bs-focus-ring-color: rgba(95, 79, 122, .28);
  --bs-heading-color: var(--pb-ink);
}

/* ---------- Base ---------- */
body {
  background: var(--pb-cream);
  color: var(--pb-ink);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 600; letter-spacing: -.01em; }
.tabular { font-variant-numeric: tabular-nums; }

a { text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--pb-lav-700); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--pb-lav-400);
  box-shadow: 0 0 0 .22rem var(--bs-focus-ring-color);
  outline: 0;
}

.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 2000;
  background: var(--pb-surface); color: var(--pb-rose-700); padding: .5rem 1rem;
  border-radius: .5rem; box-shadow: var(--pb-shadow);
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn { font-weight: 500; --bs-btn-padding-x: 1rem; }
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--pb-rose-600);
  --bs-btn-border-color: var(--pb-rose-600);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--pb-rose-700);
  --bs-btn-hover-border-color: var(--pb-rose-700);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #7A3A4A;
  --bs-btn-active-border-color: #7A3A4A;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--pb-rose-400);
  --bs-btn-disabled-border-color: var(--pb-rose-400);
}
.btn-outline-secondary {
  --bs-btn-color: var(--pb-ink-2);
  --bs-btn-border-color: var(--pb-line-strong);
  --bs-btn-hover-color: var(--pb-ink);
  --bs-btn-hover-bg: var(--pb-cream-2);
  --bs-btn-hover-border-color: var(--pb-line-strong);
  --bs-btn-active-color: var(--pb-ink);
  --bs-btn-active-bg: var(--pb-cream-2);
  --bs-btn-active-border-color: var(--pb-line-strong);
}
.btn-outline-danger {
  --bs-btn-color: var(--pb-danger);
  --bs-btn-border-color: #E3B7BC;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--pb-danger);
  --bs-btn-hover-border-color: var(--pb-danger);
}
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; padding: 0; border-radius: .6rem;
  color: var(--pb-ink-2); background: transparent; border: 1px solid transparent;
}
.btn-icon:hover { background: var(--pb-cream-2); color: var(--pb-ink); }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; color: var(--pb-ink); margin-bottom: .35rem; }
.form-control, .form-select {
  border-color: var(--pb-line-strong);
  background-color: var(--pb-surface);
  color: var(--pb-ink);
}
.form-control::placeholder { color: var(--pb-ink-3); }
.form-text { color: var(--pb-ink-3); }
.form-check-input { border-color: var(--pb-line-strong); }
.form-check-input:checked { background-color: var(--pb-rose-600); border-color: var(--pb-rose-600); }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--pb-radius); border-width: 1px; font-size: .9375rem; }
.alert-success { --bs-alert-bg: var(--pb-sage-50); --bs-alert-border-color: var(--pb-sage-100); --bs-alert-color: var(--pb-sage-700); }
.alert-info { --bs-alert-bg: var(--pb-lav-50); --bs-alert-border-color: var(--pb-lav-100); --bs-alert-color: var(--pb-lav-700); }
.alert-danger { --bs-alert-bg: var(--pb-danger-bg); --bs-alert-border-color: #F2CFD2; --bs-alert-color: var(--pb-danger); }
.alert-warning { --bs-alert-bg: #FBF4E6; --bs-alert-border-color: #F0E0BD; --bs-alert-color: #7A5518; }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Cards / surfaces ---------- */
.pb-card {
  background: var(--pb-surface);
  border: 1px solid var(--pb-line);
  border-radius: var(--pb-radius-lg);
  box-shadow: var(--pb-shadow);
}
.pb-card-body { padding: 1.5rem; }
.pb-card-title { font-size: 1.0625rem; margin: 0; }
.section-title { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--pb-ink-3); font-weight: 600; }

/* ---------- Badges ---------- */
.badge-role, .badge-status, .badge-soon {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 500; line-height: 1;
  padding: .35rem .6rem; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.badge-role { background: var(--pb-cream-2); color: var(--pb-ink-2); border-color: var(--pb-line); }
.badge-status.is-active { background: var(--pb-sage-100); color: var(--pb-sage-700); }
.badge-status.is-inactive { background: #EFECEB; color: #5E5559; }
.badge-soon { background: var(--pb-lav-50); color: var(--pb-lav-700); border-color: var(--pb-lav-100); }

/* ---------- Tables: neutral by design ---------- */
.table-pb {
  --bs-table-bg: var(--pb-surface);
  --bs-table-hover-bg: #FAF7F4;
  --bs-table-border-color: var(--pb-line);
  margin: 0;
}
.table-pb thead th {
  font-size: .75rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--pb-ink-3); font-weight: 600; background: var(--pb-surface);
  border-bottom-color: var(--pb-line-strong); white-space: nowrap;
}
.table-pb td, .table-pb th { padding: .8rem 1rem; vertical-align: middle; }
.table-pb tbody tr:last-child td { border-bottom: 0; }
/* position: relative keeps absolutely positioned children (e.g. .visually-hidden) inside the scroller */
.table-wrap { position: relative; overflow-x: auto; border-radius: var(--pb-radius-lg); }

/* ---------- Application shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { --bs-offcanvas-width: var(--pb-sidebar-w); --bs-offcanvas-bg: var(--pb-surface); }
.sidebar-inner {
  display: flex; flex-direction: column; height: 100%;
  width: var(--pb-sidebar-w);
  background: var(--pb-surface);
  border-right: 1px solid var(--pb-line);
  padding: 1.25rem .875rem 1rem;
}
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; flex: 0 0 var(--pb-sidebar-w); }
}
.brand {
  display: flex; align-items: center; gap: .7rem;
  padding: .25rem .5rem 1rem; color: var(--pb-ink); text-decoration: none;
}
.brand img { width: 36px; height: 36px; }
.brand-name { font-weight: 650; font-size: 1rem; line-height: 1.2; }
.brand-name small { display: block; font-weight: 450; font-size: .75rem; color: var(--pb-ink-3); }

.nav-pb { list-style: none; margin: 0; padding: 0; }
.nav-pb .nav-section {
  font-size: .6875rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--pb-ink-3); font-weight: 600; margin: 1.25rem .75rem .45rem;
}
.nav-pb a {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .75rem; margin-bottom: 2px; border-radius: .6rem;
  color: var(--pb-ink-2); text-decoration: none; font-weight: 500;
}
.nav-pb a:hover { background: var(--pb-cream); color: var(--pb-ink); }
.nav-pb a.active { background: var(--pb-rose-50); color: var(--pb-rose-700); }
.nav-pb a.active .icon { color: var(--pb-rose-600); }
.nav-pb .nav-label { flex: 1; min-width: 0; }

.sidebar-foot { margin-top: auto; padding: 1rem .75rem 0; }
.sidebar-foot img { width: 128px; height: auto; opacity: .9; display: block; margin-bottom: .5rem; }
.sidebar-foot .unit { font-size: .8125rem; color: var(--pb-ink-3); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: .75rem;
  height: 64px; padding: 0 2rem;
  background: rgba(251, 248, 244, .92);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--pb-line);
}
.topbar-unit { font-size: .875rem; color: var(--pb-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-user { margin-left: auto; }
.user-chip {
  display: flex; align-items: center; gap: .6rem;
  padding: .3rem .6rem .3rem .3rem; border-radius: 999px;
  background: var(--pb-surface); border: 1px solid var(--pb-line); color: var(--pb-ink);
  font-weight: 500; font-size: .875rem;
}
.user-chip:hover { border-color: var(--pb-line-strong); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--pb-rose-100); color: var(--pb-rose-700); font-weight: 600; font-size: .8125rem;
}
.dropdown-menu { --bs-dropdown-border-color: var(--pb-line); --bs-dropdown-link-active-bg: var(--pb-rose-50); --bs-dropdown-link-active-color: var(--pb-rose-700); border-radius: var(--pb-radius); box-shadow: var(--pb-shadow); }
.dropdown-header { color: var(--pb-ink-3); font-size: .8125rem; }

.app-content { width: 100%; max-width: 1200px; padding: 2rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.625rem; margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--pb-ink-2); }

@media (max-width: 991.98px) {
  .app-topbar { padding: 0 1rem; }
  .app-content { padding: 1.25rem 1rem 2rem; }
}

/* ---------- Dashboard ---------- */
.hero {
  background: linear-gradient(180deg, var(--pb-rose-50) 0%, var(--pb-cream) 100%);
  border: 1px solid var(--pb-line);
  border-radius: 1.25rem;
  padding: 2.25rem 2.25rem 2rem;
  margin-bottom: 2rem;
}
.hero-greeting { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); margin: 0 0 .25rem; }
.hero-question { font-size: 1.125rem; color: var(--pb-ink-2); margin: 0 0 1.5rem; }
.search-shell {
  position: relative; display: flex; align-items: center; max-width: 780px;
  background: var(--pb-surface); border: 1px solid var(--pb-line-strong);
  border-radius: 1rem; box-shadow: var(--pb-shadow);
}
.search-shell > .icon { position: absolute; left: 1.15rem; color: var(--pb-ink-3); pointer-events: none; }
.search-input {
  border: 0; background: transparent; height: 3.75rem;
  padding: 0 7rem 0 3.25rem; font-size: 1.0625rem; border-radius: 1rem;
}
.search-input:disabled { background: transparent; cursor: not-allowed; }
.search-shell .badge-soon { position: absolute; right: 1rem; }
.search-hint { margin: .75rem 0 0; font-size: .875rem; color: var(--pb-ink-3); }
@media (max-width: 575.98px) {
  .hero { padding: 1.5rem 1.25rem; }
  .search-input { padding-right: 1rem; font-size: 1rem; }
  .search-shell .badge-soon { display: none; }
}

.empty-state { text-align: center; padding: 1.75rem 1rem 1.25rem; }
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: 50%; margin-bottom: .9rem;
}
.empty-icon.tone-rose { background: var(--pb-rose-50); color: var(--pb-rose-600); }
.empty-icon.tone-lav { background: var(--pb-lav-50); color: var(--pb-lav-700); }
.empty-icon.tone-sage { background: var(--pb-sage-50); color: var(--pb-sage-700); }
.empty-title { font-weight: 600; font-size: .9375rem; margin-bottom: .25rem; }
.empty-text { color: var(--pb-ink-2); font-size: .875rem; margin: 0 auto; max-width: 28ch; }

.placeholder-page { text-align: center; padding: 4rem 1.5rem; }
.placeholder-page .empty-icon { width: 4rem; height: 4rem; }
.placeholder-page .placeholder-text { max-width: 42ch; }
.placeholder-page .empty-icon .icon { width: 1.75rem; height: 1.75rem; }

.dl-pb { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: .6rem 1.5rem; margin: 0; }
.dl-pb dt { font-weight: 500; color: var(--pb-ink-2); }
.dl-pb dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .dl-pb { grid-template-columns: 1fr; gap: .1rem; } .dl-pb dd { margin-bottom: .6rem; } }

/* ---------- Login ---------- */
.auth-split { display: flex; min-height: 100vh; background: var(--pb-surface); }
.auth-art {
  position: relative; display: none; flex: 0 0 40%; overflow: hidden;
  background: linear-gradient(165deg, #FBEFEF 0%, #F8F1EB 58%, #F1F4EC 100%);
  border-right: 1px solid var(--pb-line);
}
@media (min-width: 992px) { .auth-art { display: block; } }
.auth-art-branch { position: absolute; left: -2%; bottom: -3%; width: 88%; max-width: 560px; height: auto; }
.auth-art-caption { position: absolute; top: 2.5rem; left: 2.75rem; right: 2.75rem; }
.auth-art-caption .brand { padding: 0; }
.auth-art-caption p { margin: 1.25rem 0 0; max-width: 26ch; color: var(--pb-ink-2); font-size: 1rem; }

.auth-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.auth-band {
  height: 76px; border-bottom: 1px solid var(--pb-line);
  background: linear-gradient(165deg, #FBEFEF 0%, #F8F1EB 70%, #F1F4EC 100%);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem;
}
.auth-band img.sprig { width: 120px; height: auto; }
@media (min-width: 992px) { .auth-band { display: none; } }
.auth-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-title { font-size: 2rem; margin: 0 0 .35rem; }
.auth-lead { color: var(--pb-ink-2); margin-bottom: 1.75rem; }
.auth-help { margin-top: 1.5rem; font-size: .875rem; color: var(--pb-ink-3); }
.auth-foot { padding: 1rem 1.25rem; text-align: center; font-size: .75rem; color: var(--pb-ink-3); }

/* ---------- Installer ---------- */
.install-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.install-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.install-head img.sprig { width: 110px; height: auto; }
.steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: .45rem; font-size: .8125rem; color: var(--pb-ink-3);
  padding: .35rem .7rem .35rem .4rem; border-radius: 999px; background: var(--pb-surface); border: 1px solid var(--pb-line);
}
.steps .num {
  display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem;
  border-radius: 50%; background: var(--pb-cream-2); font-weight: 600; font-size: .75rem;
}
.steps li.is-current { color: var(--pb-rose-700); border-color: var(--pb-rose-200); background: var(--pb-rose-50); font-weight: 500; }
.steps li.is-current .num { background: var(--pb-rose-600); color: #fff; }
.steps li.is-done { color: var(--pb-sage-700); }
.steps li.is-done .num { background: var(--pb-sage-100); color: var(--pb-sage-700); }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--pb-line); }
.check-list li:last-child { border-bottom: 0; }
.check-list .state { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; }
.check-list .ok .state { background: var(--pb-sage-100); color: var(--pb-sage-700); }
.check-list .fail .state { background: var(--pb-danger-bg); color: var(--pb-danger); }
.check-list .label { font-weight: 500; }
.check-list .detail { font-size: .8125rem; color: var(--pb-ink-3); }
.token-input { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .04em; }
code.path { color: var(--pb-lav-700); background: var(--pb-lav-50); padding: .1rem .35rem; border-radius: .3rem; }

/* ---------- Error pages ---------- */
.error-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.error-card { max-width: 480px; text-align: center; }
.error-code { font-size: .8125rem; letter-spacing: .1em; text-transform: uppercase; color: var(--pb-rose-700); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
