/* All Invoices — table & actions */

.inv-list {
  max-width: 100%;
  min-width: 0;
}

.inv-list .page-head {
  margin-bottom: 20px;
}

.inv-toolbar {
  margin-bottom: 16px;
}

.inv-toolbar input {
  flex: 1 1 12rem;
  min-width: 0;
}

/* Table card */
.inv-table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(11, 15, 25, 0.04);
  min-width: 0;
  max-width: 100%;
}

.inv-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border-radius: inherit;
}

/* Horizontal scroll only inside card — no page overflow */
.inv-table-scroll:not(:hover) {
  scrollbar-width: thin;
}

table.inv-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

table.inv-table th,
table.inv-table td {
  padding: 14px 16px;
  vertical-align: middle;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
}

table.inv-table thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

table.inv-table tbody tr {
  transition: background 0.15s ease;
}

table.inv-table tbody tr:hover {
  background: var(--surface-hover);
}

table.inv-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Column widths */
table.inv-table th:nth-child(1),
table.inv-table td:nth-child(1) { width: 14%; }

table.inv-table th:nth-child(2),
table.inv-table td:nth-child(2) { width: 22%; }

table.inv-table th:nth-child(3),
table.inv-table td:nth-child(3) { width: 12%; }

table.inv-table th:nth-child(4),
table.inv-table td:nth-child(4) { width: 12%; }

table.inv-table th.num,
table.inv-table td.num {
  width: 14%;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

table.inv-table th.status-col,
table.inv-table td.status-col {
  width: 12%;
  text-align: center;
}

table.inv-table th.actions,
table.inv-table td.actions {
  width: 168px;
  min-width: 168px;
  max-width: 168px;
  text-align: center;
  white-space: nowrap;
  padding: 10px 12px;
  overflow: visible;
}

/* Sticky actions column during horizontal scroll */
table.inv-table th.actions,
table.inv-table td.actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -6px 0 12px rgba(11, 15, 25, 0.04);
}

table.inv-table thead th.actions {
  background: var(--surface-muted);
  z-index: 3;
}

table.inv-table tbody tr:hover td.actions {
  background: var(--surface-hover);
}

.inv-num a {
  font-weight: 700;
  color: var(--text);
}

.inv-num a:hover {
  color: var(--primary);
}

.inv-customer {
  color: var(--text-soft);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Inline row action buttons */
.inv-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.inv-icon-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.inv-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  text-decoration: none;
  flex: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.inv-icon-btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.inv-icon-btn:hover {
  background: var(--primary-soft);
  border-color: rgba(255, 107, 0, 0.35);
  color: var(--primary);
}

.inv-icon-btn:focus-visible {
  outline: 3px solid rgba(255, 107, 0, 0.35);
  outline-offset: 2px;
}

@media (max-width: 1024px) {
  .inv-row-actions {
    gap: 6px;
  }

  .inv-icon-btn {
    width: 34px;
    height: 34px;
  }

  table.inv-table th.actions,
  table.inv-table td.actions {
    width: 156px;
    min-width: 156px;
    max-width: 156px;
  }
}

/* Mobile cards */
.inv-mobile-list {
  display: none;
}

.inv-mobile-card {
  margin-bottom: 12px;
  padding: 16px;
}

.inv-mobile-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.inv-mobile-num {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
}

.inv-mobile-customer {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.inv-mobile-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.inv-mobile-card-foot {
  display: none;
}

.inv-mobile-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.inv-mobile-card-actions .inv-row-actions {
  justify-content: flex-start;
  width: 100%;
}

@media (max-width: 768px) {
  .inv-table-card.desktop-only {
    display: none !important;
  }

  .inv-mobile-list {
    display: block;
  }
}

/* Dark mode */
html[data-theme="dark"] .inv-table-card {
  background: #151c2e;
  border-color: #273049;
}

html[data-theme="dark"] table.inv-table thead th {
  background: #1b2438;
}

html[data-theme="dark"] table.inv-table th.actions,
html[data-theme="dark"] table.inv-table td.actions {
  background: #151c2e;
  box-shadow: -6px 0 12px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] table.inv-table thead th.actions {
  background: #1b2438;
}

html[data-theme="dark"] table.inv-table tbody tr:hover td.actions {
  background: #1a2236;
}

html[data-theme="dark"] .inv-icon-btn {
  background: #151c2e;
  border-color: #273049;
  color: #cbd5e1;
}

html[data-theme="dark"] .inv-icon-btn:hover {
  background: rgba(255, 107, 0, 0.12);
  border-color: rgba(255, 107, 0, 0.35);
  color: #ff8c33;
}
