:root {
  --novico-blue: #0f4c81;
  --novico-blue-dark: #0b2f5b;
  --novico-blue-bright: #2563eb;
  --novico-yellow: #f7c600;
  --novico-yellow-soft: #fff4bf;
  --text: #1f2937;
  --muted: #64748b;
  --card: rgba(255, 255, 255, 0.94);
  --border: rgba(15, 76, 129, 0.16);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  padding: 30px;
  font-family: Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 15%, rgba(247, 198, 0, 0.28) 0 150px, transparent 152px),
    radial-gradient(circle at 88% 12%, rgba(37, 99, 235, 0.24) 0 220px, transparent 222px),
    radial-gradient(circle at 78% 88%, rgba(247, 198, 0, 0.20) 0 180px, transparent 182px),
    linear-gradient(135deg, rgba(15, 76, 129, 0.08) 25%, transparent 25%) 0 0 / 44px 44px,
    linear-gradient(315deg, rgba(247, 198, 0, 0.10) 25%, transparent 25%) 0 0 / 44px 44px,
    linear-gradient(135deg, #eef5ff 0%, #f8fbff 48%, #fff7d7 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.16)),
    repeating-linear-gradient(45deg, rgba(15, 76, 129, 0.035) 0 1px, transparent 1px 18px);
}

main,
.box,
.card {
  position: relative;
  z-index: 1;
}

.box,
.card {
  width: min(980px, calc(100% - 32px));
  margin: 40px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 55px rgba(11, 47, 91, 0.16);
  backdrop-filter: blur(8px);
}

.box { max-width: 720px; }
.card.small { max-width: 460px; }

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(15, 76, 129, 0.12);
}

.brand-logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 18px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 10px 26px rgba(11, 47, 91, 0.16);
}

.brand h1 {
  margin: 0;
  color: var(--novico-blue-dark);
  letter-spacing: -0.02em;
}

.brand p,
p.small,
.small,
p {
  color: var(--muted);
}

.brand p {
  margin: 4px 0 0;
  font-size: 14px;
}

h1 { margin: 0 0 8px; }
h2 { margin: 0 0 12px; color: var(--novico-blue-dark); }
p { line-height: 1.5; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  font-weight: 700;
  color: var(--novico-blue-dark);
}

input,
select,
button {
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
}

input,
select {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--novico-blue-bright);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

button,
.button {
  display: inline-block;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--novico-blue-bright), var(--novico-blue-dark));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

button:hover,
.button:hover {
  filter: brightness(1.04);
}

button.secondary {
  background: linear-gradient(135deg, #64748b, #334155);
  box-shadow: 0 10px 24px rgba(51, 65, 85, 0.18);
}

button.danger,
button.secondary.danger {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 10px 24px rgba(153, 27, 27, 0.18);
}

.result {
  margin-top: 16px;
  font-weight: 700;
}

#errorBox,
#successBox,
.error-panel,
pre.error {
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
  white-space: pre-wrap;
}

#errorBox,
.error-panel,
pre.error {
  background: #fff7f7;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

#successBox {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

pre.error,
.error-panel pre {
  overflow: auto;
  margin: 8px 0 0;
}

pre.has-error,
pre.error {
  color: #b91c1c;
}

.hidden,
#errorBox:not(.has-error):empty,
#successBox:empty {
  display: none;
}

.small {
  font-size: 13px;
}

@media (max-width: 720px) {
  body { padding: 16px; }
  .box,
  .card { width: 100%; margin: 20px auto; padding: 20px; }
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .brand { align-items: flex-start; }
  .brand-logo { width: 72px; height: 72px; }
}

/* Screen flow, invoice list and bilingual controls */
.app-shell { max-width: 1120px; }

.utility-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.language-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--novico-blue-dark);
}

.language-switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.language-switch .flag-button {
  width: auto;
  margin: 0;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #fff;
  color: var(--novico-blue-dark);
  border: 1px solid rgba(15, 76, 129, 0.18);
  box-shadow: 0 8px 18px rgba(11, 47, 91, 0.08);
}

.language-switch .flag-button.active {
  background: linear-gradient(135deg, rgba(247, 198, 0, 0.24), rgba(37, 99, 235, 0.14));
  border-color: rgba(15, 76, 129, 0.38);
}

.screen-panel {
  animation: fadeIn 0.18s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.section-header h2,
.form-heading h2 {
  margin: 0 0 6px;
}

.section-header p,
.form-heading p {
  margin: 0;
}

.section-actions {
  flex: 0 0 auto;
}

.section-actions button,
.page-actions button,
.form-actions button {
  width: auto;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(15, 76, 129, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.invoice-table th,
.invoice-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 76, 129, 0.12);
  vertical-align: top;
}

.invoice-table th {
  color: var(--novico-blue-dark);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(15, 76, 129, 0.06);
}

.invoice-table tbody tr:hover {
  background: rgba(247, 198, 0, 0.08);
}

.invoice-table tbody tr:last-child td {
  border-bottom: 0;
}

.muted-cell,
.empty-state,
.helper-text {
  color: var(--muted);
}

.muted-cell {
  text-align: center;
}

.empty-state {
  padding: 16px;
  margin: 14px 0 0;
  border-radius: 14px;
  background: rgba(15, 76, 129, 0.06);
  border: 1px dashed rgba(15, 76, 129, 0.20);
}

.page-actions,
.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.center-form {
  width: min(100%, 480px);
  margin: 0 auto;
}

.center-form label {
  text-align: left;
}

.invoice-form {
  margin-top: 18px;
}

.form-heading {
  text-align: center;
  margin-bottom: 8px;
}

.form-actions button {
  min-width: 160px;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 720px) {
  .utility-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .language-switch {
    width: 100%;
  }

  .language-switch .flag-button {
    flex: 1 1 0;
  }

  .section-header {
    flex-direction: column;
  }

  .section-actions,
  .section-actions button,
  .page-actions button,
  .form-actions button {
    width: 100%;
  }

  .invoice-table {
    min-width: 0;
  }

  .invoice-table thead {
    display: none;
  }

  .invoice-table,
  .invoice-table tbody,
  .invoice-table tr,
  .invoice-table td {
    display: block;
    width: 100%;
  }

  .invoice-table tr {
    padding: 10px 0;
    border-bottom: 1px solid rgba(15, 76, 129, 0.12);
  }

  .invoice-table td {
    border-bottom: 0;
    padding: 8px 14px;
  }

  .invoice-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--novico-blue-dark);
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 2px;
  }
}

/* New invoice-list flow and bilingual controls */
.box.app-box {
  max-width: 1120px;
}

.brand-shell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(15, 76, 129, 0.12);
}

.brand-shell.compact {
  align-items: flex-start;
}

.brand-shell .brand {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.language-switch {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.flag-button,
.language-switch .flag-button {
  width: 46px;
  min-width: 46px;
  height: 42px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid rgba(15, 76, 129, 0.18);
  border-radius: 14px;
  background: #fff;
  color: var(--novico-blue-dark);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(11, 47, 91, 0.10);
}

.flag-button.active {
  border-color: var(--novico-yellow);
  box-shadow: 0 0 0 4px rgba(247, 198, 0, 0.22), 0 8px 18px rgba(11, 47, 91, 0.10);
}

.screen {
  animation: fadeIn 0.16s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading.centered {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 20px;
}

.center-form {
  width: min(460px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.center-form label {
  text-align: left;
}

.invoice-form input,
.invoice-form select,
.center-form input,
.center-form select {
  text-align: center;
}

.form-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.form-actions button {
  width: auto;
  min-width: 160px;
  margin-top: 0;
}

.list-topbar {
  align-items: center;
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.toolbar button {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.user-chip {
  display: inline-block;
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 76, 129, 0.08);
  color: var(--novico-blue-dark);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(15, 76, 129, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.80);
}

.invoice-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.invoice-table th,
.invoice-table td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 76, 129, 0.10);
  vertical-align: top;
}

.invoice-table th {
  background: rgba(15, 76, 129, 0.08);
  color: var(--novico-blue-dark);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.invoice-table tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  margin: 16px 0;
  padding: 22px;
  text-align: center;
  border: 1px dashed rgba(15, 76, 129, 0.28);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.success-panel {
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
  white-space: pre-wrap;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

@media (max-width: 720px) {
  .brand-shell,
  .brand-shell.compact {
    flex-direction: column;
  }

  .language-switch {
    justify-content: flex-start;
  }

  .toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar button,
  .form-actions button {
    width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }
}


/* Language selectbox with flags */
.language-select-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.flag-select {
  width: 78px;
  min-width: 78px;
  height: 44px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 76, 129, 0.22);
  border-radius: 14px;
  background: #ffffff;
  color: var(--novico-blue-dark);
  font-size: 23px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(11, 47, 91, 0.10);
}

.flag-select:focus {
  outline: none;
  border-color: var(--novico-yellow);
  box-shadow: 0 0 0 4px rgba(247, 198, 0, 0.24), 0 8px 18px rgba(11, 47, 91, 0.10);
}

.flag-select option {
  background: #ffffff;
  color: #111827;
  font-size: 20px;
}


/* Fixed language selectbox with flags */
.language-select-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.flag-select {
  width: 78px;
  min-width: 78px;
  height: 44px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 76, 129, 0.22);
  border-radius: 14px;
  background: #ffffff;
  color: #0f4c81;
  font-size: 23px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(11, 47, 91, 0.10);
}

.flag-select:focus {
  outline: none;
  border-color: #f7c600;
  box-shadow: 0 0 0 4px rgba(247, 198, 0, 0.24), 0 8px 18px rgba(11, 47, 91, 0.10);
}

.flag-select option {
  background: #ffffff;
  color: #111827;
  font-size: 20px;
}


/* Invoice table filters */
.search-hint {
  margin-top: -6px;
  margin-bottom: 14px;
  color: rgba(17, 24, 39, 0.72);
}

.invoice-filter-row th {
  background: rgba(255, 255, 255, 0.92) !important;
  padding: 8px 10px !important;
}

.invoice-filter {
  width: 100%;
  min-width: 120px;
  border: 1px solid rgba(15, 76, 129, 0.18);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  background: #ffffff;
  color: var(--novico-blue-dark);
  outline: none;
}

.invoice-filter:focus {
  border-color: var(--novico-yellow);
  box-shadow: 0 0 0 3px rgba(247, 198, 0, 0.22);
}

@media (max-width: 760px) {
  .invoice-filter-row {
    display: block !important;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
  }

  .invoice-filter-row th {
    display: block !important;
    width: 100%;
    border-bottom: 0 !important;
    padding: 6px 0 !important;
  }

  .invoice-filter {
    min-width: 0;
  }
}


/* Main menu and user management */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.menu-card {
  min-height: 150px;
  padding: 22px;
  border-radius: 18px;
  text-align: left;
  display: grid;
  gap: 8px;
  align-content: start;
  background: linear-gradient(135deg, var(--novico-blue), var(--novico-blue-bright));
  color: #fff;
  box-shadow: 0 16px 34px rgba(11, 47, 91, 0.20);
}

.menu-card:hover {
  transform: translateY(-2px);
}

.menu-card .menu-icon {
  font-size: 32px;
}

.menu-card strong {
  font-size: 20px;
}

.menu-card small {
  color: rgba(255,255,255,.84);
  line-height: 1.35;
}

.centered-actions {
  justify-content: center;
}

.user-form {
  margin-bottom: 24px;
}

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

.users-table th,
.users-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.small-action {
  padding: 8px 12px;
  font-size: 13px;
}

.admin-only.hidden {
  display: none;
}


/* Wider invoice/sales screens */
.app-box {
  width: min(1680px, calc(100% - 32px));
  max-width: 1680px;
}

.table-wrap {
  overflow-x: auto;
}

/* Sales multiselect and customer edit */
.sales-row-checkbox,
#selectAllSalesCheckbox {
  width: 18px;
  height: 18px;
  accent-color: var(--novico-blue);
  cursor: pointer;
}

.sales-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-weight: 700;
}

.sales-customer-form input[readonly] {
  background: #f8fafc;
  color: var(--muted);
  cursor: not-allowed;
}


/* Sales date range/API filters */
.date-range-filter {
  display: grid;
  grid-template-columns: minmax(125px, 1fr) minmax(125px, 1fr);
  gap: 6px;
}

.date-range-filter input {
  min-width: 125px;
}

.sales-table th select.invoice-filter {
  min-width: 130px;
}


/* Full screen workspace mode */
body.novico-fullscreen {
  padding: 0;
}

body.novico-fullscreen .app-box,
body.novico-fullscreen .box {
  width: 100vw;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  border-radius: 0;
}

body.novico-fullscreen .table-wrap {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.toolbar-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  font-size: 0.9rem;
}

.toolbar-filter input,
.toolbar-filter select {
  min-width: 90px;
}

.permission-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background: #f8fafc;
}


/* Fullscreen icon buttons */
.icon-button {
  min-width: 36px;
  min-height: 34px;
  padding: 5px 9px;
  font-size: 1.05rem;
  line-height: 1;
}

/* Pager with arrows under invoice table */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 0;
}

.pager-info {
  min-width: 190px;
  text-align: center;
  font-size: 0.9rem;
  color: #475569;
}

.pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* In fullscreen, use more of the monitor */
body.novico-fullscreen .screen {
  max-width: none;
}

body.novico-fullscreen .table-wrap {
  max-height: calc(100vh - 230px);
}


/* Correct compact invoice table layout
   - Κανονικό μήκος προς τα κάτω
   - Καλύτερη εκμετάλλευση πλάτους
   - Τα μεγάλα κείμενα κόβονται σε 2 γραμμές μέσα στο κελί
*/
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.invoice-table {
  width: 100%;
  min-width: 1250px;
  table-layout: fixed;
  border-collapse: collapse;
}

.invoice-table th,
.invoice-table td {
  padding: 5px 7px;
  font-size: 0.82rem;
  line-height: 1.2;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

/* Two-line clamp INSIDE cells without breaking table layout */
.invoice-table td > *:not(button):not(input):not(select),
.invoice-table td {
  max-height: 2.45em;
  overflow: hidden;
}

/* Better column widths for expenses/sales tables */
.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) {
  width: 86px;
}

.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
  width: 82px;
}

.invoice-table th:nth-child(3),
.invoice-table td:nth-child(3) {
  width: 145px;
}

.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4) {
  width: 78px;
}

.invoice-table th:nth-child(5),
.invoice-table td:nth-child(5) {
  width: 85px;
}

.invoice-table th:nth-child(6),
.invoice-table td:nth-child(6) {
  width: 155px;
}

.invoice-table th:nth-child(7),
.invoice-table td:nth-child(7) {
  width: 120px;
}

.invoice-table th:nth-child(8),
.invoice-table td:nth-child(8) {
  width: 95px;
}

.invoice-table th:nth-child(9),
.invoice-table td:nth-child(9),
.invoice-table th:nth-child(10),
.invoice-table td:nth-child(10) {
  width: 90px;
}

.invoice-table th:last-child,
.invoice-table td:last-child {
  width: 130px;
}

/* Filter row compact */
.invoice-filter-row input,
.invoice-filter-row select {
  width: 100%;
  min-width: 0;
  padding: 4px 5px;
  font-size: 0.76rem;
}

/* Buttons inside actions column compact */
.invoice-table td .small-action,
.invoice-table td button {
  margin: 1px 2px 2px 0;
  padding: 4px 6px;
  font-size: 0.74rem;
  line-height: 1.1;
}

/* In fullscreen use almost all monitor width */
body.novico-fullscreen .screen,
body.novico-fullscreen .app-box,
body.novico-fullscreen .box,
body.novico-fullscreen main {
  width: 100vw;
  max-width: none !important;
}

body.novico-fullscreen .table-wrap {
  max-height: calc(100vh - 230px);
  overflow: auto;
}


/* Actions immediately after invoice number, side by side */
.invoice-table td.actions-cell {
  max-height: none !important;
  overflow: visible !important;
  white-space: nowrap;
}

.invoice-table td.actions-cell .small-action,
.invoice-table td.actions-cell button {
  display: inline-block;
  vertical-align: middle;
  margin: 0 3px 3px 0;
}

/* Updated widths because Actions moved after Number */
.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) {
  width: 86px;
}

.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
  width: 150px;
}

.invoice-table th:nth-child(3),
.invoice-table td:nth-child(3) {
  width: 82px;
}

/* Ensure actions column is not pushed to the far right */
.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
  text-align: left;
}


/* --- Novico UX v4: fullscreen, compact table, filters under headers, pager --- */
body.novico-fullscreen {
  padding: 0 !important;
  margin: 0 !important;
}

body.novico-fullscreen .app-box,
body.novico-fullscreen .box,
body.novico-fullscreen .screen,
body.novico-fullscreen main {
  width: 100vw !important;
  max-width: none !important;
  min-height: 100vh;
  margin: 0 !important;
  border-radius: 0 !important;
}

body.novico-fullscreen .table-wrap {
  max-height: calc(100vh - 245px);
  overflow: auto;
}

.invoice-table {
  width: 100%;
  min-width: 1450px;
  table-layout: fixed;
}

.invoice-table thead th {
  vertical-align: bottom;
  padding: 6px;
}

.invoice-table .th-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
}

.invoice-table thead input,
.invoice-table thead select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 4px 5px;
  font-size: 0.74rem;
}

.invoice-table td {
  padding: 5px 7px;
  font-size: 0.82rem;
  line-height: 1.22;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
  max-height: 2.5em;
  overflow: hidden;
}

.invoice-table .select-col {
  width: 42px;
  text-align: center;
}

.invoice-table .erp-col {
  width: 58px;
  text-align: center;
}

.actions-cell {
  white-space: nowrap !important;
  overflow: visible !important;
  max-height: none !important;
  width: 140px;
}

.actions-cell button {
  display: inline-block;
  margin: 0 4px 3px 0;
  padding: 4px 7px;
  font-size: 0.74rem;
}

.erp-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-weight: 900;
  color: white;
}

.erp-sent {
  background: #16a34a;
}

.erp-not-sent {
  background: #dc2626;
}

tr.is-uploaded {
  background: rgba(22, 163, 74, 0.05);
}

tr.is-not-uploaded {
  background: rgba(220, 38, 38, 0.035);
}

.pager {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.pager-jump {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.pager-jump input {
  width: 72px;
  padding: 5px 6px;
  text-align: center;
}

.pager-info {
  min-width: 140px;
  text-align: left;
}

.toolbar-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}


/* FIX: Purchase list selection and pager visibility */
#invoiceListArea .table-wrap {
  overflow: auto !important;
}

#invoiceListArea .invoice-table {
  width: 100% !important;
  min-width: 1500px !important;
}

#invoiceListArea .invoice-table th.select-col,
#invoiceListArea .invoice-table td.select-col,
#invoiceListArea .invoice-table th.erp-col,
#invoiceListArea .invoice-table td.erp-col {
  width: 56px !important;
  min-width: 56px !important;
  max-height: none !important;
  overflow: visible !important;
  text-align: center !important;
  vertical-align: middle !important;
  cursor: pointer;
}

#selectAllPurchaseCheckbox,
.purchase-row-checkbox {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  accent-color: #0f766e;
  cursor: pointer;
  position: relative;
  z-index: 5;
}

#invoiceListArea .erp-status {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 16px !important;
  position: relative;
  z-index: 4;
}

#invoicePager {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid #dbeafe;
  padding: 12px 8px !important;
  margin-top: 8px !important;
}

#invoicePrevPageBtn,
#invoiceNextPageBtn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 46px !important;
  height: 38px !important;
  font-size: 22px !important;
  font-weight: 900 !important;
}

#invoicePageInput {
  display: inline-block !important;
  width: 80px !important;
  height: 34px !important;
  font-size: 16px !important;
}

body.novico-fullscreen #invoiceListArea,
body.novico-fullscreen #invoiceListArea.screen,
body.novico-fullscreen .screen:not(.hidden),
body.novico-fullscreen .app-box,
body.novico-fullscreen main,
body.novico-fullscreen .box {
  width: 100vw !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.novico-fullscreen #invoiceListArea .table-wrap {
  max-height: calc(100vh - 235px) !important;
}


/* FIX: compact icon actions so text does not overlap table cells */
#invoiceListArea .actions-cell {
  width: 74px !important;
  min-width: 74px !important;
  max-width: 74px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-align: center !important;
  vertical-align: middle !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

#invoiceListArea .icon-action {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  margin: 0 2px !important;
  padding: 0 !important;
  border-radius: 8px;
  border: 0;
  font-size: 16px !important;
  line-height: 1 !important;
  cursor: pointer;
  color: #fff;
  box-shadow: none !important;
}

#invoiceListArea .edit-icon {
  background: #475569 !important;
}

#invoiceListArea .delete-icon {
  background: #dc2626 !important;
}

#invoiceListArea .icon-action:hover {
  filter: brightness(1.08);
}

/* Give date/amount columns enough width and prevent action overlap */
#invoiceListArea .invoice-table th:nth-child(4),
#invoiceListArea .invoice-table td:nth-child(4) {
  width: 74px !important;
}

#invoiceListArea .invoice-table th:nth-child(5),
#invoiceListArea .invoice-table td:nth-child(5) {
  width: 96px !important;
}

#invoiceListArea .invoice-table td {
  line-height: 1.28 !important;
}


/* SALES V4: arrows/pagination and edit icon, no delete column */
.sales-table {
  width: 100% !important;
  min-width: 1550px !important;
  table-layout: fixed;
}

.sales-table thead th {
  vertical-align: bottom;
  padding: 6px;
}

.sales-table .th-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
}

.sales-table thead input,
.sales-table thead select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 4px 5px;
  font-size: 0.74rem;
}

.sales-select-col,
.sales-edit-col {
  width: 58px !important;
  min-width: 58px !important;
  text-align: center !important;
  vertical-align: middle !important;
}

#selectAllSalesCheckbox,
.sales-row-checkbox {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  accent-color: #0f766e;
  cursor: pointer;
}

.sales-select-col {
  cursor: pointer;
}

.sales-edit-col.actions-cell {
  max-height: none !important;
  overflow: visible !important;
  white-space: nowrap !important;
}

.sales-edit-col .icon-action {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  margin: 0 2px !important;
  padding: 0 !important;
  border-radius: 8px;
  border: 0;
  font-size: 16px !important;
  line-height: 1 !important;
  cursor: pointer;
  color: #fff;
  background: #475569 !important;
}

#salesPager {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid #dbeafe;
  padding: 12px 8px !important;
  margin-top: 8px !important;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

#salesPrevPageBtn,
#salesNextPageBtn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 46px !important;
  height: 38px !important;
  font-size: 22px !important;
  font-weight: 900 !important;
}

#salesPageInput {
  display: inline-block !important;
  width: 80px !important;
  height: 34px !important;
  font-size: 16px !important;
  text-align: center;
}

body.novico-fullscreen #SalesListArea,
body.novico-fullscreen #SalesListArea.screen {
  width: 100vw !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

body.novico-fullscreen #SalesListArea .table-wrap {
  max-height: calc(100vh - 235px) !important;
  overflow: auto !important;
}


/* SALES FINAL FIX: full screen, arrows, edit pencil, no delete */
#toggleSalesFullscreenBtn {
  min-width: 42px;
  font-size: 18px;
}

#SalesListArea .sales-table {
  width: 100% !important;
  min-width: 1550px !important;
  table-layout: fixed !important;
}

#SalesListArea .sales-table thead th {
  vertical-align: bottom !important;
  padding: 6px !important;
}

#SalesListArea .sales-table .th-title {
  display: block !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  margin-bottom: 4px !important;
  white-space: nowrap !important;
}

#SalesListArea .sales-table thead input,
#SalesListArea .sales-table thead select {
  width: 100% !important;
  padding: 4px 5px !important;
  font-size: 0.74rem !important;
}

#SalesListArea .sales-select-col,
#SalesListArea .sales-edit-col {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  text-align: center !important;
  vertical-align: middle !important;
  overflow: visible !important;
  max-height: none !important;
}

#selectAllSalesCheckbox,
.sales-row-checkbox {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  accent-color: #0f766e;
  cursor: pointer;
}

#SalesListArea .icon-action {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  margin: 0 2px !important;
  padding: 0 !important;
  border-radius: 8px !important;
  border: 0 !important;
  font-size: 16px !important;
  color: #fff !important;
  background: #475569 !important;
  cursor: pointer;
}

#salesPager {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: sticky !important;
  bottom: 0 !important;
  z-index: 20 !important;
  background: rgba(255,255,255,0.96) !important;
  border-top: 1px solid #dbeafe !important;
  padding: 12px 8px !important;
  margin-top: 8px !important;
  gap: 8px !important;
  justify-content: center !important;
  align-items: center !important;
}

#salesPrevPageBtn,
#salesNextPageBtn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 46px !important;
  height: 38px !important;
  font-size: 22px !important;
  font-weight: 900 !important;
}

#salesPageInput {
  width: 80px !important;
  height: 34px !important;
  font-size: 16px !important;
  text-align: center !important;
}

body.novico-fullscreen {
  padding: 0 !important;
  margin: 0 !important;
}

body.novico-fullscreen .app-box,
body.novico-fullscreen .box,
body.novico-fullscreen main {
  width: 100vw !important;
  max-width: none !important;
  min-height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

body.novico-fullscreen #SalesListArea,
body.novico-fullscreen #SalesListArea.screen {
  width: 100vw !important;
  max-width: none !important;
}

body.novico-fullscreen #SalesListArea .table-wrap {
  max-height: calc(100vh - 235px) !important;
  overflow: auto !important;
}


/* ADVANCED IMPROVEMENTS: sticky header, exports, ERP colors, totals, resizable columns */
.table-wrap {
  position: relative;
}

.invoice-table thead th,
.sales-table thead th {
  position: sticky !important;
  top: 0;
  z-index: 12;
  background: #eaf1f7 !important;
  box-shadow: 0 1px 0 rgba(15, 76, 129, 0.12);
}

.sortable-th {
  cursor: pointer;
  user-select: none;
}

.sortable-th .th-title::after {
  content: " ↕";
  opacity: 0.55;
  font-size: 0.72em;
}

.erp-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.totals-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: rgba(239, 246, 255, 0.92);
  color: #0f2f57;
  font-weight: 800;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.invoice-table th,
.sales-table th {
  position: sticky !important;
}

.sales-table tr:hover,
.invoice-table tr:hover {
  background: rgba(59, 130, 246, 0.06) !important;
}

@media print {
  .toolbar, .topbar button, .pager, .totals-bar, .user-chip {
    display: none !important;
  }
}


/* Sadmin/User export modal */
.modal.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  width: min(760px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  border: 1px solid #dbeafe;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.25);
  padding: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.export-column-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.export-column-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fafc;
}

.export-column-item input {
  width: 18px;
  height: 18px;
}


/* Fix: hide totals bar and user management for non-Sadmin */
.totals-bar,
#salesTotalsBar,
#purchaseTotalsBar {
  display: none !important;
}

.sadmin-only.hidden,
#adminUsersMenuBtn.hidden {
  display: none !important;
}



/* Roles final: User Management visible only for admin */
#adminUsersMenuBtn.hidden,
.admin-only.hidden {
  display: none !important;
}

/* ===============================
   Novico v5.0 ERP UI upgrade
   Dashboard, dark mode, sticky tables, tablet responsive
   =============================== */
:root {
  --v5-bg: #edf4ff;
  --v5-surface: rgba(255,255,255,.92);
  --v5-surface-solid: #ffffff;
  --v5-text: #102033;
  --v5-muted: #64748b;
  --v5-primary: #0f4c81;
  --v5-primary-2: #2563eb;
  --v5-accent: #f7c600;
  --v5-border: rgba(15,76,129,.15);
  --v5-shadow: 0 24px 70px rgba(15, 76, 129, .17);
  --v5-radius: 22px;
}

body {
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at 6% 12%, rgba(247,198,0,.26) 0 180px, transparent 181px),
    radial-gradient(circle at 93% 4%, rgba(37,99,235,.22) 0 270px, transparent 271px),
    linear-gradient(135deg, #edf4ff 0%, #f8fbff 50%, #fff8d8 100%);
  color: var(--v5-text);
}

body.dark-mode {
  --v5-bg: #0b1220;
  --v5-surface: rgba(15, 23, 42, .90);
  --v5-surface-solid: #111827;
  --v5-text: #e5edf7;
  --v5-muted: #94a3b8;
  --v5-primary: #60a5fa;
  --v5-primary-2: #38bdf8;
  --v5-accent: #facc15;
  --v5-border: rgba(148,163,184,.24);
  --v5-shadow: 0 28px 80px rgba(0,0,0,.42);
  background:
    radial-gradient(circle at 6% 12%, rgba(250,204,21,.14) 0 180px, transparent 181px),
    radial-gradient(circle at 93% 4%, rgba(56,189,248,.16) 0 270px, transparent 271px),
    linear-gradient(135deg, #020617 0%, #0f172a 55%, #111827 100%);
}

body.dark-mode::before { background: repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 1px, transparent 1px 20px); }
body.dark-mode .box,
body.dark-mode .card,
body.dark-mode .modal-card { background: var(--v5-surface); color: var(--v5-text); border-color: var(--v5-border); }
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode label { color: var(--v5-text); }
body.dark-mode p,
body.dark-mode .small,
body.dark-mode .brand p { color: var(--v5-muted); }
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea { background: #0b1220; color: var(--v5-text); border-color: var(--v5-border); }
body.dark-mode .invoice-table th { background: #111827; color: #dbeafe; }
body.dark-mode .invoice-table td { background: rgba(15,23,42,.72); color: var(--v5-text); border-color: var(--v5-border); }
body.dark-mode .invoice-table tbody tr:hover td { background: rgba(37,99,235,.16); }
body.dark-mode .menu-card,
body.dark-mode .kpi-card,
body.dark-mode .dashboard-hero { background: rgba(15,23,42,.82); border-color: var(--v5-border); color: var(--v5-text); }

.app-box,
.box.app-box {
  width: min(1500px, calc(100% - 28px));
  max-width: 1500px;
  border-radius: 28px;
  background: var(--v5-surface);
  border: 1px solid var(--v5-border);
  box-shadow: var(--v5-shadow);
  padding: 24px;
}

.brand-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(15,76,129,.10), rgba(247,198,0,.12));
  border: 1px solid var(--v5-border);
}
.brand { margin: 0; padding: 0; border: 0; }
.brand-logo { width: 72px; height: 72px; border-radius: 20px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  background: var(--v5-surface-solid);
  color: var(--v5-primary);
  border: 1px solid var(--v5-border);
  box-shadow: 0 8px 24px rgba(15,76,129,.12);
}

.dashboard-panel { display: grid; gap: 16px; margin: 16px 0 24px; }
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(15,76,129,.10), rgba(37,99,235,.08), rgba(247,198,0,.13));
  border: 1px solid var(--v5-border);
}
.dashboard-hero h3 { margin: 4px 0 6px; font-size: clamp(22px, 3vw, 34px); color: var(--v5-text); }
.dashboard-hero p { margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--v5-primary); font-weight: 800; }
.dashboard-badge {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--v5-primary);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(15,76,129,.20);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 145px;
  padding: 18px;
  margin: 0;
  text-align: left;
  border-radius: 22px;
  border: 1px solid var(--v5-border);
  background: rgba(255,255,255,.86);
  color: var(--v5-text);
  box-shadow: 0 12px 34px rgba(15,76,129,.10);
}
.kpi-card-click { cursor: pointer; }
.kpi-card-click:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(15,76,129,.16); }
.kpi-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: rgba(37,99,235,.10); font-size: 22px; }
.kpi-label { color: var(--v5-muted); font-weight: 800; font-size: 13px; }
.kpi-card strong { font-size: 34px; line-height: 1; color: var(--v5-text); }
.kpi-card small { color: var(--v5-muted); }
.dashboard-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-action { width: auto; margin: 0; border-radius: 999px; padding: 11px 16px; }

.menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.menu-card {
  min-height: 150px;
  border-radius: 24px;
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
  box-shadow: 0 12px 34px rgba(15,76,129,.10);
  transition: transform .15s ease, box-shadow .15s ease;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 20px 44px rgba(15,76,129,.16); }
.menu-icon { font-size: 34px; }

.table-wrap {
  max-height: min(68vh, 760px);
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.invoice-table { border-collapse: separate; border-spacing: 0; min-width: 1200px; }
.invoice-table thead th,
.invoice-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fbff;
  color: #0b2f5b;
  border-bottom: 1px solid var(--v5-border);
  box-shadow: 0 1px 0 var(--v5-border);
}
.invoice-table tbody tr:nth-child(even) td { background: rgba(248,251,255,.74); }
.invoice-table tbody tr:hover td { background: #fff8d8; }
.invoice-table td,
.invoice-table th { vertical-align: middle; }
.invoice-table .th-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.topbar.list-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px;
  margin: -4px -4px 14px;
  border-radius: 22px;
  background: var(--v5-surface);
  border: 1px solid var(--v5-border);
  backdrop-filter: blur(10px);
}
.toolbar { gap: 8px; align-items: end; }
.toolbar button { width: auto; margin-top: 0; }
.toolbar-filter { min-width: 120px; }

button { font-weight: 800; }
button.primary,
button:not(.secondary):not(.theme-toggle):not(.menu-card):not(.kpi-card):not(.icon-action) {
  background: linear-gradient(135deg, var(--v5-primary), var(--v5-primary-2));
  color: #fff;
}
button.secondary,
.secondary { background: rgba(15,76,129,.08); color: var(--v5-primary); border: 1px solid var(--v5-border); }

@media (max-width: 1100px) {
  body { padding: 14px; }
  .app-box, .box.app-box { width: 100%; padding: 16px; border-radius: 22px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-shell { align-items: flex-start; }
  .topbar.list-topbar { position: relative; }
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .toolbar button, .toolbar label { width: 100%; }
}

@media (max-width: 720px) {
  .brand-shell, .dashboard-hero { flex-direction: column; align-items: stretch; }
  .header-actions { justify-content: space-between; }
  .kpi-grid, .menu-grid { grid-template-columns: 1fr; }
  .dashboard-actions { display: grid; grid-template-columns: 1fr; }
  .quick-action { width: 100%; }
  .toolbar { grid-template-columns: 1fr; }
}


/* ===============================
   Novico v5.1 requested changes
   No dashboard, selectable colors, text color per theme, table size controls
   =============================== */
body.theme-blue {
  --v5-primary: #0f4c81;
  --v5-primary-2: #2563eb;
  --v5-accent: #f7c600;
  --v5-text: #102033;
  --v5-muted: #64748b;
}
body.theme-green {
  --v5-primary: #047857;
  --v5-primary-2: #10b981;
  --v5-accent: #a3e635;
  --v5-text: #052e2b;
  --v5-muted: #3f6f64;
}
body.theme-purple {
  --v5-primary: #6d28d9;
  --v5-primary-2: #a855f7;
  --v5-accent: #f0abfc;
  --v5-text: #24103f;
  --v5-muted: #6b5b7f;
}
body.theme-orange {
  --v5-primary: #c2410c;
  --v5-primary-2: #f97316;
  --v5-accent: #fde68a;
  --v5-text: #3b1d0b;
  --v5-muted: #7c5f46;
}
body.dark-mode.theme-green,
body.dark-mode.theme-purple,
body.dark-mode.theme-orange,
body.dark-mode.theme-blue {
  --v5-text: #e5edf7;
  --v5-muted: #b6c2d1;
}
body.theme-green .brand-shell { background: linear-gradient(135deg, rgba(4,120,87,.14), rgba(163,230,53,.14)); }
body.theme-purple .brand-shell { background: linear-gradient(135deg, rgba(109,40,217,.14), rgba(240,171,252,.14)); }
body.theme-orange .brand-shell { background: linear-gradient(135deg, rgba(194,65,12,.14), rgba(253,230,138,.20)); }
body.theme-blue .brand-shell { background: linear-gradient(135deg, rgba(15,76,129,.10), rgba(247,198,0,.12)); }

.ui-control {
  display: grid;
  gap: 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--v5-primary);
  min-width: 104px;
}
.ui-control span { line-height: 1; }
.ui-select {
  height: 34px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--v5-border);
  background: var(--v5-surface-solid);
  color: var(--v5-text);
  font-weight: 800;
}

body.table-size-compact .invoice-table th,
body.table-size-compact .invoice-table td { font-size: 12px; padding: 6px 8px; }
body.table-size-compact .invoice-table thead input,
body.table-size-compact .invoice-table thead select { height: 28px; font-size: 11px; }
body.table-size-normal .invoice-table th,
body.table-size-normal .invoice-table td { font-size: 14px; padding: 9px 10px; }
body.table-size-large .invoice-table th,
body.table-size-large .invoice-table td { font-size: 16px; padding: 13px 14px; }
body.table-size-large .invoice-table thead input,
body.table-size-large .invoice-table thead select { height: 38px; font-size: 14px; }

/* resize columns manually from browser */
.invoice-table th { resize: horizontal; overflow: auto; min-width: 72px; }
.invoice-table th.select-col,
.invoice-table th.sales-select-col,
.invoice-table th.erp-col,
.invoice-table th.sales-erp-col { resize: none; }

.erp-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
}
.erp-ok { background: rgba(22,163,74,.12); }
.erp-no { background: rgba(220,38,38,.12); }
.purchase-row-checkbox:disabled,
.sales-row-checkbox:disabled { cursor: not-allowed; opacity: .45; }
tr.is-uploaded td { color: #166534; }
tr.is-not-uploaded td { color: #7f1d1d; }
body.dark-mode tr.is-uploaded td { color: #bbf7d0; }
body.dark-mode tr.is-not-uploaded td { color: #fecaca; }
.sales-table .sales-erp-col,
.sales-table td.sales-erp-col,
.invoice-table .erp-col { text-align: center; width: 72px; }

@media (max-width: 720px) {
  .header-actions { flex-wrap: wrap; justify-content: flex-start; }
  .ui-control { min-width: 132px; }
}


/* v5.2 FIX: menu text visible + stronger theme colors */
.menu-card,
.menu-card strong,
.menu-card small {
  color: var(--v5-text) !important;
}
.menu-card small { color: var(--v5-muted) !important; }
.menu-card .menu-icon {
  color: var(--v5-primary) !important;
  text-shadow: 0 6px 18px rgba(15,76,129,.18);
}
body.theme-blue .menu-card { background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(247,198,0,.12)) !important; border-color: rgba(37,99,235,.26) !important; }
body.theme-green .menu-card { background: linear-gradient(135deg, rgba(16,185,129,.12), rgba(163,230,53,.12)) !important; border-color: rgba(16,185,129,.28) !important; }
body.theme-purple .menu-card { background: linear-gradient(135deg, rgba(168,85,247,.13), rgba(240,171,252,.13)) !important; border-color: rgba(168,85,247,.28) !important; }
body.theme-orange .menu-card { background: linear-gradient(135deg, rgba(249,115,22,.13), rgba(253,230,138,.18)) !important; border-color: rgba(249,115,22,.30) !important; }
body.theme-blue .invoice-table thead th,
body.theme-blue .sales-table thead th { color: #dbeafe !important; background: linear-gradient(180deg, #0f4c81, #2563eb) !important; }
body.theme-green .invoice-table thead th,
body.theme-green .sales-table thead th { color: #dcfce7 !important; background: linear-gradient(180deg, #047857, #10b981) !important; }
body.theme-purple .invoice-table thead th,
body.theme-purple .sales-table thead th { color: #f3e8ff !important; background: linear-gradient(180deg, #6d28d9, #a855f7) !important; }
body.theme-orange .invoice-table thead th,
body.theme-orange .sales-table thead th { color: #fff7ed !important; background: linear-gradient(180deg, #c2410c, #f97316) !important; }
body.theme-blue .invoice-table td,
body.theme-blue .sales-table td { color: #102033; }
body.theme-green .invoice-table td,
body.theme-green .sales-table td { color: #052e2b; }
body.theme-purple .invoice-table td,
body.theme-purple .sales-table td { color: #24103f; }
body.theme-orange .invoice-table td,
body.theme-orange .sales-table td { color: #3b1d0b; }
body.dark-mode.theme-blue .invoice-table td,
body.dark-mode.theme-blue .sales-table td,
body.dark-mode.theme-green .invoice-table td,
body.dark-mode.theme-green .sales-table td,
body.dark-mode.theme-purple .invoice-table td,
body.dark-mode.theme-purple .sales-table td,
body.dark-mode.theme-orange .invoice-table td,
body.dark-mode.theme-orange .sales-table td { color: #e5edf7; }
.locked-icon:disabled {
  opacity: 1 !important;
  cursor: not-allowed !important;
  background: rgba(22,163,74,.12) !important;
  color: #166534 !important;
  border-color: rgba(22,163,74,.30) !important;
}
body.dark-mode .locked-icon:disabled { color: #bbf7d0 !important; }


/* v5.3 purchase status colors */
.erp-col { white-space: nowrap; }
.erp-status-text { margin-left: 6px; font-weight: 800; font-size: .82rem; }
.erp-new { background: rgba(37,99,235,.12); }
.erp-modified { background: rgba(234,179,8,.18); }
.erp-error { background: rgba(220,38,38,.16); }
tr.is-new td { color: #1d4ed8; }
tr.is-modified td { color: #92400e; }
tr.is-error td { color: #991b1b; }
body.dark-mode tr.is-new td { color: #bfdbfe; }
body.dark-mode tr.is-modified td { color: #fde68a; }
body.dark-mode tr.is-error td { color: #fecaca; }
.status-counter { display: inline-flex; align-items: center; gap: 6px; margin: 4px 8px 4px 0; padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(15,23,42,.12); background: rgba(255,255,255,.75); font-weight: 700; }
.status-new { color: #1d4ed8; }
.status-modified { color: #92400e; }
.status-sent { color: #166534; }
.status-error { color: #991b1b; }
body.dark-mode .status-counter { background: rgba(15,23,42,.75); border-color: rgba(255,255,255,.14); }

/* Novico v5.4 grid layout: cross-browser column order + resize */
.status-filter-top select {
  min-width: 92px;
  font-weight: 900;
}

.invoice-table th[data-col],
.sales-table th[data-col] {
  cursor: grab;
  user-select: none;
  position: sticky !important;
}

.invoice-table th[data-col]:active,
.sales-table th[data-col]:active {
  cursor: grabbing;
}

.invoice-table th.is-dragging-col,
.sales-table th.is-dragging-col {
  opacity: .55;
  outline: 2px dashed var(--v5-primary-2, #2563eb);
}

.invoice-table th.is-drop-target,
.sales-table th.is-drop-target {
  box-shadow: inset 3px 0 0 var(--v5-accent, #f7c600);
  background: color-mix(in srgb, var(--v5-primary-2, #2563eb) 14%, white) !important;
}

.invoice-table th .col-resizer,
.sales-table th .col-resizer {
  position: absolute;
  top: 0;
  right: -2px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  z-index: 5;
}

.invoice-table th .col-resizer::after,
.sales-table th .col-resizer::after {
  content: '';
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 4px;
  width: 2px;
  border-radius: 2px;
  background: rgba(37, 99, 235, .28);
}

.invoice-table th .col-resizer:hover::after,
.sales-table th .col-resizer:hover::after {
  background: var(--v5-primary-2, #2563eb);
}

body.is-resizing-table,
body.is-resizing-table * {
  cursor: col-resize !important;
  user-select: none !important;
}

#invoiceListArea .invoice-table tbody tr.is-new td,
#SalesListArea .sales-table tbody tr.is-not-uploaded td {
  background: #eff6ff !important;
}
#invoiceListArea .invoice-table tbody tr.is-modified td {
  background: #fff7cc !important;
}
#invoiceListArea .invoice-table tbody tr.is-uploaded td,
#SalesListArea .sales-table tbody tr.is-uploaded td {
  background: #ecfdf3 !important;
}
#invoiceListArea .invoice-table tbody tr.is-error td,
#SalesListArea .sales-table tbody tr.is-error td {
  background: #fff1f2 !important;
}

body.dark-mode #invoiceListArea .invoice-table tbody tr.is-new td,
body.dark-mode #SalesListArea .sales-table tbody tr.is-not-uploaded td {
  background: rgba(37, 99, 235, .16) !important;
}
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-modified td {
  background: rgba(234, 179, 8, .18) !important;
}
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-uploaded td,
body.dark-mode #SalesListArea .sales-table tbody tr.is-uploaded td {
  background: rgba(34, 197, 94, .16) !important;
}
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-error td,
body.dark-mode #SalesListArea .sales-table tbody tr.is-error td {
  background: rgba(239, 68, 68, .16) !important;
}

/* ===============================
   Novico v5.5: more themes + translated UI controls + wide table size
   =============================== */
body.theme-red {
  --v5-primary: #b91c1c;
  --v5-primary-2: #ef4444;
  --v5-accent: #fecaca;
  --v5-text: #3f0b0b;
  --v5-muted: #7f4b4b;
}
body.theme-teal {
  --v5-primary: #0f766e;
  --v5-primary-2: #14b8a6;
  --v5-accent: #99f6e4;
  --v5-text: #082f2c;
  --v5-muted: #3f6f6b;
}
body.theme-indigo {
  --v5-primary: #4338ca;
  --v5-primary-2: #6366f1;
  --v5-accent: #c7d2fe;
  --v5-text: #19164a;
  --v5-muted: #55527a;
}
body.theme-pink {
  --v5-primary: #be185d;
  --v5-primary-2: #ec4899;
  --v5-accent: #fbcfe8;
  --v5-text: #4a102b;
  --v5-muted: #80566a;
}
body.theme-slate {
  --v5-primary: #334155;
  --v5-primary-2: #64748b;
  --v5-accent: #cbd5e1;
  --v5-text: #0f172a;
  --v5-muted: #475569;
}
body.theme-gold {
  --v5-primary: #92400e;
  --v5-primary-2: #d97706;
  --v5-accent: #facc15;
  --v5-text: #3b2505;
  --v5-muted: #7c5f2b;
}
body.dark-mode.theme-red,
body.dark-mode.theme-teal,
body.dark-mode.theme-indigo,
body.dark-mode.theme-pink,
body.dark-mode.theme-slate,
body.dark-mode.theme-gold {
  --v5-text: #e5edf7;
  --v5-muted: #b6c2d1;
}
body.theme-red .brand-shell { background: linear-gradient(135deg, rgba(185,28,28,.15), rgba(254,202,202,.18)); }
body.theme-teal .brand-shell { background: linear-gradient(135deg, rgba(15,118,110,.15), rgba(153,246,228,.18)); }
body.theme-indigo .brand-shell { background: linear-gradient(135deg, rgba(67,56,202,.15), rgba(199,210,254,.18)); }
body.theme-pink .brand-shell { background: linear-gradient(135deg, rgba(190,24,93,.15), rgba(251,207,232,.18)); }
body.theme-slate .brand-shell { background: linear-gradient(135deg, rgba(51,65,85,.15), rgba(203,213,225,.18)); }
body.theme-gold .brand-shell { background: linear-gradient(135deg, rgba(146,64,14,.15), rgba(250,204,21,.20)); }

body.theme-red .menu-card { background: linear-gradient(135deg, rgba(239,68,68,.13), rgba(254,202,202,.16)) !important; border-color: rgba(239,68,68,.30) !important; }
body.theme-teal .menu-card { background: linear-gradient(135deg, rgba(20,184,166,.13), rgba(153,246,228,.16)) !important; border-color: rgba(20,184,166,.30) !important; }
body.theme-indigo .menu-card { background: linear-gradient(135deg, rgba(99,102,241,.13), rgba(199,210,254,.16)) !important; border-color: rgba(99,102,241,.30) !important; }
body.theme-pink .menu-card { background: linear-gradient(135deg, rgba(236,72,153,.13), rgba(251,207,232,.16)) !important; border-color: rgba(236,72,153,.30) !important; }
body.theme-slate .menu-card { background: linear-gradient(135deg, rgba(100,116,139,.13), rgba(203,213,225,.16)) !important; border-color: rgba(100,116,139,.30) !important; }
body.theme-gold .menu-card { background: linear-gradient(135deg, rgba(217,119,6,.13), rgba(250,204,21,.18)) !important; border-color: rgba(217,119,6,.30) !important; }

body.theme-red .invoice-table thead th,
body.theme-red .sales-table thead th { color: #fff1f2 !important; background: linear-gradient(180deg, #b91c1c, #ef4444) !important; }
body.theme-teal .invoice-table thead th,
body.theme-teal .sales-table thead th { color: #ecfeff !important; background: linear-gradient(180deg, #0f766e, #14b8a6) !important; }
body.theme-indigo .invoice-table thead th,
body.theme-indigo .sales-table thead th { color: #eef2ff !important; background: linear-gradient(180deg, #4338ca, #6366f1) !important; }
body.theme-pink .invoice-table thead th,
body.theme-pink .sales-table thead th { color: #fdf2f8 !important; background: linear-gradient(180deg, #be185d, #ec4899) !important; }
body.theme-slate .invoice-table thead th,
body.theme-slate .sales-table thead th { color: #f8fafc !important; background: linear-gradient(180deg, #334155, #64748b) !important; }
body.theme-gold .invoice-table thead th,
body.theme-gold .sales-table thead th { color: #fffbeb !important; background: linear-gradient(180deg, #92400e, #d97706) !important; }

body.theme-red .invoice-table td,
body.theme-red .sales-table td { color: #3f0b0b; }
body.theme-teal .invoice-table td,
body.theme-teal .sales-table td { color: #082f2c; }
body.theme-indigo .invoice-table td,
body.theme-indigo .sales-table td { color: #19164a; }
body.theme-pink .invoice-table td,
body.theme-pink .sales-table td { color: #4a102b; }
body.theme-slate .invoice-table td,
body.theme-slate .sales-table td { color: #0f172a; }
body.theme-gold .invoice-table td,
body.theme-gold .sales-table td { color: #3b2505; }
body.dark-mode.theme-red .invoice-table td,
body.dark-mode.theme-red .sales-table td,
body.dark-mode.theme-teal .invoice-table td,
body.dark-mode.theme-teal .sales-table td,
body.dark-mode.theme-indigo .invoice-table td,
body.dark-mode.theme-indigo .sales-table td,
body.dark-mode.theme-pink .invoice-table td,
body.dark-mode.theme-pink .sales-table td,
body.dark-mode.theme-slate .invoice-table td,
body.dark-mode.theme-slate .sales-table td,
body.dark-mode.theme-gold .invoice-table td,
body.dark-mode.theme-gold .sales-table td { color: #e5edf7; }

body.table-size-wide .invoice-table th,
body.table-size-wide .invoice-table td { font-size: 15px; padding: 11px 18px; }
body.table-size-wide .invoice-table thead input,
body.table-size-wide .invoice-table thead select { height: 36px; font-size: 13px; }
body.table-size-wide .invoice-table { min-width: 1550px; }

/* Keep selected theme readable in every language */
.ui-control span,
.ui-select,
.status-filter-top span,
.status-filter-top select {
  color: var(--v5-text) !important;
}
body.dark-mode .ui-select,
body.dark-mode .status-filter-top select {
  background: #0b1220 !important;
  color: var(--v5-text) !important;
  border-color: var(--v5-border) !important;
}

/* v5.6 status column for expenses and sales */
.status-col {
  min-width: 88px;
  text-align: center;
  white-space: nowrap;
}
.status-col .erp-status-text {
  margin-left: 4px;
  font-weight: 700;
  font-size: 0.82em;
}
.status-col .erp-dot {
  display: inline-flex;
  align-items: center;
}
body.table-size-compact .status-col .erp-status-text { display: none; }
body.table-size-wide .status-col { min-width: 112px; }

/* v5.7: visible theme circles + A size buttons + compact status */
.theme-palette,
.size-palette {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 8px 22px rgba(15,23,42,.06);
}
body.dark-mode .theme-palette,
body.dark-mode .size-palette {
  background: rgba(15,23,42,.72);
  border-color: rgba(255,255,255,.14);
}
.theme-dot,
.size-dot {
  border: 2px solid rgba(255,255,255,.88);
  box-shadow: 0 0 0 1px rgba(15,23,42,.20), 0 4px 12px rgba(15,23,42,.14);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.theme-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
}
.theme-dot span { text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.theme-dot:hover,
.size-dot:hover,
.theme-dot.active,
.size-dot.active {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 0 0 3px var(--v5-accent), 0 8px 18px rgba(15,23,42,.20);
}
.color-blue { background: linear-gradient(135deg, #0f4c81, #2563eb); }
.color-green { background: linear-gradient(135deg, #047857, #10b981); }
.color-purple { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.color-orange { background: linear-gradient(135deg, #c2410c, #f97316); }
.color-red { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.color-teal { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.color-indigo { background: linear-gradient(135deg, #4338ca, #6366f1); }
.color-pink { background: linear-gradient(135deg, #be185d, #ec4899); }
.color-slate { background: linear-gradient(135deg, #334155, #64748b); }
.color-gold { background: linear-gradient(135deg, #92400e, #d97706); }
.size-dot {
  min-width: 32px;
  height: 30px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--v5-primary);
  color: #fff;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.size-small { font-size: 11px; }
.size-normal { font-size: 14px; }
.size-large { font-size: 18px; }
.size-wide { font-size: 15px; letter-spacing: .04em; }
.status-filter-compact span { display: none !important; }
.status-filter-compact select {
  min-width: 104px;
  height: 34px;
  border: 1px solid rgba(15,23,42,.18);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}
.status-title-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: transparent !important;
  background: linear-gradient(135deg, #60a5fa, #22c55e, #f59e0b, #ef4444);
  margin: 0 auto;
}
@media (max-width: 900px) {
  .header-actions { gap: 8px; }
  .theme-palette { max-width: 190px; flex-wrap: wrap; border-radius: 18px; }
  .size-palette { flex-wrap: nowrap; }
}

/* ===============================
   Novico v5.8: clean theme dots, ERP status filter, columns chooser, top scroll
   =============================== */
.theme-dot {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  font-size: 0 !important;
  overflow: hidden;
}
.theme-dot::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  opacity: .0;
}
.theme-dot.active::after { opacity: 1; }
.theme-dot span { display: none !important; }
.color-white { background: linear-gradient(135deg, #ffffff, #e5e7eb); }
.color-blue { background: linear-gradient(135deg, #0f4c81, #2563eb); }
.color-green { background: linear-gradient(135deg, #047857, #10b981); }
.color-purple { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.color-red { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.color-orange { background: linear-gradient(135deg, #c2410c, #f97316); }
.color-gold { background: linear-gradient(135deg, #facc15, #d97706); }
.color-black { background: linear-gradient(135deg, #020617, #334155); }
.color-brown { background: linear-gradient(135deg, #7c2d12, #92400e); }

body.theme-white {
  --v5-primary: #475569;
  --v5-primary-2: #64748b;
  --v5-accent: #e2e8f0;
  --v5-text: #0f172a;
  --v5-muted: #64748b;
}
body.theme-black {
  --v5-primary: #020617;
  --v5-primary-2: #334155;
  --v5-accent: #94a3b8;
  --v5-text: #0f172a;
  --v5-muted: #475569;
}
body.theme-brown {
  --v5-primary: #7c2d12;
  --v5-primary-2: #92400e;
  --v5-accent: #fed7aa;
  --v5-text: #3b1d0b;
  --v5-muted: #7c5f2b;
}
body.dark-mode.theme-white,
body.dark-mode.theme-black,
body.dark-mode.theme-brown {
  --v5-text: #e5edf7;
  --v5-muted: #b6c2d1;
}
body.theme-white .invoice-table thead th,
body.theme-white .sales-table thead th { color: #0f172a !important; background: linear-gradient(180deg, #f8fafc, #e2e8f0) !important; }
body.theme-black .invoice-table thead th,
body.theme-black .sales-table thead th { color: #f8fafc !important; background: linear-gradient(180deg, #020617, #334155) !important; }
body.theme-brown .invoice-table thead th,
body.theme-brown .sales-table thead th { color: #fffbeb !important; background: linear-gradient(180deg, #7c2d12, #92400e) !important; }
body.theme-white .invoice-table td,
body.theme-white .sales-table td { color: #0f172a; }
body.theme-black .invoice-table td,
body.theme-black .sales-table td { color: #0f172a; }
body.theme-brown .invoice-table td,
body.theme-brown .sales-table td { color: #3b1d0b; }
body.dark-mode.theme-white .invoice-table td,
body.dark-mode.theme-white .sales-table td,
body.dark-mode.theme-black .invoice-table td,
body.dark-mode.theme-black .sales-table td,
body.dark-mode.theme-brown .invoice-table td,
body.dark-mode.theme-brown .sales-table td { color: #e5edf7; }

.status-filter-compact {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
.status-filter-compact span {
  display: inline-flex !important;
  font-size: 12px;
  font-weight: 900;
  color: var(--v5-text) !important;
  white-space: nowrap;
}
.status-filter-compact select {
  min-width: 102px;
  height: 34px;
}
.erp-status-text { display: none !important; }
.status-col { min-width: 42px !important; width: 42px !important; }
.status-col .erp-dot { font-size: 16px; }

/* Row status colors only, no status descriptions */
#invoiceListArea .invoice-table tbody tr.is-new td,
#SalesListArea .sales-table tbody tr.is-not-uploaded td,
#SalesListArea .sales-table tbody tr.is-new td { background: #eff6ff !important; }
#invoiceListArea .invoice-table tbody tr.is-modified td,
#SalesListArea .sales-table tbody tr.is-modified td { background: #fff7cc !important; }
#invoiceListArea .invoice-table tbody tr.is-uploaded td,
#SalesListArea .sales-table tbody tr.is-uploaded td { background: #ecfdf3 !important; }
#invoiceListArea .invoice-table tbody tr.is-error td,
#SalesListArea .sales-table tbody tr.is-error td { background: #fff1f2 !important; }

.col-hidden { display: none !important; }
.columns-button {
  font-weight: 900;
  min-height: 34px;
}
.column-chooser-panel {
  position: fixed;
  z-index: 9999;
  width: 245px;
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.16);
  background: #fff;
  box-shadow: 0 22px 60px rgba(15,23,42,.22);
}
body.dark-mode .column-chooser-panel {
  background: #0b1220;
  border-color: rgba(255,255,255,.14);
  color: #e5edf7;
}
.column-chooser-title {
  font-weight: 900;
  margin-bottom: 8px;
}
.column-chooser-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(15,23,42,.08);
  font-weight: 700;
}
body.dark-mode .column-chooser-item { border-bottom-color: rgba(255,255,255,.10); }
.column-chooser-item input { accent-color: var(--v5-primary-2); }
.column-chooser-close { width: 100%; margin-top: 10px; }

.top-horizontal-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 18px;
  margin: 8px 0 4px;
  border-radius: 999px;
  background: rgba(15,23,42,.06);
}
.top-horizontal-scroll > div { height: 1px; }
body.dark-mode .top-horizontal-scroll { background: rgba(255,255,255,.08); }
.top-horizontal-scroll::-webkit-scrollbar { height: 14px; }
.top-horizontal-scroll::-webkit-scrollbar-thumb { background: var(--v5-primary-2); border-radius: 999px; border: 3px solid rgba(255,255,255,.55); }
.top-horizontal-scroll::-webkit-scrollbar-track { background: rgba(15,23,42,.08); border-radius: 999px; }

body.novico-fullscreen .table-wrap {
  width: 100% !important;
  max-width: 100% !important;
}
body.novico-fullscreen .invoice-table,
body.novico-fullscreen .sales-table {
  min-width: 100% !important;
  width: 100% !important;
}
body.novico-fullscreen .top-horizontal-scroll {
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ===============================
   Novico v6.0 stable fixes
   =============================== */
.theme-palette .theme-dot.color-white { background: linear-gradient(135deg, #ffffff 0%, #f8fafc 55%, #cbd5e1 100%) !important; }
.theme-palette .theme-dot.color-blue { background: linear-gradient(135deg, #0f4c81 0%, #2563eb 100%) !important; }
.theme-palette .theme-dot.color-green { background: linear-gradient(135deg, #047857 0%, #10b981 100%) !important; }
.theme-palette .theme-dot.color-purple { background: linear-gradient(135deg, #6d28d9 0%, #a855f7 100%) !important; }
.theme-palette .theme-dot.color-red { background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%) !important; }
.theme-palette .theme-dot.color-orange { background: linear-gradient(135deg, #c2410c 0%, #f97316 100%) !important; }
.theme-palette .theme-dot.color-gold { background: linear-gradient(135deg, #facc15 0%, #d97706 100%) !important; }
.theme-palette .theme-dot.color-black { background: linear-gradient(135deg, #020617 0%, #334155 100%) !important; }
.theme-palette .theme-dot.color-brown { background: linear-gradient(135deg, #7c2d12 0%, #92400e 100%) !important; }
.theme-dot { color: transparent !important; border-color: rgba(255,255,255,.92) !important; }
.theme-dot.active { box-shadow: 0 0 0 3px #facc15, 0 0 0 6px rgba(15,23,42,.18), 0 10px 24px rgba(15,23,42,.22) !important; }
.theme-dot.active::after { content: '✓' !important; width: 16px !important; height: 16px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; color: #fff !important; background: rgba(0,0,0,.38) !important; font-size: 11px !important; font-weight: 900 !important; opacity: 1 !important; }
.theme-dot.color-white.active::after, .theme-dot.color-gold.active::after { color: #0f172a !important; background: rgba(255,255,255,.72) !important; }

.status-filter-compact span { display: none !important; }
.status-filter-compact select { min-width: 110px !important; }
.status-col { width: 36px !important; min-width: 36px !important; max-width: 36px !important; text-align: center !important; }
.status-col .erp-dot { color: transparent !important; font-size: 0 !important; display: inline-flex !important; width: 16px !important; height: 16px !important; border-radius: 50% !important; vertical-align: middle !important; }
.status-col .erp-new { background: #bfdbfe !important; box-shadow: 0 0 0 1px #60a5fa inset; }
.status-col .erp-modified { background: #fde68a !important; box-shadow: 0 0 0 1px #f59e0b inset; }
.status-col .erp-ok { background: #bbf7d0 !important; box-shadow: 0 0 0 1px #22c55e inset; }
.status-col .erp-error { background: #fecdd3 !important; box-shadow: 0 0 0 1px #ef4444 inset; }

.column-chooser-panel { width: 330px !important; }
.column-chooser-item-v60 { justify-content: space-between; gap: 12px; }
.column-visible-check { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.column-visible-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-position-select { width: 72px; height: 30px; border-radius: 8px; border: 1px solid rgba(15,23,42,.18); background: #fff; font-weight: 800; }
body.dark-mode .column-position-select { background: #111827; color: #e5edf7; border-color: rgba(255,255,255,.18); }

.table-wrap { position: relative; }
.top-horizontal-scroll { position: sticky !important; top: 0 !important; z-index: 40 !important; height: 20px !important; }
.top-horizontal-scroll::before { content: '←  →'; position: absolute; left: 10px; top: 0px; height: 18px; line-height: 18px; font-weight: 900; font-size: 12px; color: var(--v5-primary); pointer-events: none; opacity: .75; }
.top-horizontal-scroll > div { min-height: 1px; }
body.novico-fullscreen .table-wrap { overflow-x: auto !important; }
body.novico-fullscreen .invoice-table, body.novico-fullscreen .sales-table { table-layout: fixed !important; min-width: 100% !important; }
body.novico-fullscreen .invoice-table th:not(.col-hidden), body.novico-fullscreen .invoice-table td:not(.col-hidden), body.novico-fullscreen .sales-table th:not(.col-hidden), body.novico-fullscreen .sales-table td:not(.col-hidden) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* v6.1 final UI fixes */
.theme-palette { gap: 8px !important; }
.theme-palette .theme-dot { width: 28px !important; height: 28px !important; border-radius: 50% !important; color: transparent !important; font-size: 0 !important; border: 2px solid rgba(255,255,255,.95) !important; box-shadow: 0 2px 8px rgba(15,23,42,.18) !important; }
.theme-palette .theme-dot.color-white { background: linear-gradient(135deg, #ffffff 0%, #f8fafc 55%, #cbd5e1 100%) !important; }
.theme-palette .theme-dot.color-blue { background: linear-gradient(135deg, #1d4ed8 0%, #60a5fa 100%) !important; }
.theme-palette .theme-dot.color-green { background: linear-gradient(135deg, #047857 0%, #34d399 100%) !important; }
.theme-palette .theme-dot.color-purple { background: linear-gradient(135deg, #6d28d9 0%, #c084fc 100%) !important; }
.theme-palette .theme-dot.color-red { background: linear-gradient(135deg, #b91c1c 0%, #fb7185 100%) !important; }
.theme-palette .theme-dot.color-orange { background: linear-gradient(135deg, #c2410c 0%, #fb923c 100%) !important; }
.theme-palette .theme-dot.color-gold { background: linear-gradient(135deg, #facc15 0%, #d97706 100%) !important; }
.theme-palette .theme-dot.color-black { background: linear-gradient(135deg, #020617 0%, #475569 100%) !important; }
.theme-palette .theme-dot.color-brown { background: linear-gradient(135deg, #7c2d12 0%, #b45309 100%) !important; }
.theme-palette .theme-dot.active { outline: 3px solid #facc15 !important; outline-offset: 2px !important; }
.theme-palette .theme-dot.active::after { content: '✓' !important; width: 15px !important; height: 15px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; color: #fff !important; background: rgba(0,0,0,.42) !important; border-radius: 50% !important; font-size: 10px !important; font-weight: 900 !important; opacity: 1 !important; }
.theme-palette .theme-dot.color-white.active::after,
.theme-palette .theme-dot.color-gold.active::after { color: #0f172a !important; background: rgba(255,255,255,.75) !important; }

.size-palette { gap: 8px !important; }
.size-palette .size-dot { width: 34px !important; height: 30px !important; border-radius: 12px !important; display: inline-flex !important; align-items: center !important; justify-content: center !important; font-weight: 900 !important; background: rgba(255,255,255,.9) !important; color: var(--v5-primary) !important; border: 1px solid rgba(37,99,235,.35) !important; }
.size-palette .size-small { font-size: 11px !important; }
.size-palette .size-normal { font-size: 15px !important; }
.size-palette .size-large { font-size: 20px !important; }
.size-palette .size-dot.active { background: var(--v5-primary) !important; color: #fff !important; box-shadow: 0 0 0 3px rgba(250,204,21,.95) !important; }

/* Expenses: no status color column and no row coloring */
#invoiceListArea .invoice-table thead th[data-col="status"],
#invoiceListArea .invoice-table tbody td[data-col="status"] { display: none !important; }
#invoiceListArea .invoice-table tbody tr.is-new td,
#invoiceListArea .invoice-table tbody tr.is-modified td,
#invoiceListArea .invoice-table tbody tr.is-uploaded td,
#invoiceListArea .invoice-table tbody tr.is-error td { background: var(--surface, #fff) !important; color: inherit !important; }
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-new td,
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-modified td,
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-uploaded td,
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-error td { background: rgba(15,23,42,.96) !important; color: inherit !important; }

/* Sales: keep only color indicators, short ERP header */
#SalesListArea .sales-table thead th[data-col="status"] .th-title { font-size: 12px !important; letter-spacing: .08em !important; }
#SalesListArea .sales-table tbody tr.is-new td { background: #eff6ff !important; }
#SalesListArea .sales-table tbody tr.is-modified td { background: #fff7cc !important; }
#SalesListArea .sales-table tbody tr.is-uploaded td { background: #ecfdf3 !important; }
#SalesListArea .sales-table tbody tr.is-error td { background: #fff1f2 !important; }
body.dark-mode #SalesListArea .sales-table tbody tr.is-new td { background: rgba(30,64,175,.28) !important; }
body.dark-mode #SalesListArea .sales-table tbody tr.is-modified td { background: rgba(146,64,14,.28) !important; }
body.dark-mode #SalesListArea .sales-table tbody tr.is-uploaded td { background: rgba(22,101,52,.28) !important; }
body.dark-mode #SalesListArea .sales-table tbody tr.is-error td { background: rgba(153,27,27,.28) !important; }

.status-filter-top span { font-weight: 800 !important; letter-spacing: .04em !important; }
.status-filter-top select { min-width: 104px !important; }


/* Novico v6.3: old ERP column style */
.invoice-table th.status-col,
.invoice-table td.status-col,
.sales-table th.status-col,
.sales-table td.status-col {
  width: 74px !important;
  min-width: 74px !important;
  max-width: 92px !important;
  text-align: center !important;
  vertical-align: middle !important;
}
.erp-head-filter {
  width: 64px !important;
  min-width: 64px !important;
  height: 28px !important;
  margin-top: 5px !important;
  padding: 2px 4px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  background: #fff !important;
  color: #0f172a !important;
  border: 1px solid rgba(250,204,21,.9) !important;
}
.erp-led {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.08), 0 3px 10px rgba(15,23,42,.10);
  position: relative;
}
.erp-led::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid rgba(255,255,255,.96);
  transform: translateY(-1px);
}
.erp-led-new { background: #bfdbfe; border: 1px solid #60a5fa; }
.erp-led-modified { background: #fde68a; border: 1px solid #f59e0b; }
.erp-led-sent { background: #22c55e; border: 1px solid #16a34a; }
.erp-led-error { background: #f43f5e; border: 1px solid #e11d48; }
body.dark-mode .erp-head-filter { background: #f8fafc !important; color: #0f172a !important; }
body.dark-mode .erp-led { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 3px 10px rgba(0,0,0,.25); }
/* make the ERP column look like the first version */
.invoice-table .status-col .th-title,
.sales-table .status-col .th-title { display:block; text-align:center; }


/* Novico v6.5: ERP filter visible in Expenses too and wider Columns chooser */
#invoiceListArea .invoice-table thead th[data-col="status"],
#invoiceListArea .invoice-table tbody td[data-col="status"] {
  display: table-cell !important;
}
#invoiceListArea .invoice-table tbody tr.is-new td { background: #eff6ff !important; }
#invoiceListArea .invoice-table tbody tr.is-modified td { background: #fff7cc !important; }
#invoiceListArea .invoice-table tbody tr.is-uploaded td { background: #ecfdf3 !important; }
#invoiceListArea .invoice-table tbody tr.is-error td { background: #fff1f2 !important; }
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-new td { background: rgba(30,64,175,.28) !important; }
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-modified td { background: rgba(146,64,14,.28) !important; }
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-uploaded td { background: rgba(22,101,52,.28) !important; }
body.dark-mode #invoiceListArea .invoice-table tbody tr.is-error td { background: rgba(153,27,27,.28) !important; }

.column-chooser-panel {
  width: 560px !important;
  max-width: calc(100vw - 24px) !important;
  padding: 14px !important;
}
.column-chooser-item-v60,
.column-chooser-item {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) 92px !important;
  align-items: center !important;
  column-gap: 18px !important;
}
.column-visible-check {
  min-width: 0 !important;
  width: 100% !important;
}
.column-visible-check span {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  line-height: 1.25 !important;
}
.column-position-select {
  width: 92px !important;
  min-width: 92px !important;
}
@media (max-width: 700px) {
  .column-chooser-panel { width: calc(100vw - 16px) !important; left: 8px !important; }
  .column-chooser-item-v60,
  .column-chooser-item { grid-template-columns: 1fr 78px !important; }
  .column-position-select { width: 78px !important; min-width: 78px !important; }
}


/* v6.6 clean Columns panel */
.column-chooser-panel {
  width: min(760px, calc(100vw - 24px)) !important;
  max-height: min(76vh, 640px) !important;
  overflow: auto !important;
  padding: 16px !important;
}
.column-chooser-title {
  font-size: 16px !important;
  margin-bottom: 12px !important;
}
.column-chooser-item-v60,
.column-chooser-item {
  display: grid !important;
  grid-template-columns: minmax(360px, 1fr) 110px !important;
  align-items: center !important;
  column-gap: 24px !important;
  min-height: 44px !important;
}
.column-visible-check {
  justify-content: flex-start !important;
  min-width: 0 !important;
  width: 100% !important;
  text-align: left !important;
}
.column-visible-check span {
  display: block !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  line-height: 1.25 !important;
  max-width: none !important;
}
.column-position-select {
  width: 110px !important;
  min-width: 110px !important;
  justify-self: end !important;
}
@media (max-width: 780px) {
  .column-chooser-panel { width: calc(100vw - 16px) !important; left: 8px !important; }
  .column-chooser-item-v60,
  .column-chooser-item { grid-template-columns: 1fr 88px !important; column-gap: 10px !important; }
  .column-position-select { width: 88px !important; min-width: 88px !important; }
}

/* v6.7: Clean Columns chooser */
.column-chooser-panel-v67,
.column-chooser-panel {
  width: min(860px, calc(100vw - 24px)) !important;
  max-height: min(82vh, 720px) !important;
  overflow: hidden !important;
  padding: 18px !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24) !important;
  background: var(--panel-bg, #fff) !important;
  color: var(--text, #0f172a) !important;
}
.column-chooser-title {
  font-size: 18px !important;
  font-weight: 900 !important;
  margin: 0 0 14px 0 !important;
  color: var(--text, #0f172a) !important;
}
.column-chooser-head {
  display: grid !important;
  grid-template-columns: 80px minmax(280px, 1fr) 130px !important;
  gap: 16px !important;
  align-items: center !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  background: rgba(148, 163, 184, .14) !important;
  color: var(--muted, #64748b) !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
}
.column-chooser-list {
  max-height: min(58vh, 520px) !important;
  overflow: auto !important;
  padding: 8px 2px 4px 0 !important;
}
.column-chooser-item-v67,
.column-chooser-item-v60,
.column-chooser-item {
  display: grid !important;
  grid-template-columns: 80px minmax(280px, 1fr) 130px !important;
  gap: 16px !important;
  align-items: center !important;
  min-height: 48px !important;
  padding: 8px 14px !important;
  border-bottom: 1px solid rgba(148, 163, 184, .22) !important;
  background: transparent !important;
}
.column-visible-check {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  text-align: center !important;
}
.column-visible-check input {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  accent-color: var(--accent, #2563eb) !important;
}
.column-label-full,
.column-visible-check span {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  line-height: 1.25 !important;
  text-align: left !important;
  font-weight: 800 !important;
  color: var(--text, #0f172a) !important;
}
.column-position-select {
  width: 110px !important;
  min-width: 110px !important;
  height: 38px !important;
  justify-self: end !important;
  border-radius: 10px !important;
  padding: 0 10px !important;
}
.column-chooser-close {
  width: 100% !important;
  margin-top: 14px !important;
  height: 42px !important;
  border-radius: 12px !important;
  font-weight: 900 !important;
}
@media (max-width: 720px) {
  .column-chooser-panel-v67,
  .column-chooser-panel {
    width: calc(100vw - 16px) !important;
    left: 8px !important;
    padding: 14px !important;
  }
  .column-chooser-head,
  .column-chooser-item-v67,
  .column-chooser-item-v60,
  .column-chooser-item {
    grid-template-columns: 58px minmax(150px, 1fr) 96px !important;
    gap: 8px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .column-position-select {
    width: 88px !important;
    min-width: 88px !important;
  }
}

/* v7.1 - Better columns layout tools */
.column-chooser-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin: 0 0 12px 0 !important;
}
.column-chooser-toolbar .secondary,
.column-layout-import {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 36px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  border: 1px solid rgba(148, 163, 184, .40) !important;
  background: rgba(255,255,255,.72) !important;
  color: var(--text, #0f172a) !important;
}
body.dark-mode .column-chooser-toolbar .secondary,
body.dark-mode .column-layout-import {
  background: rgba(15, 23, 42, .72) !important;
  color: #e5eefc !important;
  border-color: rgba(255,255,255,.16) !important;
}
.column-chooser-help {
  margin: 0 0 12px 0 !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  background: rgba(37, 99, 235, .08) !important;
  color: var(--muted, #64748b) !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
}

/* v7.2 filter dropdowns */
.customer-filter-wide { min-width: 260px; }
.customer-filter-wide select { min-width: 240px; max-width: 360px; }
.toolbar-filter select.invoice-filter-extra { min-width: 130px; }
@media (max-width: 900px) {
  .customer-filter-wide, .customer-filter-wide select { min-width: 180px; max-width: 100%; }
}

/* v7.4 - cleaner grouped date filters */
.toolbar .filter-card {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(130px, auto));
  gap: 8px 10px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid var(--v5-border, #d5e3f0);
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 8px 22px rgba(15, 45, 80, 0.06);
  margin: 0 4px 8px;
}
.toolbar .filter-card-created-date {
  grid-template-columns: minmax(150px, auto) minmax(130px, auto) minmax(130px, auto);
}
.filter-card-title {
  grid-column: 1 / -1;
  font-weight: 900;
  color: var(--v5-text, #0b315f);
  font-size: 0.86rem;
  letter-spacing: .02em;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(17, 72, 125, .12);
}
.toolbar-filter.compact-filter {
  margin-left: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(115px, 1fr);
  align-items: center;
  gap: 7px;
}
.toolbar-filter.compact-filter span {
  white-space: nowrap;
  font-weight: 800;
  font-size: .82rem;
  color: var(--v5-muted, #56708f);
}
.toolbar-filter.compact-filter input,
.toolbar-filter.compact-filter select {
  min-width: 115px;
  width: 100%;
}
body.dark-mode .toolbar .filter-card {
  background: rgba(16, 27, 43, .78);
  border-color: rgba(130, 170, 220, .28);
}
body.dark-mode .filter-card-title,
body.dark-mode .toolbar-filter.compact-filter span {
  color: #e8f2ff;
}
@media (max-width: 900px) {
  .toolbar .filter-card,
  .toolbar .filter-card-created-date {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .toolbar-filter.compact-filter {
    grid-template-columns: 90px 1fr;
  }
}

/* ====================================================
   v7.5 - Pylon style left filter panel
   ==================================================== */
.list-with-sidebar {
    position: relative;
    padding-left: 292px;
    transition: padding-left 0.2s ease;
}

.list-with-sidebar.filters-collapsed {
    padding-left: 18px;
}

.side-filter-panel {
    position: absolute;
    left: 18px;
    top: 18px;
    width: 248px;
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 14px 12px;
    border: 1px solid var(--border-color, #d8e3f0);
    border-radius: 16px;
    background: var(--card-bg, #fff);
    box-shadow: 0 14px 35px rgba(15, 35, 65, 0.10);
    z-index: 4;
}

.filters-collapsed .side-filter-panel {
    display: none;
}

.side-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #d8e3f0);
    color: var(--text-color, #0b2545);
}

.side-filter-toggle,
.side-filter-show {
    border: 1px solid var(--border-color, #d8e3f0);
    background: var(--button-secondary-bg, #eef5fb);
    color: var(--button-secondary-text, #0b4d86);
    border-radius: 10px;
    padding: 6px 10px;
    cursor: pointer;
    font-weight: 700;
}

.side-filter-show {
    position: absolute;
    left: 18px;
    top: 18px;
    z-index: 5;
}

.filters-collapsed .side-filter-show {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
}

.side-filter-group {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(120, 145, 170, 0.22);
}

.side-filter-group:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.side-filter-field {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--muted-text, #607089);
    font-size: 13px;
    font-weight: 700;
}

.side-filter-field:last-child {
    margin-bottom: 0;
}

.side-filter-field select,
.side-filter-field input {
    width: 100%;
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid var(--input-border, #cbd7e4);
    background: var(--input-bg, #fff);
    color: var(--text-color, #0b2545);
    padding: 8px 10px;
    font-size: 14px;
}

.side-filter-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.list-with-sidebar .list-topbar {
    align-items: flex-start;
}

.list-with-sidebar .toolbar {
    justify-content: flex-end;
}

@media (max-width: 980px) {
    .list-with-sidebar,
    .list-with-sidebar.filters-collapsed {
        padding-left: 0;
    }

    .side-filter-panel {
        position: static;
        width: auto;
        max-height: none;
        margin: 14px 0;
    }

    .side-filter-show {
        position: static;
        margin: 10px 0;
    }
}


/* ====================================================
   v7.6 - Compact Pylon-style side filters
   ==================================================== */
.list-with-sidebar {
    padding-left: 278px;
}

.list-with-sidebar.filters-collapsed {
    padding-left: 18px;
}

.list-with-sidebar .list-topbar {
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    min-height: 0;
}

.list-with-sidebar .list-topbar > div:first-child {
    display: none !important;
}

.list-with-sidebar .toolbar {
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.list-with-sidebar .toolbar button {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
}

.list-with-sidebar > .small,
.list-with-sidebar > .search-hint,
.list-with-sidebar > .empty-state {
    margin: 2px 0 6px;
}

#invoiceSearchHint,
#salesSearchHint,
#invoiceListStatus,
#salesListStatus {
    display: none !important;
}

.side-filter-panel {
    top: 8px;
    left: 12px;
    width: 242px;
    padding: 10px;
    border-radius: 14px;
    max-height: calc(100vh - 96px);
}

.side-filter-header {
    padding-bottom: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.side-filter-toggle {
    min-width: 42px;
    padding: 5px 10px;
}

.side-filter-show {
    top: 8px;
    left: 12px;
}

.side-filter-group {
    margin-bottom: 10px;
    padding-bottom: 10px;
}

.side-filter-field {
    gap: 4px;
    margin-bottom: 8px;
    font-size: 12px;
}

.side-filter-field span {
    line-height: 1.15;
}

.side-filter-field select,
.side-filter-field input {
    min-height: 34px;
    height: 34px;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 8px;
}

.side-filter-two-cols {
    gap: 6px;
}

.top-horizontal-scroll {
    margin-top: 4px;
}

.table-wrap {
    margin-top: 0;
}

.list-with-sidebar .invoice-table thead th {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* In fullscreen mode the table should start as high as possible */
.fullscreen-active .list-with-sidebar .list-topbar {
    margin-bottom: 6px;
}

@media (max-width: 980px) {
    .list-with-sidebar .list-topbar > div:first-child {
        display: none !important;
    }
    .list-with-sidebar .toolbar {
        justify-content: flex-start;
    }
    .side-filter-panel {
        width: auto;
    }
}

/* v7.8 Pylon batch progress */
.pylon-progress {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border, #cfe0f2);
  border-radius: 14px;
  background: rgba(239, 246, 255, .92);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}
.pylon-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text, #0f2747);
}
.pylon-progress-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, .28);
}
.pylon-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d4ed8, #22c55e);
  transition: width .25s ease;
}
body.dark-mode .pylon-progress {
  background: rgba(15, 23, 42, .86);
  border-color: rgba(148, 163, 184, .32);
}
body.dark-mode .pylon-progress-head {
  color: #e5edf7;
}

.side-filter-group-title {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  color: var(--text, #17365d);
}

.side-filter-apply {
  width: 100%;
  margin-top: 8px;
}

.side-filter-search-group {
  padding-top: 2px;
}

.side-filter-search-group .side-filter-apply {
  width: 100%;
  margin-top: 0;
}
