/* ============================================================
   CZCIONKI — klasy sterujące na tagu <html>
   ============================================================ */
html.font-dmsans  { --font-main: 'DM Sans', sans-serif; }
html.font-inter   { --font-main: 'Inter', sans-serif; }
html.font-jakarta { --font-main: 'Plus Jakarta Sans', sans-serif; }
html.font-geist   { --font-main: 'Geist', sans-serif; }
html.font-roboto  { --font-main: 'Roboto', sans-serif; }

/* dm-sans-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/dm-sans-v17-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* dm-sans-italic - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 400;
  src: url('./fonts/dm-sans-v17-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* dm-sans-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  src: url('./fonts/dm-sans-v17-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* dm-sans-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 600;
  src: url('./fonts/dm-sans-v17-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* dm-sans-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  src: url('./fonts/dm-sans-v17-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}



/* inter-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/inter-v20-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* inter-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('./fonts/inter-v20-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* inter-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('./fonts/inter-v20-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* inter-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url('./fonts/inter-v20-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}



/* plus-jakarta-sans-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/plus-jakarta-sans-v12-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* plus-jakarta-sans-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 500;
  src: url('./fonts/plus-jakarta-sans-v12-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* plus-jakarta-sans-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 600;
  src: url('./fonts/plus-jakarta-sans-v12-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* plus-jakarta-sans-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 700;
  src: url('./fonts/plus-jakarta-sans-v12-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}


/* geist-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Geist';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/geist-v5-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* geist-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Geist';
  font-style: normal;
  font-weight: 500;
  src: url('./fonts/geist-v5-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* geist-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Geist';
  font-style: normal;
  font-weight: 600;
  src: url('./fonts/geist-v5-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* geist-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Geist';
  font-style: normal;
  font-weight: 700;
  src: url('./fonts/geist-v5-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}


/* roboto-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/roboto-v51-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* roboto-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  src: url('./fonts/roboto-v51-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* roboto-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 600;
  src: url('./fonts/roboto-v51-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

/* roboto-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  src: url('./fonts/roboto-v51-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}


/* app.css — Platforma Bezpieczeństwa / Rymer
 * Layout, komponenty, typografia. Kolory z skin-*.css
 */

/*@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');*/
/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font-main, 'DM Sans', sans-serif);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background: var(--color-app-bg);
    color: var(--color-text);
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============================================================
   ZMIENNE STRUKTURALNE
   ============================================================ */
:root {
    --topbar-h:       48px;
    --sidebar-w:      220px;
    --radius:         6px;
    --radius-sm:      4px;
    --radius-lg:      10px;
    --font-mono:      'JetBrains Mono', monospace;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar-thumb);
    border-radius: 3px;
}

/* ============================================================
   LAYOUT: APP WRAPPER
   ============================================================ */
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    flex-shrink: 0;
    background: var(--color-topbar-bg);
    border-bottom: 1px solid var(--color-topbar-border);
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topbar-logo svg { color: var(--color-accent); }

.topbar-brand {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-topbar-brand);
    white-space: nowrap;
}

.topbar-sep {
    width: 1px;
    height: 16px;
    background: var(--color-topbar-border);
    flex-shrink: 0;
    opacity: .6;
}

.topbar-org {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.topbar-spacer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 380px;
    text-align: center;
    letter-spacing: .2px;
    pointer-events: none;
}
.page-body--fullscreen {
    padding: 0;
    overflow: hidden;
}

/* Przycisk skórki */
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.skin-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .15s, border-color .15s;
    flex-shrink: 0;
}
.skin-btn:hover { transform: scale(1.15); }
.skin-btn.active { border-color: var(--color-accent); }
.skin-navy   { background: #1c2b4a; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.skin-govtech { background: #f0ede6; border: 2px solid #d0ccc4; }

/* Użytkownik */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background .15s;
}
.user-pill:hover { background: rgba(255,255,255,0.08); }
.user-pill svg { opacity: .5; }

.topbar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.topbar-logout:hover {
    background: var(--color-err-bg);
    color: var(--color-err);
    border-color: var(--color-err-border);
}

/* Grace mode banner */
.grace-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 32px;
    background: var(--color-warn-bg);
    border-bottom: 1px solid var(--color-warn-border);
    font-size: 12px;
    color: var(--color-warn-text);
    flex-shrink: 0;
}
.grace-banner svg { flex-shrink: 0; }

/* ============================================================
   BODY BELOW TOPBAR
   ============================================================ */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Wyszukiwarka w sidebar */
.sidebar-search {
    padding: 10px 10px 6px;
    flex-shrink: 0;
}

.sidebar-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius);
}
.sidebar-search-wrap svg { color: var(--color-text-dim); flex-shrink: 0; }
.sidebar-search-wrap input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--color-text);
    font-size: 12px;
    width: 100%;
}
.sidebar-search-wrap input::placeholder { color: var(--color-text-dim); }

/* Nawigacja */
.nav-section {
    padding: 10px 10px 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-nav-section);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius);
    margin: 1px 6px;
    font-size: 13px;
    color: var(--color-nav-text);
    cursor: pointer;
    transition: background .12s, color .12s;
    user-select: none;
    position: relative;
    white-space: nowrap;
}
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item:hover {
    background: var(--color-nav-hover-bg);
    color: var(--color-nav-hover-text);
}
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
    background: var(--color-nav-active-bg);
    color: var(--color-nav-active-text);
    font-weight: 500;
}
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--color-nav-active-border);
    border-radius: 0 2px 2px 0;
}

/* Badge w nav (licznik) */
.nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}

.nav-arrow {
    margin-left: auto;
    transition: transform .2s;
    opacity: .4;
}
.nav-item.open .nav-arrow { transform: rotate(90deg); }

/* Podmenu */
.nav-sub {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}
.nav-sub.open {
    max-height: none;
    overflow: visible;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 12px 0 32px;
    margin: 1px 6px;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--color-nav-text);
    cursor: pointer;
    transition: background .12s, color .12s;
}
.nav-sub-item:hover {
    background: var(--color-nav-hover-bg);
    color: var(--color-nav-hover-text);
}
.nav-sub-item.active {
    color: var(--color-nav-active-text);
}

.sidebar-footer {
    margin-top: auto;
    padding: 10px 6px;
    border-top: 1px solid var(--color-sidebar-border);
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-content-bg);
}

/* Nagłówek strony */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 0;
    flex-shrink: 0;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-strong);
    letter-spacing: -.01em;
}

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

.page-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 20px 0;
    font-size: 11px;
    color: var(--color-text-dim);
    flex-shrink: 0;
}
.breadcrumb-sep { opacity: .5; font-size: 14px; line-height: 1; }
.breadcrumb-item { color: var(--color-text-muted); }
.breadcrumb-item.current { color: var(--color-text); }

/* Główny obszar przewijania */
.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* ============================================================
   KARTY (CARDS)
   ============================================================ */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border-subtle, var(--color-border));
}
.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-strong);
}
.card-actions { margin-left: auto; display: flex; gap: 6px; }

.card-body { padding: 16px; }

/* ============================================================
   STAT CARDS (DASHBOARD)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-card);
    transition: border-color .15s;
}
.stat-card:hover { border-color: var(--color-accent); }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--color-text-dim);
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text-strong);
    font-family: var(--font-mono);
    line-height: 1.1;
}
.stat-value.ok   { color: var(--color-ok); }
.stat-value.warn { color: var(--color-warn); }
.stat-value.err  { color: var(--color-err); }
.stat-value.info { color: var(--color-accent); }

.stat-trend {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}
.stat-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.stat-icon.ok   { background: var(--color-ok-bg);   color: var(--color-ok);   }
.stat-icon.warn { background: var(--color-warn-bg);  color: var(--color-warn); }
.stat-icon.err  { background: var(--color-err-bg);   color: var(--color-err);  }
.stat-icon.info { background: var(--color-info-bg);  color: var(--color-info); }

/* ============================================================
   TABELA
   ============================================================ */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    height: 34px;
    padding: 0 12px;
    background: var(--color-thead-bg);
    border-bottom: 1px solid var(--color-table-border);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--color-th-text);
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

tbody tr { background: var(--color-row-odd); transition: background .1s; }
tbody tr:nth-child(even) { background: var(--color-row-even); }
tbody tr:hover { background: var(--color-row-hover); }

tbody td {
    height: 38px;
    padding: 0 12px;
    border-bottom: 1px solid var(--color-row-divider);
    color: var(--color-text);
    white-space: nowrap;
}

.td-mono { font-family: var(--font-mono); font-size: 12px; }
.td-muted { color: var(--color-text-muted); }
.td-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   BADGE / STATUS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    white-space: nowrap;
}
.badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-ok      { background: var(--color-ok-bg);   color: var(--color-ok);   border: 1px solid var(--color-ok-border);   }
.badge-ok      .badge-dot { background: var(--color-ok); box-shadow: 0 0 4px var(--color-ok); }
.badge-warn    { background: var(--color-warn-bg);  color: var(--color-warn); border: 1px solid var(--color-warn-border); }
.badge-err     { background: var(--color-err-bg);   color: var(--color-err);  border: 1px solid var(--color-err-border);  }
.badge-info    { background: var(--color-info-bg);  color: var(--color-info); border: 1px solid var(--color-info-border); }
.badge-neutral { background: var(--color-surface);  color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ============================================================
   PRZYCISKI
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, opacity .12s;
    white-space: nowrap;
    border: 1px solid transparent;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

.btn-primary {
    background: var(--color-btn-primary-bg);
    border-color: var(--color-btn-primary-border);
    color: var(--color-btn-primary-text);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-subtle);
}

.btn-ghost {
    background: var(--color-btn-ghost-bg);
    border-color: var(--color-btn-ghost-border);
    color: var(--color-btn-ghost-text);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-err-bg);
    border-color: var(--color-err-border);
    color: var(--color-err);
}
.btn-danger:hover:not(:disabled) {
    background: var(--color-err);
    color: white;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon {
    padding: 5px;
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
}
.btn-icon:hover { color: var(--color-text); background: var(--color-surface-hover); }

/* ============================================================
   FORMULARZE
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.form-row .form-group {
    flex: 1;
    min-width: 160px;
}
.form-row .form-group-full {
    flex: 1 1 100%;
    min-width: 0;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 7px 10px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus,
.form-select:focus {
    border-color: var(--color-input-focus);
    box-shadow: 0 0 0 3px rgba(90,142,240,0.10);
}
.form-input::placeholder { color: var(--color-text-dim); opacity: .8; }

/* Select — niestandardowa strzałka (dotyczy form-select i filter-select) */
.form-select,
.filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23687f94'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
}

/* ============================================================
   FILTRY — filter-input / filter-select / filters-bar
   ============================================================ */
.filter-input,
.filter-select {
    height: 36px;
    padding: 0 12px;
    background: var(--color-input-bg, var(--color-surface));
    border: 1px solid var(--color-input-border, var(--color-border));
    color: var(--color-text);
    border-radius: var(--radius, 6px);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
    vertical-align: middle;
}
.filter-input::placeholder { color: var(--color-text-dim); opacity: .8; }
.filter-input:focus,
.filter-select:focus {
    border-color: var(--color-input-focus, var(--color-accent));
    background: var(--color-surface);
    box-shadow: 0 0 0 3px var(--color-accent-subtle, rgba(0,0,0,0.05));
}

.filters-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filters-bar .btn {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
}
.form-hint {
    font-size: 11px;
    color: var(--color-text-dim);
    margin-top: 4px;
}

/* ============================================================
   TOOLBAR (nad tabelą)
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.toolbar-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius);
    min-width: 200px;
}
.toolbar-search svg { color: var(--color-text-dim); flex-shrink: 0; }
.toolbar-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--color-text);
    font-size: 12px;
    width: 100%;
}
.toolbar-search input::placeholder { color: var(--color-text-dim); }

.toolbar-spacer { flex: 1; }

/* ============================================================
   PAGINACJA
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
}

.pg-info {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-right: auto;
}

.pg-btn {
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.pg-btn:hover { background: var(--color-surface); color: var(--color-text); }
.pg-btn.active {
    background: var(--color-accent-subtle);
    border-color: var(--color-accent);
    color: var(--color-accent);
    font-weight: 600;
}

/* ============================================================
   KOMUNIKATY (ALERT)
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-ok   { background: var(--color-ok-bg);   border: 1px solid var(--color-ok-border);   color: var(--color-ok);   }
.alert-warn { background: var(--color-warn-bg);  border: 1px solid var(--color-warn-border); color: var(--color-warn); }
.alert-err  { background: var(--color-err-bg);   border: 1px solid var(--color-err-border);  color: var(--color-err);  }
.alert-info { background: var(--color-info-bg);  border: 1px solid var(--color-info-border); color: var(--color-info); }

/* ============================================================
   MODALE
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    width: 100%;
    max-width: 480px;
    transform: translateY(10px);
    transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}
.modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-strong);
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color .12s;
}
.modal-close:hover { color: var(--color-text); }

.modal-body { padding: 20px; }
.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
}

/* ============================================================
   GRID POMOCNICZE
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted   { color: var(--color-text-muted) !important; }
.text-dim     { color: var(--color-text-dim) !important; }
.text-strong  { color: var(--color-text-strong) !important; }
.text-accent  { color: var(--color-accent) !important; }
.text-ok      { color: var(--color-ok) !important; }
.text-warn    { color: var(--color-warn) !important; }
.text-err     { color: var(--color-err) !important; }
.mono         { font-family: var(--font-mono); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.ml-auto      { margin-left: auto; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.w-full       { width: 100%; }

/* ============================================================
   LOGIN PAGE (oddzielna od layoutu app)
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-app-bg);
    padding: 24px;
}
.login-card {
    width: 380px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-card);
}
.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
    color: var(--color-accent);
}
.login-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-strong);
    text-align: center;
    margin-bottom: 4px;
}
.login-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}
.login-field { margin-bottom: 14px; }
.login-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 5px;
}
.login-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.login-input:focus { border-color: var(--color-input-focus); }
.login-btn {
    width: 100%;
    padding: 10px;
    background: var(--color-btn-primary-bg);
    border: 1px solid var(--color-btn-primary-border);
    border-radius: var(--radius);
    color: var(--color-btn-primary-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
    margin-top: 4px;
}
.login-btn:hover { opacity: .85; }
.login-error {
    display: none;
    padding: 10px 12px;
    background: var(--color-err-bg);
    border: 1px solid var(--color-err-border);
    color: var(--color-err);
    border-radius: var(--radius);
    font-size: 12px;
    margin-bottom: 14px;
}
.login-error.visible { display: block; }
.login-footer {
    text-align: center;
    font-size: 11px;
    color: var(--color-text-dim);
    margin-top: 20px;
}

.wizard-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-app-bg);
    padding: 20px;
}

.wizard-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    background: var(--color-topbar-bg);
    border-bottom: 1px solid var(--color-topbar-border);
    z-index: 100;
}

.wizard-topbar-brand {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-topbar-org);
}

.wizard-topbar-sep {
    width: 1px;
    height: 16px;
    background: var(--color-sidebar-border);
}

.wizard-topbar-step {
    font-size: 12px;
    color: var(--color-text-dim);
}

.wizard-card {
    width: 100%;
    max-width: 520px;
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    padding: 36px 36px 32px;
    margin-top: 70px;
}

.wizard-steps {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
}

.wizard-step-indicator {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}

.wizard-step-indicator:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 13px;
    left: calc(50% + 13px);
    right: calc(-50% + 13px);
    height: 1px;
    background: var(--color-sidebar-border);
}

.wizard-step-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--color-sidebar-border);
    background: var(--color-input-bg);
    color: var(--color-text-dim);
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.wizard-step-indicator.done .wizard-step-circle {
    background: var(--color-btn-primary-bg);
    border-color: var(--color-btn-primary-border);
    color: var(--color-btn-primary-text);
}

.wizard-step-indicator.current .wizard-step-circle {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.wizard-step-label {
    font-size: 10px;
    color: var(--color-text-dim);
    text-align: center;
    white-space: nowrap;
}

.wizard-step-indicator.current .wizard-step-label {
    color: var(--color-accent);
}

.wizard-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-strong);
    margin-bottom: 6px;
}

.wizard-desc {
    font-size: 12px;
    color: var(--color-text-dim);
    margin-bottom: 24px;
    line-height: 1.6;
}

.wizard-field {
    margin-bottom: 14px;
}

.wizard-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-dim);
    margin-bottom: 5px;
}

.wizard-input,
.wizard-select {
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid var(--color-input-border);
    background: var(--color-input-bg);
    color: var(--color-text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}

.wizard-input:focus,
.wizard-select:focus {
    border-color: var(--color-accent);
}

.wizard-hint {
    font-size: 11px;
    color: var(--color-text-dim);
    margin-top: 4px;
}

/* Wskaźnik siły hasła */
.password-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--color-sidebar-border);
    margin-top: 6px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s, background 0.3s;
}

.password-strength-bar.weak   { background: var(--color-badge-inactive-text); width: 25%; }
.password-strength-bar.fair   { background: #e5a82e; width: 50%; }
.password-strength-bar.good   { background: #3dba6e; width: 75%; }
.password-strength-bar.strong { background: #3dba6e; width: 100%; }

.password-strength-label {
    font-size: 10px;
    color: var(--color-text-dim);
    margin-top: 3px;
}

.wizard-btn {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--color-btn-primary-border);
    background: var(--color-btn-primary-bg);
    color: var(--color-btn-primary-text);
    transition: opacity 0.15s;
    font-family: inherit;
}

.wizard-btn:hover { opacity: 0.88; }
.wizard-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.wizard-msg {
    border-radius: 5px;
    padding: 9px 12px;
    font-size: 12px;
    margin-bottom: 16px;
    border: 1px solid;
    display: none;
    line-height: 1.5;
}

.wizard-msg.visible  { display: block; }
.wizard-msg.error    { background: var(--color-badge-inactive-bg); border-color: var(--color-badge-inactive-border); color: var(--color-badge-inactive-text); }
.wizard-msg.success  { background: var(--color-badge-active-bg);   border-color: var(--color-badge-active-border);   color: var(--color-badge-active-text);   }
.wizard-msg.warning  { background: var(--color-warn-bg); border-color: var(--color-warn-border); color: var(--color-warn-text); }

.wizard-warn-box {
    background: var(--color-warn-bg);
    border: 1px solid var(--color-warn-border);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 12px;
    color: var(--color-warn-text);
    line-height: 1.6;
    margin-top: 20px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .sidebar.mobile-open {
        display: flex;
        position: fixed;
        top: var(--topbar-h);
        left: 0; bottom: 0;
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-org { display: none; }
    .login-card { padding: 28px 20px; }
}

/* ============================================================
   SKIN DROPDOWN
   ============================================================ */
.skin-dropdown {
    position: relative;
    display: inline-block;
}

.skin-dropdown-trigger {
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}
.skin-dropdown-trigger:hover { transform: scale(1.08); }

.skin-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 210px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-dropdown);
    z-index: 1000;
    padding: 6px 0;
    animation: skinMenuFadeIn .15s ease-out;
}
.skin-dropdown-menu.show { display: block; }

.skin-dropdown-header {
    padding: 8px 14px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-text-muted);
    font-weight: 600;
}

.skin-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--color-text);
    font-size: 13px;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
    cursor: pointer;
}
.skin-dropdown-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-strong);
}
.skin-dropdown-item.active {
    font-weight: 600;
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}

/* Podglądy skórek — kółka w dropdown i w topbarze */
.skin-preview {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.15);
    flex-shrink: 0;
}
.skin-emerald { background: #10b981; }
.skin-slate   { background: #4f46e5; }
.skin-amber   { background: #f59e0b; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }

/* govtech ma jasne tło — potrzebuje widocznej ramki w ciemnym dropdownie */
.skin-dropdown-menu .skin-govtech { border-color: var(--color-border); }

@keyframes skinMenuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Nowe skórki — kolory kółka w dropdown */
.skin-nordic   { background: #2e4a6b; }
.skin-crimson  { background: #b91c1c; }
.skin-platinum { background: #9ca3af; border-color: var(--color-border); }

/* ============================================================
   FONT DROPDOWN
   ============================================================ */
.font-dropdown {
    position: relative;
    display: inline-block;
}

.font-dropdown-trigger {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: var(--radius);
    width: 36px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
}
.font-dropdown-trigger:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-text-muted);
}

.font-trigger-icon {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.5px;
    font-family: 'DM Sans', sans-serif; /* zawsze czytelne */
}

.font-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-dropdown);
    z-index: 1001;
    padding: 6px 0;
    animation: skinMenuFadeIn .15s ease-out;
}
.font-dropdown-menu.show { display: block; }

.font-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    color: var(--color-text);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s;
}
.font-dropdown-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-strong);
}
.font-dropdown-item.active {
    font-weight: 600;
    color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.font-sample {
    font-size: 15px;
    opacity: .55;
    font-weight: 400;
}

/* POPRAWIONY, BEZPIECZNY STYL TOPBARU W app.css */

/* Przycisk biblioteki mediów i czcionki Aa */
.font-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--color-topbar-trigger-text, currentColor) !important;
    background: transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    vertical-align: middle;
}

/* Przycisk wyboru skórki (kółeczko) - NIE czyścimy tła (background)! */
.skin-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;  /* Zgodnie z Twoim pierwotnym rozmiarem kółka */
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    vertical-align: middle;
    transition: transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2) !important; /* Delikatna obwódka wokół kółka */
}

/* Zabezpieczenie dla ikon SVG wewnątrz topbaru */
.font-dropdown-trigger svg {
    stroke: var(--color-topbar-trigger-text, currentColor);
    transition: stroke 0.2s ease;
}

.font-trigger-icon {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-topbar-trigger-text, currentColor);
}

/* Efekty najechania (Hover) */
.font-dropdown-trigger:hover {
    background-color: var(--color-topbar-trigger-hover-bg, rgba(255,255,255,0.08));
    color: var(--color-topbar-trigger-hover-text, #fff) !important;
}
.font-dropdown-trigger:hover svg {
    stroke: var(--color-topbar-trigger-hover-text, #fff);
}
.skin-dropdown-trigger:hover {
    transform: scale(1.1); /* Subtelne powiększenie kółka zamiast zmiany tła */
}
