/**
 * Epos Now Nexus — shared portal styles
 * Used by login, customers, customer detail, db-schema
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  background: #0a1628;
  color: #0D223E;
  overflow-x: hidden;
}

/* Login page: centered layout */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: linear-gradient(160deg, #0a1628 0%, #0f2847 40%, #0d223e 100%);
}

/* ——— Login card ——— */
.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  padding: 2.5rem 2.25rem;
  border-radius: 20px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  text-align: center;
}

.login-card .logo,
.login .logo {
  display: block;
  margin: 0 auto 1.5rem;
  height: 28px;
  width: auto;
  object-fit: contain;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0D223E;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.subtext {
  font-size: 0.9375rem;
  font-weight: 400;
  color: #5c6b82;
  margin-bottom: 2rem;
  letter-spacing: 0.01em;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(13, 34, 62, 0.12), transparent);
  margin-bottom: 1.75rem;
}

.login-prompt {
  font-size: 0.9rem;
  color: #5c6b82;
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #0D223E 0%, #1a3a5c 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 34, 62, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-google:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13, 34, 62, 0.4);
}

.btn-google:active {
  transform: translateY(0);
}

/* ——— Internal portal (nav + main) ——— */
.portal-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 1.5rem;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.portal-nav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
}

.portal-nav a:hover {
  color: #fff;
  text-decoration: none !important;
}

.portal-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-right: auto;
}

.portal-nav .logo {
  height: 24px;
  width: auto;
  display: block;
}

.portal-nav .brand-text {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}

.portal-nav .brand-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: 400;
}

.portal-main {
  max-width: 1200px;
  margin: 0 auto;
}

.portal-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.portal-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0D223E;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.portal-card h1:not(:first-child) {
  margin-bottom: 0.5rem;
}

.portal-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0D223E;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.portal-card h2:first-of-type {
  margin-top: 0;
}

.card-title {
  clear: right;
  font-weight: 700;
  color: #0D223E;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.25rem;
  grid-template-columns: 1fr 1fr;
  padding: 15px;
}

.detail-row {
  display: flex;
  gap: 0.5rem;
  padding: 5px;
  border-bottom: 1px solid #ccc;
}

.detail-label {
  color: #5c6b82;
  font-size: 0.9rem;
  min-width: 30%;
}

.detail-value {
  font-weight: 500;
  color: #0D223E;
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.portal-table th,
.portal-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid rgba(13, 34, 62, 0.08);
}

.portal-table th {
  background: #0D223E;
  color: #fff;
  font-weight: 600;
}

.portal-table th:first-child {
  border-radius: 10px 0 0 0;
}

.portal-table th:last-child {
  border-radius: 0 10px 0 0;
}

.portal-table tbody tr:hover {
  background: rgba(13, 34, 62, 0.04);
}

.portal-table a {
  color: #0D223E;
  text-decoration: none;
  font-weight: 500;
}

.portal-table a:hover {
  text-decoration: underline;
}

.empty-state {
  color: #5c6b82;
  font-style: italic;
  padding: 1rem;
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: #fff;
  text-decoration: underline;
}

.portal-card ul {
  margin-left: 1.25rem;
  margin-bottom: 1rem;
  color: #0D223E;
}

.portal-card li {
  margin-bottom: 0.35rem;
}

.record-id-label {
  font-weight: 500;
  color: #5c6b82;
  font-size: 1rem;
}

.related-list-title {
  border-top: 1px solid rgba(13, 34, 62, 0.1);
  padding-top: 1.25rem;
  margin-top: 1.5rem;
}

.related-count {
  font-weight: 500;
  color: #5c6b82;
  font-size: 0.95rem;
}

.portal-card .inline-back {
  display: inline-block;
  margin: 0.75rem 0 0.25rem;
  color: #0D223E;
  font-weight: 500;
  text-decoration: none;
  font-size: 0.9rem;
}

.portal-card .inline-back:hover {
  text-decoration: underline;
}

/* ——— Customer summary (dashboard) ——— */
.customer-snapshot {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(13, 34, 62, 0.1);
}

.customer-section-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0D223E;
  margin: 1.35rem 0 0.75rem;
  letter-spacing: -0.02em;
}

.customer-snapshot > .customer-section-heading:first-child {
  margin-top: 0;
}

.customer-section-sub {
  font-size: 0.82rem;
  color: #5c6b82;
  margin: -0.35rem 0 0.85rem;
  line-height: 1.45;
}

.customer-empty-hint {
  font-size: 0.88rem;
  color: #5c6b82;
  margin-bottom: 0.5rem;
}

.customer-empty-hint code {
  font-size: 0.8em;
  background: rgba(13, 34, 62, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 0.25rem;
}

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

.kpi-card {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(13, 34, 62, 0.1);
  box-shadow: 0 4px 14px rgba(13, 34, 62, 0.06);
}

.kpi-card--neutral {
  background: linear-gradient(145deg, #f4f7fc 0%, #e8eef7 100%);
  border-color: rgba(13, 34, 62, 0.12);
}

.kpi-card--positive {
  background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: rgba(16, 185, 129, 0.35);
}

.kpi-card--negative {
  background: linear-gradient(145deg, #fef2f2 0%, #fee2e2 100%);
  border-color: rgba(239, 68, 68, 0.35);
}

.kpi-card__icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-card--neutral .kpi-card__icon {
  background: rgba(13, 34, 62, 0.1);
  color: #0D223E;
}

.kpi-card--positive .kpi-card__icon {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.kpi-card--negative .kpi-card__icon {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.kpi-card__body {
  min-width: 0;
}

.kpi-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c6b82;
  margin-bottom: 0.2rem;
}

.kpi-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0D223E;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.kpi-card__hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: #5c6b82;
}

.kpi-trend {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
}

.kpi-trend--good {
  color: #059669;
}

.kpi-trend--bad {
  color: #dc2626;
}

.payment-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.payment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem 0.55rem 0.65rem;
  border-radius: 999px;
  text-decoration: none;
  color: #0D223E;
  border: 1px solid rgba(13, 34, 62, 0.12);
  background: #fff;
  box-shadow: 0 2px 8px rgba(13, 34, 62, 0.06);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  max-width: 100%;
}

.payment-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 34, 62, 0.1);
  border-color: rgba(13, 34, 62, 0.22);
  text-decoration: none;
}

.payment-pill--bank {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #fff 0%, #eff6ff 100%);
}

.payment-pill--bank .payment-pill__icon {
  color: #1d4ed8;
}

.payment-pill__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(13, 34, 62, 0.06);
}

.payment-pill--visa .payment-pill__icon,
.payment-pill--mastercard .payment-pill__icon,
.payment-pill--amex .payment-pill__icon,
.payment-pill--discover .payment-pill__icon {
  background: transparent;
  padding: 0;
}

.customer-pill-svg {
  width: 34px;
  height: auto;
  max-height: 24px;
  display: block;
}

.customer-pill-svg--visa,
.customer-pill-svg--mc,
.customer-pill-svg--amex,
.customer-pill-svg--discover {
  width: 44px;
  max-height: 30px;
  border-radius: 6px;
}

.payment-pill__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.payment-pill__title {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.payment-pill__sub {
  font-size: 0.78rem;
  color: #5c6b82;
}

.pill-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.pill-badge--default {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.service-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.service-chip {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: linear-gradient(160deg, #fafbfc 0%, #f0f4f8 100%);
  border: 1px solid rgba(13, 34, 62, 0.1);
  box-shadow: 0 2px 6px rgba(13, 34, 62, 0.04);
}

.service-chip__product {
  font-weight: 600;
  font-size: 0.9rem;
  color: #0D223E;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.service-chip__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #5c6b82;
  margin-bottom: 0.45rem;
}

.service-chip__sku {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  background: rgba(13, 34, 62, 0.07);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.service-chip__qty {
  font-weight: 700;
  color: #0D223E;
  background: rgba(13, 34, 62, 0.08);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
}

.service-chip__amt {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0D223E;
}

.service-chip__amt-label {
  font-weight: 500;
  font-size: 0.72rem;
  color: #5c6b82;
  margin-left: 0.25rem;
}

.related-lists-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(13, 34, 62, 0.12);
}

.related-lists-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0D223E;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.related-lists-intro {
  font-size: 0.85rem;
  color: #5c6b82;
  margin: 0 0 1rem;
  line-height: 1.45;
}

/* ——— Record detail: product image (from product.image_url__c) ——— */
.record-product-figure {
  float: right;
  margin: 0 0 0.75rem 1.25rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid rgba(13, 34, 62, 0.1);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(13, 34, 62, 0.08);
}

.record-product-figure__img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
}

/* ——— Related list sections: shared icon + coloured header (portal-related--*) ——— */
.portal-related-block {
  margin-top: 1.5rem;
  border: 1px solid rgba(13, 34, 62, 0.1);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(13, 34, 62, 0.05);
}

.portal-related-block:first-of-type {
  margin-top: 0.5rem;
}

.portal-related-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  min-height: 2.75rem;
}

.portal-related-header__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: #fff;
}

.portal-related-header__icon .section-icon {
  display: block;
}

.portal-related-header__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0d223e;
  margin: 0;
  letter-spacing: -0.02em;
  border: none;
  padding: 0;
}

.portal-related-table-wrap {
  padding: 0 0.15rem 0.25rem;
}

.portal-table--themed {
  margin-bottom: 0;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

/* One accent only: the section label bar. Table column headers stay neutral. */
.portal-related-block .portal-table--themed thead th {
  background: #e8edf4;
  color: #0d223e;
  font-weight: 600;
  border-bottom: 1px solid rgba(13, 34, 62, 0.12);
}

.portal-related-block .portal-table--themed thead th:first-child,
.portal-related-block .portal-table--themed thead th:last-child {
  border-radius: 0;
}

.portal-related--default .portal-related-header {
  background: linear-gradient(100deg, #5c6b82 0%, #7a8aa0 100%);
}
.portal-related--default .portal-related-header__title,
.portal-related--default .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--default .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--customer .portal-related-header,
.portal-related--customers .portal-related-header {
  background: linear-gradient(100deg, #1d4ed8 0%, #3b82f6 100%);
}
.portal-related--customer .portal-related-header__title,
.portal-related--customer .portal-related-header__title .related-count,
.portal-related--customers .portal-related-header__title,
.portal-related--customers .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--customer .portal-related-header__icon,
.portal-related--customers .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--address .portal-related-header {
  background: linear-gradient(100deg, #57534e 0%, #a8a29e 100%);
}
.portal-related--address .portal-related-header__title,
.portal-related--address .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--address .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--chargeInvoiceSnapshot .portal-related-header {
  background: linear-gradient(100deg, #4f46e5 0%, #a5b4fc 100%);
}
.portal-related--chargeInvoiceSnapshot .portal-related-header__title,
.portal-related--chargeInvoiceSnapshot .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--chargeInvoiceSnapshot .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--subscription .portal-related-header {
  background: linear-gradient(100deg, #6d28d9 0%, #a78bfa 100%);
}
.portal-related--subscription .portal-related-header__title,
.portal-related--subscription .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--subscription .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--service .portal-related-header {
  background: linear-gradient(100deg, #0d9488 0%, #2dd4bf 100%);
}
.portal-related--service .portal-related-header__title,
.portal-related--service .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--service .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--charge .portal-related-header {
  background: linear-gradient(100deg, #c2410c 0%, #fb923c 100%);
}
.portal-related--charge .portal-related-header__title,
.portal-related--charge .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--charge .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--invoice .portal-related-header,
.portal-related--invoiceLine .portal-related-header {
  background: linear-gradient(100deg, #0369a1 0%, #38bdf8 100%);
}
.portal-related--invoice .portal-related-header__title,
.portal-related--invoice .portal-related-header__title .related-count,
.portal-related--invoiceLine .portal-related-header__title,
.portal-related--invoiceLine .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--invoice .portal-related-header__icon,
.portal-related--invoiceLine .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--payment .portal-related-header {
  background: linear-gradient(100deg, #15803d 0%, #4ade80 100%);
}
.portal-related--payment .portal-related-header__title,
.portal-related--payment .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--payment .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--paymentMethod .portal-related-header {
  background: linear-gradient(100deg, #be185d 0%, #f472b6 100%);
}
.portal-related--paymentMethod .portal-related-header__title,
.portal-related--paymentMethod .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--paymentMethod .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--paymentAttempt .portal-related-header {
  background: linear-gradient(100deg, #b91c1c 0%, #f87171 100%);
}
.portal-related--paymentAttempt .portal-related-header__title,
.portal-related--paymentAttempt .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--paymentAttempt .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--paymentAllocation .portal-related-header {
  background: linear-gradient(100deg, #0e7490 0%, #22d3ee 100%);
}
.portal-related--paymentAllocation .portal-related-header__title,
.portal-related--paymentAllocation .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--paymentAllocation .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.portal-related--promotion .portal-related-header {
  background: linear-gradient(100deg, #7c3aed 0%, #c4b5fd 100%);
}
.portal-related--promotion .portal-related-header__title,
.portal-related--promotion .portal-related-header__title .related-count {
  color: #fff;
}
.portal-related--promotion .portal-related-header__icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Product + thumbnail in table cells */
.product-table-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
}

.product-table-cell__thumb {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid rgba(13, 34, 62, 0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-table-cell__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-table-cell__text {
  font-weight: 500;
  min-width: 0;
  word-break: break-word;
}

.service-chip__product-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.service-chip__thumb {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid rgba(13, 34, 62, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.service-chip__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
