/* ═══════════════════════════════════════════════════════
   PROKSEF — FRRE OS Design System v2.0
   Oparte na: FRRE OS Official Design Tokens v1.0
   Fonty: DM Sans · DM Mono · DM Serif Display
   Akcent ProKSeF: olive green #3D5139 (brand)
   Layout: Icon Rail (dark) + Sidebar (light) + Content
════════════════════════════════════════════════════════ */

/* ── Google Fonts (loaded in <head>) ─────────────────── */
/* DM Sans, DM Mono, DM Serif Display */

/* ── CSS RESET ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS — FRRE OS + ProKSeF Brand
═══════════════════════════════════════════════════════ */
:root {
  /* ── Backgrounds ── */
  --bg-base:       #FAFAF8;
  --bg-raised:     #F4F3F0;
  --bg-sunken:     #ECEAE4;
  --bg-sidebar:    #F0EFE9;
  --bg-hover:      #ECEAE4;
  --bg-selected:   #EBF0E8;

  /* ── Dark Rail (left icon nav — zawsze ciemna) ── */
  --rail-bg:       #1A1916;
  --rail-hover:    #2A2925;
  --rail-active:   #3A3932;
  --rail-icon:     #6B6860;
  --rail-icon-act: #FFFFFF;
  --rail-border:   #2A2925;
  --rail-w:        52px;

  /* ── Dark Anchor ── */
  --dark-1:        #1A1916;
  --dark-2:        #2A2925;
  --dark-3:        #3A3932;
  --dark-text:     #E5E3DB;

  /* ── Borders ── */
  --border:        #E2E0D8;
  --border-strong: #D4D2C8;
  --border-dark:   #2A2925;
  --border-focus:  #3D5139;

  /* ── Typography ── */
  --text-1:        #1A1916;
  --text-2:        #6B6860;
  --text-3:        #9B9890;
  --text-4:        #C4C2BA;

  /* ── Brand Accent — ProKSeF olive green ── */
  --accent:        #3D5139;
  --accent-hover:  #2E3E2B;
  --accent-light:  #EBF0E8;
  --accent-mid:    #C8D5C6;
  --accent-dark:   #1E2B1C;

  /* ── Semantic colors ── */
  --success:       #16A34A;
  --success-light: #DCFCE7;
  --success-mid:   #BBF7D0;
  --warning:       #D97706;
  --warning-light: #FEF3C7;
  --warning-mid:   #FDE68A;
  --danger:        #DC2626;
  --danger-light:  #FEE2E2;
  --danger-mid:    #FECACA;
  --info:          #1D6EE6;
  --info-light:    #EBF2FF;
  --info-mid:      #BFDBFE;

  /* ── AI / Intelligence ── */
  --ai:            #7C3AED;
  --ai-light:      #EDE9FE;
  --ai-mid:        #DDD6FE;

  /* ── Tags ── */
  --tag-commit-bg: #D1FAE5; --tag-commit-tx: #065F46;
  --tag-risk-bg:   #FDE68A; --tag-risk-tx:   #92400E;
  --tag-wait-bg:   #DBEAFE; --tag-wait-tx:   #1E3A8A;
  --tag-ai-bg:     #EDE9FE; --tag-ai-tx:     #4C1D95;

  /* ── Glassmorphism ── */
  --glass-bg:      rgba(250,250,248,0.75);
  --glass-border:  rgba(255,255,255,0.60);
  --glass-blur:    16px;
  --glass-shadow:  0 8px 32px rgba(26,25,22,0.09), 0 2px 8px rgba(26,25,22,0.05);

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.07);

  /* ── Radius ── */
  --r-xs:  3px;
  --r-sm:  5px;
  --r:     8px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full:9999px;

  /* ── Fonts ── */
  --font-ui:      'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'DM Mono', 'Fira Code', 'Courier New', monospace;
  --font-display: 'DM Serif Display', Georgia, serif;

  /* ── Font sizes ── */
  --text-xs:   10.5px;
  --text-sm:   12px;
  --text-base: 13px;
  --text-md:   14px;
  --text-lg:   16px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  32px;

  /* ── Spacing ── */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

  /* ── Layout ── */
  --sidebar-w: 220px;
  --topbar-h:  52px;

  /* ── Transitions ── */
  --t-fast: .12s ease;
  --t-base: .18s ease;
  --t-slow: .28s ease;

  /* ── Compatibility aliases (stary kod) ── */
  --green:      #3D5139;
  --green-light:#EBF0E8;
  --green-mid:  #C8D5C6;
  --bg:         #FAFAF8;
  --sidebar-bg: #F0EFE9;
  --card-bg:    #FFFFFF;
  --text:       #1A1916;
  --text-2-old: #6B6860;
  --text-3-old: #9B9890;
  --red:        #DC2626;
  --orange:     #D97706;
  --blue:       #1D6EE6;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --radius:     8px;
  --transition: all .15s ease;
}

/* ═══════════════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════════════ */
html { height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-1);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 400;
  letter-spacing: -0.5px; color: var(--text-1);
}
h2, .h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 400;
  letter-spacing: -0.3px; color: var(--text-1);
}
h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: 600; color: var(--text-1);
}

/* Monospaced elements */
code, pre, kbd, samp,
.mono, [class*="numer"], [class*="number"],
.kwota, .amount, .invoice-no, .nip {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ═══════════════════════════════════════════════════════
   LAYOUT — OS Shell
═══════════════════════════════════════════════════════ */
.os-shell {
  display: flex;
  min-height: 100vh;
}









/* ── SIDEBAR (light) ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: var(--rail-w);
  top: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}
.sidebar::-webkit-scrollbar { width: 3px; }

.sidebar-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-1);
  letter-spacing: -0.2px;
  margin-bottom: 10px;
}

/* Brain search */
.brain-search {
  position: relative;
}
.brain-search input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  background: var(--bg-sunken);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-1);
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.brain-search input:focus {
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 3px var(--accent-light);
}
.brain-search input::placeholder { color: var(--text-3); }
.brain-search-icon {
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 11px;
}

/* Tenant pill */
.tenant-chip {
  margin: 10px 10px 0;
  padding: 6px 10px;
  background: var(--accent-light);
  border-radius: var(--r);
  border-left: 2.5px solid var(--accent);
}
.tenant-chip-label {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-3);
}
.tenant-chip-name {
  font-size: 12px; font-weight: 600;
  color: var(--accent); margin-top: 1px;
}

/* Nav */
.sidebar-nav { flex: 1; padding: 6px 0 12px; }
.nav-group { margin-bottom: 0; }
.nav-group-label {
  padding: 10px 14px 3px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-4);
  font-family: var(--font-ui);
}
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; margin: 1px 6px;
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}
.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -6px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 14px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-link i {
  width: 15px; text-align: center;
  font-size: 12px; opacity: 0.7;
  flex-shrink: 0;
}
.nav-link.active i { opacity: 1; }
.nav-link .nav-count {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  background: var(--warning);
  color: #fff;
  padding: 1px 5px;
  border-radius: var(--r-full);
  min-width: 16px;
  text-align: center;
}
.nav-link .nav-count.red { background: var(--danger); }
.nav-link .nav-count.accent { background: var(--accent); }

/* Sidebar footer */
.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t-fast);
}
.user-row:hover { background: var(--bg-hover); }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name-text {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role-text { font-size: 11px; color: var(--text-3); }
.user-logout {
  color: var(--text-4);
  font-size: 12px; padding: 3px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  text-decoration: none;
}
.user-logout:hover { color: var(--danger); }

/* Theme toggle */
.theme-toggle-wrap {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t-fast);
  margin-bottom: 4px;
}
.theme-toggle-wrap:hover { background: var(--bg-hover); }
.theme-toggle-label {
  font-size: 11.5px; color: var(--text-3); flex: 1;
}
.toggle-track {
  width: 30px; height: 16px;
  background: var(--border-strong);
  border-radius: var(--r-full);
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}
[data-theme="dark"] .toggle-track { background: var(--accent); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%; background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform var(--t-base);
}
[data-theme="dark"] .toggle-thumb { transform: translateX(14px); }

/* ── TOPBAR ── */
.topbar {
  position: fixed;
  left: calc(var(--rail-w) + var(--sidebar-w));
  right: 0; top: 0;
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
  transition: background var(--t-base), border-color var(--t-base);
}

.topbar-breadcrumb {
  display: flex; align-items: center;
  gap: 5px; flex: 1;
  font-size: 13px;
}
.topbar-crumb { color: var(--text-3); }
.topbar-crumb-sep { color: var(--text-4); font-size: 10px; }
.topbar-crumb.current { color: var(--text-1); font-weight: 600; }

.topbar-actions {
  display: flex; align-items: center; gap: 6px;
}

.ai-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast);
  text-decoration: none;
}
.ai-pill:hover { background: var(--accent-mid); }
.ai-pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.topbar-btn {
  width: 32px; height: 32px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  position: relative;
}
.topbar-btn:hover {
  background: var(--bg-raised);
  border-color: var(--accent-mid);
  color: var(--text-1);
}
.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  background: var(--danger);
  border-radius: 50%;
  border: 1px solid white;
}

.topbar-user {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 8px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t-fast);
}
.topbar-user:hover { background: var(--bg-raised); }
.topbar-user-name { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.topbar-user-company { font-size: 11px; color: var(--text-3); }
.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── MAIN CONTENT ── */
.main-wrapper {
  margin-left: calc(var(--rail-w) + var(--sidebar-w));
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 24px 24px 40px;
  margin-top: var(--topbar-h);
  background: var(--bg-base);
}

/* ═══════════════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════════════ */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px; gap: 16px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 400;
  color: var(--text-1); letter-spacing: -0.4px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px; color: var(--text-3);
  margin-top: 3px;
}
.page-actions {
  display: flex; align-items: center;
  gap: 8px; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════ */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-flat {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 13.5px; font-weight: 700;
  color: var(--text-1);
  display: flex; align-items: center; gap: 7px;
}
.card-subtitle { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 18px; }

/* Glass card */
.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-lg);
}

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

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-mid);
  transform: translateY(-1px);
}

/* Accent line on top */
.stat-card.accent-top::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2.5px;
  background: var(--accent);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.stat-card.danger-top::before { background: var(--danger); }
.stat-card.warning-top::before { background: var(--warning); }
.stat-card.info-top::before { background: var(--info); }
.stat-card.ai-top::before { background: var(--ai); }

.stat-label {
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 6px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 400;
  color: var(--text-1); letter-spacing: -0.5px;
  line-height: 1.1;
}
.stat-value.mono {
  font-family: var(--font-mono);
  font-size: 22px; font-weight: 500;
}
.stat-delta {
  font-size: 11.5px; margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
  color: var(--text-3);
}
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-icon {
  float: right; margin-top: -4px;
  width: 34px; height: 34px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  background: var(--accent-light);
  color: var(--accent);
}
.stat-icon.danger-icon { background: var(--danger-light); color: var(--danger); }
.stat-icon.warning-icon { background: var(--warning-light); color: var(--warning); }
.stat-icon.info-icon { background: var(--info-light); color: var(--info); }
.stat-icon.ai-icon { background: var(--ai-light); color: var(--ai); }

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center;
  justify-content: center; gap: 6px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--t-fast);
  outline: none;
  letter-spacing: -0.01em;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-light); }

.btn-primary {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(61,81,57,.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(61,81,57,.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white; color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.btn-ghost {
  background: transparent; color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }

.btn-danger {
  background: var(--danger); color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #B91C1C; }

.btn-ai {
  background: linear-gradient(135deg, var(--ai), #6366F1);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(124,58,237,.3);
}
.btn-ai:hover { box-shadow: 0 4px 16px rgba(124,58,237,.45); transform: translateY(-1px); }

.btn-sm { font-size: 11.5px; padding: 4px 11px; border-radius: var(--r-sm); }
.btn-lg { font-size: 14px; padding: 10px 22px; border-radius: var(--r-md); }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-green { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-green:hover { background: var(--accent-hover); }

/* ═══════════════════════════════════════════════════════
   BADGES / TAGS
═══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--r-sm);
  white-space: nowrap;
}
.badge-success  { background: var(--success-light);  color: var(--success);  }
.badge-warning  { background: var(--warning-light);  color: var(--warning);  }
.badge-danger   { background: var(--danger-light);   color: var(--danger);   }
.badge-info     { background: var(--info-light);     color: var(--info);     }
.badge-ai       { background: var(--ai-light);       color: var(--ai);       }
.badge-accent   { background: var(--accent-light);   color: var(--accent);   }
.badge-neutral  { background: var(--bg-sunken);      color: var(--text-2);   }
.badge-green    { background: var(--success-light);  color: var(--success);  }
.badge-red      { background: var(--danger-light);   color: var(--danger);   }
.badge-orange   { background: var(--warning-light);  color: var(--warning);  }
.badge-blue     { background: var(--info-light);     color: var(--info);     }
.badge-gray     { background: var(--bg-sunken);      color: var(--text-2);   border: 1px solid var(--border); }

/* Status dot */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.status-dot.green  { background: var(--success); }
.status-dot.orange { background: var(--warning); }
.status-dot.red    { background: var(--danger); }
.status-dot.blue   { background: var(--info); }
.status-dot.ai     { background: var(--ai); }
.status-dot.gray   { background: var(--text-4); }

/* Tags (inline) */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px; font-weight: 500;
  font-family: var(--font-mono);
}
.tag-commit { background: var(--tag-commit-bg); color: var(--tag-commit-tx); }
.tag-risk   { background: var(--tag-risk-bg);   color: var(--tag-risk-tx); }
.tag-wait   { background: var(--tag-wait-bg);   color: var(--tag-wait-tx); }
.tag-ai     { background: var(--tag-ai-bg);     color: var(--tag-ai-tx); }

/* ═══════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════ */
.table-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.table-wrap-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  background: var(--bg-sidebar);
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  font-size: 13px; color: var(--text-1);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
tbody td.mono { font-family: var(--font-mono); font-size: 12px; }
tbody td.text-muted { color: var(--text-3); font-size: 12px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-raised); }

/* ═══════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 14px; }

.form-label, label {
  display: block;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 4px;
}

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select, textarea {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-1);
  background: white;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r);
  padding: 7px 11px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input[type="number"] { font-family: var(--font-mono); }
.form-input:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
select { cursor: pointer; }

/* ═══════════════════════════════════════════════════════
   FLASH MESSAGES
═══════════════════════════════════════════════════════ */
.flash, .flash-success, .flash-error, .flash-warning, .flash-info {
  padding: 10px 14px;
  border-radius: var(--r);
  margin-bottom: 16px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 9px;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-light); color: var(--success); border-color: var(--success-mid); }
.flash-error   { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger-mid); }
.flash-warning { background: var(--warning-light); color: var(--warning); border-color: var(--warning-mid); }
.flash-info    { background: var(--info-light);    color: var(--info);    border-color: var(--info-mid); }

/* ═══════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-3);
}
.empty-state i, .empty-state-icon {
  font-size: 36px; margin-bottom: 12px;
  opacity: 0.4; display: block;
}
.empty-state h3, .empty-state-title {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 400;
  color: var(--text-2); margin-bottom: 6px;
}
.empty-state p, .empty-state-text {
  font-size: 13px; color: var(--text-3);
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════ */
.modal-backdrop {
  background: rgba(26,25,22,0.45);
  backdrop-filter: blur(4px);
}
.modal-content {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
}

/* ═══════════════════════════════════════════════════════
   DIVIDERS
═══════════════════════════════════════════════════════ */
.divider {
  height: 1px; background: var(--border);
  margin: 16px 0;
}
.divider-label {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--text-xs); font-weight: 700;
  color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.07em; margin: 14px 0;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ═══════════════════════════════════════════════════════
   BANNER
═══════════════════════════════════════════════════════ */
.banner {
  padding: 9px 20px;
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; cursor: pointer;
}
.banner-warning {
  background: var(--warning-light);
  border-bottom: 1px solid var(--warning-mid);
  color: #78350F;
}
.banner-info {
  background: var(--info-light);
  border-bottom: 1px solid var(--info-mid);
  color: #1E3A8A;
}

/* ═══════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════ */
.text-muted { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent { color: var(--accent); }
.text-ai { color: var(--ai); }

.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Code block */
.code-block {
  background: var(--dark-1);
  border-radius: var(--r-md);
  padding: 16px 18px;
  overflow-x: auto;
}
.code-block pre {
  font-family: var(--font-mono);
  font-size: 12px; color: #D4D2C8;
  line-height: 1.8;
}

/* ═══════════════════════════════════════════════════════
   LIVEWIRE DARK WRAP — przejście OSFORYOU → ProKSeF
   Livewire komponenty z OSFORYOU używają dark-glass theme.
   Renderujemy je w dark containerze żeby zachować spójność.
═══════════════════════════════════════════════════════ */
.kp-livewire-wrap {
  background: #1E293B;
  border-radius: var(--r-xl);
  padding: 20px;
  margin-top: 4px;
  min-height: 200px;
}

/* Override: białe teksty w dark wrap */
.kp-livewire-wrap * {
  --kp-text: #e2e8f0;
  --kp-text-muted: #94a3b8;
  --kp-border: rgba(148,163,184,0.15);
  --kp-card-bg: rgba(30,41,59,0.8);
  --kp-primary: #3D5139;
}

/* Tailwind color overrides dla dark theme */
.kp-livewire-wrap .bg-white { background: rgba(30,41,59,0.6) !important; }
.kp-livewire-wrap .text-gray-900 { color: #e2e8f0 !important; }
.kp-livewire-wrap .text-gray-800 { color: #e2e8f0 !important; }
.kp-livewire-wrap .text-gray-700 { color: #cbd5e1 !important; }
.kp-livewire-wrap .text-gray-600 { color: #94a3b8 !important; }
.kp-livewire-wrap .text-gray-500 { color: #64748b !important; }
.kp-livewire-wrap .text-gray-400 { color: #64748b !important; }
.kp-livewire-wrap .border-gray-200 { border-color: rgba(148,163,184,0.15) !important; }
.kp-livewire-wrap .border-gray-100 { border-color: rgba(148,163,184,0.1) !important; }
.kp-livewire-wrap .bg-gray-50 { background: rgba(15,23,42,0.4) !important; }
.kp-livewire-wrap .bg-gray-100 { background: rgba(15,23,42,0.5) !important; }
.kp-livewire-wrap input,
.kp-livewire-wrap select,
.kp-livewire-wrap textarea {
  background: rgba(15,23,42,0.6) !important;
  border-color: rgba(148,163,184,0.2) !important;
  color: #e2e8f0 !important;
}
.kp-livewire-wrap input::placeholder { color: #64748b !important; }

/* Page header w dark wrap */
.kp-livewire-wrap .kp-page-header h1,
.kp-livewire-wrap .kp-page-title { color: #e2e8f0 !important; }
.kp-livewire-wrap .kp-page-subtitle { color: #94a3b8 !important; }

/* Table styling */
.kp-livewire-wrap table { border-color: rgba(148,163,184,0.1); }
.kp-livewire-wrap th { color: #94a3b8 !important; border-color: rgba(148,163,184,0.15) !important; }
.kp-livewire-wrap td { border-color: rgba(148,163,184,0.08) !important; }
.kp-livewire-wrap tr:hover td { background: rgba(59,130,246,0.05) !important; }

/* Buttons */
.kp-livewire-wrap .btn-primary,
.kp-livewire-wrap .inv-btn-primary {
  background: #3D5139 !important;
  color: #fff !important;
  border-color: #3D5139 !important;
}
.kp-livewire-wrap .btn-secondary { background: rgba(30,41,59,0.8) !important; color: #e2e8f0 !important; }

