:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --text: #101418;
  --muted: #5b6570;
  --border: rgba(16, 20, 24, 0.12);
  --primary: #2563eb;
  --danger: #b42318;

  --radius: 12px;
  --radius-md: 10px;
  --shadow: 0 10px 30px rgba(16, 20, 24, 0.08);
  --shadow-md: 0 4px 12px rgba(16, 20, 24, 0.15);
  --color-border: var(--border);
  --color-surface: var(--surface);
  --color-surface-hover: var(--surface-2);
  --color-text-muted: var(--muted);

  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";

  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-6: 28px;
}

:root.theme-dark {
  --bg: #0b0f14;
  --surface: #111827;
  --surface-2: #0f172a;
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --border: rgba(229, 231, 235, 0.12);
  --primary: #60a5fa;
  --danger: #f97066;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --color-border: var(--border);
  --color-surface: var(--surface);
  --color-surface-hover: var(--surface-2);
  --color-text-muted: var(--muted);
}

:root[data-density="compact"] {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
}

:root[data-density="normal"] {
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-6: 28px;
}

:root[data-density="comfy"] {
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 22px;
  --space-6: 34px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
}

.app-content {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* =============================================================================
   FOCUS VISIBLE - Accessibility (WCAG 2.4.7)
   Shows outline only for keyboard navigation, not mouse clicks
   ============================================================================= */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Remove default focus for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.link {
  color: var(--primary);
}

.link-button {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.logout-form {
  display: inline;
  margin: 0;
}

.only-mobile {
  display: none;
}

.only-desktop {
  display: initial;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-4);
}

.sidebar-header {
  margin-bottom: var(--space-4);
}

.sidebar-brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  display: grid;
  gap: var(--space-1);
}

.sidebar-link {
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  background: transparent;
}

.sidebar-link:hover {
  background: var(--surface-2);
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: var(--danger, #dc3545);
  border-radius: 1rem;
  margin-left: auto;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

/* Navigation Buttons (Back/Up) */
.nav-buttons {
  display: flex;
  gap: 4px;
  margin-right: var(--space-2);
}

.nav-btn {
  width: 36px;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

.nav-btn:active:not(:disabled) {
  transform: scale(0.93);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Theme toggle sun/moon icons */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
.theme-dark .theme-toggle .icon-sun { display: block; }
.theme-dark .theme-toggle .icon-moon { display: none; }

.topbar-title {
  font-weight: 650;
}

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

.topbar-desktop-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-mobile-button {
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.icon-gear {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 24, 0.45);
  z-index: 40;
}

.mobile-settings-drawer {
  display: none;
}

.ui-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.user-chip {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-left: var(--space-3);
}

.user-section-separator {
  border-top: 1px solid var(--border);
  margin-top: var(--space-3);
  padding-top: var(--space-2);
}

.logout-action {
  color: #f87171 !important;
}
.logout-action:hover {
  color: #ef4444 !important;
}

.app-content {
  padding: var(--space-4);
}

.split {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.panel-title {
  font-weight: 650;
}

.filters {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.filters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.filters-row--2col {
  grid-template-columns: 1fr 1fr;
}

.filters-details > summary {
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.filters-details > summary::-webkit-details-marker {
  display: none;
}

.filters-details > summary::after {
  content: "▾";
  color: var(--muted);
}

.filters-details[open] > summary::after {
  content: "▴";
}

.filters-details > summary + * {
  margin-top: var(--space-2);
}

.list {
  min-height: 120px;
}

.cards {
  display: grid;
  gap: var(--space-2);
}

.card {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.card-selectable {
  position: relative;
  padding: var(--space-3);
}

.card-checkbox {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
}

.card-link {
  display: grid;
  gap: var(--space-1);
  padding-right: 44px;
}

a.card-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.card-link:hover {
  border-color: var(--primary);
}

.card:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.card-draft {
  border-width: 2px;
  border-color: var(--primary);
}

.card-title {
  font-weight: 650;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
}

.badge-ok {
  border-color: rgba(0, 166, 81, 0.25);
}

.badge-muted {
  opacity: 0.75;
}

.badge-info {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.list-summary {
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.list-summary .summary-title {
  font-weight: 650;
  font-size: 1.1rem;
}

.list-summary .summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.placeholder {
  padding: var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.detail-back {
  display: none;
}

.detail-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

.section {
  display: grid;
  gap: var(--space-2);
}

.section-title {
  font-weight: 650;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}

.btn-icon {
  width: 44px;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.bulk-actions {
  display: grid;
  gap: var(--space-2);
}

.bulk-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.bulk-actions-row--main input[type="number"] {
  flex: 1 1 180px;
}

.btn:hover {
  background: var(--surface-2);
}

.btn-primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(0.98);
}

.btn-ghost {
  background: transparent;
}

.select,
input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-6);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}

.auth-title {
  margin: 0 0 var(--space-2) 0;
}

.form {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.field {
  display: grid;
  gap: var(--space-1);
}

.label {
  font-size: 0.9rem;
  color: var(--muted);
}

.alert {
  padding: var(--space-2) var(--space-3);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.alert-danger {
  border-color: rgba(180, 35, 24, 0.4);
  color: var(--danger);
}

.messages {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 52px;
    bottom: 0;
    left: 0;
    width: min(360px, 88vw);
    z-index: 50;
    transform: translateX(-110%);
    transition: transform 160ms ease;
    border-right: 1px solid var(--border);
    border-bottom: none;
    box-shadow: var(--shadow);
    overflow: auto;
  }

  .mobile-modules-open .sidebar {
    transform: translateX(0);
  }

  .mobile-modules-open .mobile-backdrop,
  .mobile-settings-open .mobile-backdrop {
    display: block;
  }

  .only-mobile {
    display: inline-flex;
  }

  .only-desktop {
    display: none !important;
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }

  .app-content {
    padding-top: calc(52px + var(--space-4));
  }

  .topbar-title {
    display: none;
  }

  .topbar-left {
    flex: 1;
  }

  .topbar-modules-button {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-gear-button {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
    width: 44px;
    justify-content: center;
  }

  .filters-row {
    grid-template-columns: 1fr;
  }

  .filters-row--2col {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-settings-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(360px, 88vw);
    z-index: 55;
    transform: translateX(110%);
    transition: transform 160ms ease;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: var(--space-4);
    display: grid;
    grid-auto-rows: max-content;
    gap: var(--space-4);
    overflow: auto;
  }

  .mobile-settings-open .mobile-settings-drawer {
    transform: translateX(0);
  }

  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .mobile-drawer-title {
    font-weight: 650;
  }

  .mobile-drawer-body {
    display: grid;
    gap: var(--space-3);
  }

  .mobile-ui-controls {
    display: grid;
    gap: var(--space-2);
    align-items: stretch;
  }

  .mobile-user-chip {
    margin-left: 0;
    justify-content: space-between;
  }

  .detail-panel {
    display: none;
  }

  .people-detail-open .list-panel {
    display: none;
  }

  .people-detail-open .detail-panel {
    display: block;
  }

  .work-sessions-detail-open .list-panel {
    display: none;
  }

  .work-sessions-detail-open .detail-panel {
    display: block;
  }

  .comp-items-detail-open .list-panel {
    display: none;
  }

  .comp-items-detail-open .detail-panel {
    display: block;
  }

  .ledger-detail-open .list-panel {
    display: none;
  }

  .ledger-detail-open .detail-panel {
    display: block;
  }

  .salarizare-detail-open .list-panel {
    display: none;
  }

  .salarizare-detail-open .detail-panel {
    display: block;
  }

  .receptie-detail-open .list-panel {
    display: none;
  }

  .receptie-detail-open .detail-panel {
    display: block;
  }

  .list-controls {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
    padding-bottom: var(--space-2);
  }

  .detail-back {
    display: inline-flex;
  }
}

@media (min-width: 901px) {
  .split {
    grid-template-columns: 420px 1fr;
  }
}

/* Detail rows for read-only view */
.detail-row {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--muted);
  min-width: 100px;
  flex-shrink: 1;
}

.detail-value {
  color: var(--text);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   UNIFIED DETAIL CARDS (UI-004)
   ═══════════════════════════════════════════════════════════════ */

/* Detail card container */
.detail-card,
.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

/* Alias pentru panel-header (inventory) */
.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

/* Info grid layout (salarizare pattern) */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.info-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.info-value {
  font-weight: 500;
}

/* Definition list în detail cards */
.detail-card dl,
.detail-section dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
}

.detail-card dt,
.detail-section dt {
  font-size: 0.875rem;
  color: var(--muted);
}

.detail-card dd,
.detail-section dd {
  margin: 0;
  font-weight: 500;
}

/* Summary grid (ledger pattern) */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius);
}

/* === Theme Selector === */
.theme-selector {
  position: relative;
}

.theme-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
}

.theme-menu.open {
  display: block;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2);
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text);
}

.theme-option:hover {
  background: var(--surface-2);
}

.theme-option.active {
  background: var(--primary);
  color: #fff;
}

.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.theme-swatch-legacy { background: #2563eb; }
.theme-swatch-slate { background: #3b82f6; }
.theme-swatch-stone { background: #0d9488; }
.theme-swatch-zinc { background: #6366f1; }

.theme-selector-mobile {
  width: 100%;
}

.theme-selector-mobile .theme-menu {
  position: static;
  margin-top: var(--space-2);
  box-shadow: none;
}

/* === Slate Theme (Light) === */
:root.theme-slate {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

/* === Slate Theme (Dark) === */
:root.theme-slate.theme-dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --danger: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
}

/* === Stone Theme (Light) === */
:root.theme-stone {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
}

/* === Stone Theme (Dark) === */
:root.theme-stone.theme-dark {
  --bg: #1c1917;
  --surface: #292524;
  --surface-2: #44403c;
  --text: #fafaf9;
  --muted: #a8a29e;
  --border: #44403c;
  --primary: #2dd4bf;
  --primary-hover: #14b8a6;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #facc15;
}

/* === Zinc Theme (Light) === */
:root.theme-zinc {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --text: #18181b;
  --muted: #71717a;
  --border: #e4e4e7;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #eab308;
}

/* === Zinc Theme (Dark) === */
:root.theme-zinc.theme-dark {
  --bg: #18181b;
  --surface: #27272a;
  --surface-2: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --border: #3f3f46;
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #facc15;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Fond Operational - Styles
   ═══════════════════════════════════════════════════════════════════════════════ */

.fond-summary-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fond-balance {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.fond-balance .label {
  font-size: 0.85rem;
  color: var(--muted);
}

.fond-balance .amount {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--success, #00a651);
}

.fond-balance .amount.warning {
  color: var(--warning, #f59e0b);
}

.fond-balance .amount.negative {
  color: var(--danger);
}

.fond-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.section-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: var(--space-2) 0;
  margin-top: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.section-header.warning {
  color: var(--warning, #f59e0b);
}

.badge-warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface);
}

.btn-danger {
  background: #dc3545;
  color: white;
  border: 1px solid #dc3545;
}

.btn-danger:hover {
  background: #c82333;
  border-color: #bd2130;
}

/* Status filter buttons */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-filter {
  display: flex;
  gap: 0.25rem;
}

.filter-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 1rem;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Deleted card styling */
.card-deleted {
  opacity: 0.6;
  background: var(--surface) !important;
}

.badge-deleted {
  background: #dc3545;
  color: white;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
}

.pending-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pending-card {
  border-left: 3px solid var(--warning, #f59e0b);
}

.card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATION PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}

.notification-bell:hover {
  background: var(--surface-2);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: #ef4444;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.notification-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 59;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms, visibility 200ms;
}

.notification-panel-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.notification-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 200ms ease-out;
  display: flex;
  flex-direction: column;
}

.notification-panel.open {
  transform: translateX(0);
}

.notification-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notification-panel__title {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 0;
}

.notification-panel__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-mark-all {
  font-size: 0.8rem;
  color: var(--primary);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
}

.btn-mark-all:hover {
  text-decoration: underline;
}

.notification-panel__filters {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-chip {
  padding: 6px 14px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--text);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.notification-panel__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.notification-panel__footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.notification-panel__footer .btn {
  width: 100%;
  justify-content: center;
}

.notification-loading {
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
}

/* Notification Items */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.15s;
  position: relative;
  min-height: 72px;
}

.notification-item:active {
  background: var(--surface-2);
}

.notification-item--unread {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.notification-item--unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

.notification-item__indicator {
  padding-top: 4px;
  flex-shrink: 0;
}

.notification-type-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.notification-type--front_blocked,
.notification-type--deadline_overdue {
  background: #ef4444;
}

.notification-type--front_unblocked,
.notification-type--status_changed {
  background: #22c55e;
}

.notification-type--item_assigned,
.notification-type--document_added {
  background: #3b82f6;
}

.notification-type--deadline_approaching,
.notification-type--comment_added {
  background: #f59e0b;
}

.notification-item__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}

.notification-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.notification-item__type {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.notification-item__time {
  font-size: 0.7rem;
  color: var(--muted);
  flex-shrink: 0;
}

.notification-item__title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.notification-item--unread .notification-item__title {
  color: var(--primary);
}

.notification-item__message {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item__action {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.notification-item__action:hover {
  background: var(--surface-2);
  color: var(--primary);
}

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  min-height: 200px;
}

.notification-empty__icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-3);
  color: var(--border);
}

.notification-empty__icon svg {
  width: 100%;
  height: 100%;
}

.notification-empty__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--space-1);
  color: var(--text);
}

.notification-empty__message {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HTMX Loading Indicators (FE-001)
   Apare DOAR dacă request-ul durează > 300ms
   ═══════════════════════════════════════════════════════════════════════════ */

/* Manual indicator (pentru cazuri speciale) */
.htmx-indicator {
  opacity: 0;
  display: inline-block;
  transition: opacity 150ms ease-out;
  pointer-events: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
  transition: opacity 150ms ease-in 300ms;
}

/* Spinner animation */
@keyframes htmx-spin {
  to { transform: rotate(360deg); }
}

.htmx-indicator-spinner {
  width: 1em;
  height: 1em;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: htmx-spin 0.6s linear infinite;
  margin-left: var(--space-1);
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTO-SPINNER pe butoane (GLOBAL - fără modificări în templates)
   Butonul arată spinner automat când are request HTMX activ > 300ms
   ═══════════════════════════════════════════════════════════════════════════ */
.btn.htmx-request {
  pointer-events: none;
  position: relative;
}

/* Spinner after button text - apare cu delay 300ms */
.btn.htmx-request::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.4em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: htmx-spin 0.6s linear infinite;
  opacity: 0;
  transition: opacity 150ms ease-in 300ms;
  vertical-align: middle;
}

/* Delay: spinner vizibil doar după 300ms */
.btn.htmx-request::after {
  opacity: 1;
}

/* Dim content while loading */
.htmx-request [data-loading-dim] {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 150ms ease-in 300ms;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE FORM COMPONENTS (used by fond/, ledger/ mobile templates)
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-content {
  max-width: 100%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.modal-header .close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: var(--space-2);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-group {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILE UPLOAD WIDGET (consolidated from inline styles in 3 templates)
   ═══════════════════════════════════════════════════════════════════════════ */
.file-upload-wrapper {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  max-width: 100%;
}

.file-upload-wrapper:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.file-upload-wrapper input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.file-icon {
  font-size: 2rem;
}

.file-text {
  color: var(--muted);
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: var(--surface);
  border-radius: 4px;
  gap: 0.5rem;
}

.file-name {
  font-size: 0.875rem;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-all;
  min-width: 0;
}

.file-remove {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0 0.25rem;
  flex-shrink: 0;
}

.file-remove:hover {
  color: var(--danger);
}

.ocr-badge {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #065f46;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE DETAIL ROWS — stack on narrow viewports
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .detail-row {
    flex-direction: column;
    gap: var(--space-1);
  }
  .detail-label {
    min-width: unset;
  }
}
