/* Stage 2 table foundation: one calm rhythm for pagination and desktop ledgers. */
.pagination-bar.modern-pagination {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(96px, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .045);
}

.modern-pagination .pagination-info {
  justify-content: flex-start;
  gap: 6px;
  font-size: .76rem;
}

.modern-pagination .pagination-controls {
  justify-content: center;
  gap: 6px;
}

.modern-pagination .pagination-pages {
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(15, 23, 42, .055);
  background: #f8fafc;
}

.modern-pagination .pagination-page,
.modern-pagination .pagination-nav {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 11px;
  font-size: .78rem;
  font-weight: 850;
  box-shadow: none;
}

.modern-pagination .pagination-page.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 10px 20px rgba(124, 58, 237, .2);
}

.modern-pagination .pagination-nav {
  background: #fff;
  color: #64748b;
  border: 1px solid rgba(15, 23, 42, .08);
}

.modern-pagination .pagination-gap {
  min-width: 18px;
  justify-content: center;
  color: #94a3b8;
}

.modern-pagination .pagination-jump {
  justify-content: flex-end;
  gap: 7px;
  font-size: .74rem;
}

.modern-pagination .pagination-jump select {
  min-width: 72px;
  min-height: 32px;
  padding-inline: 12px 26px;
  border-radius: 12px;
}

.topbar-back-btn {
  border-color: rgba(124, 58, 237, .16) !important;
  background: #f6f1ff !important;
  color: #5b21b6 !important;
}

.topbar-back-btn:hover {
  transform: translateY(-1px);
  background: #ede9fe !important;
}

.invoice-revamp-actions {
  justify-content: center;
  gap: 6px !important;
}

.invoice-revamp-actions > button,
.invoice-action-menu summary {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: 12px !important;
}

.invoice-revamp-actions .app-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.invoice-action-menu div {
  min-width: 150px;
  gap: 4px;
  padding: 8px;
  border-radius: 16px;
}

.invoice-action-menu div button {
  justify-content: flex-start;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 11px;
  font-size: .78rem;
  font-weight: 850;
}

@media (min-width: 921px) {
  .invoice-revamp-table-shell,
  .modern-table-wrap,
  .table-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 58, 237, .36) rgba(241, 245, 249, .95);
  }

  .invoice-revamp-table th,
  .customer-ledger-table th,
  .activity-table th,
  .archive-table th,
  .document-registry-table th,
  .unified-data-table th {
    height: 48px;
    padding-block: 10px !important;
    white-space: nowrap;
  }

  .invoice-revamp-table td,
  .customer-ledger-table td,
  .activity-table td,
  .archive-table td,
  .document-registry-table td,
  .unified-data-table td {
    padding-block: 12px !important;
    vertical-align: middle;
  }

  .invoice-revamp-table th:not(:last-child)::after,
  .customer-ledger-table th:not(:last-child)::after,
  .activity-table th:not(:last-child)::after,
  .archive-table th:not(:last-child)::after,
  .document-registry-table th:not(:last-child)::after,
  .unified-data-table th:not(:last-child)::after {
    content: "\2195" !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-inline-start: 6px;
    border-radius: 999px;
    background: #eef4fb;
    color: #94a3b8;
    font-size: .72rem;
    line-height: 1;
  }
}

@media (max-width: 720px) {
  .pagination-bar.modern-pagination {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .modern-pagination .pagination-info,
  .modern-pagination .pagination-controls,
  .modern-pagination .pagination-jump {
    justify-content: center;
  }
}

/* Customer ledger: keep the side summary, but make the table fit cleanly on desktop. */
.customer-ledger-workspace {
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr) !important;
}

.customer-ledger-table-panel,
.customer-ledger-workspace > div {
  min-width: 0;
}

.customer-ledger-table-shell {
  display: block !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, .38) rgba(241, 245, 249, .98);
}

.customer-ledger-table-shell::-webkit-scrollbar {
  height: 10px;
}

.customer-ledger-table-shell::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, .96);
  border-radius: 999px;
}

.customer-ledger-table-shell::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(124, 58, 237, .72), rgba(192, 38, 211, .58));
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .92);
}

.customer-ledger-table {
  width: max(100%, 980px) !important;
  min-width: 980px !important;
  table-layout: fixed !important;
}

.customer-ledger-table .customer-col-code { width: 108px; }
.customer-ledger-table .customer-col-name { width: 220px; }
.customer-ledger-table .customer-col-count { width: 72px; }
.customer-ledger-table .customer-col-money { width: 118px; }
.customer-ledger-table .customer-col-status { width: 112px; }
.customer-ledger-table .customer-col-actions { width: 58px; }

.customer-ledger-person > span:last-child,
.customer-ledger-person b,
.customer-ledger-person small,
.customer-code-cell strong {
  min-width: 0;
}

.customer-ledger-person b,
.customer-ledger-person small,
.customer-code-cell strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The financial side card inside the full customer file was redundant with the main KPIs. */
.customer-profile-grid {
  grid-template-columns: 1fr !important;
}

.customer-profile-grid .customer-finance-card {
  display: none !important;
}

@media (max-width: 1280px) {
  .customer-ledger-workspace {
    grid-template-columns: 1fr !important;
  }

  .customer-ledger-table {
    width: max(100%, 900px) !important;
    min-width: 900px !important;
  }
}

/* Permanent notification-popover hardening: compact cards that never stretch on long dates/text. */
.notifications-popover {
  width: min(430px, calc(100vw - 34px)) !important;
  max-height: min(70vh, 540px) !important;
  grid-template-rows: auto auto minmax(0, 1fr) !important;
}

.notifications-toolbar {
  grid-template-columns: 40px minmax(0, 1fr) !important;
  gap: 8px !important;
}

.notification-link {
  grid-column: 1;
  grid-row: 1;
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  border-radius: 14px !important;
}

.notification-tabs {
  grid-column: 2;
  grid-row: 1;
}

.notifications-toolbar-side {
  display: contents !important;
}

.notifications-summary-badge {
  display: none !important;
}

.notifications-popover-body {
  max-height: min(43vh, 330px) !important;
  gap: 8px !important;
  padding-inline: 4px 8px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  min-height: 0 !important;
}

.notification-feed-item {
  min-height: 0 !important;
  padding: 9px 10px !important;
  gap: 7px !important;
  border-radius: 17px !important;
  overflow: hidden !important;
}

.notification-feed-main {
  display: grid !important;
  grid-template-columns: 34px minmax(0, 1fr) 10px;
  align-items: start !important;
  gap: 8px !important;
}

.notification-avatar {
  grid-column: 1;
  width: 34px !important;
  height: 34px !important;
}

.notification-feed-copy {
  grid-column: 2;
  min-width: 0 !important;
}

.notification-dot {
  grid-column: 3;
  margin-top: 12px !important;
}

.notification-feed-line {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(42px, auto);
  gap: 6px !important;
  align-items: center !important;
}

.notification-feed-line strong,
.notification-feed-line span,
.notification-feed-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-feed-line strong {
  font-size: .9rem !important;
}

.notification-feed-line span {
  max-width: 78px;
  font-size: .78rem !important;
}

.notification-feed-meta {
  display: grid !important;
  grid-template-columns: minmax(72px, 1fr) auto auto auto;
  gap: 5px !important;
  align-items: center !important;
  font-size: .74rem !important;
  width: 100%;
}

.notification-feed-meta > span:first-child {
  max-width: 104px;
}

.notification-priority-chip,
.notification-chip {
  min-height: 22px !important;
  padding: 3px 7px !important;
  font-size: .7rem !important;
}

.notification-feed-actions {
  grid-template-columns: minmax(72px, .9fr) 32px minmax(104px, 1.1fr) !important;
  gap: 6px !important;
  margin-inline-start: 42px !important;
}

.notification-feed-actions .btn {
  min-height: 32px !important;
  padding: 7px 8px !important;
  border-radius: 13px !important;
  font-size: .76rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.notification-priority-action {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.notification-priority-action .app-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.35;
}

.notifications-popover-body.single-notification {
  max-height: min(43vh, 330px) !important;
  overflow-y: auto !important;
}

.notifications-popover-body.single-notification .notification-feed-item {
  min-height: 0 !important;
}

.notifications-popover-body.single-notification .notification-feed-actions {
  margin-inline-start: 42px !important;
}

@media (max-width: 520px) {
  .notifications-popover {
    left: 8px !important;
    width: calc(100vw - 16px) !important;
  }

  .notification-feed-actions {
    margin-inline-start: 0 !important;
    grid-template-columns: 1fr 34px 1fr !important;
  }

  .notification-feed-meta {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
  }

  .notification-feed-meta > span:nth-child(2) {
    display: none !important;
  }
}
