/* ========================================================
   RachAuto KSeF — platform shell + list view
======================================================== */

:root {
  --bg: #edf2f4;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-hover: #eef5f7;

  --text: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --border: #d8e2e7;
  --border-soft: #e7eef2;

  --navy-950: #062f3f;
  --navy-900: #08384b;
  --navy-850: #0e4358;
  --navy-800: #164e63;

  --primary: #0284c7;
  --primary-dark: #0369a1;

  --green: #10b981;
  --green-dark: #059669;
  --red: #dc2626;
  --orange: #f59e0b;
  --purple: #8b5cf6;

  --topbar-height: 58px;
  --rail-width: 58px;
  --rail-expanded-width: 264px;

  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-float: 0 18px 45px rgba(15, 23, 42, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

/* ========================================================
   App shell
======================================================== */

.app-shell {
  min-height: 100vh;
}

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  z-index: 1000;

  display: grid;
  grid-template-columns: 210px minmax(220px, 1fr) minmax(280px, 520px) auto;
  align-items: center;
  gap: 16px;

  background: var(--navy-950);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.25);
  padding: 0 14px 0 18px;
}

.app-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.app-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.app-brand-main {
  font-size: 25px;
  line-height: 1;
}

.app-brand-dot {
  display: none;
}

.app-context {
  min-width: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 14px;
}

.app-context-title {
  overflow: hidden;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-context-subtitle {
  margin-top: 2px;
  color: rgba(226, 232, 240, 0.8);
  font-size: 11px;
  font-weight: 600;
}

.app-search {
  position: relative;
  display: flex;
  align-items: center;
}

.app-search-icon {
  position: absolute;
  left: 13px;
  color: #cbd5e1;
  font-size: 18px;
  pointer-events: none;
}

.app-search input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(226, 232, 240, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  outline: none;
  padding: 0 14px 0 38px;
  font-size: 13px;
}

.app-search input::placeholder {
  color: rgba(226, 232, 240, 0.82);
}

.app-search input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(125, 211, 252, 0.75);
}

.app-user-area {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
}

.app-user-name {
  color: rgba(226, 232, 240, 0.88);
  font-size: 12px;
  font-weight: 700;
}

.app-logout-form {
  margin: 0;
}

.app-logout-button {
  height: 34px;
  border: 1px solid rgba(226, 232, 240, 0.2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.app-logout-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ========================================================
   Left rail
======================================================== */

.app-rail {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--rail-width);
  z-index: 950;

  background: var(--navy-900);
  color: #e2e8f0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 6px 0 18px rgba(15, 23, 42, 0.18);

  overflow: hidden;
  padding: 10px 7px;
  transition: width 0.18s ease;
}

.app-rail:hover {
  width: var(--rail-expanded-width);
  box-shadow: var(--shadow-float);
}

.app-rail-link {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 13px;

  color: rgba(226, 232, 240, 0.86);
  text-decoration: none;
  border-radius: 10px;
  padding: 0 12px;
  margin-bottom: 6px;

  font-weight: 800;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-rail-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.app-rail-link.active {
  background: rgba(14, 165, 233, 0.22);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #38bdf8;
}

.app-rail-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app-rail-icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 15px;
  font-weight: 900;
}

.app-rail-text {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.app-rail:hover .app-rail-text {
  opacity: 1;
  transform: translateX(0);
}

.app-rail-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 10px 6px;
}

/* ========================================================
   Content
======================================================== */

.app-content {
  min-height: 100vh;
  padding: 18px 20px 20px 20px;
  padding-top: calc(var(--topbar-height) + 18px);
  margin-left: var(--rail-width);

  display: flex;
  flex-direction: column;
}

/* Compatibility: stare strony z company-sidebar nie będą robiły drugiego menu */
.app-content .company-page {
  max-width: none;
  padding: 0;
}

.app-content .company-topbar,
.app-content .company-sidebar {
  display: none;
}

.app-content .company-layout {
  display: block;
}

.app-content .company-content {
  overflow: visible;
}

/* ========================================================
   Messages
======================================================== */

.message-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.message-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  padding: 11px 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  font-size: 13px;
  font-weight: 700;
}

.message-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.message-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.message-warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.message-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

/* ========================================================
   Workspace
======================================================== */

.workspace {
  width: 100%;
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 12px;
}

.workspace-header.compact {
  align-items: flex-start;
}

.workspace-header.compact h1 {
  margin-top: 0;
}

.workspace-back {
  display: inline-flex;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.workspace-back:hover {
  color: var(--primary);
}

.workspace-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.workspace-header p {
  margin: 7px 0 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.workspace-company-card {
  min-width: 280px;
  max-width: 520px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px 14px;
  text-align: right;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.workspace-company-name {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.workspace-company-nip {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* ========================================================
   Toolbar
======================================================== */

.workspace-toolbar {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
  margin-bottom: 12px;

  flex: 0 0 auto;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.quick-filters a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: #475569;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.quick-filters a:hover {
  background: #e2e8f0;
}

.quick-filters a.active {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #ffffff;
}

.document-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.document-filter-form label {
  display: grid;
  gap: 4px;
}

.document-filter-form label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.document-filter-form input,
.document-filter-form select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f8fafc;
  color: var(--text);
  padding: 0 11px;
  font-size: 12px;
  outline: none;
}

.document-filter-form input:focus,
.document-filter-form select:focus {
  border-color: #38bdf8;
  background: #ffffff;
}

.filter-search-field input {
  width: 270px;
}

/* ========================================================
   Buttons
======================================================== */

.btn-primary,
.btn-secondary,
.btn-success {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 0;
  padding: 0 15px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy-900);
  color: #ffffff;
}

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

.btn-secondary {
  background: #334155;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #1e293b;
}

.btn-success {
  background: var(--green);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--green-dark);
}

/* ========================================================
   List card
======================================================== */

.list-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);

  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
}

.list-card-header {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.85);

  flex: 0 0 auto;
}

.list-count-label {
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bulk-actions-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: #f8fafc;
}

.bulk-actions-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-actions-inline select {
  height: 32px;
  min-width: 210px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 10px;
  font-size: 12px;
}

.bulk-actions-inline .btn-secondary {
  height: 32px;
  padding: 0 12px;
}

.bulk-actions-bar select {
  height: 32px;
  min-width: 210px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 10px;
  font-size: 12px;
}

/* ========================================================
   Table
======================================================== */

.table-scroll {
  width: 100%;
  flex: 1;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.96);
}

.invoice-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

/* fixed columns, contractor gets the remaining space */
.invoice-table col.col-check {
  width: 42px;
}

.invoice-table col.col-type {
  width: 76px;
}

.invoice-table col.col-ksef {
  width: 150px;
}

.invoice-table col.col-number {
  width: 160px;
}

.invoice-table col.col-date {
  width: 105px;
}

.invoice-table col.col-contractor {
  width: auto;
}

.invoice-table col.col-nip {
  width: 112px;
}

.invoice-table col.col-gross {
  width: 122px;
}

.invoice-table col.col-status {
  width: 112px;
}

.invoice-table col.col-tag {
  width: 132px;
}

.invoice-table col.col-actions {
  width: 110px;
}

.invoice-table th,
.invoice-table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 9px 10px;
  vertical-align: middle;
}

.invoice-table th {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 38px;
  background: var(--navy-900);
  color: #eaf5f8;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.invoice-table td {
  height: 44px;
  background: #ffffff;
  color: var(--text);
  overflow: hidden;
}

.invoice-table tr:hover td {
  background: var(--surface-hover);
}

.invoice-table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 20px;
  position: sticky;
}

.invoice-table th.sortable::after {
  content: "↕";
  position: absolute;
  right: 7px;
  color: #86a6b4;
  font-size: 10px;
}

.invoice-table th.sort-asc::after {
  content: "↑";
  color: #67e8f9;
}

.invoice-table th.sort-desc::after {
  content: "↓";
  color: #67e8f9;
}

/* ========================================================
   Table cells
======================================================== */

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

.ksef-number {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.invoice-number-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.contractor-cell {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.28;
}

.muted-small {
  color: var(--muted);
  font-size: 10px;
}

/* ========================================================
   Badges
======================================================== */

.type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 1px;
  padding: 3px 7px;
  border-radius: 6px;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.type-badge.purchase {
  background: var(--green);
}

.type-badge.sale {
  background: #3b82f6;
}

.type-badge.correction {
  background: var(--orange);
}

.type-badge.advance {
  background: var(--purple);
}

.status-badge,
.tag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 900;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 6px;
}

.status-new {
  background-color: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--border);
}

.status-processed {
  background-color: #d1fae5;
  color: var(--green-dark);
}

.status-error {
  background-color: #fee2e2;
  color: var(--red);
}

.tag-badge {
  padding: 4px 8px;
  border-radius: 999px;
}

.tag-empty {
  background: #f1f5f9;
  color: #64748b;
}

.tag-cost {
  background: #fee2e2;
  color: #991b1b;
}

.tag-trade_goods {
  background: #dcfce7;
  color: #166534;
}

.tag-fixed_asset {
  background: #dbeafe;
  color: #1e40af;
}

.tag-service {
  background: #fef3c7;
  color: #92400e;
}

.tag-fuel {
  background: #ede9fe;
  color: #5b21b6;
}

.tag-other {
  background: #e2e8f0;
  color: #334155;
}

/* ========================================================
   Links
======================================================== */

td.links {
  text-align: center;
  white-space: nowrap;
}

td.links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin: 1px;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 900;
}

.link-xml {
  background: #e0e7ff;
  color: #4338ca;
}

.link-xml:hover {
  background: #c7d2fe;
}

.link-pdf {
  background: #fee2e2;
  color: #b91c1c;
}

.link-pdf:hover {
  background: #fecaca;
}

.link-fetch {
  background: var(--orange);
  color: #ffffff;
}

.link-fetch:hover {
  background: #d97706;
}

.empty-table {
  height: 120px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

/* ========================================================
   Loader
======================================================== */

#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: rgba(241, 245, 249, 0.86);
  backdrop-filter: blur(4px);
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#loading-text {
  margin-top: 18px;
  color: #2c3e50;
  font-size: 20px;
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================================
   Auth fallback
======================================================== */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-messages {
  position: fixed;
  top: 18px;
  left: 50%;
  width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
}

/* ========================================================
   Responsywność
======================================================== */

@media (max-width: 1500px) {
  .table-scroll {
    overflow-x: auto;
  }

  .invoice-table {
    min-width: 1320px;
  }
}

@media (max-width: 1200px) {
  .app-topbar {
    grid-template-columns: 190px minmax(180px, 1fr) minmax(220px, 380px) auto;
  }

  .workspace-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-company-card {
    max-width: none;
    text-align: left;
  }
}

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

  .app-context,
  .app-search {
    display: none;
  }

  .app-user-name {
    display: none;
  }

  .app-content {
    padding: 16px;
    padding-top: calc(var(--topbar-height) + 16px);
  }

  .filter-search-field input {
    width: 100%;
  }

  .document-filter-form label,
  .document-filter-form input,
  .document-filter-form select,
  .btn-primary,
  .btn-success {
    width: 100%;
  }

  .document-filter-form {
    align-items: stretch;
  }
}

@media (max-width: 900px) {
  .list-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-actions-inline {
    justify-content: flex-start;
  }

  .bulk-actions-inline select,
  .bulk-actions-inline .btn-secondary {
    width: 100%;
  }
}


/* ========================================================
   BRMP THEME — dark violet / gold
   Dopisane jako override na końcu pliku
======================================================== */

:root {
  --bg: #120d24;

  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #f8f6fb;
  --surface-hover: #f3effa;

  --text: #100b1f;
  --muted: #6b6380;
  --muted-light: #a59abf;

  --border: #e4dff0;
  --border-soft: #eee9f6;

  --navy-950: #160f2e;
  --navy-900: #1c1536;
  --navy-850: #241a44;
  --navy-800: #2a2250;

  --primary: #c99a45;
  --primary-dark: #a8792e;

  --gold: #d6aa55;
  --gold-light: #f4d28b;
  --gold-soft: rgba(214, 170, 85, 0.16);

  --green: #10b981;
  --green-dark: #059669;
  --red: #dc2626;
  --orange: #f59e0b;
  --purple: #7c3aed;

  --shadow-soft: 0 14px 34px rgba(28, 21, 54, 0.14);
  --shadow-float: 0 18px 45px rgba(10, 6, 24, 0.36);
}

body {
  background:
    radial-gradient(1200px 600px at 70% -20%, #2a2250 0%, rgba(42, 34, 80, 0) 60%),
    radial-gradient(800px 400px at -10% 120%, #1c1536 0%, rgba(28, 21, 54, 0) 60%),
    var(--bg);
  color: var(--text);
}

/* ========================================================
   Topbar
======================================================== */

.app-topbar {
  background:
    linear-gradient(90deg, #140e2a 0%, #1c1536 48%, #241a44 100%);
  border-bottom: 1px solid rgba(244, 210, 139, 0.22);
  box-shadow: 0 8px 26px rgba(10, 6, 24, 0.38);
}

.app-brand-logo {
  box-shadow:
    0 0 0 1px rgba(244, 210, 139, 0.34),
    0 6px 16px rgba(0, 0, 0, 0.28);
}

.app-brand-main {
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.app-context {
  border-left: 1px solid rgba(244, 210, 139, 0.22);
}

.app-context-title {
  color: #ffffff;
}

.app-context-subtitle {
  color: rgba(244, 210, 139, 0.78);
}

.app-search input {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(244, 210, 139, 0.22);
}

.app-search input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(244, 210, 139, 0.82);
  box-shadow: 0 0 0 3px rgba(214, 170, 85, 0.16);
}

.app-search-icon {
  color: rgba(244, 210, 139, 0.78);
}

.app-logout-button {
  border-color: rgba(244, 210, 139, 0.28);
  background: rgba(244, 210, 139, 0.10);
}

.app-logout-button:hover {
  background: rgba(244, 210, 139, 0.18);
}

/* ========================================================
   Lewy rail
======================================================== */

.app-rail {
  background:
    linear-gradient(180deg, #1c1536 0%, #160f2e 100%);
  border-right: 1px solid rgba(244, 210, 139, 0.18);
}

.app-rail-icon {
  background: rgba(244, 210, 139, 0.10);
  color: #f4d28b;
}

.app-rail-link {
  color: rgba(255, 255, 255, 0.78);
}

.app-rail-link:hover {
  background: rgba(244, 210, 139, 0.10);
  color: #ffffff;
}

.app-rail-link.active {
  background: rgba(214, 170, 85, 0.18);
  box-shadow: inset 3px 0 0 var(--gold);
  color: #ffffff;
}

.app-rail-link.active .app-rail-icon {
  background: rgba(214, 170, 85, 0.22);
  color: #f4d28b;
}

.app-rail-separator {
  background: rgba(244, 210, 139, 0.16);
}

/* ========================================================
   Workspace / cards
======================================================== */

.workspace-header h1 {
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

.workspace-header p,
.workspace-back {
  color: rgba(255, 255, 255, 0.72);
}

.workspace-back:hover {
  color: var(--gold-light);
}

.workspace-company-card,
.workspace-toolbar,
.list-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(244, 210, 139, 0.22);
  box-shadow: 0 18px 42px rgba(10, 6, 24, 0.18);
}

.workspace-toolbar {
  border-top: 3px solid rgba(214, 170, 85, 0.70);
}

.list-card {
  border-top: 3px solid rgba(214, 170, 85, 0.70);
}

.list-card-header {
  background: rgba(255, 255, 255, 0.88);
}

/* ========================================================
   Filtry / przyciski
======================================================== */

.quick-filters a {
  background: #f4f0fa;
  border-color: #e4dff0;
  color: #4a3f65;
}

.quick-filters a:hover {
  background: #ebe3f6;
  color: #1c1536;
}

.quick-filters a.active {
  background: #1c1536;
  border-color: #d6aa55;
  color: #f4d28b;
}

.document-filter-form input,
.document-filter-form select,
.bulk-actions-inline select,
.bulk-actions-bar select {
  background: #fbf9fe;
  border-color: #ded6ec;
}

.document-filter-form input:focus,
.document-filter-form select:focus,
.bulk-actions-inline select:focus,
.bulk-actions-bar select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 170, 85, 0.15);
}

.btn-primary {
  background: #1c1536;
  color: #f4d28b;
  border: 1px solid rgba(214, 170, 85, 0.42);
}

.btn-primary:hover {
  background: #2a2250;
}

.btn-secondary {
  background: #2a2250;
  color: #f4d28b;
  border: 1px solid rgba(214, 170, 85, 0.35);
}

.btn-secondary:hover {
  background: #1c1536;
}

/* Zielony zostawiamy dla akcji pobierania, bo dobrze komunikuje "uruchom/pobierz" */
.btn-success {
  background: var(--green);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--green-dark);
}

/* ========================================================
   Tabela
======================================================== */

.invoice-table th {
  background: #1c1536;
  color: #f7efe0;
  border-bottom: 1px solid rgba(214, 170, 85, 0.35);
}

.invoice-table th.sortable::after {
  color: rgba(244, 210, 139, 0.58);
}

.invoice-table th.sort-asc::after,
.invoice-table th.sort-desc::after {
  color: #f4d28b;
}

.invoice-table td {
  border-bottom-color: #eee9f6;
}

.invoice-table tr:hover td {
  background: #f7f2fb;
}

.ksef-number,
.muted-small,
.list-count-label,
.toolbar-label {
  color: #6b6380;
}

/* ========================================================
   Badge / statusy / linki
======================================================== */

.type-badge.purchase {
  background: #10b981;
}

.type-badge.sale {
  background: #3b82f6;
}

.status-new {
  background-color: #f5f0fa;
  color: #6b6380;
  border-color: #ded6ec;
}

.tag-empty {
  background: #f5f0fa;
  color: #6b6380;
}

.link-xml {
  background: #ede9fe;
  color: #5b21b6;
}

.link-xml:hover {
  background: #ddd6fe;
}

.link-pdf {
  background: #fee2e2;
  color: #b91c1c;
}

.link-pdf:hover {
  background: #fecaca;
}


/* ========================================================
   BRMP THEME TUNING — jaśniejszy fiolet + miękkie karty
======================================================== */

:root {
  --bg: #1a1230;

  --surface: #fbf9ff;
  --surface-soft: #f6f1fb;
  --surface-hover: #f0e8f7;

  --text: #120d24;
  --muted: #706684;
  --muted-light: #a99dbc;

  --border: #ded5ea;
  --border-soft: #ece4f4;

  --navy-950: #1a1230;
  --navy-900: #21163d;
  --navy-850: #2a1b4a;
  --navy-800: #34235a;

  --gold: #d6aa55;
  --gold-light: #f4d28b;
  --gold-soft: rgba(214, 170, 85, 0.18);

  --shadow-soft: 0 16px 36px rgba(18, 13, 36, 0.18);
  --shadow-float: 0 22px 52px rgba(10, 6, 24, 0.38);
}

body {
  background:
    radial-gradient(1200px 600px at 70% -20%, #3a2b68 0%, rgba(58, 43, 104, 0) 62%),
    radial-gradient(900px 520px at -10% 115%, #2a1b4a 0%, rgba(42, 27, 74, 0) 62%),
    linear-gradient(180deg, #21163d 0%, #160f2b 100%);
}

/* topbar trochę jaśniejszy */
.app-topbar {
  background:
    linear-gradient(90deg, #1a1230 0%, #21163d 48%, #2a1b4a 100%);
  border-bottom: 1px solid rgba(244, 210, 139, 0.24);
}

/* rail też mniej czarny */
.app-rail {
  background:
    linear-gradient(180deg, #21163d 0%, #1a1230 100%);
}

/* treść bez zbyt dużej czarnej pustki */
.app-content {
  background:
    radial-gradient(900px 480px at 85% 0%, rgba(58, 43, 104, 0.28), transparent 60%),
    transparent;
}

/* karty nie czysto białe, tylko jasna lawenda */
.workspace-toolbar,
.list-card,
.workspace-company-card,
.message-card {
  background: rgba(251, 249, 255, 0.96);
  border-color: rgba(214, 170, 85, 0.24);
}

/* tabela delikatnie cieplejsza/lawendowa */
.invoice-table td {
  background: #fffdff;
}

.invoice-table tr:hover td {
  background: #f4edf9;
}

.list-card-header {
  background: rgba(247, 242, 251, 0.96);
}

.bulk-actions-inline select,
.bulk-actions-bar select,
.document-filter-form input,
.document-filter-form select,

/* nagłówek tabeli fioletowy, ale nie tak ciężki */
.invoice-table th {
  background: #21163d;
  color: #fff8e8;
}

/* aktywne filtry bardziej złoto-fioletowe */
.quick-filters a.active {
  background: #21163d;
  border-color: #d6aa55;
  color: #f4d28b;
}

/* cień kart mniej "biała kartka na czarnym" */
.workspace-toolbar,
.list-card {
  box-shadow: 0 16px 34px rgba(18, 13, 36, 0.20);
}

/* ========================================================
   DASHBOARD — BRMP modern cards
======================================================== */

.dashboard-page {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 6px 0 28px 0;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;

  margin-bottom: 22px;
  padding: 22px 24px;

  border: 1px solid rgba(214, 170, 85, 0.24);
  border-top: 3px solid rgba(214, 170, 85, 0.72);
  border-radius: 20px;

  background:
    linear-gradient(135deg, rgba(251, 249, 255, 0.98), rgba(244, 238, 250, 0.96));
  box-shadow: 0 18px 42px rgba(18, 13, 36, 0.22);
}

.dashboard-eyebrow {
  display: inline-flex;
  margin-bottom: 7px;
  color: #8a6a2d;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-hero h1 {
  margin: 0;
  color: #120d24;
  font-size: 32px;
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.dashboard-hero p {
  margin: 8px 0 0 0;
  color: #706684;
  font-size: 14px;
  font-weight: 700;
}

.dashboard-stats {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-stat-card {
  min-width: 148px;
  padding: 13px 16px;
  border: 1px solid rgba(214, 170, 85, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(246, 241, 251, 0.92));
  text-align: right;
}

.dashboard-stat-value {
  display: block;
  color: #21163d;
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.dashboard-stat-label {
  display: block;
  margin-top: 4px;
  color: #706684;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-clear-search {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 14px;
  border: 1px solid rgba(214, 170, 85, 0.34);
  border-radius: 11px;

  background: rgba(214, 170, 85, 0.12);
  color: #5c4520;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.dashboard-clear-search:hover {
  background: rgba(214, 170, 85, 0.20);
}

.dashboard-search-summary {
  width: fit-content;
  margin: -8px 0 18px 4px;
  padding: 8px 12px;

  border: 1px solid rgba(214, 170, 85, 0.20);
  border-radius: 999px;

  background: rgba(251, 249, 255, 0.88);
  color: #706684;
  font-size: 13px;
  font-weight: 750;
}

.dashboard-search-summary strong {
  color: #21163d;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(280px, 1fr));
  gap: 22px;
  align-items: stretch;
}

/* ========================================================
   Company card
======================================================== */

.dash-company-card {
  position: relative;
  overflow: hidden;

  min-height: 330px;
  display: flex;
  flex-direction: column;

  padding: 20px;
  border: 1px solid rgba(214, 170, 85, 0.22);
  border-radius: 20px;

  background:
    radial-gradient(360px 190px at 100% -20%, rgba(214, 170, 85, 0.13), transparent 60%),
    linear-gradient(180deg, rgba(251, 249, 255, 0.98), rgba(246, 241, 251, 0.96));

  box-shadow: 0 16px 34px rgba(18, 13, 36, 0.20);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.dash-company-card:hover {
  transform: translateY(-4px);
  border-color: rgba(214, 170, 85, 0.48);
  box-shadow: 0 24px 52px rgba(18, 13, 36, 0.30);
}

.dash-card-topline {
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background:
    linear-gradient(90deg, #d6aa55, #8b6d31 38%, #21163d 100%);
}

.dash-settings-button {
  position: absolute;
  top: 16px;
  right: 16px;

  width: 34px;
  height: 34px;

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

  border: 1px solid rgba(214, 170, 85, 0.18);
  border-radius: 11px;

  background: rgba(255, 255, 255, 0.72);
  color: #706684;
  text-decoration: none;
  font-size: 14px;

  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.dash-settings-button:hover {
  background: rgba(214, 170, 85, 0.16);
  color: #21163d;
  transform: rotate(18deg);
}

.dash-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-right: 34px;
  margin-bottom: 18px;
}

.dash-company-icon {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;

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

  border: 1px solid rgba(214, 170, 85, 0.22);
  border-radius: 16px;

  background:
    linear-gradient(135deg, rgba(214, 170, 85, 0.18), rgba(255, 255, 255, 0.72));

  font-size: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.dash-company-meta {
  min-width: 0;
}

.dash-company-meta h2 {
  margin: 0;
  color: #120d24;
  font-size: 19px;
  line-height: 1.22;
  font-weight: 950;
  letter-spacing: -0.035em;
}

.dash-company-nip {
  margin-top: 7px;
  color: #706684;
  font-size: 12px;
  font-weight: 850;
}

.dash-company-details {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px;

  border: 1px solid rgba(222, 213, 234, 0.82);
  border-radius: 14px;

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

.dash-company-details div {
  min-width: 0;
}

.dash-company-details span {
  display: block;
  margin-bottom: 2px;
  color: #9a8dad;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dash-company-details strong {
  display: block;
  overflow: hidden;
  color: #21163d;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================================
   Dashboard actions
======================================================== */

.dash-action-menu {
  display: grid;
  gap: 9px;
  margin-top: auto;
}

.dash-action {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;

  padding: 9px 11px;
  border-radius: 14px;

  text-decoration: none;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.dash-action:hover {
  transform: translateY(-1px);
}

.dash-action-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;

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

  border-radius: 9px;
  background: rgba(255, 255, 255, 0.60);
}

.dash-action strong {
  display: block;
  font-size: 12px;
  font-weight: 950;
  line-height: 1.1;
}

.dash-action small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  opacity: 0.72;
}

.dash-action-primary {
  border: 1px solid rgba(14, 165, 233, 0.20);
  background: #e8f6fd;
  color: #036987;
}

.dash-action-primary:hover {
  background: #d8f0fb;
  border-color: rgba(14, 165, 233, 0.38);
}

.dash-action-secondary {
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: #f1ebff;
  color: #5b21b6;
}

.dash-action-secondary:hover {
  background: #e8ddff;
  border-color: rgba(124, 58, 237, 0.34);
}

.dash-action-bank {
  border: 1px solid rgba(16, 185, 129, 0.20);
  background: #eafbf2;
  color: #047857;
}

.dash-action-bank:hover {
  background: #dcf7ea;
  border-color: rgba(16, 185, 129, 0.36);
}

.dash-action-disabled {
  border: 1px dashed rgba(154, 141, 173, 0.52);
  background: rgba(255, 255, 255, 0.42);
  color: #9a8dad;
  cursor: not-allowed;
}

/* ========================================================
   Empty dashboard
======================================================== */

.dashboard-empty-state {
  grid-column: 1 / -1;
  text-align: center;

  padding: 58px 32px;
  border: 1px dashed rgba(214, 170, 85, 0.34);
  border-radius: 20px;

  background: rgba(251, 249, 255, 0.94);
  color: #706684;
  box-shadow: 0 16px 34px rgba(18, 13, 36, 0.14);
}

.dashboard-empty-state h3 {
  margin: 0 0 8px 0;
  color: #120d24;
  font-size: 24px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.dashboard-empty-state p {
  margin: 0 0 18px 0;
  font-weight: 700;
}

/* ========================================================
   Dashboard responsive
======================================================== */

@media (max-width: 1700px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(280px, 1fr));
  }
}

@media (max-width: 1250px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-stats {
    justify-content: flex-start;
  }
}

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

  .dashboard-hero {
    padding: 18px;
  }

  .dashboard-hero h1 {
    font-size: 28px;
  }

  .dashboard-stat-card {
    width: 100%;
    text-align: left;
  }

  .dash-company-card {
    padding: 18px;
  }
}

/* ========================================================
   BRMP THEME TUNING 2 — jaśniejszy content + search fix
======================================================== */

/* Jaśniejsze, mniej czarne tło aplikacji */
body {
  background:
    radial-gradient(1200px 620px at 75% -18%, rgba(83, 62, 132, 0.58) 0%, rgba(83, 62, 132, 0) 62%),
    radial-gradient(900px 520px at -10% 110%, rgba(61, 43, 101, 0.52) 0%, rgba(61, 43, 101, 0) 62%),
    linear-gradient(180deg, #2a1d4a 0%, #21163d 48%, #1b1332 100%);
}

/* Content dostaje lekką lawendową poświatę, żeby nie było dużej czarnej pustki */
.app-content {
  background:
    radial-gradient(1100px 620px at 65% 12%, rgba(255, 255, 255, 0.075), transparent 64%),
    radial-gradient(800px 480px at 15% 95%, rgba(214, 170, 85, 0.055), transparent 62%),
    transparent;
}

/* Delikatnie jaśniejszy topbar, mniej "prawie czarny" */
.app-topbar {
  background:
    linear-gradient(90deg, #22163d 0%, #2a1d4a 46%, #35245f 100%);
}

/* Lewy rail też minimalnie jaśniejszy */
.app-rail {
  background:
    linear-gradient(180deg, #2a1d4a 0%, #21163d 100%);
}

/* Karty i panele lekko lawendowe, nie czysto białe */
.workspace-toolbar,
.list-card,
.dashboard-hero,
.dash-company-card,
.workspace-company-card,
.message-card {
  background:
    linear-gradient(180deg, rgba(253, 250, 255, 0.97), rgba(247, 241, 252, 0.96));
}

/* Tabela też nie czysta biel */
.invoice-table td {
  background: #fffaff;
}

.invoice-table tr:hover td {
  background: #f3edf9;
}

/* ========================================================
   TOPBAR SEARCH — przywrócenie ciemnego pola z jasnym tekstem
======================================================== */

.app-topbar .app-search input {
  background: rgba(255, 255, 255, 0.105) !important;
  border: 1px solid rgba(244, 210, 139, 0.24) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.app-topbar .app-search input::placeholder {
  color: rgba(245, 235, 214, 0.76) !important;
  opacity: 1;
}

.app-topbar .app-search input:focus {
  background: rgba(255, 255, 255, 0.155) !important;
  border-color: rgba(244, 210, 139, 0.85) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(214, 170, 85, 0.16) !important;
}

.app-topbar .app-search-icon {
  color: rgba(244, 210, 139, 0.78) !important;
}

/* Search w topbarze nie może dziedziczyć stylu zwykłych formularzy */
.app-search input:-webkit-autofill,
.app-search input:-webkit-autofill:hover,
.app-search input:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff;
  box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.12) inset !important;
  transition: background-color 9999s ease-in-out 0s;
}


/* ========================================================
   BRMP THEME TUNING 3 — light violet controls / table header
======================================================== */

/* Pola formularzy w body — jasne, ale nadal fioletowe */
.document-filter-form input,
.document-filter-form select {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 241, 252, 0.92)) !important;
  border: 1px solid rgba(214, 170, 85, 0.22) !important;
  color: #21163d !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.document-filter-form input::placeholder {
  color: rgba(80, 67, 108, 0.68) !important;
}

.document-filter-form input:focus,
.document-filter-form select:focus {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 246, 255, 0.98)) !important;
  border-color: rgba(214, 170, 85, 0.72) !important;
  color: #21163d !important;
  box-shadow:
    0 0 0 3px rgba(214, 170, 85, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.86) !important;
}

/* Select "Dla zaznaczonych" — nie ciemny, tylko jasny lawendowy */
.bulk-actions-inline select,
.bulk-actions-bar select {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 241, 252, 0.94)) !important;
  border: 1px solid rgba(214, 170, 85, 0.24) !important;
  color: #21163d !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.bulk-actions-inline select:focus,
.bulk-actions-bar select:focus {
  border-color: rgba(214, 170, 85, 0.74) !important;
  box-shadow: 0 0 0 3px rgba(214, 170, 85, 0.14) !important;
}

/* Przycisk "Oznacz" — jaśniejszy, złoto-fioletowy, mniej agresywny */
.bulk-actions-inline .btn-secondary,
.bulk-actions-bar .btn-secondary {
  background:
    linear-gradient(180deg, rgba(68, 48, 110, 0.92), rgba(45, 31, 78, 0.94)) !important;
  border: 1px solid rgba(214, 170, 85, 0.42) !important;
  color: #f4d28b !important;
  box-shadow: 0 4px 10px rgba(33, 22, 61, 0.16);
}

.bulk-actions-inline .btn-secondary:hover,
.bulk-actions-bar .btn-secondary:hover {
  background:
    linear-gradient(180deg, rgba(82, 59, 132, 0.96), rgba(55, 39, 96, 0.96)) !important;
}

/* Przycisk Filtruj — też trochę lżejszy */
.document-filter-form .btn-primary,
.btn-primary {
  background:
    linear-gradient(180deg, rgba(68, 48, 110, 0.94), rgba(45, 31, 78, 0.96)) !important;
  border: 1px solid rgba(214, 170, 85, 0.38) !important;
  color: #f4d28b !important;
}

.document-filter-form .btn-primary:hover,
.btn-primary:hover {
  background:
    linear-gradient(180deg, rgba(82, 59, 132, 0.98), rgba(55, 39, 96, 0.98)) !important;
}

/* Nagłówek tabeli — zamiast bardzo ciemnego: jasny fiolet/lawenda */
.invoice-table th {
  background:
    linear-gradient(180deg, rgba(244, 238, 250, 0.98), rgba(232, 222, 242, 0.98)) !important;
  color: #21163d !important;
  border-bottom: 1px solid rgba(214, 170, 85, 0.38) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    inset 0 -1px 0 rgba(214, 170, 85, 0.18);
}

/* Sortowanie w nagłówkach — złoty akcent zamiast ciemnego */
.invoice-table th.sortable::after {
  color: rgba(138, 106, 45, 0.72) !important;
}

.invoice-table th.sort-asc::after,
.invoice-table th.sort-desc::after {
  color: #8a6a2d !important;
}

/* Hover nagłówka tabeli */
.invoice-table th.sortable:hover {
  background:
    linear-gradient(180deg, rgba(239, 230, 247, 1), rgba(223, 211, 237, 1)) !important;
}

/* Pasek z licznikiem i akcjami — mniej biały, bardziej lawendowy */
.list-card-header {
  background:
    linear-gradient(180deg, rgba(250, 247, 253, 0.98), rgba(241, 234, 248, 0.98)) !important;
  border-bottom: 1px solid rgba(214, 170, 85, 0.18) !important;
}

/* Toolbar filtrów — minimalnie cieplejszy/lawendowy */
.workspace-toolbar {
  background:
    linear-gradient(180deg, rgba(252, 249, 255, 0.97), rgba(246, 240, 252, 0.96)) !important;
}

/* Wiersze tabeli — lekko lawendowe, żeby nie było czystej bieli */
.invoice-table td {
  background: #fffbff !important;
}

.invoice-table tr:nth-child(even) td {
  background: #faf6fd !important;
}

.invoice-table tr:hover td {
  background: #f1e9f8 !important;
}

/* Granice tabeli delikatnie fioletowe */
.invoice-table th,
.invoice-table td {
  border-bottom-color: rgba(222, 213, 234, 0.78) !important;
}

/* ========================================================
   SALES TABLE — tabela sprzedaży bez checkboxów i oznaczeń
======================================================== */

.sales-table col.col-type {
  width: 88px;
}

.sales-table col.col-ksef {
  width: 170px;
}

.sales-table col.col-number {
  width: 170px;
}

.sales-table col.col-date {
  width: 110px;
}

.sales-table col.col-contractor {
  width: auto;
}

.sales-table col.col-nip {
  width: 120px;
}

.sales-table col.col-gross {
  width: 135px;
}

.sales-table col.col-status {
  width: 120px;
}

.sales-table col.col-actions {
  width: 115px;
}

@media (max-width: 1500px) {
  .sales-table {
    min-width: 1180px;
  }
}

/* ========================================================
   BRMP TYPOGRAPHY TUNING — lżejsza, czytelniejsza typografia
======================================================== */

/* Bardziej czytelna czcionka systemowa, bez ciężkiego "display look" */
body {
  font-family:
    "Segoe UI",
    "Aptos",
    "Calibri",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    Arial,
    sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}

/* Marka może zostać mocniejsza, ale nie aż tak masywna */
.app-brand-main {
  font-weight: 750;
  letter-spacing: -0.025em;
}

/* Główne nagłówki — eleganckie, ale lżejsze */
.workspace-header h1,
.dashboard-hero h1,
.dashboard-header h1 {
  font-weight: 700 !important;
  letter-spacing: -0.025em !important;
  text-shadow: none !important;
}

/* Tytuł firmy w topbarze */
.app-context-title {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

.app-context-subtitle {
  font-weight: 500 !important;
}

/* Dashboard cards */
.dash-company-meta h2,
.card-title {
  font-weight: 700 !important;
  letter-spacing: -0.015em !important;
}

.dash-company-nip,
.dash-company-details strong,
.card-desc,
.company-info {
  font-weight: 500 !important;
}

/* Etykiety formularzy i toolbarów — mniej "bold" */
.toolbar-label,
.document-filter-form label span,
.filter-label,
.list-count-label,
.dashboard-eyebrow,
.dash-company-details span {
  font-weight: 650 !important;
  letter-spacing: 0.01em !important;
}

/* Przyciski — nadal wyraźne, ale nie krzyczą */
.btn-primary,
.btn-secondary,
.btn-success,
.dash-action strong,
.quick-filters a,
.app-logout-button {
  font-weight: 650 !important;
  letter-spacing: 0;
}

/* Pola input/select — poprawa czytelności */
.document-filter-form input,
.document-filter-form select,
.bulk-actions-inline select,
.bulk-actions-bar select,
.app-search input {
  font-weight: 400 !important;
  letter-spacing: 0;
}

/* Tabela — najważniejsze: mniej zlane nagłówki */
.invoice-table th {
  font-weight: 650 !important;
  letter-spacing: 0.015em !important;
}

/* Komórki tabeli */
.invoice-table td {
  font-weight: 400;
}

/* Numery dokumentów i wartości mogą być pogrubione, ale nie maksymalnie */
.invoice-number-cell strong,
.invoice-table td strong,
.dashboard-stat-value {
  font-weight: 700 !important;
}

/* Badge — mniejsze i czytelniejsze */
.type-badge,
.status-badge,
.tag-badge,
td.links a {
  font-weight: 700 !important;
  letter-spacing: 0.015em !important;
}

/* Opisy pomocnicze */
.muted-small,
.dash-action small,
.workspace-header p,
.dashboard-hero p {
  font-weight: 400 !important;
}

/* Trochę większa czytelność w tabeli */
.invoice-table {
  font-size: 12.5px;
}

.invoice-table th {
  font-size: 10.5px;
}

.ksef-number {
  font-size: 10.5px;
}

/* Nagłówki strony nie muszą być aż tak duże */
.workspace-header h1 {
  font-size: 29px;
}

.dashboard-hero h1 {
  font-size: 30px;
}

/* ========================================================
   DASHBOARD HARD FIX — wymuszenie widoczności dashboardu
======================================================== */

.app-content {
  position: relative !important;
  z-index: 1 !important;
  overflow: auto !important;
}

.dashboard-page {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;

  position: relative !important;
  z-index: 10 !important;

  width: min(1720px, calc(100vw - 110px)) !important;
  max-width: none !important;

  margin: 0 auto !important;
  padding: 22px 0 42px 0 !important;
}

.dashboard-hero {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;

  justify-content: space-between !important;
  align-items: center !important;
  gap: 22px !important;

  margin: 0 0 22px 0 !important;
  padding: 22px 24px !important;

  border: 1px solid rgba(214, 170, 85, 0.24) !important;
  border-top: 3px solid rgba(214, 170, 85, 0.72) !important;
  border-radius: 20px !important;

  background:
    linear-gradient(135deg, rgba(251, 249, 255, 0.98), rgba(244, 238, 250, 0.96)) !important;

  box-shadow: 0 18px 42px rgba(18, 13, 36, 0.22) !important;
}

.dashboard-hero h1 {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;

  margin: 0 !important;
  color: #120d24 !important;
  font-size: 30px !important;
  font-weight: 700 !important;
}

.dashboard-hero p,
.dashboard-eyebrow {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.dashboard-grid {
  display: grid !important;
  visibility: visible !important;
  opacity: 1 !important;

  grid-template-columns: repeat(4, minmax(280px, 1fr)) !important;
  gap: 22px !important;

  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

.dash-company-card {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;

  position: relative !important;
  overflow: hidden !important;

  min-height: 330px !important;
  flex-direction: column !important;

  padding: 20px !important;
  border: 1px solid rgba(214, 170, 85, 0.22) !important;
  border-radius: 20px !important;

  background:
    radial-gradient(360px 190px at 100% -20%, rgba(214, 170, 85, 0.13), transparent 60%),
    linear-gradient(180deg, rgba(251, 249, 255, 0.98), rgba(246, 241, 251, 0.96)) !important;

  box-shadow: 0 16px 34px rgba(18, 13, 36, 0.20) !important;
}

.dashboard-empty-state {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;

  grid-column: 1 / -1 !important;
  padding: 58px 32px !important;

  background: rgba(251, 249, 255, 0.94) !important;
  color: #706684 !important;
  border: 1px dashed rgba(214, 170, 85, 0.34) !important;
  border-radius: 20px !important;
}

@media (max-width: 1700px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(280px, 1fr)) !important;
  }
}

@media (max-width: 1250px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr)) !important;
  }

  .dashboard-hero {
    align-items: flex-start !important;
    flex-direction: column !important;
  }
}

@media (max-width: 760px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}
/* ========================================================
   BRMP — logowanie księgowości
======================================================== */

.auth-page {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(2, 132, 199, 0.14), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(16, 185, 129, 0.10), transparent 32%),
    linear-gradient(145deg, #eaf1f4 0%, #f7fafc 48%, #edf3f5 100%);
}

.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(8, 56, 75, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 56, 75, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100vw - 32px));
  padding: 34px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(216, 226, 231, 0.95);
  border-radius: 18px;
  box-shadow: 0 24px 65px rgba(15, 23, 42, 0.14);
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.auth-brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(8, 56, 75, 0.08);
}

.auth-brand-name {
  color: var(--navy-950);
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.auth-brand-caption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.auth-heading {
  margin: 27px 0 24px;
}

.auth-kicker {
  margin-bottom: 7px;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-heading h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.auth-heading p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field label {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 3px;
  border: 0;
  border-radius: 9px;
  background: var(--navy-950);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 9px 22px rgba(6, 47, 63, 0.18);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  background: var(--navy-850);
  box-shadow: 0 12px 26px rgba(6, 47, 63, 0.22);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-error-box {
  margin: -6px 0 18px;
  padding: 10px 12px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.45;
}

.auth-field-error {
  color: var(--red);
  font-size: 11px;
  line-height: 1.4;
}

.auth-footer-note {
  margin-top: 22px;
  padding-top: 18px;
  color: var(--muted-light);
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 520px) {
  .auth-page {
    padding: 16px;
  }

  .auth-card {
    width: 100%;
    padding: 26px 22px;
    border-radius: 15px;
  }

  .auth-heading h1 {
    font-size: 25px;
  }
}
