/* =================================================
   1. DESIGN TOKENS
=================================================== */

:root {
  --bg-main: #0f1419;
  --bg-card: #151b22;
  --bg-hover: #1c2530;
  --bg-panel: #151b22;

  --text-primary: #e6edf3;
  --text-secondary: #9da7b3;

  --accent: #00e0a4;
  --accent-hover: #00c893;

  --border: #2a3440;

  --success: #00e0a4;
  --warning: #f5c842;
  --danger: #ff5c5c;

  /* spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-xxl: 24px;

  /* motion */
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s ease;
}

/* =================================================
   2. BASE
=================================================== */

body {
  margin: 0;
  font-family: Inter, Segoe UI, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
}

h1, h2, h3 {
  margin: 0 0 var(--space-sm);
}

p {
  margin: 4px 0;
  color: var(--text-secondary);
}

/* =================================================
   3. STATE SYSTEM (LEVEL 2)
=================================================== */

.is-selected {}
.is-hovered {}
.is-active {}
.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* =================================================
   4. LAYOUT
=================================================== */

.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.layout-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* =================================================
   HEADER LAYOUT + PROJECT SELECTOR
=================================================== */

.header {
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 0 var(--space-xl);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);

  position: relative;
  z-index: 200;
}

.header-left,
.header-right {
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-xxl);
}

.header-project-select {
  width: min(860px, 68vw);
  height: 44px;
  min-width: 520px;
  max-width: 860px;
  box-sizing: border-box;
  padding: 0 42px 0 16px;

  border: 1px solid var(--border);
  border-radius: 10px;

  background-color: var(--bg-hover);
  color: var(--text-primary);

  /* Krój o stałej szerokości zapewnia równe położenie separatorów. */
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;

  cursor: pointer;
  outline: none;

  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.header-project-select:hover {
  border-color: rgba(0, 224, 164, 0.55);
  background-color: #1f2a36;
}

.header-project-select:focus {
  border-color: var(--accent);
  background-color: var(--bg-hover);
  box-shadow: 0 0 0 2px rgba(0, 224, 164, 0.15);
}

.header-project-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

.header-project-select option[value=""] {
  color: var(--text-secondary);
}

/* ==== HEADER PROJECT SELECTOR GROUP (select + search input) ==== */

.header-project-selector-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-project-search {
  height: 44px;
  width: 300px;
  box-sizing: border-box;
  padding: 0 16px;

  border: 1px solid var(--border);
  border-radius: 10px;

  background-color: var(--bg-hover);
  color: var(--text-primary);

  font-family: Inter, Segoe UI, sans-serif;
  font-size: 14px;

  outline: none;

  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.header-project-search:hover {
  border-color: rgba(0, 224, 164, 0.55);
  background-color: #1f2a36;
}

.header-project-search:focus {
  border-color: var(--accent);
  background-color: var(--bg-hover);
  box-shadow: 0 0 0 2px rgba(0, 224, 164, 0.15);
}

.header-project-search::placeholder {
  color: var(--text-secondary);
}

/* SIDEBAR */

.sidebar {
  width: 240px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: var(--space-xl);
  transition: width var(--transition-smooth), padding var(--transition-smooth);
}

/* MAIN */

.main {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xxl);
}

.right-panel {
  width: 320px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: var(--space-xl);
}

/* =================================================
   5. NAV
=================================================== */

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.nav-divider {
  height: 1px;
  margin: var(--space-md) var(--space-sm);
  background: var(--border);
  opacity: 0.9;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);

  padding: var(--space-sm) var(--space-md);
  border-radius: 10px;

  background: var(--bg-card);
  text-decoration: none;
  color: var(--text-primary);

  transition: var(--transition-fast);
}

/* ===== ACTIVE NAV (STRONG) ===== */

.nav-item.active {
  background: rgba(0, 224, 164, 0.18);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(0,224,164,0.25);
  position: relative;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 3px;
  background: var(--accent);
}

.nav-item.active span {
  color: var(--accent);
  font-weight: 600;
}

.nav-item:hover {
  background: var(--bg-hover);
  transform: translateX(4px);
}

.nav-item:hover:not(.active) {
  background: var(--bg-hover);
}

.icon {
  width: 24px;
  height: 24px;
}

/* ===== NAV TOGGLE ===== */

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-toggle {
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-toggle:hover {
  transform: rotate(180deg);
}


/* ===== MINI SIDEBAR ===== */

.layout.collapsed .icon {
  width: 24px;
  height: 24px;
}

.layout.collapsed .logo {
  display: none;
}

.layout.collapsed .main {
  margin-left: 0;
}

.layout.collapsed .nav-item {
  justify-content: center;
  padding: var(--space-sm);
}

.layout.collapsed .nav-item.active {
  justify-content: center;
}

.nav-item.active .icon {
  filter: brightness(1.6);
}

/* ukryj tekst */
.layout.collapsed .nav-item span {
  display: none;
}

.layout.collapsed .nav-section {
  display: none;
}

.layout.collapsed .nav-divider {
  width: 32px;
  margin: var(--space-md) auto;
}

.layout.collapsed .sidebar {
  width: 60px;
  padding: var(--space-md) var(--space-xs);
  overflow: hidden;
}


/* =================================================
   6. COMPONENTS
=================================================== */

/* ---------- SELECT CARD ---------- */

.select-card {
  background: var(--bg-hover);
  padding: var(--space-md) var(--space-lg);
  border-radius: 12px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  cursor: pointer;
  border: 1px solid transparent;
  min-height: 48px;

  transition: var(--transition-fast);
}

.select-card:hover {
  background: #1f2a36;
  border-color: var(--accent);
}

.select-card:active {
  transform: scale(0.98);
}

/* states */

.select-card.is-selected,
.select-card.active {
  background: rgba(0, 224, 164, 0.15);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(0,224,164,0.2);
}

/* variants */

.select-card--compact {
  padding: var(--space-sm) var(--space-md);
  min-height: 36px;
}

.select-card--danger {
  border: 1px solid rgba(255,92,92,0.4);
}

.select-card--danger.is-selected {
  background: rgba(255,92,92,0.15);
  border-color: var(--danger);
}

/* ---------- LIST ITEM ---------- */

.list-item {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: var(--space-md) var(--space-lg);

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: var(--space-md);
  transition: var(--transition-fast);
  
  cursor: pointer;
  
}

.list-item:hover {
  border: 1px solid var(--accent);
}

.list-item.is-selected,
.list-item.active {
  background: #0f2a24;
  border: 1px solid var(--accent);
}

/* ---------- CARD ---------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;

  display: flex;
  flex-direction: column;
  min-height: 600px;
  height: 95%;
  overflow: visible;
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
}

/* ---------- FORM SYSTEM ---------- */

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 400px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---------- INPUTS ---------- */

input, select {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);

  padding: var(--space-md);
  border-radius: 8px;
}

.form-group select {
  max-width: 100%;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- BUTTONS ---------- */

button {
  background: var(--accent);
  border: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

button:hover {
  background: var(--accent-hover);
}

/* =================================================
   🔥 PERMISSIONS (FIX CHECKBOX LAYOUT)
=================================================== */

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

/* =================================================
   7. ADMIN
=================================================== */

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-xl);
}

.role-editor {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-hover);
  border-radius: 10px;
}

.search-wrapper {
  width: 100%;
}

.search {
  width: 100%;
  box-sizing: border-box;
}

/* FILTRY */
.filters {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
}

.filters select {
  min-width: 0;
}

.filters select:nth-child(1) {
  width: 25%;
}

.filters select:nth-child(2) {
  width: 60%;
}

.filters select:nth-child(3) {
  width: 15%;
}

/* =================================================
   ROLES LIST FIX
=================================================== */

.roles-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}


/* =================================================
   8. USER / AVATAR
=================================================== */

.user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.user-item,
.client-item {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 8px var(--space-md);

  min-height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  cursor: pointer;
  transition: 0.2s;
}

/* LEWA STRONA */
.user-main,
.client-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* PRAWA STRONA */
.user-row-right {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.user-meta .status {
  width: 62px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
}

.permission-badge {
  width: 142px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.user-action-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.user-action-btn:hover {
  background: rgba(0, 224, 164, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.user-action-btn--danger:hover {
  background: rgba(255, 92, 92, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}

/* IMIĘ */
.user-name {
  font-weight: 500;
}

.user-company {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

#userList {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-right: 4px; /* dla scrolla */
}

/* ===== ROLE BADGES ===== */

.role {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 5px;
  font-weight: 500;
  text-transform: capitalize;
}

/* PRODUCENT */
.role.producent {
  background: rgba(0, 224, 164, 0.15);
  color: #00e0a4;
}

/* REŻYSER */
.role.rezyser {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

/* MONTAŻYSTA */
.role.montazysta {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

/* KLIENT */
.role.klient {
  background: rgba(245, 200, 66, 0.15);
  color: #f5c842;
}

/* DEFAULT */
.role.default {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

/* STATUS */
.status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
}

/* STATUS: ACTIVE */
.status.active {
  background: rgba(0, 224, 164, 0.2);
  color: var(--accent);
}

/* STATUS: INVITED */
.status.invited {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}
/*
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  font-weight: 600;
  color: #0f1419;
}
*/
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #d1d5db;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  font-weight: 600;
  color: #111;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.avatar-box {
  width: 200px;
  height: 200px;
  flex: none;

  border-radius: 50%;
  overflow: hidden;

  background: var(--bg-hover);
  border: 1px solid var(--border);

  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

/* BUTTON – zielony jak primary */
.upload-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition-fast);
  display: inline-flex;
  justify-content: center;
}

.upload-btn:hover {
  background: var(--accent-hover);
}

.context-menu {
  display: none;
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 0;
  z-index: 9999;
  min-width: 160px;
  cursor: pointer;
}

/* =================================================
   9. PANEL (SLIDE)
=================================================== */

.slide-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100%;

  background: var(--bg-card);
  border-left: 1px solid var(--border);

  transition: var(--transition-smooth);
}

.slide-panel.open {
  right: 0;
}

.panel-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);

  display: flex;
  justify-content: space-between;
}

.panel-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.contact-switch {
  width: fit-content;
}

input:disabled {
  background: #0d1117;
  color: var(--text-secondary);
  border-color: #1f2937;

  cursor: not-allowed;
  opacity: 0.6;
}

input:disabled::placeholder {
  color: #6b7280;
}

#personFields {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

#personFields input:disabled {
  opacity: 0.4;
}


/* =================================================
   10. SCROLLBAR
=================================================== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: #2a3440;
  border-radius: 10px;
}


/* =================================================
   11. ANIMATIONS
=================================================== */

#toggleIcon {
  transition: opacity 0.5s ease;
}

#toggleIcon.fade-out {
  opacity: 0;
}


/* =================================================
   12. NEW PROJECT: STEPS
=================================================== */

.step {
  opacity: 0.5;
}

.step.active {
  opacity: 1;
  font-weight: bold;
}

.step.done {
  opacity: 1;
  color: green;
}

textarea {
  font-family: inherit;
  resize: vertical;
}

small {
  font-size: 12px;
  color: var(--text-secondary);
}

select, input[type="time"], input[type="number"] {
  width: 100%;
}

.is-saving {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0,224,164,0.3);
}

.status.production { color: #3b82f6; }
.status.completed { color: var(--accent); }
.status.draft { color: var(--text-secondary); }


/* =================================================
   13. LOGO - <RC> RICHERT CODE SYSTEMS
=================================================== */
/* ===== SIDEBAR FOOTER ===== */

.sidebar {
  display: flex;
  flex-direction: column;
}

.nav {
  flex: 1;
}

/* footer na dole */
.sidebar-footer {
  padding: 16px 12px;
  font-size: 11px;
  color: #6B7280;
  opacity: 0.7;
}

/* RC */
.sidebar-footer .rc {
  font-weight: 600;
  margin-right: 6px;
}

/* pełna wersja */
.brand-full {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* mini wersja (centered) */
.brand-mini {
  display: none;
  justify-content: center;
}

/* ===== COLLAPSED MODE ===== */

.layout.collapsed .brand-full {
  display: none;
}

.layout.collapsed .brand-mini {
  display: flex;
}

/* opcjonalnie — jeszcze bardziej subtelnie */
.layout.collapsed .sidebar-footer {
  opacity: 0.6;
}


/* =================================================
   14. LOGIN CENTER PANEL
=================================================== */

.login-page {
  margin: 0;
  height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* wrapper może zostać, ale nie musi */
.login-center {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-panel {
  width: 380px;              /* było ~320 */
  padding: 40px 32px;        /* więcej powietrza */

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;

  display: flex;
  flex-direction: column;
  gap: 0px;                 /* globalny odstęp */

  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

/* LOGO */

.login-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: -160px;
  margin-top: -180px;
}

.login-logo img {
  /*max-width: 220px; */         /* większe logo */
  /*max-height: 100px; */
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* FORM */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;                 /* odstępy między inputami */
}

/* INPUT GROUP */

.input-icon-group {
  position: relative;
  width: 100%;
}

/* 🔥 KLUCZOWE – żeby NIE wychodziło */

.input-icon-group input {
  width: 100%;
  height: 46px;

  box-sizing: border-box;    /* 🔥 naprawia overflow */

  padding: 0 20px 0 48px;

  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;

  color: var(--text-primary);
  font-size: 14px;
}

/* IKONA */

.input-icon {
  position: absolute;
  top: 50%;
  left: 14px;

  transform: translateY(-50%);

  width: 20px;
  height: 20px;

  opacity: 0.7;
  pointer-events: none;
}

/* FOCUS */

.input-icon-group:focus-within input {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,224,164,0.15);
}

.input-icon-group:focus-within .input-icon {
  opacity: 1;
}

/* OPCJE (checkbox + reset) */

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;

  font-size: 14px;
  margin-top: 4px;
}

/* BUTTON */

.login-btn {
  width: 100%;
  height: 46px;

  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
}


/* =================================================
   15. AUTOSAVE
=================================================== */

.autosave-toast {
  position: fixed;
  top: 20px;
  right: 20px;

  background: #222;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;

  font-size: 12px;
  opacity: 0;
  pointer-events: none;

  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 9999;
}

.autosave-toast.show {
  opacity: 0.9;
  transform: translateY(0);
}

.autosave-toast.success { background: #2ecc71; }
.autosave-toast.error { background: #e74c3c; }
.autosave-toast.pending { background: #f39c12; }


/* =================================================
   16. NEW PROJECT: STEP 1-7
=================================================== */

/* ===== HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xxl);
}

.page-header-text h1 {
  font-size: 26px;
  font-weight: 600;
}

.page-header-text p {
  color: var(--text-secondary);
}

.back-btn {
  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: var(--bg-hover);
  border: 1px solid var(--border);

  color: var(--text-primary);
  font-size: 18px;

  text-decoration: none;
  cursor: pointer;

  transition: var(--transition-fast);
}

.back-btn:hover {
  background: #1f2a36;
  border-color: var(--accent);
  transform: translateX(-2px);
}

.back-btn:active {
  transform: scale(0.95);
}


/* ===== CARD ===== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;

  padding: var(--space-xl);

  display: flex;
  flex-direction: column;
  gap: var(--space-md);

  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  transition: var(--transition-fast);
}

.form-card:hover {
  border-color: var(--accent);
}

.form-card-header h2 {
  margin-bottom: 4px;
}

.form-card input,
.form-card select,
.form-card textarea {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);

  border-radius: 8px;
  padding: var(--space-md);

  transition: var(--transition-fast);
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,224,164,0.15);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

/* ===== GRID ===== */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.three-cols {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ===== FORM ===== */
.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: span 2;
}

label {
  font-size: 12px;
  margin-bottom: 4px;
}

.required {
  color: orange;
}

input, select, textarea {
  padding: 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  color: white;
}

textarea {
  min-height: 120px;
  resize: none;
}

small {
  color: #777;
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.link-btn {
  background: none;
  border: none;
  color: #4ea1ff;
  margin-top: 6px;
  text-align: left;
  cursor: pointer;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent);
  color: #000;

  padding: var(--space-sm) var(--space-lg);
  border-radius: 8px;

  font-weight: 500;

  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th, .table td {
  padding: 10px;
  border-bottom: 1px solid #2a2a2a;
  text-align: left;
}

.space-between {
  display: flex;
  justify-content: space-between;
}

.green {
  color: #00c853;
}

.blue {
  color: #2196f3;
}


/* =================================================
   17. NEW PROJECT: RIGHT PANEL STAGES
=================================================== */

.steps-panel {
  width: 320px;
  color: white;
}

.steps-list {
  margin-top: 20px;
}

/* STEP = RZĄD */
.step {
  display: flex;
  align-items: flex-start;
  position: relative;
  margin-bottom: 28px;
}

/* LINIA */
.step::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 32px;
  width: 2px;
  height: calc(100% + 8px);
  background: #1f2937;
  transition: background 0.3s ease;
}

.step:last-child::before {
  display: none;
}

/* KOŁO */
.circle {
  min-width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  z-index: 2;
  box-shadow: 0 0 0 3px #0f172a;
  transition: all 0.3s ease;
}

/* TEKST */
.content {
  margin-left: 12px;
}

.title {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.desc {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

/* DONE */
.step.done .circle {
  background: #22c55e;
  color: black;
}

.step.done::before {
  background: #22c55e;
}

/* ACTIVE */
.step.active .circle {
  background: #3b82f6;
  color: white;
}

.step.active::before {
  background: #3b82f6;
}

/* NEXT */
.step.next .circle {
  background: #1f2937;
  color: white;
}

.step.next::before {
  background: #1f2937;
}



/* =================================================
   18. LOGIN AVATAR + NAME + LOGOUT
=================================================== */


.avatar-header {
  background: #d1d5db;
  color: #111;
}

/* ===== USER MENU (HEADER) ===== */

.user-menu {
  position: relative;
  cursor: pointer;
}

/* GŁÓWNY BLOK USERA */
.user-box {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 6px 12px;
  border-radius: 8px;

  background: #f3f4f6;       /* 🔥 jasny szary */
  border: 1px solid #d1d5db;

  color: #111;               /* ciemny tekst */

  cursor: pointer;
  transition: 0.2s ease;
}

/* HOVER */
.user-box:hover {
  border-color: var(--accent);
  background: #e5e7eb;
}

/* NAZWA */
.user-name-header {
  font-size: 16px;
  font-weight: 500;
  color: #111;
}

/* ===== DROPDOWN ===== */

.user-dropdown {
  position: absolute;
  top: 110%;
  right: 0;

  min-width: 160px;

  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 10px;

  padding: 6px 0;

  display: none;
  flex-direction: column;

  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  z-index: 9999;
}

/* IKONA + TEKST */
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 6px 12px;
  font-size: 18px;/
  line-height: 1.3;

  transition: var(--transition-fast);
}

.user-dropdown .divider {
  margin: 4px 0;
}

/* ITEM */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;

  font-size: 18px;
  color: #111;

  cursor: pointer;
}

.dropdown-item:hover {
  background: #e5e7eb;
}

/* IKONY */
.dropdown-icon {
  width: 22px;
  height: 22px;
  opacity: 0.7;
}

.user-dropdown a:active {
  transform: scale(0.97);
}

.user-dropdown a:hover {
  background: var(--bg-hover);
}

/* WYLOGUJ = czerwony */
.user-dropdown .danger {
  color: var(--danger);
}

/* AKTYWNY */
.user-menu.open .user-dropdown {
  display: flex;
}

/* HOVER = podbicie */
.user-dropdown a:hover .dropdown-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* WYLOGUJ (czerwony) */
.user-dropdown .danger .dropdown-icon {
  filter: brightness(0) saturate(100%) invert(55%) sepia(68%) saturate(500%) hue-rotate(320deg);
}


/* =====================================================
   19. USERS / CLIENTS - CHANGING NAME IN ADMIN PANEL
======================================================= */

.switch {
  display: flex;
  gap: 4px;

  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(6px);

  padding: 4px;
}

/* BUTTON BASE */
.switch button {
  padding: 6px 14px;
  border-radius: 8px;

  background: transparent;
  border: none;

  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;

  cursor: pointer;

  transition: var(--transition-fast);
}

/* 🔥 ACTIVE = PREMIUM */
.switch button.active {
  background: rgba(0, 224, 164, 0.15);
  color: var(--accent);

  box-shadow:
    0 0 0 1px rgba(0,224,164,0.25),
    0 4px 12px rgba(0,224,164,0.15);
}

/* CLICK FEEDBACK */
.switch button:active {
  transform: scale(0.96);
}

/* HOVER */
.switch button:hover {
  color: var(--text-primary);
}

#userSectionTitle span {
  opacity: 0.4;
}

#userSectionTitle span.active {
  font-weight: bold;
  opacity: 1;
}

.footer-info {
  min-width: 140px;
  text-align: right;
}


/* =================================================
   20. ROLES SECTION
=================================================== */

.roles-dropdown {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  overflow: visible;
}

.roles-menu {
  position: fixed; /* 🔥 KLUCZ */
  
  display: none;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm);

  width: 240px;
  max-height: 240px;

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);

  overflow-y: auto;
  z-index: 99999; /* 🔥 NAD WSZYSTKIM */
}

.roles-menu.open {
  display: flex;
}

.role-option {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;

  cursor: pointer;
  transition: var(--transition-fast);
}

.role-option:hover {
  background: var(--bg-hover);
}

.role-option.is-selected {
  background: rgba(0, 224, 164, 0.15);
  border: 1px solid var(--accent);
}

/* =================================================
   21. PROJECT DASHBOARD
=================================================== */


.project-card {
  height: 240px;
  min-height: unset;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: var(--transition-fast);
  overflow: hidden;
}

/* 🔒 tylko w projectach */
.project-card .card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  height: 100%;
  padding: var(--space-lg);
  gap: var(--space-sm);
}

/* 🔥 tylko specjalny wariant */
.project-card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.project-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* 🔥 SELECTED — spójne z select-card */
.project-card.selected {
  background: rgba(0, 224, 164, 0.12);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(0,224,164,0.25);
}

.project-card:active {
  transform: scale(0.98);
}

.project-card h3 {
  font-size: 16px;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-danger {
  background: rgba(255, 92, 92, 0.15);
  color: var(--danger);
  border: 1px solid rgba(255, 92, 92, 0.4);

  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;

  transition: var(--transition-fast);
}

.btn-danger:hover {
  background: rgba(255, 92, 92, 0.25);
  border-color: var(--danger);
}

.btn-danger:active {
  transform: scale(0.96);
}

/* 🔒 disabled */
.btn-danger:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.modal-overlay {
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background: rgba(0,0,0,0.6);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:1000;
}

.modal {
  background:#1c2530;
  padding:20px;
  border-radius:8px;
  width:350px;
}

.filters-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-xl);
}

.filters-labels {
  display: grid;

  grid-template-columns:
    minmax(140px, 15.5%)
    minmax(110px, 7.8%)
    1fr
    90px;

  gap: 12px;

  font-size: 11px;
  color: var(--text-secondary);
  padding-left: 2px;
}

.filters-row {
  display: grid;

  grid-template-columns:
    minmax(140px, 15.5%)
    minmax(110px, 7.8%)
    1fr
    90px;

  gap: 12px;
}

.filters-row input[type="text"],
.filters-labels div:nth-child(3) {
  margin-left: 8px;
}

/* SELECT + INPUT już masz globalne — tylko dopasuj wysokość */
.filters-row select,
.filters-row input,
.filters-row button {
  height: 36px;
  box-sizing: border-box;
  padding: 0 var(--space-md);
}

.filters-row select,
.filters-row input {
  line-height: 36px;
}

/* BUTTON OK */
.filters-row button {
  padding: 0;
}

.filters-row select,
.filters-row button {
  cursor: pointer;
}

/* opcjonalnie (bardziej UX-owo poprawne) */
.filters-row input {
  cursor: text;
}

.filters-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,224,164,0.15);
}


/* =================================================
   21. PROJECT : STEP 3
=================================================== */

.step3-description {
  height: 100%;
  min-height: unset;
  resize: none;
}

#milestones_table input,
#milestones_table select {
  width: 100%;
  box-sizing: border-box;
}

#milestones_table tr:hover {
  background: rgba(255,255,255,0.02);
}

.input-error {
  border: 1px solid #ff4d4f !important;
  background: rgba(255, 77, 79, 0.08);
}

/* =================================================
   22. BUDGET TABLE
=================================================== */

.table td input {
  width: 90%;
  padding: 6px 8px;
  box-sizing: border-box;
}

.table td:first-child input {
  width: 95%;
}

.table input {
  background: #1c2530;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
  color: white;
}



/* =====================================================
   23. PROJECTS DASHBOARD V2
====================================================== */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.dashboard-title {
  font-size: 32px;
  margin-bottom: 6px;
}

.dashboard-subtitle {
  color: var(--text-secondary);
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}


/* =====================================================
   STATS
====================================================== */

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.dashboard-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;

  padding: 14px 18px;
  min-height: 92px;

  display: flex;
  align-items: center;
  gap: 18px;

  transition: var(--transition-fast);
}

.dashboard-stat-card:hover {
  border-color: var(--accent);
}

.dashboard-stat-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 28px;
  font-weight: bold;
}

.dashboard-stat-icon.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.dashboard-stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.dashboard-stat-icon.orange {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.dashboard-stat-icon.green {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.dashboard-stat-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.dashboard-stat-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-stat-number {
  font-size: 32px;
  font-weight: 700;
}

.dashboard-stat-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.dashboard-stat-info.warning {
  color: #f59e0b;
}


/* =====================================================
   TABS
====================================================== */

.dashboard-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}

.dashboard-tab {
  background: transparent;
  border: none;

  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;

  padding: 0 0 10px 0;

  border-bottom: 2px solid transparent;
  border-radius: 0;

  transition: var(--transition-fast);
}

.dashboard-tab:hover {
  color: var(--text-primary);
  background: transparent;
}

.dashboard-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.dashboard-tab-count {
  margin-left: 6px;
  opacity: 0.7;
}


/* =====================================================
   FEATURED PROJECTS
====================================================== */
/*
.featured-projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
*/
.featured-project-card {

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;

  padding: 10px 14px 0 14px;

  display: flex;
  align-items: flex-start;

  gap: 14px;
  min-height: 160px;
  height: 180px;

  overflow: hidden;
  position: relative;

  transition: var(--transition-fast);
}

.featured-project-card:hover {
  border-color: var(--accent);
}

.featured-project-card.selected {
  border-color: var(--accent);
  background: rgba(0,224,164,0.08);
}

.featured-project-image-wrapper {
  flex-shrink: 0;
}


/* =====================================================
   IMAGE
====================================================== */

.featured-project-image {

  width: 92px;
  height: 92px;

  border-radius: 14px;

  background: linear-gradient(
    135deg,
    rgba(0,224,164,0.18),
    rgba(59,130,246,0.18)
  );

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 30px;
  font-weight: bold;
}

.featured-project-content {

  flex: 1;

  display: flex;
  flex-direction: column;

  justify-content: space-between;

  min-width: 0;

  width: 100%;
  height: 100%;
}


/* =====================================================
   PROJECT NAME
====================================================== */

.featured-project-name {

  font-size: 20px;
  font-weight: 700;

  line-height: 1.2;

  overflow: hidden;
  text-overflow: ellipsis;

  white-space: nowrap;
  
  width: 100%;
  margin-bottom: 0;
}

/* =====================================================
   TOP
====================================================== */

.featured-project-top {

  display: flex;

  gap: 10px;

  align-items: flex-start;
}


/* =====================================================
   LEFT COLUMN
====================================================== */

.featured-project-left {

  display: flex;
  flex-direction: column;

  align-items: flex-start;
  gap: 20px;

  flex-shrink: 0;
}


/* =====================================================
   RIGHT COLUMN
====================================================== */

.featured-project-right {

  display: flex;
  flex-direction: column;

  justify-content: flex-start;

  min-width: 0;

  padding-top: 4px;

  gap: 10px;
}

.featured-project-client {
  margin-top: -2px;
  margin-bottom: 2px;
  
  font-size: 15px;

  color: var(--text-secondary);

  overflow: hidden;
  text-overflow: ellipsis;

  white-space: nowrap;
}

.featured-project-status-row {
  margin-top: 0;
}

.featured-project-progress-wrapper {
  margin-top: 8px;
  margin-bottom: 0;
  padding-bottom: 0;
}

.featured-project-updated {
  margin-top: 2px;
}

.featured-project-progress-top {
  display: flex;
  justify-content: flex-end;
  font-size: 12px;
  margin-bottom: 4px;
}

.featured-project-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #1f2937;
  overflow: hidden;
}

.featured-project-progress-fill {
  height: 100%;
  border-radius: 999px;
  position: relative;
}

.featured-project-progress-fill span {
  position: absolute;
  right: 0; /* Umieszcza procent po prawej stronie */
  padding-right: 8px;
  font-size: 10px;
  color: white;
  font-weight: bold;
}

.featured-project-updated {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}


/* =====================================================
   FILTERS
====================================================== */

.dashboard-filters {
  display: grid;

  grid-template-columns:
    1fr
    1fr
    1fr
    1fr
    1fr;

  gap: 12px;

  width: 50%;

  margin-bottom: 16px;
}

.dashboard-filters select,
.dashboard-filters button {
  height: 44px;
  width: 100%;
}


/* =====================================================
   TABLE
====================================================== */

.dashboard-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;

  overflow: hidden;
}

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

.dashboard-table thead {
  background: rgba(255,255,255,0.02);
}

.dashboard-table th {
  text-align: left;

  padding: 12px 16px;

  font-size: 13px;
  font-weight: 700;

  color: var(--text-secondary);

  border-bottom: 1px solid var(--border);

  cursor: pointer;
  user-select: none;
}

.dashboard-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.dashboard-table td:first-child {
  padding-right: 4px;
}

.dashboard-table td:nth-child(2) {
  padding-left: 4px;
  padding-right: 4px;
}

.dashboard-table-row {
  transition: var(--transition-fast);
  cursor: pointer;
}

.dashboard-table-row:hover {
  background: rgba(255,255,255,0.02);
}

.dashboard-table-row.selected {
  background: rgba(0,224,164,0.08);
}


/* =====================================================
   TABLE PROJECT CELL
====================================================== */

.table-project-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-project-image {
  width: 52px;
  height: 52px;
  border-radius: 12px;

  background: linear-gradient(
    135deg,
    rgba(0,224,164,0.18),
    rgba(59,130,246,0.18)
  );

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: bold;
  font-size: 18px;
}

.table-project-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.table-project-name {
  font-weight: 600;
}

.table-project-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}


/* =====================================================
   STATUS
====================================================== */

.project-status-badge {
  padding: 6px 12px;
  border-radius: 999px;

  font-size: 12px;
  font-weight: 600;

  text-transform: capitalize;
}

.project-status-badge.production {
  background: rgba(59,130,246,0.15);
  color: #3b82f6;
}

.project-status-badge.completed {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.project-status-badge.draft {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}

.project-status-badge.overdue {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}

.project-status-badge.post-production {
  background: rgba(168,85,247,0.15);
  color: #a855f7;
}


/* =====================================================
   PROGRESS
====================================================== */

.table-progress-wrapper {
  min-width: 140px;
}

.table-progress-top {
  display: flex;
  justify-content: flex-end;

  font-size: 12px;
  margin-bottom: 6px;
}

.table-progress-bar {
  height: 8px;
  background: #1f2937;
  border-radius: 999px;
  overflow: hidden;
}

.table-progress-fill {
  height: 100%;
  border-radius: 999px;
}

.table-progress-fill.production,
.featured-project-progress-fill.production {
  background: #3b82f6;
}

.table-progress-fill.completed,
.featured-project-progress-fill.completed {
  background: #22c55e;
}

.table-progress-fill.overdue,
.featured-project-progress-fill.overdue {
  background: #f59e0b;
}

.table-progress-fill.post-production,
.featured-project-progress-fill.post-production {
  background: #a855f7;
}

.table-progress-fill.draft,
.featured-project-progress-fill.draft {
  background: #6b7280;
}


/* =====================================================
   PIN BUTTON
====================================================== */

.table-pin-btn {
  background: transparent;
  border: none;

  color: var(--text-secondary);

  font-size: 24px;
  font-weight: 700;

  line-height: 1;

  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition: var(--transition-fast);
}

.table-pin-btn:hover {
  background: transparent;
  color: #f5c842;
}

.table-pin-btn.active {
  color: #f5c842;
}


/* =====================================================
   AVATAR STACK
====================================================== */

.avatar-stack {
  display: flex;
  align-items: center;
}

.stack-avatar {
  margin-left: -10px;
  border: 2px solid var(--bg-card);

  width: 34px;
  height: 34px;

  font-size: 12px;
}

.stack-avatar:first-child {
  margin-left: 0;
}

.more-avatar {
  background: #1f2937;
  color: white;
}


/* =====================================================
   ACTION BUTTON
====================================================== */

.table-actions-btn {
  background: transparent;
  border: none;

  color: var(--text-secondary);
  font-size: 22px;

  padding: 0;
}

.table-actions-btn:hover {
  background: transparent;
  color: white;
}


/* =====================================================
   PAGINATION
====================================================== */

.dashboard-pagination-wrapper {
  display: flex;
  justify-content: flex-end;

  margin-top: 24px;
}

.dashboard-pagination {
  display: flex;
  gap: 8px;
}

.dashboard-pagination button {
  width: 40px;
  height: 40px;

  border-radius: 10px;

  background: var(--bg-card);
  border: 1px solid var(--border);

  color: var(--text-primary);
}

.dashboard-pagination button.active {
  background: rgba(0,224,164,0.15);
  border-color: var(--accent);
  color: var(--accent);
}


/* =====================================================
   MODAL
====================================================== */

.modal-actions {
  margin-top: 20px;

  display: flex;
  justify-content: flex-end;
  gap: 10px;
}


/* =====================================================
   RESPONSIVE
====================================================== */

@media (max-width: 1600px) {

  .featured-projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.featured-project-empty-slot {
  background: rgba(255,255,255,0.02);

  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: 16px;

  min-height: 180px;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 14px;

  transition: var(--transition-fast);
}

.btn-secondary {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);

  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;

  transition: var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: #1f2a36;
}

.dashboard-stat-info.clickable {
  cursor: pointer;
}

.dashboard-stat-info.clickable:hover {
  text-decoration: underline;
}

.project-checkbox,
#selectAllProjects {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.featured-project-empty-slot.drag-over {
  border-color: var(--accent);

  background: rgba(0,224,164,0.08);

  transform: scale(1.02);
}
/*
#recentProjectsContainer,
#pinnedProjectsContainer {
  width: 100%;

  display: grid;

  grid-template-columns: repeat(4, 1fr);

  gap: 16px;
}
*/


/* =====================================================
   FEATURED PROJECTS CONTAINERS
====================================================== */

#recentProjectsContainer,
#pinnedProjectsContainer {

  width: 100%;

  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}


/* =====================================================
   FEATURED PROJECT CARD
====================================================== */

.featured-project-card,
.featured-project-empty-slot {

  width: 100%;
  min-width: 0;

  box-sizing: border-box;

}


/* =====================================================
   PROJECT NAME FIX
====================================================== */

.dashboard-tabs-wrapper {

  display: flex;
  align-items: center;

  gap: 10px;

  margin-bottom: 10px;
}

.dashboard-collapse-btn {

  background: transparent;
  border: none;

  color: var(--text-primary);

  font-size: 20px;
  font-weight: 700;

  width: 24px;
  height: 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  cursor: pointer;
}

.dashboard-collapse-btn:hover {
  background: transparent;
  color: var(--accent);
}

/* =====================================================
   UNPIN BUTTON
====================================================== */

.unpin-project-btn {

  position: absolute;

  top: 10px;
  right: 10px;

  width: 28px;
  height: 28px;

  border-radius: 50%;

  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);

  color: var(--text-secondary);

  font-size: 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;

  transition: var(--transition-fast);

  z-index: 5;
}

.featured-project-card:hover .unpin-project-btn {
  opacity: 1;
}

.unpin-project-btn:hover {

  background: rgba(239,68,68,0.12);

  border-color: rgba(239,68,68,0.3);

  color: #ef4444;
}

/* =================================================
   24. SCHEDULE
=================================================== */

.schedule-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-title {
  font-size: 24px;
  font-weight: 600;
}

.calendar-nav-btn {
  width: 40px;
  height: 40px;
}

.schedule-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.calendar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 10px;
}

.calendar-weekday {
  padding: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.calendar-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.calendar-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;

  min-height: 150px;

  padding: 10px;

  display: flex;
  flex-direction: column;

  transition: var(--transition-fast);

  cursor: pointer;
}

.calendar-day:hover {
  border-color: var(--accent);
}

.calendar-day.today {
    outline: 2px solid #f59e0b;
    outline-offset: -2px;
}

.calendar-day.selected {
  background: rgba(0,224,164,0.08);
}

.calendar-day.other-month {
  opacity: 0.35;
}

.calendar-day-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.calendar-day-number {
  font-size: 14px;
  font-weight: 600;
}

.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  min-height: 0;
  overflow-y: auto;
}

.calendar-event {
  min-height: 24px;

  border-radius: 8px;

  padding: 4px 8px;

  display: flex;
  align-items: center;

  font-size: 12px;
  font-weight: 500;

  color: white;

  cursor: grab;

  transition: var(--transition-fast);
}

.calendar-event:hover {
  transform: scale(1.02);
}

.calendar-event:active {
  cursor: grabbing;
}

.calendar-event-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar-event-line {
    width: 100%;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.schedule-right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.right-panel-header h2 {
  margin-bottom: 6px;
}

.day-events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-event-card {
  background: var(--bg-card);

  border: 1px solid var(--border);

  border-radius: 12px;

  padding: 12px;

  display: flex;
  align-items: center;
  gap: 12px;

  cursor: pointer;

  transition: var(--transition-fast);
}

.day-event-card:hover {
  border-color: var(--accent);
}

.event-color {
  width: 10px;
  height: 40px;
  border-radius: 999px;
}

.day-event-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-event-title {
  font-weight: 600;
}

.day-event-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.add-event-btn {
  margin-top: auto;
}

.slide-panel {
  z-index: 2000;
}

.calendar-event-inner {
  display: flex;
  align-items: center;
  gap: 6px;

  min-width: 0;
}

.calendar-event-time {
  font-size: 11px;
  opacity: 0.85;
  flex-shrink: 0;
}

.calendar-day.drag-target {
  border-color: var(--accent);
  background: rgba(0,224,164,0.08);
}

.empty-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 12px;

  opacity: 0.5;

  padding: 40px 20px;
  text-align: center;
}

.schedule-right-panel {
  position: sticky;
  top: 0;
}

.calendar-grid {
  transition: opacity 0.2s ease;
}


/* =================================================
   SCHEDULE PARTICIPANTS
=================================================== */

.participants-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.participant-pill {

  display: flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;

  border-radius: 999px;

  background: var(--bg-hover);

  border: 1px solid var(--border);

  cursor: pointer;

  transition: var(--transition-fast);
}

.participant-pill:hover {
  border-color: var(--accent);
}

.participant-pill.active {

  background: rgba(0,224,164,0.12);

  border-color: var(--accent);
}

.participant-avatar,
.mini-avatar {

  width: 24px;
  height: 24px;

  border-radius: 50%;

  overflow: hidden;

  background: #d1d5db;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 11px;
  font-weight: 600;

  color: #111;
}

.participant-avatar img,
.mini-avatar img {

  width: 100%;
  height: 100%;

  object-fit: cover;
}

.calendar-event-participants {

  display: flex;
  margin-top: 4px;
}

.mini-avatar {
  margin-left: -6px;
  border: 2px solid var(--bg-card);
}

.mini-avatar:first-child {
  margin-left: 0;
}

.day-event-location {

  font-size: 12px;

  color: var(--text-secondary);
}

.event-status-badge {

  width: fit-content;

  margin-top: 6px;

  padding: 4px 8px;

  border-radius: 999px;

  font-size: 11px;
  font-weight: 600;

  text-transform: capitalize;
}

.event-status-badge.planned {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
}

.event-status-badge.confirmed {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
}

.event-status-badge.completed {
  background: rgba(59,130,246,0.15);
  color: #3b82f6;
}

.event-status-badge.cancelled {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

/* =================================================
   PARTICIPANTS DROPDOWN
=================================================== */

.participants-dropdown-trigger {

  width: 100%;

  min-height: 44px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 14px;

  background: var(--bg-card);

  border: 1px solid var(--border);

  border-radius: 12px;

  cursor: pointer;

  transition: var(--transition-fast);
}

.participants-dropdown-trigger:hover {
  border-color: var(--accent);
}

.participants-dropdown {

  margin-top: 10px;

  display: flex;
  flex-direction: column;

  gap: 4px;

  max-height: 260px;

  overflow-y: auto;

  padding: 10px;

  border-radius: 12px;

  background: var(--bg-card);

  border: 1px solid var(--border);
}

.participant-checkbox-row {

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 8px 10px;

  border-radius: 10px;

  cursor: pointer;

  transition: var(--transition-fast);
}

.participant-checkbox-row:hover {
  background: rgba(255,255,255,0.04);
}

.participant-list-user {

  display: flex;
  align-items: center;

  gap: 10px;
}


/* =================================================
   PARTICIPANTS SYSTEM V1
=================================================== */

.participant-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.participant-group {

  border: 1px solid var(--border);

  border-radius: 14px;

  overflow: hidden;

  background: var(--bg-card);
}

.participant-role-header {

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 14px;

  background: rgba(255,255,255,0.03);
}

.participant-role-left {

  display: flex;
  align-items: center;

  gap: 10px;
}

.role-expand-btn {

  border: none;
  background: transparent;

  color: var(--text-primary);

  cursor: pointer;
}

.participant-users {

  display: flex;
  flex-direction: column;

  padding: 8px;
}

.participant-row {

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 10px 12px;

  border-radius: 10px;

  cursor: pointer;

  transition: var(--transition-fast);
}

.participant-row:hover {
  background: rgba(255,255,255,0.04);
}

.participant-user {

  display: flex;
  align-items: center;

  gap: 10px;
}

.participant-avatar {

  width: 28px;
  height: 28px;

  border-radius: 50%;

  overflow: hidden;

  background: rgba(255,255,255,0.08);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 11px;
  font-weight: 600;
}

.participant-avatar img {

  width: 100%;
  height: 100%;

  object-fit: cover;
}

.entire-team-row {

  margin-bottom: 14px;

  border: 1px solid var(--border);

  border-radius: 12px;

  background: rgba(0,224,164,0.06);
}


.btn-edit-event {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; padding: 0.25rem;
    opacity: 0.4; transition: opacity 0.15s; flex-shrink: 0;
}
.btn-edit-event:hover { opacity: 1; }

.slide-panel-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.3); z-index: 99;
}

.input-error { border-color: red !important; }
.field-error { color: red; font-size: 0.75rem; display: block; margin-top: 2px; }
.empty-state { color: #888; text-align: center; padding: 2rem 0; font-size: 0.9rem; }
.right-panel-root { height: 100%; display: flex; flex-direction: column; }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(72%) sepia(98%) saturate(400%) hue-rotate(115deg) brightness(95%);
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: all;
    filter: grayscale(50%);
}

/* =================================================
   25. PROJECT FILES
=================================================== */

[x-cloak] {
  display: none !important;
}

.files-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.7fr) minmax(260px, 1.3fr);
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.files-toolbar .form-group {
  gap: 6px;
}

.files-toolbar select,
.files-toolbar input {
  width: 100%;
  height: 42px;
  box-sizing: border-box;
}

.files-summary-row {
  min-height: 24px;
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 13px;
}

.files-table-wrapper {
  flex: 1;
  min-height: 360px;
  max-height: calc(100vh - 285px);
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.files-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

.files-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 14px;
  text-align: left;
  color: var(--text-secondary);
  background: #151b22;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.files-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
  color: var(--text-primary);
  font-size: 13px;
}

.files-table-row {
  cursor: pointer;
  transition: var(--transition-fast);
}

.files-table-row:hover {
  background: rgba(255,255,255,0.025);
}

.files-table-row.selected {
  background: rgba(0,224,164,0.08);
  box-shadow: inset 3px 0 0 var(--accent);
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.file-type-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,224,164,0.12);
  border: 1px solid rgba(0,224,164,0.25);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.file-name {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.file-mime {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
}

.file-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.file-category-badge.casting {
  background: rgba(168,85,247,0.14);
  color: #c084fc;
}

.file-category-badge.callsheet {
  background: rgba(59,130,246,0.14);
  color: #60a5fa;
}

.file-category-badge.script {
  background: rgba(245,158,11,0.14);
  color: #fbbf24;
}

.file-category-badge.storyboard {
  background: rgba(34,197,94,0.14);
  color: #4ade80;
}

.files-actions-column {
  min-width: 260px;
}

.files-actions-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.files-actions-cell button,
.files-action-link {
  padding: 7px 10px;
  font-size: 12px;
  text-decoration: none;
  box-sizing: border-box;
}

.files-modal {
  width: min(680px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-sizing: border-box;
  border: 1px solid var(--border);
}

.files-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.files-modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 22px;
}

.files-upload-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.files-upload-form input,
.files-upload-form select {
  width: 100%;
  box-sizing: border-box;
}

.files-recipient-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.files-recipient-actions {
  display: flex;
  gap: var(--space-sm);
}

.files-recipient-actions .link-btn {
  margin: 0;
  padding: 0;
  font-size: 12px;
}

.files-recipient-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.files-recipient-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.files-recipient-row:hover {
  background: var(--bg-hover);
}

.files-recipient-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.files-recipient-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.files-recipient-meta strong,
.files-recipient-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-recipient-meta span {
  color: var(--text-secondary);
  font-size: 11px;
}

.files-form-error {
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .files-toolbar {
    grid-template-columns: 1fr;
  }

  .files-table-wrapper {
    max-height: none;
  }
}

.files-file-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.files-file-link:hover .files-file-link-name {
  color: var(--accent);
  text-decoration: underline;
}

.files-file-link:focus-visible {
  border-radius: 6px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.files-file-link-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  transition:
    color 0.15s ease,
    text-decoration-color 0.15s ease;
}


/* =================================================
   26. FILES - FOLDER EXPLORER
=================================================== */
[x-cloak] { display: none !important; }

.project-files-page {
    --files-folder-size: 112px;
    --files-folder-gap: 14px;
    --files-folders-width:
        calc(
            5 * var(--files-folder-size) +
            4 * var(--files-folder-gap)
        );

    display: flex;
    flex-direction: column;
}

.files-project-selector {
    width: var(--files-folders-width);
    max-width: 100%;

    margin-bottom: 24px;
}

.files-project-selector select {
    width: 100%;
    box-sizing: border-box;

    font-family:
        "Courier New",
        Consolas,
        monospace;

    font-variant-numeric: tabular-nums;
}

.files-folders-row {
    display: grid;
    grid-template-columns:
        repeat(5, var(--files-folder-size));

    justify-content: start;
    align-items: start;

    gap: var(--files-folder-gap);

    width: var(--files-folders-width);
    max-width: 100%;

    margin-bottom: 28px;
}

.files-folder-tile {
    position: relative;
    display: flex;
    flex-direction: column;

    width: 112px;
    height: 112px;
    min-width: 112px;

    padding: 9px;
    box-sizing: border-box;

    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.012)
        );

    transition:
        border-color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.files-folder-tile:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.055),
            rgba(255, 255, 255, 0.018)
        );
}

.files-folder-tile.is-selected {
    border-color: var(--accent);
    background: rgba(0, 224, 164, 0.06);
    box-shadow:
        0 0 0 1px rgba(0, 224, 164, 0.12),
        0 14px 35px rgba(0, 0, 0, 0.22);
}

.files-folder-title {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 28px;
    margin: 0 0 7px;

    overflow: hidden;

    color: var(--text-primary);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.1;
    text-align: center;
    letter-spacing: 0.01em;
}

.files-folder-card {
    position: relative;

    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;

    width: 100%;
    min-height: 0;

    padding: 14px 9px 8px;
    box-sizing: border-box;

    overflow: visible;

    border: 1px solid rgba(93, 135, 166, 0.55);
    border-radius: 7px 7px 9px 9px;

    color: var(--text-primary);

    background:
        linear-gradient(
            145deg,
            #2d4659,
            #233845
        );

    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.22);

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.files-folder-card:hover {
    border-color: rgba(110, 168, 205, 0.9);
    background:
        linear-gradient(
            145deg,
            #36566d,
            #294455
        );
}

.files-folder-card.is-open {
    border-color: var(--accent);
    color: #071a16;
    background:
        linear-gradient(
            145deg,
            #27ddb0,
            #12b98f
        );
    box-shadow:
        0 12px 30px rgba(0, 224, 164, 0.22);
}

.files-folder-card.drag-over {
    border-color: var(--accent);
    outline: 2px dashed var(--accent);
    outline-offset: 5px;
    background:
        linear-gradient(
            145deg,
            #375f6d,
            #294b56
        );
}

.files-folder-card-all {
    background:
        linear-gradient(
            145deg,
            #3c4656,
            #2c3542
        );
    border-color: rgba(151, 164, 184, 0.52);
}

.files-folder-card-all:hover {
    background:
        linear-gradient(
            145deg,
            #4a5668,
            #343f4e
        );
    border-color: rgba(174, 190, 214, 0.75);
}

.files-folder-card-all.is-open {
    border-color: var(--accent);
    color: #071a16;
    background:
        linear-gradient(
            145deg,
            #27ddb0,
            #12b98f
        );
}

.files-folder-tab {
    position: absolute;
    top: -7px;
    left: -1px;

    width: 44%;
    height: 13px;

    box-sizing: border-box;

    border: inherit;
    border-bottom: 0;
    border-radius: 5px 7px 0 0;

    background: inherit;
}

.files-folder-count {
    position: relative;
    z-index: 1;

    font-size: 19px;
    font-weight: 800;
    line-height: 1;
}

.files-folder-count-label {
    position: relative;
    z-index: 1;

    margin-top: 2px;

    font-size: 9px;
    font-weight: 600;
    opacity: 0.72;
}

.files-category-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 8px;
    border: 1px solid rgba(0, 224, 164, 0.22);
    border-radius: 999px;
    color: var(--accent);
    background: rgba(0, 224, 164, 0.07);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.files-explorer-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; min-height: 420px; margin-top: 0;}
.files-explorer-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.files-explorer-actions { display: flex; gap: 10px; }
.files-hidden-input { display: none; }
.files-open-folder-dropzone { margin: 16px 20px 0; padding: 14px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; color: var(--text-secondary); transition: var(--transition-fast); }
.files-open-folder-dropzone.drag-over { border-color: var(--accent); background: rgba(0,224,164,.08); color: var(--text-primary); }

.files-explorer-table-wrapper { overflow: auto; max-height: 520px; margin-top: 14px; }
.files-explorer-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.files-explorer-table thead { position: sticky; top: 0; z-index: 4; background: #18212a; }
.files-explorer-table th, .files-explorer-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); }
.files-explorer-table th { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.files-explorer-table tbody tr:hover { background: rgba(255,255,255,.025); }
.files-explorer-table tbody tr.selected { background: rgba(0,224,164,.08); }
.files-checkbox-column { width: 38px; }
.files-table-actions-column { width: 190px; }
.files-name-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.files-type-icon { min-width: 38px; height: 32px; border-radius: 7px; background: var(--bg-hover); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: var(--accent); }
.files-row-actions { display: flex; gap: 8px; }
.files-row-actions a { text-decoration: none; display: inline-flex; align-items: center; }

.files-slide-panel { width: 520px; right: -540px; z-index: 2100; }
.files-slide-panel.open { right: 0; }
.files-panel-close { background: transparent; color: var(--text-primary); font-size: 26px; padding: 0 8px; }
.files-panel-close:hover { background: transparent; color: var(--accent); }
.files-upload-panel-body { height: calc(100% - 75px); box-sizing: border-box; overflow-y: auto; padding-bottom: 90px; }
.files-pending-list { display: flex; flex-direction: column; gap: 14px; }
.files-pending-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: rgba(255,255,255,.02); }
.files-pending-file-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.files-pending-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.files-pending-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-pending-name span { font-size: 12px; color: var(--text-secondary); }
.files-users-dropdown { position: relative; }
.files-users-dropdown .participants-dropdown { max-height: 220px; }
.files-panel-footer { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 16px; background: var(--bg-card); border-top: 1px solid var(--border); }
.files-access-users { max-height: calc(100vh - 250px); }
.files-form-error { color: var(--danger); }

@media (max-width: 1300px) {
    .files-folders-row {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
}

@media (max-width: 900px) {
    .files-folders-row {
        grid-template-columns: repeat(2, minmax(145px, 1fr));
    }
}

@media (max-width: 560px) {
    .files-folders-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .files-folder-tile {
        padding: 12px;
        border-radius: 14px;
    }

    .files-folder-title {
        min-height: 34px;
        margin-bottom: 12px;
        font-size: 12px;
    }

    .files-folder-count {
        font-size: 26px;
    }
}

.files-project-selector select {
    font-family:
        "Courier New",
        Consolas,
        monospace;
    font-variant-numeric: tabular-nums;
}



/* =================================================
   MOBILE PROJECTS
=================================================== */

.mobile-projects-page {
  width: 100%;
  max-width: 720px;
  height: 100%;
  margin: 0 auto;

  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mobile-projects-header {
  margin-bottom: 14px;
}

.mobile-projects-sort {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;

  min-height: 42px;
  margin-bottom: 12px;

  border-bottom: 1px solid var(--border);
}

.mobile-sort-option {
  padding: 8px 0;

  border: 0;
  border-radius: 0;
  background: transparent;

  color: #f5c842;
  font-size: 14px;
  font-weight: 700;

  cursor: pointer;
}

.mobile-sort-option:hover {
  background: transparent;
  color: #ffb347;
}

.mobile-sort-option.is-active {
  color: #ff8c1a;
}

.mobile-projects-list {
  --mobile-project-row-height: 104px;

  height: calc(var(--mobile-project-row-height) * 5 + 48px);
  max-height: calc(var(--mobile-project-row-height) * 5 + 48px);

  display: flex;
  flex-direction: column;
  gap: 10px;

  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;

  padding-right: 4px;
  padding-bottom: 8px;
}

.mobile-project-row {
  width: 100%;
  min-height: var(--mobile-project-row-height);
  height: var(--mobile-project-row-height);

  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;

  padding: 10px 12px;

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;

  color: var(--text-primary);
  text-align: left;

  flex-shrink: 0;
}

.mobile-project-row:hover,
.mobile-project-row:focus-visible {
  background: var(--bg-hover);
  border-color: var(--accent);
  outline: none;
}

.mobile-project-row:active {
  transform: scale(0.99);
}

.mobile-project-image {
  width: 82px;
  height: 82px;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(0, 224, 164, 0.18),
    rgba(59, 130, 246, 0.18)
  );

  color: var(--text-primary);
  font-size: 23px;
  font-weight: 700;
}

.mobile-project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-project-content {
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-project-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 17px;
  font-weight: 700;
}

.mobile-project-client {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: var(--text-secondary);
  font-size: 14px;
}

.mobile-project-date {
  display: flex;
  align-items: center;
  gap: 5px;

  color: var(--text-secondary);
  font-size: 12px;
}

.mobile-project-date strong {
  color: var(--text-primary);
  font-weight: 600;
}

.mobile-project-arrow {
  color: var(--text-secondary);
  font-size: 28px;
  line-height: 1;
}

@media (max-width: 768px) {
  .mobile-projects-page {
    max-width: none;
  }

  .main {
    padding: 14px;
  }

  .right-panel {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .dashboard-title {
    font-size: 24px;
  }

  .mobile-projects-sort {
    justify-content: space-between;
  }

  .mobile-projects-list {
    height: calc(100dvh - 205px);
    max-height: calc(100dvh - 205px);
  }
}

@media (max-width: 420px) {
  .mobile-project-row {
    grid-template-columns: 70px minmax(0, 1fr) 18px;
    gap: 10px;
    padding: 9px;
  }

  .mobile-project-image {
    width: 70px;
    height: 70px;
  }

  .mobile-project-name {
    font-size: 15px;
  }

  .mobile-project-client {
    font-size: 13px;
  }
}



/* =================================================
   MOBILE PROJECT MODULES
=================================================== */

[x-cloak] {
  display: none !important;
}

.mobile-project-modules-page,
.mobile-category-files-page {
  width: 100%;
  max-width: 720px;
  min-height: 100%;
  margin: 0 auto;
}

.mobile-project-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 24px;
}

.mobile-topbar-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  min-height: 40px;
  padding: 0 4px;

  color: var(--text-primary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
}

.mobile-topbar-action:hover {
  color: var(--accent);
}

.mobile-topbar-action--logout:hover {
  color: var(--danger);
}

.mobile-topbar-icon {
  font-size: 24px;
  line-height: 1;
}

.mobile-topbar-image-icon {
  width: 22px;
  height: 22px;
}

.mobile-current-project {
  margin-bottom: 24px;
  padding: 18px;

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.mobile-current-project--compact {
  padding: 14px 16px;
}

.mobile-current-project-label {
  margin-bottom: 5px;

  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.mobile-current-project h1 {
  margin: 0;

  font-size: 24px;
  line-height: 1.2;
}

.mobile-current-project p {
  margin-top: 7px;
}

.mobile-module-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-module-card {
  width: 100%;
  min-height: 92px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  box-sizing: border-box;
  padding: 18px;

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 15px;

  color: var(--text-primary);
  text-decoration: none;

  transition: var(--transition-fast);
}

.mobile-module-card:hover,
.mobile-module-card:focus-visible {
  background: var(--bg-hover);
  border-color: var(--accent);
  outline: none;
}

.mobile-module-card:active {
  transform: scale(0.99);
}

.mobile-module-card-main {
  min-width: 0;
}

.mobile-module-name {
  margin-bottom: 6px;

  font-size: 18px;
  font-weight: 700;
}

.mobile-module-description {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.mobile-module-arrow {
  flex-shrink: 0;

  color: var(--text-secondary);
  font-size: 30px;
}

/* =================================================
   MOBILE FILE LIST
=================================================== */

.mobile-files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-file-card {
  width: 100%;
  min-height: 82px;

  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;

  padding: 11px 12px;

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;

  color: var(--text-primary);
  text-align: left;
}

.mobile-file-card:hover,
.mobile-file-card:focus-visible {
  background: var(--bg-hover);
  border-color: var(--accent);
  outline: none;
}

.mobile-file-type {
  width: 58px;
  height: 58px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;
  background: rgba(255,255,255,0.08);

  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.mobile-file-type--pdf {
  background: rgba(239, 68, 68, 0.14);
  color: #ff7474;
}

.mobile-file-type--image {
  background: rgba(59, 130, 246, 0.14);
  color: #72a7ff;
}

.mobile-file-type--excel {
  background: rgba(34, 197, 94, 0.14);
  color: #5ee083;
}

.mobile-file-content {
  min-width: 0;
}

.mobile-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  margin-bottom: 7px;

  font-size: 15px;
  font-weight: 700;
}

.mobile-file-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;

  color: var(--text-secondary);
  font-size: 12px;
}

.mobile-file-preview-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

/* =================================================
   MOBILE FILE PREVIEW
=================================================== */

body.mobile-preview-open {
  overflow: hidden;
}

.mobile-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;

  display: flex;
  align-items: stretch;
  justify-content: center;

  background: rgba(0, 0, 0, 0.75);
}

.mobile-preview-panel {
  width: 100%;
  max-width: 900px;
  height: 100%;

  display: flex;
  flex-direction: column;

  background: var(--bg-main);
}

.mobile-preview-header {
  min-height: 68px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 12px 16px;

  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.mobile-preview-title {
  max-width: 70vw;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 15px;
  font-weight: 700;
}

.mobile-preview-subtitle {
  margin-top: 3px;

  color: var(--text-secondary);
  font-size: 12px;
}

.mobile-preview-close {
  width: 42px;
  height: 42px;

  padding: 0;

  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;

  color: var(--text-primary);
  font-size: 28px;
  line-height: 1;
}

.mobile-preview-close:hover {
  background: rgba(255, 92, 92, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}

.mobile-preview-body {
  flex: 1;
  min-height: 0;

  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.mobile-preview-frame {
  width: 100%;
  height: 100%;

  border: 0;
  background: white;
}

.mobile-image-preview {
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: auto;
  padding: 16px;
  box-sizing: border-box;
}

.mobile-image-preview img {
  max-width: 100%;
  max-height: 100%;

  object-fit: contain;
}

.mobile-preview-error {
  margin: auto;
  padding: 24px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;

  text-align: center;
}

@media (max-width: 768px) {
  .mobile-project-modules-page,
  .mobile-category-files-page {
    max-width: none;
  }

  .mobile-current-project h1 {
    font-size: 21px;
  }

  .mobile-module-card {
    min-height: 86px;
    padding: 15px;
  }

  .mobile-module-name {
    font-size: 17px;
  }
}

@media (max-width: 420px) {
  .mobile-file-card {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .mobile-file-type {
    width: 50px;
    height: 50px;
  }

  .mobile-file-preview-label {
    display: none;
  }
}


/* =================================================
   MOBILE CREWLIST
=================================================== */

.mobile-crew-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-crew-card {
  min-height: 76px;

  display: flex;
  align-items: center;
  gap: 13px;

  padding: 12px;

  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.mobile-crew-content {
  min-width: 0;
}

.mobile-crew-name {
  margin-bottom: 5px;

  font-size: 15px;
  font-weight: 700;
}

.mobile-crew-role {
  color: var(--text-primary);
  font-size: 13px;
}

.mobile-crew-department {
  margin-top: 3px;

  color: var(--text-secondary);
  font-size: 12px;
}


/* =================================================
   LOGIN — RESET HASŁA
=================================================== */

.forgot-link {
  padding: 0;
  border: 0;
  border-radius: 0;

  background: transparent;
  color: #4ea1ff;

  font: inherit;
  font-size: 14px;

  cursor: pointer;
}

.forgot-link:hover {
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
}

.reset-header {
  display: flex;
  flex-direction: column;
  gap: 6px;

  margin-bottom: 8px;
}

.reset-header h2 {
  margin: 0;
  text-align: center;
}

.reset-header p {
  margin: 0 0 8px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

.login-message {
  box-sizing: border-box;
  width: 100%;

  margin-bottom: 16px;
  padding: 12px 14px;

  border: 1px solid transparent;
  border-radius: 8px;

  font-size: 13px;
  line-height: 1.45;
}

.login-message.success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.login-message.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.login-form[hidden] {
  display: none;
}


/* =====================================================
   27. PROJECTS DASHBOARD — PAGE-SPECIFIC OVERRIDES
   Moved from projects_dashboard.html
====================================================== */

/* Projects dashboard enhancements */
.featured-project-card {
  position: relative;
  box-sizing: border-box;
  min-height: 0 !important;
  height: auto !important;
}

/* Force compact vertical layout inside the project card. */
.featured-project-card .featured-project-content {
  box-sizing: border-box;
  width: 100%;
  min-height: 0 !important;
  padding: 14px 18px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  gap: 4px !important;
}

/* Remove inherited space between project details and progress. */
.featured-project-card .featured-project-top {
  display: flex !important;
  align-items: center !important;
  min-height: 54px;
  flex: 0 0 auto !important;
  margin: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  gap: 12px !important;
}

.featured-project-card .featured-project-left {
  display: flex !important;
  align-items: center !important;
  align-self: center;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

.featured-project-card .featured-project-status-corner {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 2;
}

.featured-project-card .featured-project-right {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  min-width: 0;
  padding: 0 72px 0 0 !important;
  margin: 0 !important;
}

.featured-project-card .featured-project-name,
.featured-project-card .featured-project-client {
  margin: 0 !important;
}

.featured-project-card .featured-project-progress-wrapper {
  width: 100%;
  flex: 0 0 auto !important;
  margin: 0 !important;
  margin-top: 0 !important;
  padding: 0 !important;
}

.featured-project-card .featured-project-progress-top {
  margin: 0 0 4px !important;
  padding: 0 !important;
}

/* Intermediate project avatar size. */
.featured-project-card .featured-project-image-wrapper,
.featured-project-card .featured-project-image {
  width: 54px;
  height: 54px;
  min-width: 54px;
}

.featured-project-card .featured-project-image {
  font-size: 20px;
}

/* The content padding now provides equal margins on both sides. */
.featured-project-card .featured-project-progress-bar {
  box-sizing: border-box;
  width: 100% !important;
  margin: 0 !important;
}

/* Remove legacy fixed/minimum heights that kept the card unnecessarily tall. */
.featured-projects-grid .featured-project-card.project-card,
.featured-projects-grid .featured-project-card.project-card .featured-project-content {
  height: auto !important;
  min-height: 0 !important;
}

.avatar-stack .stack-avatar {
  overflow: hidden;
}

.avatar-stack .stack-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}


/* Pinned Projects — use exactly the same compact card geometry as Recent Projects. */
#pinnedProjectsContainer .featured-project-card.project-card {
  box-sizing: border-box;
  height: auto !important;
  min-height: 0 !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-content {
  box-sizing: border-box;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  padding: 14px 18px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  gap: 4px !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-top {
  display: flex !important;
  align-items: center !important;
  min-height: 54px !important;
  height: 54px !important;
  flex: 0 0 54px !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 12px !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-left {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-right {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 42px 0 0 !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-progress-wrapper {
  width: 100%;
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-progress-top {
  margin: 0 0 4px !important;
  padding: 0 !important;
}

#pinnedProjectsContainer .featured-project-card .featured-project-progress-bar {
  box-sizing: border-box;
  width: 100% !important;
  margin: 0 !important;
}

#pinnedProjectsContainer .featured-project-image-wrapper,
#pinnedProjectsContainer .featured-project-image {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
}

/* Empty pinned slots follow the same compact outer height. */
#pinnedProjectsContainer .featured-project-empty-slot {
  box-sizing: border-box;
  min-height: 0 !important;
  height: 111px !important;
}

/* Project picture in Recent Projects cards */
.featured-project-image-wrapper {
  overflow: hidden;
  border-radius: 50%;
}

.featured-project-image-wrapper img.featured-project-image {
  display: block;
  width: 54px;
  height: 54px;
  min-width: 54px;
  object-fit: cover;
  border-radius: 50%;
}

/* Project picture in projects table */
.table-project-image {
  overflow: hidden;
  flex: 0 0 auto;
}

.table-project-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* =====================================================
   PROJECTS DASHBOARD — FILTERS AND SEARCH
====================================================== */

.dashboard-filters {
  display: grid;
  grid-template-columns:
    minmax(0, 25fr)
    minmax(72px, 5fr)
    minmax(32px, 10fr)
    repeat(4, minmax(118px, 10fr))
    minmax(104px, 5fr);
  align-items: center;
  column-gap: 10px;
  width: 100%;
  margin: 0 0 16px;
  box-sizing: border-box;
}

.dashboard-search-group {
  display: contents;
}

.dashboard-search-input,
.dashboard-search-button,
.dashboard-filters > select,
.dashboard-clear-filters-button {
  width: 100% !important;
  min-width: 0 !important;
  height: 44px;
  box-sizing: border-box;
}

.dashboard-search-input {
  grid-column: 1;
}

.dashboard-search-button {
  grid-column: 2;
  padding: 0 12px;
  white-space: nowrap;
}

.dashboard-filters-spacer {
  grid-column: 3;
  min-width: 0;
}

.dashboard-filters > select {
  padding-left: 12px;
  padding-right: 32px;
}

#statusFilter {
  grid-column: 4;
}

#clientFilter {
  grid-column: 5;
}

#dateFilter {
  grid-column: 6;
}

#teamFilter {
  grid-column: 7;
}

.dashboard-clear-filters-button {
  grid-column: 8;
  padding: 0 12px;
  white-space: nowrap;
}

/*
 * Przy mniejszej szerokości głównej części aplikacji elementy nadal
 * pozostają w jednym rzędzie, ale kolumny otrzymują bardziej praktyczne minima.
 */
@media (max-width: 1450px) {
  .dashboard-filters {
    grid-template-columns:
      minmax(210px, 25fr)
      minmax(72px, 5fr)
      minmax(24px, 7fr)
      repeat(4, minmax(105px, 10fr))
      minmax(100px, 5fr);
    column-gap: 8px;
  }

  .dashboard-search-button,
  .dashboard-clear-filters-button {
    padding-left: 9px;
    padding-right: 9px;
  }
}

/* Na tabletach układ przechodzi w dwa logiczne rzędy bez poziomego scrolla. */
@media (max-width: 1050px) {
  .dashboard-filters {
    grid-template-columns: minmax(0, 1fr) 110px repeat(4, minmax(0, 1fr));
    row-gap: 10px;
  }

  .dashboard-search-input {
    grid-column: 1 / 5;
    grid-row: 1;
  }

  .dashboard-search-button {
    grid-column: 5;
    grid-row: 1;
  }

  .dashboard-filters-spacer {
    display: none;
  }

  #statusFilter {
    grid-column: 1;
    grid-row: 2;
  }

  #clientFilter {
    grid-column: 2;
    grid-row: 2;
  }

  #dateFilter {
    grid-column: 3;
    grid-row: 2;
  }

  #teamFilter {
    grid-column: 4 / 6;
    grid-row: 2;
  }

  .dashboard-clear-filters-button {
    grid-column: 6;
    grid-row: 1 / 3;
    align-self: stretch;
  }
}

@media (max-width: 720px) {
  .dashboard-filters {
    grid-template-columns: 1fr;
  }

  .dashboard-search-input,
  .dashboard-search-button,
  #statusFilter,
  #clientFilter,
  #dateFilter,
  #teamFilter,
  .dashboard-clear-filters-button {
    grid-column: 1;
    grid-row: auto;
  }
}

/* =====================================================
   PROJECTS DASHBOARD — FIXED PAGE AND SCROLLABLE TABLE
====================================================== */

.main:has(.projects-dashboard-page) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.projects-dashboard-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  height: auto;
  overflow: hidden;
}

.projects-dashboard-page .dashboard-header,
.projects-dashboard-page .dashboard-stats-grid,
.projects-dashboard-page .dashboard-tabs-wrapper,
.projects-dashboard-page > .featured-projects-grid,
.projects-dashboard-page .dashboard-filters,
.projects-dashboard-page .dashboard-pagination-wrapper {
  flex: 0 0 auto;
}

.projects-dashboard-page .dashboard-table-wrapper {
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.projects-dashboard-page .dashboard-table {
  min-width: 1180px;
}

.projects-dashboard-page .dashboard-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
}

.projects-dashboard-page .dashboard-table thead th {
  position: sticky;
  top: 0;
  z-index: 21;
  background: var(--bg-card);
  box-shadow: 0 1px 0 var(--border);
}

@media (max-height: 900px) {
  .projects-dashboard-page .dashboard-header {
    margin-bottom: 16px;
  }

  .projects-dashboard-page .dashboard-stats-grid {
    margin-bottom: 16px;
  }

  .projects-dashboard-page .featured-project-card {
    height: 150px;
    min-height: 140px;
  }
}


/* =================================================
   ADMIN — SQUARE AVATARS WITH ROUNDED CORNERS
=================================================== */

#userList .avatar,
#userList .avatar img {
  border-radius: 10px;
}

.avatar-box,
.avatar-box img {
  border-radius: 18px;
}


/* =================================================
   ADMIN PANEL — SHARED LAYOUT + PROJECT ROLES
=================================================== */

.admin-layout.admin-layout--roles-manager {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
  gap: var(--space-xl);
  align-items: stretch;
}

.admin-people-card,
.admin-project-roles-card {
  min-width: 0;
}

.admin-card-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
}

.admin-people-table-header,
.admin-person-row {
  display: grid;
  grid-template-columns:
    48px
    minmax(160px, 1.2fr)
    minmax(190px, 1.35fr)
    minmax(125px, 0.8fr)
    minmax(210px, 1.25fr)
    82px;
  align-items: center;
  gap: 14px;
}

.admin-people-table-header {
  min-height: 42px;
  padding: 0 var(--space-md);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.admin-person-row {
  width: 100%;
  box-sizing: border-box;
}

.admin-person-row .avatar {
  border-radius: 12px;
}

.admin-person-row .avatar img {
  border-radius: 12px;
}

.admin-person-name,
.admin-person-contact {
  min-width: 0;
}

.admin-person-contact {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-person-row .user-meta {
  min-width: 0;
  justify-content: flex-start;
}

.admin-person-row .user-actions {
  justify-content: flex-end;
  margin-left: 0;
}

.admin-role-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.admin-role-table-header,
.admin-role-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  align-items: center;
  gap: 12px;
}

.admin-role-table-header {
  min-height: 46px;
  padding: 0 14px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}

.admin-role-table-body {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

.admin-role-row {
  min-height: 58px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.admin-role-row:last-child {
  border-bottom: 0;
}

.admin-role-row:hover {
  background: rgba(255,255,255,0.025);
}

.admin-role-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-role-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1350px) {
  .admin-layout.admin-layout--roles-manager {
    grid-template-columns: 1fr;
  }

  .admin-role-table-body {
    max-height: 420px;
  }
}

@media (max-width: 980px) {
  .admin-people-table-header {
    display: none;
  }

  .admin-person-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .admin-person-contact {
    grid-column: 2;
  }

  .admin-person-row .user-meta {
    grid-column: 2;
  }

  .admin-person-row .user-actions {
    grid-column: 3;
    grid-row: 1 / span 4;
  }
}


/* =================================================
   ADMIN PANEL — FILTER ROWS AND MATCHING TABLE HEADERS
=================================================== */

.admin-people-filters-row {
  display: grid;
  grid-template-columns:
    minmax(260px, 6fr)
    minmax(150px, 2fr)
    minmax(145px, 1fr)
    minmax(110px, 1fr);
  gap: var(--space-sm);
  width: 100%;
  align-items: center;
}

.admin-people-filters-row > input,
.admin-people-filters-row > select {
  width: 100%;
  min-width: 0;
  height: 42px;
  box-sizing: border-box;
}

.admin-people-table-header {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-bottom-color: var(--border);
  border-radius: 14px 14px 0 0;
}

.admin-people-table-header > div:last-child {
  text-align: right;
}


.admin-project-roles-body {
  align-items: stretch;
}

.admin-role-search {
  width: 100%;
  height: 42px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

@media (max-width: 1180px) {
  .admin-people-filters-row {
    grid-template-columns: minmax(220px, 3fr) minmax(140px, 1fr);
  }
}

@media (max-width: 720px) {
  .admin-people-filters-row {
    grid-template-columns: 1fr;
  }
}


/* =================================================
   ADMIN PANEL — FILTER ROW AND SCROLL FIX (V2)
=================================================== */
.admin-layout .users-card-body {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.admin-people-filters-row {
  display: grid !important;
  grid-template-columns:
    minmax(0, 6fr)
    minmax(0, 2fr)
    minmax(0, 1fr)
    minmax(0, 1fr) !important;
  gap: var(--space-sm) !important;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

.admin-people-filters-row > input,
.admin-people-filters-row > select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 42px;
  box-sizing: border-box;
  padding-left: 10px;
  padding-right: 10px;
}

.admin-people-filters-row > select {
  font-size: 12px;
}

.admin-people-table-header {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

#userList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  align-content: start;
}

/* Wyłącz wcześniejsze reguły, które przenosiły filtry do dwóch lub jednego rzędu. */
@media (max-width: 1180px) {
  .admin-people-filters-row {
    grid-template-columns:
      minmax(0, 6fr)
      minmax(0, 2fr)
      minmax(0, 1fr)
      minmax(0, 1fr) !important;
  }
}

@media (max-width: 720px) {
  .admin-people-filters-row {
    grid-template-columns:
      minmax(0, 6fr)
      minmax(0, 2fr)
      minmax(0, 1fr)
      minmax(0, 1fr) !important;
  }
}

/* =================================================
   ADMIN PANEL — FINAL FILTER + USER TABLE SCROLL FIX
=================================================== */

/* Karta musi mieć określoną wysokość, aby przewijanie mogło
   objąć wyłącznie listę użytkowników. */
.admin-layout.admin-layout--roles-manager {
  height: calc(100vh - 150px);
  min-height: 560px;
  align-items: stretch;
}

.admin-layout.admin-layout--roles-manager > .card,
.admin-people-card,
.admin-project-roles-card {
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.admin-people-card {
  overflow: hidden;
}

.admin-people-card > .card-header {
  flex: 0 0 auto;
}

.admin-layout .users-card-body {
  flex: 1 1 auto;
  height: 0;
  min-height: 0;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Jeden stabilny rząd: 60% / 20% / 10% / 10%.
   Flex eliminuje wpływ wcześniejszych reguł grid i media queries. */
.admin-people-filters-row {
  display: flex !important;
  flex-flow: row nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: var(--space-sm) !important;
  width: 100% !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
}

.admin-people-filters-row > .admin-people-search {
  flex: 6 1 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
}

.admin-people-filters-row > #clientFilter {
  flex: 2 1 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
}

.admin-people-filters-row > #permissionFilter,
.admin-people-filters-row > #statusFilter {
  flex: 1 1 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
}

.admin-people-filters-row > input,
.admin-people-filters-row > select {
  height: 42px !important;
  box-sizing: border-box !important;
}

/* Nagłówek pozostaje nieruchomy. */
.admin-people-table-header {
  flex: 0 0 42px !important;
  min-height: 42px !important;
  position: relative !important;
  top: auto !important;
  z-index: 3;
}

/* Przewijane są wyłącznie rekordy od pierwszego użytkownika. */
.admin-layout .users-card-body > #userList {
  flex: 1 1 auto !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;
  align-content: initial;
  padding-right: 4px;
}

/* Wyłączamy wcześniejsze warianty responsywne, które łamały rząd filtrów. */
@media (max-width: 1350px) {
  .admin-layout.admin-layout--roles-manager {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr) !important;
  }
}

@media (max-width: 980px) {
  .admin-people-filters-row {
    display: flex !important;
    flex-flow: row nowrap !important;
  }
}

@media (max-width: 720px) {
  .admin-people-filters-row {
    display: flex !important;
    flex-flow: row nowrap !important;
  }
}

/* =================================================
   ADMIN PANEL — USER ROW HEIGHT FIX
=================================================== */

/* Wiersze nie mogą kurczyć się wewnątrz przewijanego kontenera. */
.admin-layout .users-card-body > #userList > .admin-person-row,
.admin-layout .users-card-body > #userList > .user-item,
.admin-layout .users-card-body > #userList > .client-item {
  flex: 0 0 auto !important;
  min-height: 58px !important;
  height: auto !important;
  box-sizing: border-box !important;
  padding: 8px 12px !important;
  overflow: visible !important;
}

/* Avatar i akcje zachowują pełny rozmiar i pozostają wewnątrz wiersza. */
.admin-person-row .avatar,
.admin-person-row .user-actions,
.admin-person-row .user-action-btn {
  flex-shrink: 0 !important;
}

.admin-person-row .avatar {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
}

.admin-person-row .user-action-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
}

/* Zawartość tekstowa może się zwężać, ale nie zwiększa wysokości wiersza. */
.admin-person-row > *,
.admin-person-row .user-info,
.admin-person-row .user-meta {
  min-width: 0;
}

.admin-person-row .user-name,
.admin-person-row .user-company,
.admin-person-row .admin-person-contact {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



/* =========================================================
   PROFILE SLIDE PANEL
   ========================================================= */

.dropdown-item-button {
  width: 100%;
  box-sizing: border-box;

  display: flex;
  align-items: center;
  gap: 8px;

  padding: 8px 12px;

  border: 0;
  border-radius: 0;
  background: transparent;

  color: #111;
  font-family: inherit;
  font-size: 18px;
  font-weight: 400;
  line-height: normal;
  text-align: left;

  cursor: pointer;
}

.dropdown-item-button:hover {
  background: #e5e7eb;
  color: #111;
}

.dropdown-item-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.dropdown-item-button .dropdown-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.7;
}

.profile-slide-panel {
  z-index: 10020;
}

.profile-slide-panel .panel-header {
  position: relative;
}

.profile-panel-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.profile-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10010;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.profile-panel-backdrop.open {
  opacity: 1;
  visibility: visible;
}

body.profile-panel-open {
  overflow: hidden;
}

.profile-password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-password-field input {
  width: 100%;
  padding-right: 72px;
}

.profile-password-toggle {
  position: absolute;
  right: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.profile-field-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.65;
}

.profile-form-message {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
}

.profile-form-message.error {
  color: #c62828;
}

.profile-form-message.success {
  color: #2e7d32;
}

.profile-slide-panel
.profile-avatar-preview-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-slide-panel
.panel-actions
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================================================
   PROJECT DASHBOARD — RECENT / PINNED PROJECT AVATARS
   Keep the same visual shape as project avatars in the table.
========================================================= */

.featured-project-image-wrapper {
  overflow: hidden !important;
  border-radius: 12px !important;
}

.featured-project-image,
.featured-project-image-wrapper img.featured-project-image {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  border-radius: 12px !important;
  object-fit: cover;
}


/* =========================================================
   RESPONSIVE LAYOUT — FULL-WIDTH MAIN CONTENT (V3)
   The permanent right rail was removed from layout.html.
   These rules make the remaining content consume the free width
   and protect right-aligned actions from being clipped.
========================================================= */

.layout-body {
  min-width: 0;
}

.sidebar {
  flex: 0 0 240px;
  box-sizing: border-box;
}

.layout.collapsed .sidebar {
  flex-basis: 60px;
}

.main {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Kept only as a defensive rule for templates not migrated yet. */
.right-panel {
  display: none !important;
}

/* ---------- Header: middle area absorbs width changes ---------- */
.header {
  min-width: 0;
}

.header-left,
.header-right {
  flex: 0 0 auto;
}

.header-center {
  flex: 1 1 auto;
  min-width: 0;
  padding-inline: clamp(12px, 2.2vw, var(--space-xxl));
}

.header-project-selector-group {
  width: min(100%, 1168px);
  min-width: 0;
}

.header-project-select {
  flex: 1 1 520px;
  width: auto;
  min-width: 0;
  max-width: 860px;
}

.header-project-search {
  flex: 0 1 300px;
  width: clamp(170px, 20vw, 300px);
  min-width: 0;
}

/* ---------- Generic left / right header behavior ---------- */
.card-header,
.dashboard-header,
.places-header,
.places-toolbar,
.files-explorer-toolbar,
.files-summary-row {
  min-width: 0;
}

.card-header > :first-child,
.dashboard-header > :first-child,
.places-header > :first-child,
.places-toolbar > :first-child,
.files-explorer-toolbar > :first-child,
.files-summary-row > :first-child {
  min-width: 0;
}

.card-header > :last-child,
.dashboard-header-actions,
.places-header-actions,
.files-explorer-actions {
  flex: 0 0 auto;
}

/* =========================================================
   ADMIN PANEL — RESPONSIVE PEOPLE MANAGEMENT
========================================================= */

.admin-layout.admin-layout--roles-manager {
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr) !important;
}

.admin-people-table-header,
.admin-person-row {
  grid-template-columns:
    40px
    minmax(120px, 1.25fr)
    minmax(140px, 1.15fr)
    minmax(100px, 0.8fr)
    auto
    76px !important;
  gap: clamp(6px, 0.8vw, 14px) !important;
}

.admin-person-row .user-meta {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: max-content;
}

.admin-person-row .user-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 70px;
  margin-left: 0;
}

.admin-person-name,
.admin-person-contact {
  min-width: 0 !important;
}

/* Laptop widths: give Clients/Users the full content width.
   Project Roles moves below instead of squeezing management actions. */
@media (max-width: 1650px) {
  .admin-layout.admin-layout--roles-manager {
    grid-template-columns: minmax(0, 1fr) !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .admin-layout.admin-layout--roles-manager > .admin-people-card {
    height: calc(100vh - 150px) !important;
    min-height: 560px !important;
    max-height: none !important;
  }

  .admin-layout.admin-layout--roles-manager > .admin-project-roles-card {
    height: auto !important;
    min-height: 420px !important;
    max-height: none !important;
  }

  .admin-role-table-body {
    max-height: 520px;
  }
}

/* Narrower desktop/tablet: preserve actions, simplify secondary data. */
@media (max-width: 1180px) {
  .admin-people-table-header,
  .admin-person-row {
    grid-template-columns:
      40px
      minmax(130px, 1fr)
      minmax(150px, 1fr)
      auto
      76px !important;
  }

  .admin-people-table-header > :nth-child(4),
  .admin-person-row > .admin-person-contact:nth-of-type(4) {
    display: none;
  }

  .admin-people-table-header > :nth-child(5) {
    grid-column: 4;
  }

  .admin-people-table-header > :nth-child(6) {
    grid-column: 5;
  }
}

@media (max-width: 980px) {
  .admin-people-table-header {
    display: none !important;
  }

  .admin-person-row {
    grid-template-columns: 40px minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto auto;
    align-items: center;
  }

  .admin-person-row .avatar {
    grid-column: 1;
    grid-row: 1 / span 3;
  }

  .admin-person-row .admin-person-name,
  .admin-person-row .admin-person-contact,
  .admin-person-row .user-meta {
    grid-column: 2 !important;
  }

  .admin-person-row .user-actions {
    grid-column: 3 !important;
    grid-row: 1 / span 3 !important;
  }

  .admin-people-filters-row {
    display: grid !important;
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) !important;
  }
}

/* =========================================================
   PROJECT DASHBOARD — RESPONSIVE TOP AREAS
========================================================= */

.projects-dashboard-page,
.dashboard-header,
.dashboard-header-actions,
.dashboard-stats-grid,
.featured-projects-grid,
.dashboard-filters {
  min-width: 0;
}

@media (max-width: 1500px) {
  .dashboard-filters {
    grid-template-columns: minmax(0, 1fr) 100px repeat(4, minmax(0, 1fr)) !important;
    row-gap: 10px;
  }

  .dashboard-search-input {
    grid-column: 1 / 5 !important;
    grid-row: 1;
  }

  .dashboard-search-button {
    grid-column: 5 !important;
    grid-row: 1;
  }

  .dashboard-filters-spacer {
    display: none;
  }

  #statusFilter { grid-column: 1 !important; grid-row: 2; }
  #clientFilter { grid-column: 2 !important; grid-row: 2; }
  #dateFilter { grid-column: 3 !important; grid-row: 2; }
  #teamFilter { grid-column: 4 / 6 !important; grid-row: 2; }

  .dashboard-clear-filters-button {
    grid-column: 6 !important;
    grid-row: 1 / 3;
    align-self: stretch;
  }
}

/* =========================================================
   FILES — FLEXIBLE WIDTH, ACTIONS STAY VISIBLE
========================================================= */

.project-files-page,
.files-project-selector,
.files-folders-row,
.files-explorer-card,
.files-explorer-table-wrapper {
  min-width: 0;
}

.files-project-selector,
.files-folders-row {
  width: min(100%, var(--files-folders-width));
}

.files-explorer-toolbar > div:first-child {
  min-width: 0;
}

.files-explorer-actions {
  margin-left: auto;
}

@media (max-width: 1100px) {
  .files-explorer-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .files-explorer-actions {
    margin-left: auto;
  }
}

/* =========================================================
   TEAM — USE AVAILABLE WIDTH BEFORE HORIZONTAL SCROLL
========================================================= */

.team-readonly-page,
.team-readonly-page .member-table {
  min-width: 0;
}

@media (max-width: 1400px) and (min-width: 1001px) {
  .team-readonly-page .member-table-header,
  .team-readonly-page .member-row {
    grid-template-columns:
      44px
      minmax(135px, 1.35fr)
      minmax(135px, 1.2fr)
      minmax(115px, 1fr)
      minmax(115px, 0.95fr)
      minmax(82px, 0.7fr) !important;
    gap: 8px;
  }
}

/* =========================================================
   COMMON BREAKPOINTS
========================================================= */

@media (max-width: 1100px) {
  .main {
    padding: var(--space-xl);
  }

  .header-project-selector-group {
    gap: 8px;
  }

  .header-project-search {
    flex-basis: 200px;
  }

  .dashboard-header,
  .places-header,
  .places-toolbar {
    gap: 12px;
  }
}

@media (max-width: 820px) {
  .sidebar {
    flex-basis: 60px;
    width: 60px;
    padding: var(--space-md) var(--space-sm);
    overflow: hidden;
  }

  .sidebar .nav-item span,
  .sidebar .nav-section,
  .sidebar-footer .footer-full {
    display: none !important;
  }

  .sidebar .nav-item {
    justify-content: center;
    padding: var(--space-sm);
  }

  .main {
    padding: var(--space-lg);
  }

  .header-center {
    padding-inline: 8px;
  }

  .header-project-search {
    display: none;
  }

  .dashboard-header,
  .places-header,
  .places-toolbar,
  .files-explorer-toolbar,
  .files-summary-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .dashboard-header-actions,
  .places-header-actions,
  .files-explorer-actions {
    margin-left: auto;
  }
}


/* =================================================
   OPTIONAL RIGHT PANEL — enabled only by templates
=================================================== */

.right-panel.is-enabled {
  display: flex !important;
  flex: 0 0 320px;
  width: 320px;
  min-width: 320px;
  min-height: 0;
  box-sizing: border-box;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-xl);
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
}

.right-panel.is-enabled > * {
  min-width: 0;
}

@media (max-width: 1180px) {
  .right-panel.is-enabled {
    flex-basis: 280px;
    width: 280px;
    min-width: 280px;
    padding: var(--space-lg);
  }
}

@media (max-width: 900px) {
  .right-panel.is-enabled {
    display: none !important;
  }
}
