

:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --dark: #111827;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  overflow-x: hidden;
}

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

button, input, select, textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input[readonly], input:disabled, select:disabled, textarea:disabled {
  background: #f3f4f6;
  color: #6b7280;
}

/* Login */
.login-page, #loginPage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 45%, #2563eb 100%);
}

.login-card, .login-box {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.login-card h1, .login-box h1, .login-card h2, .login-box h2 {
  margin: 0 0 10px;
  color: var(--dark);
}

.login-card p, .login-box p {
  margin: 0 0 20px;
  color: var(--muted);
}

.login-card input, .login-box input {
  width: 100%;
  margin-bottom: 12px;
}

/* Premium Login Layout */
.premium-login-page {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.35), transparent 32%),
    radial-gradient(circle at 85% 10%, rgba(14, 165, 233, 0.25), transparent 30%),
    linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e3a8a 100%);
}

.login-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.42;
  pointer-events: none;
}

.login-glow-one {
  width: 280px;
  height: 280px;
  left: -90px;
  bottom: 12%;
  background: #38bdf8;
}

.login-glow-two {
  width: 360px;
  height: 360px;
  right: -120px;
  top: 8%;
  background: #2563eb;
}

.premium-login-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.login-intro-panel {
  padding: 44px;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(37, 99, 235, 0.9), rgba(15, 23, 42, 0.55)),
    rgba(15, 23, 42, 0.68);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
}

.login-intro-panel h1 {
  margin: 8px 0 12px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: -1.5px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #bfdbfe;
}

.intro-copy {
  margin: 0;
  max-width: 420px;
  color: #dbeafe;
  line-height: 1.7;
}

.login-feature-list {
  display: grid;
  gap: 12px;
}

.login-feature-list div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #eff6ff;
  font-weight: 700;
}

.login-feature-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.premium-login-box {
  max-width: none;
  border-radius: 0;
  box-shadow: none;
  padding: 44px;
  background: rgba(255, 255, 255, 0.96);
}

.login-brand.compact {
  margin-bottom: 26px;
}

.brand-mark.large {
  width: 70px;
  height: 70px;
  border-radius: 22px;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.input-shell:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.input-icon {
  width: 22px;
  text-align: center;
  opacity: 0.78;
}

.input-shell input {
  border: none;
  box-shadow: none !important;
  padding: 12px 0;
  background: transparent;
}

.premium-login-btn {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.3);
}

.premium-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.36);
}

.btn-arrow {
  font-size: 18px;
  line-height: 1;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

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

/* Login UI Enhancements */
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-field input {
  margin-bottom: 0;
}

.login-help {
  margin-top: 14px;
  text-align: center;
  line-height: 1.4;
}

.auth-message {
  min-height: 20px;
  margin-bottom: 12px;
}

.auth-message.error {
  color: #991b1b;
  font-weight: 700;
}

.auth-message.warning {
  color: #92400e;
  font-weight: 700;
}

.auth-message.success {
  color: #166534;
  font-weight: 700;
}

/* Main layout */
#mainPage, .main-page {
  min-height: 100vh;
  padding: 18px;
}

.topbar, .header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.topbar h1, .header-bar h1 {
  margin: 0;
  font-size: 22px;
}

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

.card, .panel, .section-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.toolbar, .filter-bar, .actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

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

/* Buttons */
.btn, button {
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}

button:hover, .btn:hover {
  opacity: 0.92;
}

button:active, .btn:active {
  transform: translateY(1px);
}

.primary-btn, .save-btn, .login-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover, .save-btn:hover, .login-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn, .gray-btn {
  background: #374151;
  color: #fff;
}

.print-btn {
  background: #0f766e;
  color: #fff;
}

.edit-btn {
  background: var(--warning);
  color: #111827;
}

.delete-btn, .danger-btn {
  background: var(--danger);
  color: #fff;
}

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

/* Tables */
.table-wrap, .table-container {
  width: 100%;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 13px;
}

thead {
  background: #111827;
  color: #fff;
}

th, td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

th {
  white-space: nowrap;
  font-weight: 700;
}

#receiptTable th:nth-child(1),
#receiptTable td:nth-child(1) {
  min-width: 180px;
  max-width: 260px;
  text-align: left;
}

#receiptTable th:nth-child(2),
#receiptTable td:nth-child(2) {
  min-width: 155px;
  max-width: 220px;
  text-align: left;
}

#receiptTable th:nth-child(5),
#receiptTable td:nth-child(5),
#receiptTable th:nth-child(7),
#receiptTable td:nth-child(7),
#receiptTable th:nth-child(11),
#receiptTable td:nth-child(11),
#receiptTable th:nth-child(12),
#receiptTable td:nth-child(12) {
  min-width: 125px;
  white-space: nowrap;
}

#receiptTable th:nth-child(4),
#receiptTable td:nth-child(4),
#receiptTable th:nth-child(6),
#receiptTable td:nth-child(6),
#receiptTable th:nth-child(8),
#receiptTable td:nth-child(8),
#receiptTable th:nth-child(9),
#receiptTable td:nth-child(9),
#receiptTable th:nth-child(10),
#receiptTable td:nth-child(10) {
  min-width: 95px;
  max-width: 130px;
}

#receiptTable td:nth-child(5),
#receiptTable td:nth-child(7),
#receiptTable td:nth-child(8),
#receiptTable td:nth-child(11),
#receiptTable td:nth-child(12) {
  text-align: center;
}

tbody tr:hover {
  background: #f8fafc;
}

.main-page #receiptTable tbody tr {
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.main-page #receiptTable tbody tr:nth-child(odd) td {
  background: #ffffff;
}

.main-page #receiptTable tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.main-page #receiptTable tbody tr td:first-child {
  border-left: 4px solid transparent;
}

.main-page #receiptTable tbody tr:nth-child(odd) td:first-child {
  border-left-color: #2563eb;
}

.main-page #receiptTable tbody tr:nth-child(even) td:first-child {
  border-left-color: #0f766e;
}

.main-page #receiptTable tbody tr:hover td {
  background: #eff6ff;
  box-shadow: inset 0 1px 0 #bfdbfe, inset 0 -1px 0 #bfdbfe;
}

.main-page #receiptTable tbody tr:hover td:first-child {
  border-left-color: #f59e0b;
}

.receipt-no {
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}

.receipt-customer {
  font-weight: 700;
}

.net-highlight {
  display: inline-block;
  font-weight: 800;
  color: #92400e;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  padding: 7px 9px;
  font-size: 12px;
}

.record-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  width: 104px;
  max-width: 104px;
}

.record-action-row button {
  min-width: 0;
  width: 100%;
  white-space: nowrap;
  min-height: 24px !important;
  padding: 3px 2px !important;
  font-size: 9px !important;
  line-height: 1 !important;
}

.record-action-cell .row-actions,
.record-action-cell .claim-row-actions {
  display: grid !important;
  grid-template-columns: 1fr !important;
  justify-items: center;
  gap: 3px !important;
}

.record-action-cell {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  text-align: center;
}

.record-action-cell .record-action-row button {
  width: 100% !important;
  min-width: 0 !important;
}

.record-action-cell .edit-btn,
.record-action-cell .table-action-btn[data-action="edit"],
.record-action-cell .claim-btn.edit-btn {
  background: var(--warning) !important;
  border-color: var(--warning) !important;
  color: #111827 !important;
}

.record-action-cell .print-btn,
.record-action-cell .table-action-btn[data-action="print"],
.record-action-cell .claim-btn.print-btn {
  background: #0f766e !important;
  border-color: #0f766e !important;
  color: #ffffff !important;
}

.record-danger-outline,
.row-actions .record-danger-outline,
.claim-row-actions .record-danger-outline,
.purchase-return-page .table-action-btn.record-danger-outline {
  background: #ef4444 !important;
  border: 1px solid #dc2626 !important;
  color: #111827 !important;
  box-shadow: none !important;
}

.record-danger-outline:hover,
.row-actions .record-danger-outline:hover,
.claim-row-actions .record-danger-outline:hover,
.purchase-return-page .table-action-btn.record-danger-outline:hover {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  color: #111827 !important;
}

.checkbox-cell {
  text-align: center;
  vertical-align: middle;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #e5e7eb;
  color: #374151;
  white-space: nowrap;
}

.status-badge.ok {
  background: #dcfce7;
  color: #166534;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.locked-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.empty-state {
  padding: 28px !important;
  text-align: center;
  color: var(--muted);
}

/* Pagination */
.pagination, .pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
}

.pagination button, .pager button {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.pagination button.active, .pager button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Modal */
.modal, .popup, .dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.62);
  padding: 20px;
}

.modal.show, .popup.show, .dialog-backdrop.show {
  display: flex;
}

.modal-content, .popup-content, .dialog {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
  padding: 18px;
}

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

.close-btn {
  background: #e5e7eb;
  color: #111827;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  padding: 0;
}

/* Forms */
.form-grid, .settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.form-row label, .form-grid label, .settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid input, .form-grid select, .form-grid textarea,
.settings-grid input, .settings-grid select, .settings-grid textarea {
  width: 100%;
}

/* Totals */
.total-box, .summary-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.total-box > div, .summary-box > div {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.total-box .net, .summary-box .net {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
  font-weight: 800;
}

/* User-friendly dashboard / edit enhancements */
.dashboard-header,
.page-header {
  align-items: flex-start;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 6px 10px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.loading {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.success {
  background: #dcfce7;
  color: #166534;
}

.status-pill.error {
  background: #fee2e2;
  color: #991b1b;
}

.page-alert {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 600;
}

.info-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.dashboard-summary {
  margin-bottom: 16px;
}

/* Premium dashboard UI */
.dashboard-header {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.08)),
    var(--panel);
}

/* Dashboard Company Logo */
.dashboard-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-logo-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.dashboard-company-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.dashboard-logo-fallback {
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.nav-btn,
.soft-btn {
  background: #eef2ff;
  color: #1e3a8a;
  border: 1px solid #c7d2fe;
}

.nav-btn:hover,
.soft-btn:hover {
  background: #e0e7ff;
}

.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.primary-metric {
  border-color: #bfdbfe;
}

.success-metric {
  border-color: #bbf7d0;
}

.success-metric::after {
  background: rgba(22, 163, 74, 0.1);
}

.warning-metric {
  border-color: #fde68a;
}

.warning-metric::after {
  background: rgba(245, 158, 11, 0.12);
}

.ai-only-actions {
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
}

.filter-card .section-heading,
.table-card .section-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.section-heading p {
  margin: 0;
}

.filter-grid {
  align-items: stretch;
}

.filter-grid input,
.filter-grid select {
  flex: 1 1 170px;
}

.bulk-actions {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card .section-heading {
  padding: 16px 16px 0;
}

.table-card .table-container {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.table-wrap {
  -webkit-overflow-scrolling: touch;
}

.action-col {
  width: 110px;
  text-align: center;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  backdrop-filter: blur(8px);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2000;
  max-width: 360px;
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
  font-weight: 600;
}

.toast.success {
  background: #166534;
}

.toast.error {
  background: #991b1b;
}

.toast.warning {
  background: #92400e;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}

/* Print helpers */
@media print {
  body {
    background: #fff;
  }

  .topbar,
  .toolbar,
  .filter-bar,
  .row-actions,
  .pagination,
  .pager,
  button,
  .no-print {
    display: none !important;
  }

  .card, .panel, .section-card, .table-wrap, .table-container {
    box-shadow: none;
    border: none;
  }
}

/* Responsive */
@media (max-width: 768px) {
  #mainPage, .main-page {
    padding: 10px;
  }

  .topbar, .header-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar input, .toolbar select,
  .filter-bar input, .filter-bar select {
    width: 100%;
    min-width: 0;
  }

  th, td {
    padding: 8px 7px;
    font-size: 12px;
  }

  .modal-content, .popup-content, .dialog {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .filter-card .section-heading,
  .table-card .section-heading,
  .section-heading {
    flex-direction: column;
  }

  .header-actions,
  .bulk-actions,
  .actions,
  .sticky-actions {
    width: 100%;
  }

  .header-actions button,
  .bulk-actions button,
  .filter-card button,
  .actions button,
  .sticky-actions button {
    flex: 1 1 auto;
  }

  .summary-grid,
  .form-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .total-box,
  .summary-box {
    grid-template-columns: 1fr;
  }

  .table-section .section-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .table-section .section-title button {
    width: 100%;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }
 
  .premium-login-page {
    padding: 16px;
  }

  .premium-login-shell {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .login-intro-panel {
    padding: 26px;
  }

  .premium-login-box {
    padding: 26px;
  }

  .login-feature-list {
    gap: 8px;
  }

  .dashboard-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ai-only-actions {
    align-items: stretch;
  }

  .ai-only-actions button {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Customer Payment Bank Settings page */
.customer-bank-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 18px 96px;
}

.customer-bank-page .hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  color: #0f172a;
  border: 1px solid #e2e8f0;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
  margin-bottom: 18px;
}

.customer-bank-page .hero-content {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.customer-bank-page .hero-icon {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 28px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  flex: 0 0 auto;
}

.customer-bank-page .eyebrow {
  margin: 0 0 5px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-bank-page .hero-card h1,
.customer-bank-page .premium-card h2 {
  margin: 0;
}

.customer-bank-page .hero-muted {
  margin: 6px 0 0;
  color: #64748b;
  font-weight: 600;
}

.customer-bank-page .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.customer-bank-page .status-pill,
.customer-bank-page .bank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.customer-bank-page .status-pill {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.customer-bank-page .bank-pill {
  margin-left: 8px;
  padding: 4px 8px;
}

.customer-bank-page .bank-pill.default {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.customer-bank-page .bank-pill.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #bbf7d0;
}

.customer-bank-page .bank-pill.inactive {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.customer-bank-page .secondary-btn,
.customer-bank-page .primary-btn,
.customer-bank-page .edit-btn,
.customer-bank-page .danger-btn {
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 900;
  cursor: pointer;
  transition: 0.18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.customer-bank-page .secondary-btn {
  background: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.customer-bank-page .primary-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.customer-bank-page .edit-btn {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.customer-bank-page .danger-btn {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.customer-bank-page .secondary-btn:hover,
.customer-bank-page .primary-btn:hover,
.customer-bank-page .edit-btn:hover,
.customer-bank-page .danger-btn:hover {
  transform: translateY(-1px);
}

.customer-bank-page button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.customer-bank-page .page-alert {
  border-radius: 18px;
  padding: 13px 16px;
  margin-bottom: 16px;
  font-weight: 800;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
}

.customer-bank-page .page-alert.success {
  background: #ecfdf5;
  color: #047857;
  border-color: #bbf7d0;
}

.customer-bank-page .page-alert.error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.customer-bank-page .bank-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  align-items: start;
}

.customer-bank-page .premium-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
  overflow: hidden;
}

.customer-bank-page .card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid #eef2f7;
}

.customer-bank-page .card-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.customer-bank-page .bank-form {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.customer-bank-page label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.customer-bank-page input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
  background: #ffffff;
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.customer-bank-page input[type="text"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.customer-bank-page .toggle-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
}

.customer-bank-page .toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #0f172a;
  font-weight: 900;
}

.customer-bank-page .toggle-item small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.35;
}

.customer-bank-page .toggle-item input {
  width: 20px;
  height: 20px;
  accent-color: #2563eb;
  flex: 0 0 auto;
}

.customer-bank-page .form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.customer-bank-page .form-actions .primary-btn,
.customer-bank-page .form-actions .edit-btn {
  flex: 1;
  min-width: 140px;
}

.customer-bank-page .default-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #bfdbfe;
  margin: 0 20px 20px;
}

.customer-bank-page .default-preview-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  color: #2563eb;
  font-size: 20px;
  flex: 0 0 auto;
}

.customer-bank-page .default-preview span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.customer-bank-page .default-preview strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
}

.customer-bank-page .table-wrap {
  overflow-x: auto;
  border-top: 1px solid #eef2f7;
  background: #ffffff;
}

.customer-bank-page table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

.customer-bank-page th,
.customer-bank-page td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  font-size: 14px;
}

.customer-bank-page th {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
  white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
}

.customer-bank-page td strong {
  color: #0f172a;
}

.customer-bank-page .row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.customer-bank-page .row-actions .secondary-btn {
  color: #475569;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.customer-bank-page .empty-state {
  text-align: center;
  color: #64748b;
  padding: 26px !important;
  font-weight: 700;
}

.customer-bank-page .empty-state.error {
  color: #b91c1c;
}

@media (max-width: 920px) {
  .customer-bank-page {
    padding: 14px 12px 96px;
  }

  .customer-bank-page .hero-card {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 22px;
    padding: 18px;
  }

  .customer-bank-page .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .customer-bank-page .bank-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .customer-bank-page .hero-content {
    align-items: flex-start;
  }

  .customer-bank-page .hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 24px;
  }

  .customer-bank-page .hero-card h1 {
    font-size: 24px;
  }

  .customer-bank-page .card-header,
  .customer-bank-page .bank-form {
    padding: 16px;
  }

  .customer-bank-page .default-preview {
    margin: 0 16px 16px;
  }
}

/* Module Dashboard page */
.module-select-page {
  max-width: 1180px;
  margin: 0 auto;
}

.module-select-card {
  min-height: 260px;
}

.module-summary-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.module-summary-grid .metric-card strong {
  word-break: break-word;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.module-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 170px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.module-card h3 {
  margin: 0;
  font-size: 20px;
  color: #111827;
}

.module-desc {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.45;
}

.module-card .primary-btn {
  align-self: flex-start;
  min-width: 110px;
}

.module-card .primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dashboard-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
  padding: 4px;
}

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

  .module-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Unified app UI layer */
:root {
  --app-bg: #f6f8fb;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafc;
  --app-text: #111827;
  --app-muted: #64748b;
  --app-border: #e2e8f0;
  --app-primary: #2563eb;
  --app-primary-dark: #1d4ed8;
  --app-primary-soft: #eff6ff;
  --app-success: #059669;
  --app-warning: #d97706;
  --app-danger: #dc2626;
  --app-radius: 14px;
  --app-radius-lg: 18px;
  --app-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

body,
body.purchase-return-page {
  color: var(--app-text);
  background: var(--app-bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.main-page,
.page,
.claim-page,
.purchase-return-page .page-shell,
.customer-bank-page,
.supplier-bank-page {
  width: min(1280px, 100%);
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px;
}

.topbar,
.header-bar,
.hero-card,
.claim-hero,
.claim-edit-hero,
.purchase-return-page .premium-blue-hero,
.supplier-bank-page .hero-card,
.customer-bank-page .hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 20px 22px;
  color: var(--app-text);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow);
}

.purchase-return-page .premium-blue-hero::after {
  display: none;
}

.dashboard-brand-block,
.hero-content,
.hero-left,
.claim-edit-hero-main,
.supplier-bank-page .hero-content,
.customer-bank-page .hero-content {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar h1,
.header-bar h1,
.hero-card h1,
.claim-title-wrap h1,
.claim-edit-hero h1,
.purchase-return-page h1,
.supplier-bank-page .hero-card h1,
.customer-bank-page .hero-card h1 {
  margin: 0;
  color: var(--app-text);
  font-size: 26px;
  line-height: 1.12;
  font-weight: 850;
  letter-spacing: 0;
}

.eyebrow,
.claim-edit-eyebrow,
.purchase-return-page .eyebrow,
.supplier-payment-page .eyebrow,
.supplier-bank-page .eyebrow,
.customer-bank-page .eyebrow {
  margin: 0 0 5px;
  color: var(--app-primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted,
.small-muted,
.hero-muted,
.hero-subtitle,
.claim-title-wrap p,
.claim-edit-hero p,
.purchase-return-page .hero-subtitle,
.supplier-bank-page .hero-muted,
.customer-bank-page .hero-muted {
  color: var(--app-muted) !important;
}

.card,
.panel,
.section-card,
.premium-card,
.claim-card,
.purchase-return-page .premium-card,
.supplier-bank-page .premium-card,
.customer-bank-page .card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow);
}

.card,
.panel,
.section-card,
.premium-card,
.purchase-return-page .premium-card {
  padding: 18px;
}

.claim-card {
  overflow: hidden;
}

.claim-card-header,
.records-header,
.section-heading,
.section-title,
.card-title-row,
.supplier-bank-page .card-header,
.customer-bank-page .card-header {
  border-bottom-color: var(--app-border);
}

.primary-btn,
.save-btn,
.login-btn,
.claim-btn.primary,
.supplier-bank-page .primary-btn,
.customer-bank-page .primary-btn,
.purchase-return-page .primary-btn,
.purchase-return-page .chip-btn.active,
.purchase-return-page .chip-btn[aria-pressed="true"] {
  color: #ffffff !important;
  background: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18) !important;
}

.primary-btn:hover,
.save-btn:hover,
.login-btn:hover,
.claim-btn.primary:hover,
.supplier-bank-page .primary-btn:hover,
.customer-bank-page .primary-btn:hover,
.purchase-return-page .primary-btn:hover {
  background: var(--app-primary-dark) !important;
}

.secondary-btn,
.gray-btn,
.nav-btn,
.soft-btn,
.primary-soft-btn,
.claim-btn,
.purchase-return-page .secondary-btn,
.purchase-return-page .chip-btn,
.supplier-bank-page .secondary-btn,
.customer-bank-page .secondary-btn,
.purchase-return-page .icon-btn.ghost,
.claim-icon-back {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #334155 !important;
  background: #ffffff !important;
  border: 1px solid var(--app-border) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  font-weight: 800;
}

.secondary-btn:hover,
.gray-btn:hover,
.nav-btn:hover,
.soft-btn:hover,
.primary-soft-btn:hover,
.claim-btn:hover,
.purchase-return-page .secondary-btn:hover,
.purchase-return-page .chip-btn:hover,
.supplier-bank-page .secondary-btn:hover,
.customer-bank-page .secondary-btn:hover,
.purchase-return-page .icon-btn.ghost:hover,
.claim-icon-back:hover {
  opacity: 1;
  background: var(--app-surface-soft) !important;
  transform: translateY(-1px);
}

.danger-btn,
.delete-btn,
.claim-btn.danger,
.supplier-bank-page .danger-btn,
.customer-bank-page .danger-btn {
  color: #ffffff !important;
  background: var(--app-danger) !important;
  border-color: var(--app-danger) !important;
}

.success-btn {
  color: #ffffff !important;
  background: var(--app-success) !important;
}

.status-pill,
.claim-status-pill,
.bank-pill,
.supplier-bank-page .status-pill,
.supplier-bank-page .bank-pill,
.discount-mode-pill,
.claim-edit-mini-badge {
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select,
textarea,
.claim-input,
.claim-select,
.purchase-return-page input,
.purchase-return-page select,
.purchase-return-page textarea {
  border-color: #dbe3ef;
  border-radius: 10px;
  background: #ffffff;
}

.table-wrap,
.table-container,
.responsive-table,
.purchase-return-page .table-wrap,
.claim-table-wrap,
.customer-bank-page .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: #ffffff;
  box-shadow: none;
}

.claim-table-wrap {
  margin: 0 20px 20px;
  padding: 0;
}

table,
.claim-table,
.purchase-return-page table,
.customer-bank-page table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

thead,
.claim-table thead,
.purchase-return-page thead,
.customer-bank-page thead {
  background: #f8fafc;
  color: #334155;
}

th,
td,
.claim-table th,
.claim-table td,
.purchase-return-page th,
.purchase-return-page td,
.customer-bank-page th,
.customer-bank-page td {
  border-bottom: 1px solid #eef2f7;
  padding: 12px 13px;
  text-align: left;
  vertical-align: middle;
}

th,
.claim-table th,
.purchase-return-page th,
.customer-bank-page th {
  color: #334155;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.claim-table td,
.claim-table td:first-child,
.claim-table td:last-child {
  background: #ffffff;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
}

.summary-strip,
.dashboard-summary-grid,
.summary-grid,
.bank-grid,
.settings-grid {
  gap: 14px;
}

.metric-card,
.summary-tile,
.purchase-return-page .summary-tile,
.discount-mode-card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: #ffffff;
  box-shadow: var(--app-shadow);
}

@media (max-width: 900px) {
  .main-page,
  .page,
  .claim-page,
  .purchase-return-page .page-shell,
  .customer-bank-page,
  .supplier-bank-page {
    padding: 14px;
  }

  .topbar,
  .header-bar,
  .hero-card,
  .claim-hero,
  .claim-edit-hero,
  .purchase-return-page .premium-blue-hero,
  .supplier-bank-page .hero-card,
  .customer-bank-page .hero-card {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .header-actions,
  .hero-actions,
  .claim-actions,
  .claim-edit-hero-actions,
  .records-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar h1,
  .header-bar h1,
  .hero-card h1,
  .claim-title-wrap h1,
  .claim-edit-hero h1,
  .purchase-return-page h1 {
    font-size: 23px;
  }
}
.customer-payment-record-page .table-sort-btn,
.supplier-payment-record-page .table-sort-btn,
.purchase-return-page .table-sort-btn,
.claim-page .table-sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  text-align: center;
}

.customer-payment-record-page .table-sort-btn:hover,
.supplier-payment-record-page .table-sort-btn:hover,
.purchase-return-page .table-sort-btn:hover,
.claim-page .table-sort-btn:hover {
  color: #1d4ed8;
}

.customer-payment-record-page .table-sort-btn [data-sort-icon],
.supplier-payment-record-page .table-sort-btn [data-sort-icon],
.purchase-return-page .table-sort-btn [data-sort-icon],
.claim-page .table-sort-btn [data-sort-icon] {
  display: inline-block;
  min-width: 10px;
  font-size: 10px;
  line-height: 1;
}
