/* Inter (SIL Open Font License, static/drawings/fonts/OFL.txt) hostowana lokalnie:
   bez żądań do Google Fonts. Czcionka zmienna (wagi 100-900), dwa podzbiory;
   polskie znaki diakrytyczne leżą w latin-ext. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.1ad231aac0a8.woff2") format('woff2');
  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';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.260c81a4759b.woff2") format('woff2');
  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;
}

:root, [data-theme="light"] {
    --color-bg: #f7f6f2;
    --color-surface: #f9f8f5;
    --color-surface-2: #fbfbf9;
    --color-surface-offset: #f0ede8;
    --color-divider: #dcd9d5;
    --color-border: #d4d1ca;
    --color-text: #28251d;
    --color-text-muted: #55534e;
    --color-text-faint: #5f5e59;
    --color-primary: #01696f;
    --color-primary-hover: #0c4e54;
    --color-primary-highlight: #cedcd8;
    --color-warning: #964219;
    --color-warning-highlight: #fef3ec;
    --color-success: #437a22;
    --color-success-highlight: #edf6e7;
    --color-error: #b91c1c;
    --color-error-highlight: #fef2f2;
    --color-folder: #c9a800;
    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    --font-body: 'Inter', 'Helvetica Neue', sans-serif;
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
    --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="dark"]{--color-bg:#171614;--color-surface:#1c1b19;--color-surface-2:#201f1d;--color-surface-offset:#1d1c1a;--color-divider:#262523;--color-border:#393836;--color-text:#cdccca;--color-text-muted:#8e8d89;--color-text-faint:#8a8985;--color-primary:#4f98a3;--color-primary-hover:#227f8b;--color-primary-highlight:#313b3b;--color-warning:#bb653b;--color-warning-highlight:#2a1f14;--color-success:#6daa45;--color-success-highlight:#1c2a16;--color-error:#f0807a;--color-error-highlight:#2e1717;  --color-folder: #806D00;--shadow-sm:0 1px 2px oklch(0 0 0/.2);--shadow-md:0 4px 12px oklch(0 0 0/.3);}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html{-webkit-font-smoothing:antialiased;}
/* Tryb standardowy HTML: body ma stałą wysokość okna, żeby przewijał się kontener
   .content, a nie cała strona (w trybie quirks rozciągała body sama przeglądarka).
   `100vh` jest zapasem dla przeglądarek bez jednostki `dvh`. */
body{height:100vh;height:100dvh;font-family:var(--font-body);font-size:var(--text-base);color:var(--color-text);background:var(--color-bg);display:flex;flex-direction:column;}
a,button{transition:color var(--transition),background var(--transition),border-color var(--transition);text-decoration:none;}
button{cursor:pointer;background:none;border:none;font:inherit;color:inherit;}
.topbar{position:sticky;top:0;z-index:100;background:var(--color-surface);border-bottom:1px solid var(--color-border);box-shadow:var(--shadow-sm);display:flex;align-items:center;justify-content:space-between;padding:0.75rem 2rem;gap:1rem;}
.logo{display:flex;align-items:center;gap:0.75rem;color:var(--color-text);}
.logo-mark{width:36px;height:36px;background:var(--color-primary);border-radius:var(--radius-md);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.logo-name{font-size:var(--text-sm);font-weight:600;}
.logo-sub{font-size:var(--text-xs);color:var(--color-text-muted);}
.topbar-right{display:flex;align-items:center;gap:0.75rem;font-size:var(--text-sm);color:var(--color-text-muted);}
.layout{display:flex;flex:1;min-height:0;}
.sidebar{width:260px;flex-shrink:0;background:var(--color-surface);border-right:1px solid var(--color-border);padding:1.5rem 1rem;overflow-y:auto;display:flex;flex-direction:column;gap:0.5rem;}
.sidebar-label{font-size:var(--text-sm);font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:var(--color-text-faint);padding:0 0.75rem 0.5rem;margin-top:1rem;
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: 0.5rem;}
.sidebar-label:first-child{margin-top:0;}
.project-btn{display:flex;align-items:center;gap:0.75rem;padding:0.5rem 0.75rem;border-radius:var(--radius-md);font-size:var(--text-sm);font-weight:500;color:var(--color-text-muted);width:100%;cursor:pointer;}
.project-btn:hover{background:var(--color-surface-offset);color:var(--color-text);}
.project-btn.active{background:var(--color-primary-highlight);color:var(--color-primary);}
.project-icon{width:28px;height:28px;border-radius:var(--radius-sm);background:var(--color-surface-offset);display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:13px;}
.project-meta{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0;}
.project-meta span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.project-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;}
.project-count{font-size:var(--text-xs);color:var(--color-text-faint);font-weight:400;}
.project-btn.active .project-count{color:var(--color-primary);}
.project-number{color:var(--color-text-muted);font-weight:400;white-space:nowrap;}
.project-number::after{content:" \00b7";}
.project-btn.active .project-number{color:inherit;}
.content{flex:1;overflow-y:auto;padding:2rem;padding-top:0.75rem;padding-bottom: calc(1rem + 49px); ;display:flex;flex-direction:column;gap:1.5rem;}
.btn-primary{
  display:inline-flex;
  align-items:right;
  gap:0.5rem;
  padding:0.5rem 1.25rem;
  background:var(--color-primary);
  color:white;
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:600;
  white-space:nowrap;
  margin-bottom:1rem;}
.btn-primary:hover{background:var(--color-primary-hover);}
.btn-download {
  display: inline-flex;
  align-items: right;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid var(--color-divider);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom:1rem;
}

.btn-download:hover {
  background: #dc3545;
  color: #ffffff;
}
#scroll-top-btn {
  position: fixed;
  bottom: calc(1rem + 49px); /* nad demo-barem */
  right: 3.25rem;
  z-index: 900;
  /* padding-bottom: calc(1rem + 49px); */
  display: flex;
  align-items: center;
  justify-content: center;

  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);

  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#scroll-top-btn:hover {
  background: var(--color-primary-hover, #1a7fd4);
  border-color: var(--color-primary-hover, #1a7fd4);
}
a.project-btn {
  color: var(--color-text-muted);
}
a.project-btn:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
a.project-btn.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}
a.project-btn.active .project-count {
  color: var(--color-primary);
  /* opacity: 0.7; */
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}
.breadcrumb a {
  color: var(--color-primary);
  font-weight: 500;
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.breadcrumb-sep {
  color: var(--color-text-muted);
}
.breadcrumb-current,
.breadcrumb-item {
  color: var(--color-text);
  font-weight: 600;
}
.page-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.5rem;
}
.upload-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.upload-copy {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 720px;
}

.upload-lead {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  line-height: 1.6;
}

.upload-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.upload-hints span {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  border: 1px solid var(--color-border);
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 1.25rem;
  align-items: stretch;
}

.dropzone {
  position: relative;
  min-height: 420px;
  border-radius: 1.25rem;
  border: 1px solid var(--color-border);
  background:
    radial-gradient(circle at top, oklch(from var(--color-primary) l c h / 0.08), transparent 38%),
    linear-gradient(180deg, var(--color-surface), var(--color-surface-2));
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}

.dropzone::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 1rem;
  border: 1px dashed oklch(from var(--color-primary) l c h / 0.32);
  pointer-events: none;
}

.dropzone:hover {
  border-color: oklch(from var(--color-primary) l c h / 0.35);
  transform: translateY(-1px);
}

.dropzone.dragover {
  background:
    radial-gradient(circle at top, oklch(from var(--color-primary) l c h / 0.16), transparent 42%),
    linear-gradient(180deg, var(--color-surface), var(--color-surface-offset));
}

.dropzone-icon {
  width: 108px;
  height: 108px;
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(from var(--color-primary) l c h / 0.1);
  color: var(--color-primary);
  box-shadow: inset 0 0 0 1px oklch(from var(--color-primary) l c h / 0.14);
}

.dropzone-title {
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 2rem);
  font-weight: 700;
  color: var(--color-text);
}

.dropzone-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.dropzone-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: white;
  font-weight: 700;
  font-size: var(--text-sm);
  box-shadow: 0 10px 30px oklch(from var(--color-primary) l c h / 0.22);
}

.dropzone-footer {
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  max-width: 36ch;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-info-card {
  border-radius: 1.25rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.upload-info-card h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

.upload-info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.upload-info-list li {
  padding-left: 1rem;
  position: relative;
}

.upload-info-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--color-primary);
}

.upload-submit {
  margin-top: auto;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  
}
.sidebar-info {
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar-info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-info-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.sidebar-info-value {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
  /*font-weight: bold;*/
}
/*.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.75rem 0.5rem;
  border-top: 1px solid var(--color-divider);
}
.sidebar-footer-mockup {
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: 500;
}*/
.demo-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background:var(--color-surface);
  color:var(--color-text);
  padding: var(--space-3) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  gap: var(--space-4);
  z-index: 200;
}
/*.demo-bar-label{
  color: var(--color-text-faint);
}*/
.demo-bar-copyrights {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.server-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.server-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #4ade80;
}
.server-dot.is-offline {
  background: #f87171;
  animation: none;
}
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.theme-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.topbar-user {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Dzwonek powiadomień (OD-005). Przycisk dzieli wygląd z przełącznikiem motywu;
   lista jest fragmentem HTML z `notification_list`. Reguły `[hidden]` są jawne,
   bo `display` z tej sekcji przebiłby atrybut. */
.notification-bell-wrap {
  position: relative;
}
.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.notification-bell:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: #b91c1c;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.notification-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(22rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 110;
}
.notification-badge[hidden],
.notification-dropdown[hidden] {
  display: none;
}
.notification-panel {
  padding: 0.75rem 1rem;
}
.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.notification-head h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notification-mark-read {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}
.notification-mark-read:hover {
  background: var(--color-primary-highlight);
}
.notification-items {
  list-style: none;
}
.notification-item {
  position: relative;
}
.notification-item-read {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}
.notification-item-read:hover {
  background: var(--color-surface-offset);
}
.notification-item.has-read-button .notification-link {
  padding-right: 6rem;
}
.notification-item + .notification-item {
  border-top: 1px solid var(--color-divider);
}
.notification-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
}
.notification-link:hover {
  background: var(--color-surface-offset);
}
.notification-item.is-unread .notification-link {
  background: var(--color-primary-highlight);
}
.notification-event {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}
.notification-file {
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-word;
}
.notification-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.notification-empty {
  padding: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
/* Hamburger — default - hidden on desktop */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.hamburger:hover {
  background: var(--color-surface-offset);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  z-index: 90;
}
.sidebar-overlay.active {
  display: block;
}

/* Restore icons and metadata in the drawer */
.sidebar .project-icon { display: flex !important; }
.sidebar .project-meta .project-count { display: block !important; }
.sidebar .sidebar-label { display: block !important; }
.sidebar .sidebar-info { display: flex !important; }
.sidebar-footer { display: block !important; }

.search-toggle {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border-radius: var(--radius-md);
color: var(--color-text-muted);
border: 1px solid var(--color-border);
flex-shrink: 0;
}
.search-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.45);
  z-index: 120;
}
.search-overlay.active {
  display: block;
}

.search-drawer {
  position: fixed;
  top: 56px;
  right: 16px;
  width: min(520px, calc(100vw - 32px));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  z-index: 130;
  display: none;
}
.search-drawer.active {
  display: block;
}

.search-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.search-drawer-header h2 {
  font-size: var(--text-base);
  font-weight: 700;
}

.search-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.search-close:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.search-form {
  margin-bottom: 1rem;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
}

.search-input-wrap input {
  /* Bez wewnętrznego odstępu kursor na początku pola bywał ucinany. */
  padding: 0 2px;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  color: var(--color-text);
}

.search-section-title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: 0.5rem;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-result-item {
  display: block;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-surface-2);
}
.search-result-item:hover {
  background: var(--color-surface-offset);
}

.content-login {
  flex: 1;
  display: flex;
  /* flex-direction: column; */
  justify-content: space-between;
  align-items: center;
}
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  width: min(420px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.login-title {
  font-size: var(--text-lg);
  font-weight: 700;
}
.login-error {
  background: var(--color-error-highlight);
  color: var(--color-error);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: var(--text-sm);
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.login-field label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}
.login-field input {
  padding: 0.75rem 1rem;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
  color: var(--color-text);
  outline: none;
}
.login-field input:focus {
  border-color: var(--color-primary);
}
.login-submit {
  width: 100%;
  justify-content: center;
  padding: 0.85rem;
  margin-top: 0.5rem;
}
.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.btn-logout:hover {
  background: var(--color-error-highlight);
  color: var(--color-error);
}
.folder-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-folder);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-interactive), border-color var(--transition-interactive);
    width: fit-content;
}
.folder-btn:hover {
    background: var(--color-surface-offset);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.folder-btn-icon { color: var(--color-primary); display: flex; }
.folder-btn-name { flex: 1; }
.folder-btn-count {
    font-weight: 400;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-surface-offset);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
}
.folder-btn-arrow { color: var(--color-text-faint); display: flex; }
.folder-btn:hover .folder-btn-arrow { color: var(--color-primary); }
.content-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;}
.content-title{font-size:var(--text-xl);font-weight:700;letter-spacing:-0.02em;}
.content-subtitle{font-size:var(--text-sm);color:var(--color-text-muted);margin-top:0.25rem;}
.section-label{font-size:var(--text-xs);font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:var(--color-text-faint);display:flex;align-items:center;gap:0.75rem;}
.section-label::after{content:'';flex:1;height:1px;background:var(--color-divider);}
.files-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(280px,100%),1fr));gap:1rem;}
.file-card{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:1.25rem;display:flex;flex-direction:column;gap:0.75rem;box-shadow:var(--shadow-sm);position:relative;overflow:hidden;transition:box-shadow var(--transition),transform var(--transition);}
.file-card:hover{box-shadow:var(--shadow-md);transform:translateY(-1px);}
.file-card.new::before{content:'';position:absolute;inset:0;border:2px solid var(--color-warning);border-radius:var(--radius-lg);pointer-events:none;}
.file-card-top{display:flex;align-items:flex-start;justify-content:space-between;gap:0.5rem;}
.file-type{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:var(--radius-md);font-size:var(--text-sm);font-weight:700;flex-shrink:0;}
.file-type.pdf {background: #fee2e2;color: #b91c1c;}
/* dwg and dxf share the same color intentionally — both are AutoCAD formats */
.file-type.dwg {background: #dbeafe;color: #1d4ed8;}
.file-type.xls {background: #dcfce7;color: #166534;}
.file-type.met {background: #fef3c7;color: #92400e;}
.file-type.ali {background: #ffe4e6;color: #9f1239;}
.file-type.rey {background: #ede9fe;color: #4c1d95;}
.file-type.txt {background: #f1f5f9;color: #334155;}
.file-type.doc {background: #dbeafe;color: #1e3a8a;}
.file-type.md {background: #f0fdf4;color: #065f46;}
.file-type.img {background: #ffedd5;color: #c2410c;}
.file-type.other {background: var(--color-text-muted);color: #fff;}
[data-theme="dark"] .file-type.pdf{background:#2a1010;color:#f87171;}
[data-theme="dark"] .file-type.dwg{background:#0f1d35;color:#60a5fa;}
.badge-new{display:inline-flex;align-items:center;gap:0.3rem;font-size:var(--text-xs);font-weight:700;background:var(--color-warning-highlight);color:var(--color-warning);padding:3px 0.6rem;border-radius:var(--radius-full);white-space:nowrap;border:1px solid var(--color-warning);}
.file-bottom{margin-top:auto; display:flex; flex-direction:column; gap:0.35rem;}
.file-name{font-size:var(--text-sm);font-weight:600;line-height:1.4;padding-bottom:1rem;padding-top:0.25rem;overflow-wrap:anywhere; min-width:0;word-break: normal;}
.file-date{font-size:var(--text-xs);color:var(--color-text-muted);}
.file-uploader{font-size:var(--text-xs);color:var(--color-text-muted);padding-bottom:0.5rem;}
.file-action{display:flex;flex-direction:column;gap:0.5rem;}
.btn-open{display:flex;width:100%;align-items:center;justify-content:center;gap:0.5rem;padding:0.5rem 0.75rem;background:var(--color-primary);color:white;border-radius:var(--radius-md);font-size:var(--text-xs);font-weight:600;}
.btn-open:hover{background:var(--color-primary-hover);}
.btn-open.dwg-btn{background:transparent;color:var(--color-primary);border:1px solid var(--color-primary);}
.btn-open.dwg-btn:hover{background:var(--color-primary-highlight);}
.project-date {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
}
.file-uploader {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
.messages-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    padding-bottom: calc(1rem + 49px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    transition: opacity 600ms ease, transform 600ms ease;
}

.toast-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--color-surface-2);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg), 0 0 0 1px oklch(from var(--color-text) l c h / 0.06);
    font-size: var(--text-sm);
    min-width: 280px;
    max-width: 420px;
    border: 1px solid var(--color-border);
    animation: toast-in 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.toast-success {
    background: var(--color-success-highlight);
    border-left: 3px solid var(--color-success);
    color: var(--color-text);
}
.toast-error {
    background: var(--color-error-highlight);
    border-left: 3px solid var(--color-error);
    color: var(--color-text);
}
.toast-warning {
    background: var(--color-warning-highlight);
    border-left: 3px solid var(--color-warning);
    color: var(--color-text);
}

.toast-close {
    color: var(--color-text-muted);
    flex-shrink: 0;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
}
.toast-close:hover { color: var(--color-text); }
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 10px;
}
.log-row {
  display: flex;
  flex-direction: row; 
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
}
.log-action {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.log-upload { text-align: center;background: var(--color-primary-highlight); color: var(--color-primary);text-wrap:wrap; word-break: normal;;}
.log-update { text-align: center; background: var(--color-warning-highlight); color: var(--color-warning);text-wrap:wrap; word-break: normal;}
.log-delete { text-align: center; background: var(--color-error-highlight); color: var(--color-error);text-wrap:wrap; word-break: normal;}
.log-file { flex: 1; color: var(--color-text); text-overflow: ellipsis; text-wrap:wrap; word-break: normal; }
.log-meta { color: var(--color-text-faint); font-size: var(--text-xs); white-space: nowrap; text-wrap:wrap; word-break: normal; }
.logs-panel {
  border-top: 1px solid var(--color-divider);
  padding-top: 1rem;
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: 1rem;
}

.logs-panel summary {
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  list-style: none;
}

.logs-panel summary::-webkit-details-marker {
  display: none;
}

.logs-panel[open] summary {
  margin-bottom: 1rem;
}
.login-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: var(--text-sm);
}
.login-checkbox-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding-left: 1.5rem;
}

/* POPUP NOTIFICATION */
.notification-demo {
  position: fixed;
  bottom: calc(1rem + 49px); right: var(--space-6);
  width: 340px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  z-index: 999;
  flex-direction: column; gap: var(--space-4);
  transform: translateY(0);
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.notif-header { display: flex; align-items: flex-start; gap: var(--space-3); }
.notif-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md); flex-shrink: 0;
  background: var(--color-warning-highlight);
  display: flex; align-items: center; justify-content: center;
}
@keyframes slideOut {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(16px); opacity: 0; }
}
.notif-icon svg { color: var(--color-warning); }
.notif-title { font-size: var(--text-sm); font-weight: 700; line-height: 1.3; }
.notif-body { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; line-height: 1.5; }
.notif-close {
  margin-left: auto; width: 28px; height: 28px;
  border-radius: var(--radius-sm); color: var(--color-text-faint);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-close:hover { background: var(--color-surface-offset); color: var(--color-text); }
.notif-actions { display: flex; gap: var(--space-2); }
.notif-btn-primary {
  flex: 1; padding: var(--space-2) var(--space-3);
  background: var(--color-primary); color: white;
  border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 600;
  text-align: center;
}
.notif-btn-primary:hover { background: var(--color-primary-hover); }
.notif-btn-secondary {
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 500;
}
.notif-btn-secondary:hover { background: var(--color-surface-offset); }
.notif-whatsapp {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); color: var(--color-text-faint);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}
.wa-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #dcfce7; color: #15803d;
  border-radius: var(--radius-full);
  padding: 2px var(--space-2); font-size: 11px; font-weight: 600;
}
[data-theme="dark"] .wa-badge { background: #0f2a18; color: #4ade80; }

/* TOGGLE DEMO BAR */
.demo-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #1c1b19; color: #cdccca;
  padding: var(--space-3) var(--space-8);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--text-xs); gap: var(--space-4);
  z-index: 200;
}
.demo-bar-label { color: #797876; }
.demo-bar-actions { display: flex; gap: var(--space-3); }
.demo-bar-actions[hidden] { display: none; }
.demo-action {
  padding: var(--space-1) var(--space-4);
  border: 1px solid #393836;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 500; color: #cdccca;
  cursor: pointer; white-space: nowrap;
}
.demo-action:hover { background: #262523; }
.demo-action.active-demo { background: var(--color-primary); border-color: var(--color-primary); color: white; }

/* WHATSAPP MOCK */
.wa-phone {
  position: fixed; bottom: 60px; left: var(--space-6);
  width: 280px;
  background: #111b21;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-body);
  display: none;
  z-index: 998;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.wa-phone.visible { display: block; }
.wa-header {
  background: #202c33;
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
}
.wa-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #25d366; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #0b141a; font-weight: 700; flex-shrink: 0;
}
.wa-contact { font-size: 13px; font-weight: 600; color: #e9edef; }
.wa-online { font-size: 11px; color: #8696a0; }
.wa-body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); min-height: 120px; background: #0b141a; }
.wa-msg {
  background: #202c33;
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  max-width: 90%; align-self: flex-start;
}
.wa-msg-text { font-size: 13px; color: #e9edef; line-height: 1.5; }
.wa-msg-time { font-size: 11px; color: #8696a0; margin-top: var(--space-1); text-align: right; }

/* MISC */
.empty-section {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-12); color: var(--color-text-faint);
  text-align: center; gap: var(--space-3);
}
.empty-section p { font-size: var(--text-sm); max-width: 30ch; }

/* ============================================================
   RESPONSIVE — mobile & tablet
   ============================================================ */

/* Tablet — sidebar narrows, content gains space */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }
  .content {
    padding: 1.5rem;
    padding-bottom: calc(1rem + 49px); 
  }
  .demo-bar {
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
  }

  .demo-bar-copyrights {
    position: static;        /* turn absolute off on mobile */
    transform: none;
    font-size: 0.75rem;
    order: 3;                /* goes to the end */
  }

}
@media (max-width: 960px) {
  
  .login-wrap {
    padding:1rem;
    justify-content: flex-start;
    margin-top:100px;
  }
  .upload-layout {
    grid-template-columns: 1fr;
  }

  .dropzone {
    min-height: 360px;
  }
  .log-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .log-file {
    width: 100%;
    word-break: break-word;
  }
  .log-upload {flex:1; max-width:400px;}
  .log-update {flex:1; max-width:400px;}
  .log-delete {flex:1; max-width:400px;}

}
/* Mobile — full column */
@media (max-width: 768px) {

  .content-login {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  }
  .login-wrap {
    padding:1rem;
    justify-content: flex-start;
    margin-top:40px;
  }
  .login-card {
    padding:1rem 1.5rem;
    gap:0.5rem;
  }
  .login-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .btn-primary-login-submit {
    justify-content: center;
    margin-top: 0.5rem;
    margin-bottom:0.5rem;
  }
  /* Topbar */
  .topbar {
    padding: 0.65rem 1rem;
    gap: 0.5rem;
  }
  .logo-sub {
    display: none;
  }
  .server-status .server-text {
    display: none;
  }
  .server-dot {
    width: 15px;
    height: 15px;
    border-radius: 999px;
    background: #4ade80;
  }
  .topbar-user {
    display: none; /* no space for username on small screens */
  }

  /* Layout — from row to column */
  .layout {
    flex-direction: column;
    min-height: 0;
  }

  /* Sidebar becomes a horizontal bar at the top */
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
    top: 0 !important;
    padding-top: 4.5rem !important; /* robi miejsce pod topbarem */
    height: 100dvh !important;
    /* hide sections INFO and labels */
  }
    /* Sidebar returns to the vertical drawer */
 .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    border-right: 1px solid var(--color-border) !important;
    border-bottom: none !important;
    padding: 1.5rem 1rem !important;
    padding-top: 4.5rem !important;
    gap: 0.5rem !important;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-label,
  .sidebar-info,
  .sidebar-footer {
    display: none;
  }
  .project-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-full);
    min-width: auto;
  }
  .project-icon {
    display: none;
  }
  .project-name{
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
    display:-webkit-box;
    line-clamp:2;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }
  .project-meta .project-count {
    display: none;
  }

  /* Content */
  .content {
    padding: 1rem;
    gap: 1rem;
    padding-bottom: calc(2rem + 49px); /* 49px = height of demo bar */
  }

  /* Demo bar — simplify */
  .demo-bar {
    padding: var(--space-2) var(--space-4);
    font-size: 0.75rem;
  }
  /* Hamburger — show on mobile only */
  .hamburger {
    display: flex;
}
/* Hamburger button */
  .project-btn {
    flex-shrink: unset !important;
    white-space: normal !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
  }
  .search-drawer {
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    padding-top: 4.75rem;
  }
}

/* Small mobile < 480px */
@media (max-width: 480px) {

  .login-wrap {
    padding:1rem;
    justify-content: flex-start;
    margin-top:0px;
  }
  .topbar {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  .logo-name {
    font-size: var(--text-xs);
  }
  /* Osiem elementów po prawej nie mieści się w 412 px: bez zawijania pasek
     rozpychał stronę poziomo, a treść zostawała węższa niż okno. */
  .logo > div:last-child {
    display: none;
  }
  .topbar-right {
    flex: 1 1 0;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.25rem;
  }
  .content {
    padding: 0.75rem;
    padding-bottom: calc(1rem + 49px);
  }
  .log-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .log-file {
    width: 100%;
    word-break: break-word;
  }
  .log-upload {flex:1; max-width:400px;}
  .log-update {flex:1; max-width:400px;}
  .log-delete {flex:1; max-width:400px;}
}

/* --- Drzewo folderów projektu (OD-003a) ---------------------------------
   Panel widoczny wyłącznie dla ról z nawigacją folderową. Wcięcie robi
   padding-inline-start na wierszu, a nie zagnieżdżone <ul>, bo drzewo jest
   spłaszczone w widoku i niesie własną głębokość. */

.folder-tree-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.folder-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.folder-tree-head h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.folder-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.folder-row:hover {
  background: var(--color-surface-offset);
}

.folder-row.is-active {
  background: var(--color-primary-highlight);
}

.folder-depth-1 { padding-inline-start: 1.75rem; }
.folder-depth-2 { padding-inline-start: 3rem; }
.folder-depth-3 { padding-inline-start: 4.25rem; }
.folder-depth-4 { padding-inline-start: 5.5rem; }
.folder-depth-5 { padding-inline-start: 6.75rem; }

.folder-icon {
  display: inline-flex;
  color: var(--color-folder);
  flex-shrink: 0;
}

.folder-name {
  flex: 1;
  color: var(--color-text);
  text-decoration: none;
  word-break: break-word;
}

.folder-name:hover {
  color: var(--color-primary);
}

.folder-count {
  color: var(--color-text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.folder-tree-active {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .folder-tree-panel { padding: 0.75rem; }
  .folder-depth-1 { padding-inline-start: 1rem; }
  .folder-depth-2 { padding-inline-start: 1.75rem; }
  .folder-depth-3 { padding-inline-start: 2.5rem; }
  .folder-depth-4 { padding-inline-start: 3.25rem; }
  .folder-depth-5 { padding-inline-start: 4rem; }
}

/* --- Panel historii rewizji (OD-003) ------------------------------------
   Kontener `#history-drawer` żyje na karcie projektu i jest pusty, dopóki
   `openHistory()` nie wstrzyknie do niego fragmentu z `drawing_history`.
   Reguła `[hidden]` jest jawna: `display` z tej sekcji przebiłby atrybut
   `hidden`, więc bez niej panel byłby widoczny przed pierwszym pobraniem. */

.history-drawer {
  margin: 1.5rem 0 0;
}

.history-drawer[hidden] {
  display: none;
}

.history-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.history-head h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.history-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
  border-radius: 6px;
}

.history-close:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.history-document {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--color-text);
  word-break: break-word;
}

.history-folder {
  color: var(--color-text-muted);
}

/* Tabela rewizji bywa szersza niż karta na wąskim ekranie — przewijamy ją
   poziomo zamiast łamać nazwy plików. */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.history-table thead th {
  text-align: start;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}

.history-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: middle;
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-row.is-current {
  background: var(--color-primary-highlight);
}

.history-row td:first-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.badge-current {
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-success-highlight);
  color: var(--color-success);
  padding: 2px 0.5rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-archived {
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 2px 0.5rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Status approval (OD-004).

   Paleta jest rozdzielona swiadomie: bursztyn nalezy do `Nowa wersja`, wiec
   `Oczekujace` dostaje indygo. Oba stany stoja obok siebie na sasiednich
   kartach i wspolny odcien znosilby roznice miedzy „to jest nowsze" a „to
   czeka na moja decyzje" — a to sa dwie rozne akcje czytelnika. */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 0.6rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid transparent;
}

.badge-status-pending {
  background: #e8ebfb;
  color: #33409e;
  border-color: #33409e;
}

.badge-status-approved {
  background: #dff0d3;
  color: #2f5c17;
  border-color: #2f5c17;
}

.badge-status-rejected {
  background: #fadcdc;
  color: #8f1414;
  border-color: #8f1414;
}

.badge-status-obsolete {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

/* Motyw ciemny nie definiuje wariantow `-highlight` dla success i error, wiec
   badge dziedziczylby jasne tlo z motywu jasnego. Domykamy je tutaj — te
   odcienie sa dzis uzywane wylacznie przez status rewizji. */
[data-theme="dark"] .badge-status-pending {
  background: #1b1f3a;
  color: #97a3ec;
  border-color: #4d59bd;
}

[data-theme="dark"] .badge-status-approved {
  background: #1d2a18;
  color: #8ccc69;
  border-color: #4a7a33;
}

[data-theme="dark"] .badge-status-rejected {
  background: #2c1717;
  color: #ea8b8b;
  border-color: #8f3b3b;
}

/* Wyroznienie calej karty. `file-card.new` rysuje bursztynowa obwodke, wiec
   stany decyzji uzywaja tego samego mechanizmu w swoich kolorach — karta ma
   zawsze **jedno** wyroznienie, nigdy dwa naraz. */
.file-card.decision-pending::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid #33409e;
  border-radius: var(--radius-lg);
  pointer-events: none;
}

.file-card.decision-pending {
  background: #f3f5fe;
}

.file-card.decision-rejected::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid #8f1414;
  border-radius: var(--radius-lg);
  pointer-events: none;
}

[data-theme="dark"] .file-card.decision-pending {
  background: #1a1c2b;
}

[data-theme="dark"] .file-card.decision-pending::before {
  border-color: #4d59bd;
}

[data-theme="dark"] .file-card.decision-rejected::before {
  border-color: #8f3b3b;
}

/* Przyciski decyzji. Rozsuniete i z ikona, bo „Zatwierdz" i „Odrzuc" stojace
   ciasno obok siebie sa nieodwracalna akcja wybierana jednym omylkowym
   klknieciem. */
/* Przyciski w korpusie karty, nie w gornym pasku. `min-width: 0` i zawijanie
   sa tu konieczne: `.file-card` przycina zawartosc przez `overflow: hidden`,
   wiec bez nich dluzsza etykieta wychodzi poza obrys zamiast sie zlamac. */
.approval-actions {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.5rem;
  min-width: 0;
}

.approval-actions form {
  display: contents;
}

.approval-actions .btn-decision {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.btn-decision {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
}

.btn-decision:hover {
  border-color: var(--color-text-muted);
}

.btn-approve {
  border-color: #2f5c17;
  color: #2f5c17;
}

[data-theme="dark"] .btn-approve {
  border-color: #4a7a33;
  color: #8ccc69;
}

.btn-reject {
  border-color: #8f1414;
  color: #8f1414;
}

[data-theme="dark"] .btn-reject {
  border-color: #8f3b3b;
  color: #ea8b8b;
}

/* Modal odrzucenia.

   `margin: auto` jest tu **konieczne**: globalny reset `*{margin:0}` kasuje
   wartosc z arkusza przegladarki, a to wlasnie ona centruje okno modalne.
   Bez tej linii `<dialog>` laduje w lewym gornym rogu ekranu. */
.reject-dialog {
  margin: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 1.5rem;
  min-width: min(30rem, 92vw);
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.35));
}

.reject-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.reject-dialog form {
  position: relative;
}

.reject-dialog-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.35rem;
  line-height: 1;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
}

.reject-dialog-close:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

.reject-dialog h2,
.reject-dialog h3 {
  margin: 0 0 0.25rem;
  font-size: var(--text-base);
  padding-right: 2rem;
}

/* Okno potwierdzenia zatwierdzenia (dwustopniowe zatwierdzanie). */
.approve-dialog-note {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4);
}

.reject-dialog-file {
  margin: 0 0 1rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  word-break: break-all;
}

.reject-dialog textarea {
  display: block;
  width: 100%;
  font: inherit;
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  resize: vertical;
}

.reject-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.approval-comment {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0.25rem 0 0;
}

/* `.btn-open` jest w karcie pliku przyciskiem pełnej szerokości; w wierszu
   tabeli ma być kompaktowy, więc szerokość i zawijanie nadpisujemy tutaj,
   zamiast tworzyć drugi wariant przycisku. */
.history-actions {
  display: flex;
  gap: 0.5rem;
  white-space: nowrap;
}

.history-actions .btn-open {
  width: auto;
  padding: 0.35rem 0.7rem;
}

.history-btn {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.history-btn:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

@media (max-width: 640px) {
  .history-panel { padding: 0.75rem; }
  .history-table { font-size: 0.85rem; }
}

/* --- Wynik wgrania folderu (OP-009) -------------------------------------
   Blok żyje na karcie projektu i renderuje się wyłącznie wtedy, gdy sesja
   niesie wynik ostatniego uploadu archiwum. Kolory statusów są tymi samymi
   trzema, których używa reszta karty: zieleń dla rzeczy nowej, bursztyn dla
   zmiany wymagającej uwagi, szarość dla braku akcji. */

.upload-result {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
}

.upload-result-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.upload-result-head h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.upload-result-count {
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 2px 0.5rem;
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}

/* Paczka potrafi mieć 200 wpisów o długich nazwach — przewijamy poziomo
   zamiast łamać nazwy plików, tak samo jak w tabeli rewizji. */
.upload-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.upload-result-table thead th {
  text-align: start;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}

.upload-result-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
  vertical-align: middle;
  word-break: break-word;
}

.upload-result-table tr:last-child td {
  border-bottom: none;
}

.upload-result-detail {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.upload-status {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 0.5rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.upload-status-new_document {
  background: var(--color-success-highlight);
  color: var(--color-success);
}

.upload-status-new_revision {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
}

.upload-status-unchanged {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .upload-result { padding: 0.75rem; }
  .upload-result-table { font-size: 0.85rem; }
}

/* Rewizja, ktorej dana rola nie dostanie. Etykieta zamiast przyciskow: panel
   ma informowac, ze wersja istnieje i czeka, a nie zapraszac do kliniecia
   konczacego sie odmowa. */
.history-unavailable {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
  white-space: nowrap;
}

/* Karty Oferty (B-084). Reguły zawężone do widoków Oferty — wspólne
   `.btn-primary` i `.btn-decision` zostają bez zmian. */
.offer-list {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.offer-list th,
.offer-list td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
}

.offer-list th {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}

.offer-list-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
}

.offer-list tbody tr:hover {
  background: var(--color-surface-offset);
}

.offer-list tbody tr:last-child td {
  border-bottom: 0;
}

.offer-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}

.offer-list a:hover {
  color: var(--color-primary);
}

.offer-list .folder-icon {
  color: var(--color-folder);
}

.offer-actions form {
  margin-bottom: 1rem;
}

.offer-actions textarea {
  display: block;
  width: 100%;
  max-width: 32rem;
  min-height: 4rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.offer-actions .btn-primary {
  margin-bottom: 0;
}

/* Link akcji ("Przekaz do sprawdzenia") stoi w <p>, a globalny reset kasuje
   jego margines, wiec przycisk stykal sie z polem nastepnej akcji. */
.offer-actions p {
  margin-bottom: 1rem;
}

/* Podpowiedz "Czeka na: ..." gdy uzytkownik nie ma w tym stanie zadnej akcji. */
.offer-actions .offer-waiting {
  color: var(--color-text-muted);
}

/* Pasek pigulek w gornej czesci karty pliku. Dwie pigulki naraz (`Nowy plik`
   + status approvalu) nie mieszcza sie obok ikony w karcie 280 px, a
   `.file-card` przycina zawartosc. Zawijanie dotyczy wylacznie tej pary —
   ikona typu pliku zostaje w swoim rzedzie. */
.file-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-left: auto;
  min-width: 0;
}

[data-theme="dark"] .badge-new {
  background: #2a1f14;
  color: #e0a070;
  border-color: #8a5030;
}

/* Workflow Oferty. Statusy Oferty (`OFFER_STATUS_*`) maja wlasna rodzine
   `.badge-status-offer-*` na wspolnej geometrii `.badge-status`. Realizacja to
   nie status, tylko `realization_number` na `Project`. */
.badge-status-event-manager_assigned,
.badge-status-event-realization_reverted,
.badge-status-offer-draft {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.badge-status-event-submitted_for_review,
.badge-status-offer-submitted_for_review {
  background: #e8ebfb;
  color: #33409e;
  border-color: #33409e;
}

.badge-status-event-returned_for_correction,
.badge-status-offer-returned_for_correction {
  background: var(--color-warning-highlight);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.badge-status-event-ready_for_realization,
.badge-status-event-realized,
.badge-status-offer-ready_for_realization {
  background: #dff0d3;
  color: #2f5c17;
  border-color: #2f5c17;
}

.badge-status-event-cancelled,
.badge-status-offer-cancelled {
  background: #f3e4e4;
  color: #7a3a3a;
  border-color: #b98a8a;
}

[data-theme="dark"] .badge-status-event-submitted_for_review,
[data-theme="dark"] .badge-status-offer-submitted_for_review {
  background: #1b1f3a;
  color: #97a3ec;
  border-color: #4d59bd;
}

[data-theme="dark"] .badge-status-event-returned_for_correction,
[data-theme="dark"] .badge-status-offer-returned_for_correction {
  background: #2a1f14;
  color: #e0a070;
  border-color: #8a5030;
}

[data-theme="dark"] .badge-status-event-ready_for_realization,
[data-theme="dark"] .badge-status-event-realized,
[data-theme="dark"] .badge-status-offer-ready_for_realization {
  background: #1d2a18;
  color: #8ccc69;
  border-color: #4a7a33;
}

[data-theme="dark"] .badge-status-event-cancelled,
[data-theme="dark"] .badge-status-offer-cancelled {
  background: #241a1a;
  color: #c48f8f;
  border-color: #6b4444;
}

.offer-detail h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.offer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin: 0.75rem 0;
}

.offer-meta dt {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  margin-bottom: 0.2rem;
}

.offer-meta dd {
  font-size: var(--text-sm);
}

.offer-history {
  list-style: none;
  padding: 0;
  font-size: var(--text-sm);
}

.offer-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.offer-history-meta {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.offer-history-reason {
  flex-basis: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.offer-form {
  max-width: 32rem;
}

.offer-form p,
.offer-form > div {
  margin-bottom: 1rem;
}

.offer-form label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.offer-form select,
.offer-form input[type="text"],
.offer-form textarea,
.offer-actions select {
  display: block;
  width: 100%;
  max-width: 32rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.offer-form textarea {
  height: 6rem;
  min-height: 4rem;
  resize: vertical;
}

.offer-form select:focus,
.offer-form input[type="text"]:focus,
.offer-form textarea:focus,
.offer-actions select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.offer-form ul {
  list-style: none;
  padding: 0;
}

.offer-form ul li label,
.offer-form div[id] label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.offer-form .errorlist {
  color: var(--color-error);
  font-size: var(--text-xs);
  margin-bottom: 0.3rem;
}

.offer-form .helptext {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  margin-top: 0.25rem;
}

/* Audyt 2026-10-31 (E4): na telefonie listy Ofert i zgłoszeń to karty zamiast tabeli
   przewijanej w poziomie. Etykieta kolumny przychodzi z `data-label` komórki. */
@media (max-width: 640px) {
  .offer-list-panel, .bug-report-list-panel { overflow-x: visible; }
  .offer-list-panel .offer-list thead, .bug-report-list-panel .bug-report-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .offer-list-panel .offer-list, .offer-list-panel .offer-list tbody, .offer-list-panel .offer-list tr, .offer-list-panel .offer-list td, .bug-report-list-panel .bug-report-list, .bug-report-list-panel .bug-report-list tbody, .bug-report-list-panel .bug-report-list tr, .bug-report-list-panel .bug-report-list td { display: block; width: 100%; }
  .offer-list-panel .offer-list tr, .bug-report-list-panel .bug-report-list tr { padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--color-divider); }
  .offer-list-panel .offer-list tr:last-child, .bug-report-list-panel .bug-report-list tr:last-child { border-bottom: 0; }
  .offer-list-panel .offer-list td, .bug-report-list-panel .bug-report-list td { padding: 2px 0; border: 0; }
  .offer-list-panel .offer-list td:first-child, .bug-report-list-panel .bug-report-list td:first-child { font-weight: 600; padding-bottom: var(--space-2); }
  .offer-list-panel .offer-list td[data-label], .bug-report-list-panel .bug-report-list td[data-label] { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); }
  .offer-list-panel .offer-list td[data-label]::before, .bug-report-list-panel .bug-report-list td[data-label]::before { content: attr(data-label); color: var(--color-text-muted); }
}

/* Strzalka przy wpisie sidebara, ktory prowadzi do listy (nie do jednego
   projektu): daje sygnal, ze wiersz jest klikalny. Aktywny wiersz dziedziczy
   podswietlenie z `.project-btn.active`. */
.project-btn-arrow {
  display: flex;
  margin-left: auto;
  color: var(--color-text-faint);
}

.project-btn:hover .project-btn-arrow,
.project-btn.active .project-btn-arrow {
  color: var(--color-primary);
}

/* --- Poprawki z przeglądu UI/UX (2026-10-05) --- */

/* Toasty: nad dolnym paskiem, na środku — nie zasłaniają przycisków nagłówka. */
.messages-container {
  top: auto;
  right: auto;
  left: 50%;
  bottom: calc(var(--space-6) + 56px);
  transform: translateX(-50%);
  align-items: center;
  max-width: calc(100vw - 2rem);
  padding-bottom: 0;
  transition: none;
  pointer-events: none;
}
.messages-container .toast-message { pointer-events: auto; }
.toast-message { animation-name: toast-in; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}
.toast-message.is-leaving { animation: toast-out 300ms ease forwards; }

/* Nagłówek karty projektu: przyciski akcji zawijają się pod tytuł na wąskich ekranach. */
.project-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
@media (max-width: 768px) {
  .content-header { flex-direction: column; align-items: stretch; }
  .project-actions { justify-content: flex-start; }
}

/* Dolny pasek nie zasłania ostatniej treści, gdy układa się w kolumnę (<= 1024 px). */
@media (max-width: 1024px) {
  .content { padding-bottom: calc(1rem + 104px); }
  .messages-container { bottom: calc(1rem + 104px); }
}

/* Dolny pasek podąża za motywem (wcześniej kolory na sztywno, ciemne także w jasnym motywie). */
.demo-bar {
  background: var(--color-surface);
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
}
.demo-bar-label { color: var(--color-text-muted); }
.demo-action { border-color: var(--color-border); color: var(--color-text); }
.demo-action:hover { background: var(--color-surface-offset); }
.demo-action.active-demo:hover { background: var(--color-primary); }

/* Link „Pokaż wszystkie pliki”: kolor odwiedzonego linku był ciemnofioletowy na ciemnym tle. */
.folder-tree-active a,
.folder-tree-active a:visited { color: var(--color-primary); text-decoration: underline; }

/* Formularz uploadu: zagnieżdżona lista limitów miała podwójne znaczniki. */
.upload-info-list ul {
  list-style: none;
  padding-left: 0;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Strona startowa: kafelki projektów. */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}
.project-card:hover { border-color: var(--color-primary); background: var(--color-surface-2); }
.project-card.is-inactive { opacity: 0.55; }
.project-card-name { font-weight: 600; overflow-wrap: anywhere; }
.project-card-meta { font-size: var(--text-xs); color: var(--color-text-muted); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.empty-state { color: var(--color-text-muted); margin-top: var(--space-4); max-width: 60ch; }
.empty-state a { color: var(--color-primary); }

/* Przełącznik motywu na pokaz (UAT); renderowany wyłącznie przy THEME_PREVIEW_ENABLED.
   Dzieli wygląd z .theme-toggle, więc motyw organizacji ubiera go razem z paskiem. */
.theme-preview-form { display: flex; }
.theme-toggle.theme-preview { width: auto; padding: 0 0.75rem; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }

/* === B1 upload-batch-notes: Aktywność i uwagi przy uploadzie (OP-025) ===
   Zakładka „Aktywność” karty projektu (partial upload_batches.html), uwaga
   pod nazwą pliku (file_note.html) i pola „Uwagi”/„Powiadom” formularzy
   uploadu (upload_batch_fields.html). Wyłącznie tokeny motywu: obie palety
   i motyw organizacji ubierają te bloki bez osobnych reguł. */

.activity-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-6);
}
.activity-summary {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.activity-count {
  font-size: var(--text-xs);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}
.activity-items {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
}
.activity-item {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-divider);
}
.activity-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
}
.activity-author { font-weight: 600; color: var(--color-text); }
.activity-date,
.activity-counts,
.activity-recipients {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.activity-note {
  margin: var(--space-2) 0;
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.activity-note.is-empty { color: var(--color-text-faint); font-style: italic; }
.activity-files {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
  font-size: var(--text-xs);
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.activity-recipients { margin: 0; }

/* Uwaga pod nazwą pliku: trzy linie, reszta w zakładce „Aktywność”. */
.file-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Uwagi na karcie pliku i w projekcie (B-101, mockup `uwagi-karta` A). */
.file-note-meta { margin: 2px 0 0; font-size: var(--text-xs); color: var(--color-text-faint); }
.file-notes, .file-note-add { margin-top: var(--space-1); }
.file-notes > summary, .file-note-add > summary, .project-notes > summary {
  cursor: pointer; font-size: var(--text-xs); font-weight: 600; color: var(--color-primary); list-style: none;
}
.file-notes > summary::-webkit-details-marker, .file-note-add > summary::-webkit-details-marker,
.project-notes > summary::-webkit-details-marker { display: none; }
.file-notes > summary::before, .project-notes > summary::before { content: "\25B8  "; }
.file-notes[open] > summary::before, .project-notes[open] > summary::before { content: "\25BE  "; }
.file-notes .when-open { display: none; }
.file-notes[open] .when-closed { display: none; }
.file-notes[open] .when-open { display: inline; }
.file-notes ol, .project-notes ol {
  list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2);
}
.file-notes li, .project-notes li {
  border-left: 2px solid var(--color-divider); padding-left: var(--space-2); font-size: var(--text-xs); overflow-wrap: anywhere;
}
.file-notes .ver { font-weight: 700; color: var(--color-text); }
.file-notes .meta, .project-notes .meta { color: var(--color-text-faint); }
.file-notes li p, .project-notes li p { margin: 2px 0 0; color: var(--color-text-muted); }
.file-note-add form, .project-notes-form { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1); }
.file-note-add textarea, .project-notes-form textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: var(--text-xs); color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-1) var(--space-2);
}
.file-note-add button, .project-notes-form button { align-self: flex-start; width: auto; padding-inline: var(--space-3); }
.project-notes {
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
  padding: var(--space-2) var(--space-3); margin: 0 0 var(--space-4);
}

.upload-batch-fields {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin: var(--space-4) 0;
}
.upload-batch-fields legend { font-weight: 600; padding: 0 var(--space-1); }
.upload-batch-label { display: block; font-weight: 600; margin: var(--space-2) 0 var(--space-1); }
.upload-batch-hint { font-weight: 400; font-size: var(--text-xs); color: var(--color-text-muted); }
.upload-batch-fields textarea,
.upload-note textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
}
.upload-notify { display: flex; flex-direction: column; gap: var(--space-1); max-height: 12rem; overflow-y: auto; }
.upload-notify-choice { display: flex; gap: var(--space-2); align-items: center; }
.upload-batch-error { color: var(--color-error); font-size: var(--text-xs); margin: var(--space-1) 0 0; }

/* ===== B9 attention-pulse (OP-028, OP-024 etap 3) =====
   Pulsowanie zwraca uwagę, ale niczego nie komunikuje samo: kropka projektu
   stoi obok tekstu „nowe: N”, karty mają badge'e „Nowy plik” i status,
   licznik dzwonka ma cyfrę. Klasy ustawia serwer z flag, które już liczy
   (unread_count, unread_kind, can_decide_approval), więc CSS niczego nie
   rozstrzyga. Kolory idą z tokenów motywu; kropka i halo dzwonka mają
   wartości kolorów istniejących elementów (badge dzwonka, ramka karty
   „Do zatwierdzenia”). Wszystkie animacje gasi blok na końcu sekcji. */

@keyframes attention-dot {
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-warning) 38%, transparent); }
}
@keyframes attention-ring {
  50% { outline-color: color-mix(in srgb, var(--pulse-color) 55%, transparent); }
}
@keyframes sidebar-glow {
  50% { box-shadow: 0 0 0 1px var(--attention-glow), 0 0 22px var(--attention-glow); }
}
@keyframes badgepulse {
  50% { box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.4); }
}

.attention-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: var(--radius-full);
  background: var(--color-warning);
  animation: attention-dot 2.4s ease-in-out 3;
}

/* Obrys zamiast box-shadow: karta ma już cień (a w motywie PROFIL cień
   wewnętrzny), a `overflow: hidden` przycinałoby halo pseudo-elementu. */
.file-card.pulse {
  --pulse-color: var(--ring, var(--color-warning));
  outline: 3px solid transparent;
  outline-offset: 1px;
  animation: attention-ring 2.4s ease-in-out infinite;
}
.file-card.decision-pending.pulse { --pulse-color: var(--ring, #33409e); }
[data-theme="dark"] .file-card.decision-pending.pulse { --pulse-color: var(--ring, #4d59bd); }

.project-btn.active {
  --attention-glow: color-mix(in srgb, var(--color-primary) 40%, transparent);
  animation: sidebar-glow 3s ease-in-out infinite;
}

/* Znacznik dzwonka jest ukryty atrybutem `hidden`, gdy nie ma nieprzeczytanych,
   więc puls nie wymaga ani klasy, ani zmiany skryptu. */
.notification-badge:not([hidden]) { animation: badgepulse 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .attention-dot, .file-card.pulse, .project-btn.active, .notification-badge:not([hidden]) { animation: none; }
}

/* ==========================================================================
   B2 notification-deeplink — przejście z powiadomienia do karty pliku
   (OP-028: flash = 3 pulsy, raz; prefers-reduced-motion = bez animacji).
   Wyłącznie tokeny motywu, więc działa w jasnym, ciemnym i w motywie tenanta.
   ========================================================================== */

/* Stałe wyróżnienie karty wskazanej przez serwer — zostaje także bez animacji. */
.file-card.is-notification-target {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.file-card.flash {
  animation: notification-flash 0.9s ease-in-out 3;
}

@keyframes notification-flash {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: 0 0 0 6px var(--color-primary-highlight), var(--shadow-md); }
}

@media (prefers-reduced-motion: reduce) {
  .file-card.flash { animation: none; }
}

.notification-arrival {
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.notification-all {
  display: block;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.notification-all:hover { text-decoration: underline; }

.notifications-page {
  padding: 0;
  max-width: 48rem;
}
.notifications-pager {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.notifications-pager a { color: var(--color-primary); }

/* ==========================================================================
   B12 bug-report-form — „Zgłoś problem” i „Moje zgłoszenia”
   ========================================================================== */

/* Ikona w topbarze dzieli wygląd z dzwonkiem i przełącznikiem motywu. */
.bug-report-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.bug-report-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.bug-report-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.bug-report-form {
  max-width: 40rem;
  margin-top: var(--space-4);
}
.bug-report-field {
  margin-bottom: 1rem;
}
.bug-report-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.bug-report-field input[type="text"],
.bug-report-field select,
.bug-report-field textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.bug-report-field textarea {
  resize: vertical;
  min-height: 3rem;
}
.bug-report-field input[type="file"] {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.bug-report-field input:focus,
.bug-report-field select:focus,
.bug-report-field textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.bug-report-field-error,
.bug-report-alert {
  color: var(--color-error);
  font-size: var(--text-sm);
}
.bug-report-alert {
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-md);
  background: var(--color-error-highlight);
}
.bug-report-field-error ul,
.bug-report-alert ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}
.bug-report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.bug-report-actions a {
  color: var(--color-primary);
  font-size: var(--text-sm);
}
/* `.btn-primary` niesie `margin-bottom` dla układu kart; w rzędzie akcji
   podnosiłby przycisk ponad link, więc rząd go zeruje. */
.bug-report-actions .btn-primary {
  margin-bottom: 0;
}

.bug-report-list-panel {
  margin-top: var(--space-4);
}
.bug-report-list {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.bug-report-list th,
.bug-report-list td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  text-align: left;
  vertical-align: top;
}
.bug-report-list th {
  color: var(--color-text-muted);
  font-weight: 600;
}
.bug-report-list a {
  color: var(--color-primary);
}
.bug-report-title {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}
.bug-report-description {
  display: block;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}
.bug-report-status {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}
.bug-report-status-new {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.bug-report-status-in_progress {
  border-color: var(--color-warning);
  color: var(--color-text);
  background: var(--color-warning-highlight);
}
.bug-report-status-closed {
  color: var(--color-text-muted);
}


   B8 cnc-tree-view — drzewo folderów i widok „Wg paczek” (OP-029)
   Zwijanie to prezentacja (OP-010): licznik grupy widać także po zwinięciu.
   Wyłącznie tokeny motywu; bez animacji. Reguły `[hidden]` są jawne, bo
   `display` z tej sekcji przebiłby atrybut ustawiany przez wyszukiwarkę.
   ========================================================================== */

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}
.view-switch-link {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  text-decoration: none;
}
.view-switch-link:hover { border-color: var(--color-primary); }
.view-switch-link.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-weight: 600;
}

.path-tree-panel { margin: 0 0 var(--space-6); }

.last-batch-panel {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.last-batch-panel.is-empty { color: var(--color-text-muted); }
.last-batch-author { font-weight: 600; }
.last-batch-counts,
.tree-batch-counts {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.last-batch-counts { margin-top: var(--space-1); }
.last-batch-filter { margin-top: var(--space-2); }
.last-batch-filter a { color: var(--color-primary); font-weight: 600; }

.tree-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
}
.tree-search[hidden] { display: none; }
.tree-search input {
  min-width: 14rem;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
.tree-search-status { font-size: var(--text-xs); color: var(--color-text-muted); }

.path-tree {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: var(--space-2);
}
.tree-group { margin: 0; }
.tree-group .tree-group { margin-left: var(--space-4); }
.tree-group[hidden] { display: none; }
.tree-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.tree-summary:hover { background: var(--color-surface-offset); }
.tree-name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.tree-group.is-loose > .tree-summary .tree-name { color: var(--color-text-muted); }
.tree-count {
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}
.tree-changed-count,
.badge-changed {
  padding: 0 var(--space-2);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.tree-batch-counts { padding: 0 var(--space-2) var(--space-1); }

.tree-files {
  list-style: none;
  margin: 0 0 var(--space-2) var(--space-4);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.file-card.tree-file {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  box-shadow: none;
}
.file-card.tree-file:hover { transform: none; box-shadow: var(--shadow-sm); }
.file-card.tree-file[hidden] { display: none; }
.file-card.tree-file.is-changed { border-color: var(--color-primary); }
.tree-file .file-type {
  width: 2.25rem;
  height: 1.75rem;
  font-size: var(--text-xs);
}
.tree-file-name {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.tree-file-badges { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.tree-file-date { font-size: var(--text-xs); color: var(--color-text-muted); }
.tree-file-actions { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.tree-file-actions .btn-open { width: auto; padding: var(--space-1) var(--space-2); }
.tree-empty { color: var(--color-text-muted); }
.last-batch-note,
.tree-batches-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.tree-batches-note { margin: 0 0 var(--space-3); }

/* ==========================================================================
   B3 notification-preferences — koło zębate i strona ustawień powiadomień
   ========================================================================== */

/* Ikona w topbarze: ten sam wygląd co „Zgłoś problem” (B12). */
.notification-settings-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.notification-settings-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.notification-settings-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.nps-form {
  max-width: 48rem;
  margin-top: var(--space-4);
}
.nps-section {
  margin-bottom: var(--space-6);
}
.nps-heading {
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}
.nps-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-2) 0;
}
.nps-table-wrap {
  overflow-x: auto;
}
.nps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.nps-table th,
.nps-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  text-align: center;
  vertical-align: middle;
}
.nps-table thead th {
  color: var(--color-text-muted);
  font-weight: 600;
}
.nps-table tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
}
.nps-lock {
  color: var(--color-text-muted);
  white-space: nowrap;
}
.nps-none {
  color: var(--color-text-faint);
}
.nps-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  cursor: pointer;
}
/* Etykieta komórki dla czytnika ekranu — tabela ma nagłówki, wzrok jej nie potrzebuje. */
.nps-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.nps-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  margin: var(--space-2) 0 var(--space-3);
  color: var(--color-text);
}
.nps-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.nps-form input[type="time"],
.nps-form input[type="number"],
.nps-form input[type="text"] {
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.nps-form input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.nps-days {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-3);
}
.nps-days legend {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--color-text);
}
.nps-day {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* ==========================================================================
   Klatki ruchu z mockupu (OP-040). Same definicje: używa ich wyłącznie paczka
   motywu tenanta (`themes/*.css`), więc motyw domyślny nie zmienia wyglądu.
   `.topbar-progress` jest w szablonie zawsze, a bez paczki ukryty.
   ========================================================================== */
@keyframes ui-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ui-sweep { 0% { transform: translateX(-100%); } 10% { transform: translateX(0); } 16%, 100% { transform: translateX(100%); } }
@keyframes ui-beat { 50% { opacity: .45; } }
@keyframes ui-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ui-pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ui-flash {
  50% {
    background-color: color-mix(in srgb, var(--flash) 30%, var(--color-surface));
    box-shadow:
      inset 0 0 0 2px color-mix(in srgb, var(--flash) 75%, white),
      inset 0 0 46px color-mix(in srgb, var(--flash) 60%, transparent),
      0 0 24px color-mix(in srgb, var(--flash) 45%, transparent);
  }
}
.topbar-progress { display: none; }
/* Elementy z mockupu bez wpływu na motyw domyślny: pokazuje je dopiero paczka tenanta. */
.project-num-tile, .project-number.is-none, .project-card-arrow { display: none; }

/* --- Upload: grupy adresatów, lista plików, kanały, pasek akcji (OP-040) --- */
.upload-notify-group { display: flex; flex-direction: column; gap: var(--space-1); }
.upload-notify-group + .upload-notify-group { margin-top: var(--space-2); }
.upload-notify-group-title {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}
.upload-notify-choice { justify-content: space-between; }
.upload-notify-person { display: flex; flex-direction: column; min-width: 0; }
.upload-notify-name { font-weight: 600; overflow-wrap: anywhere; }
.upload-notify-meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.upload-file-list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  width: 100%;
  max-height: 12rem;
  overflow-y: auto;
  text-align: left;
}
.upload-file-list[hidden] { display: none; }
.upload-file-list li { padding: var(--space-1) var(--space-2); font-size: var(--text-sm); overflow-wrap: anywhere; border-bottom: 1px solid var(--color-divider); }
.upload-file-list li:last-child { border-bottom: 0; }
.upload-channels { list-style: none; margin: var(--space-1) 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.upload-channels li { font-size: var(--text-xs); font-weight: 600; padding: 4px 10px; border-radius: var(--radius-full); border: 1px solid var(--color-divider); background: var(--color-surface-2); }
.upload-channels li.is-off { color: var(--color-text-faint); text-decoration: line-through; }
.upload-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }
.upload-actions .upload-submit { width: auto; margin-bottom: 0; }
.upload-cancel { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }

/* --- Ustawienia powiadomień: karta jak modal z mockupu (OP-040) --- */
.nps-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.nps-modal-title { margin: 0; font-size: var(--text-xl); font-weight: 700; }
.nps-modal-subtitle { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.nps-close { font-size: 1.5rem; line-height: 1; padding: 0 var(--space-2); color: var(--color-text-muted); }
.nps-blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: var(--space-4); }
.nps-modal-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); }
.nps-modal-foot .btn-primary { margin-bottom: 0; }
.nps-cancel { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.nps-sample { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.nps-sample[hidden] { display: none; }
.nps-sample-btn { font: inherit; font-size: var(--text-sm); font-weight: 600; padding: 0.4rem 0.8rem; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: none; color: var(--color-text); cursor: pointer; }
.nps-form input[type="range"] { width: 100%; accent-color: var(--color-primary); }

/* --- CNC: liczniki partii jako pigułki (OP-040) --- */
.last-batch-counts .pill, .tree-batch-counts .pill { display: inline-block; margin-right: var(--space-2); }
.pill + .pill::before { content: "· "; }

/* --- Upload: dwie karty, szczegóły limitów, nakładka przeciągania (OP-040) --- */
.upload-card { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; border: 1px solid var(--color-border); border-radius: 1.25rem; background: var(--color-surface); box-shadow: var(--shadow-sm); }
.upload-limits summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.upload-limits .upload-info-list { margin-top: var(--space-2); }
.upload-note .upload-batch-label { margin-top: 0; }
.upload-drop-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; border: 3px dashed var(--color-primary); background: color-mix(in srgb, var(--color-primary) 14%, transparent); color: var(--color-text); font-size: var(--text-xl); font-weight: 700; pointer-events: none; }
.upload-drop-overlay[hidden] { display: none; }
.dropzone-overlay-box { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); max-width: 36rem; padding: var(--space-6); border-radius: 12px; background: var(--color-surface); box-shadow: var(--shadow-md); text-align: center; }
.dropzone-overlay-box strong { font-size: var(--text-xl); }
.dropzone-overlay-box span { font-size: var(--text-sm); color: var(--color-text-muted); }
.dropzone-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 210; max-width: min(90vw, 36rem); padding: 10px 16px; border-radius: 10px; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); box-shadow: var(--shadow-md); font-size: var(--text-sm); }
.dropzone-toast[hidden] { display: none; }
.dropzone-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 205; padding: var(--space-4) var(--space-6); background: var(--color-surface); border-top: 3px solid var(--color-primary); box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.28); }
.dropzone-panel[hidden] { display: none; }
.dropzone-panel-title { font-weight: 700; margin-bottom: var(--space-2); }
.dropzone-panel-tiles { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.dropzone-tile { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 2px; padding: var(--space-4); border: 2px dashed var(--color-border); border-radius: 10px; text-align: center; }
.dropzone-tile span { font-size: var(--text-sm); color: var(--color-text-muted); }
.dropzone-tile.is-over { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 14%, transparent); }
.dropzone-tile.is-disabled { opacity: 0.5; cursor: not-allowed; }
.dropzone-panel-status { min-height: 1.25em; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-warning); }
@media (prefers-reduced-motion: no-preference) { .dropzone-tile { transition: border-color .15s, background-color .15s; } }

/* --- Wyszukiwarka: wskazówki klawiszy i „wyczyść” — pokazuje je paczka motywu (OP-040) --- */
.search-clear, .search-kbd, .search-hint { display: none; }

/* --- Lista Ofert: cały wiersz jest klikalny; Szczegóły Oferty (OP-040) --- */
.offer-list tbody tr { position: relative; cursor: pointer; }
.offer-list td:first-child a::after { content: ""; position: absolute; inset: 0; }
.offer-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.offer-detail-head h2 { margin: 0; }
.offer-section { display: block; }
.nps-is-off { opacity: 0.45; }
