/* ============================================================
   SSC Customer Portal — in-page components
   Lives inside the site's normal header/footer chrome.
   ============================================================ */

:root {
  --p-ink: #1B2430;
  --p-surface: #F4F5F7;
  --p-card: #FFFFFF;
  --p-muted: #66738A;
  --p-faint: #93A0B4;
  --p-line: #E4E8EF;
  --p-accent: #C8332B;        /* site red */
  --p-accent-deep: #A82820;
  --p-accent-soft: #FBEAE8;

  /* status — reserved, never decorative */
  --p-good: #1E7A4C;
  --p-good-soft: #E5F3EC;
  --p-warn: #9A5B00;
  --p-warn-soft: #FCF0DC;
  --p-crit: #B3261E;
  --p-crit-soft: #FBEAE9;

  --p-radius: 14px;
  --p-shadow: 0 1px 2px rgba(20, 28, 40, 0.05), 0 10px 30px -12px rgba(20, 28, 40, 0.16);
  --p-shadow-soft: 0 1px 3px rgba(20, 28, 40, 0.07);
}

.portal-section {
  background: var(--p-surface);
  padding: 34px 0 60px;
}
.portal-container { max-width: 1320px; }
.portal-section, .portal-section * { box-sizing: border-box; }

/* ---------- sidebar card ---------- */

.portal-side-card {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  box-shadow: var(--p-shadow-soft);
  padding: 26px 18px 20px;
  position: sticky;
  top: 16px;
}
.side-brand { text-align: center; margin-bottom: 14px; }
.side-brand img { max-width: 150px; height: auto; }
.side-user { text-align: center; margin-bottom: 18px; }
.side-user-name { font-weight: 700; color: var(--p-ink); font-size: 15.5px; }
.side-company-badge {
  display: inline-block;
  margin-top: 6px;
  background: var(--p-accent);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
  padding: 4px 14px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 99px;
  color: var(--p-ink);
  font-weight: 500;
  font-size: 14.5px;
  text-decoration: none;
  transition: background 0.15s ease;
}
.side-nav-item i { width: 20px; text-align: center; color: var(--p-muted); font-size: 15px; }
.portal-section .side-nav-item { color: var(--p-ink); text-decoration: none; }
.portal-section .side-nav-item:hover { background: var(--p-surface); color: var(--p-ink); }
.portal-section .side-nav-item.active { background: var(--p-ink); color: #FFFFFF; }
.side-nav-item.active i { color: #F08A84; }
.side-nav-item.is-soon { opacity: 0.5; cursor: default; }
.side-nav-item.is-soon:hover { background: none; }
.soon-chip {
  margin-left: auto;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--p-line);
  color: var(--p-faint);
  border-radius: 99px;
  padding: 1px 7px;
}
.side-logout { width: 100%; border-radius: 99px; font-weight: 600; }
.side-logout i { margin-right: 6px; }

/* ---------- page column ---------- */

.portal-page {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  box-shadow: var(--p-shadow-soft);
  padding: 26px 28px 30px;
  min-height: 420px;
}
.portal-page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--p-ink);
  margin: 0 0 12px;
}
.portal-title-rule { border: 0; border-top: 1px solid var(--p-line); opacity: 1; margin: 0 0 24px; }

.portal-subheading {
  font-size: 17px;
  font-weight: 700;
  color: var(--p-ink);
  margin: 26px 0 12px;
}

/* ---------- stat chips ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 6px;
}
.stat-chip {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  background: var(--p-surface);
  border: 1px solid var(--p-line);
  border-radius: 12px;
  padding: 14px 18px;
}
.stat-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--p-card);
  color: var(--p-accent-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--p-ink); line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--p-muted); }

/* ---------- inner cards ---------- */

.p-card {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
}
.p-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}
.p-card-head h2 { font-size: 16px; font-weight: 700; margin: 0; color: var(--p-ink); }
.p-card-head .head-link { font-size: 13.5px; font-weight: 600; color: var(--p-accent-deep); text-decoration: none; }
.p-card-head .head-link:hover { text-decoration: underline; color: var(--p-accent-deep); }
.p-card-body { padding: 14px 20px 20px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.card-grid > * { min-width: 0; }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; max-width: 100%; }
.p-table { width: 100%; border-collapse: collapse; }
.p-table th {
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-faint);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--p-line);
  white-space: nowrap;
}
.p-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--p-line);
  vertical-align: middle;
  font-size: 14.5px;
  color: var(--p-ink);
}
.p-table tbody tr:last-child td { border-bottom: none; }
.p-table tbody tr:hover { background: #F8FAFC; }
.p-table tbody tr.row-link { cursor: pointer; }
.p-table .cell-strong { font-weight: 600; color: var(--p-ink); }
.p-table .cell-muted { color: var(--p-muted); }
.p-table .cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
  padding: 3px 11px;
  white-space: nowrap;
}
.pill i { font-size: 10.5px; }
.pill-neutral { background: var(--p-surface); color: var(--p-muted); border: 1px solid var(--p-line); }
.pill-accent { background: var(--p-accent-soft); color: var(--p-accent-deep); }
.pill-good { background: var(--p-good-soft); color: var(--p-good); }
.pill-warn { background: var(--p-warn-soft); color: var(--p-warn); }
.pill-crit { background: var(--p-crit-soft); color: var(--p-crit); }

/* ---------- buttons & forms ---------- */

.btn-p,
.btn-p-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 20px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}
.portal-section .btn-p { background: var(--p-ink); color: #FFFFFF; }
.portal-section .btn-p:hover { background: #2A3646; color: #FFFFFF; text-decoration: none; }
.portal-section .btn-p-ghost { background: var(--p-card); color: var(--p-ink); border-color: var(--p-line); }
.portal-section .btn-p-ghost:hover { border-color: var(--p-faint); color: var(--p-ink); text-decoration: none; }
.btn-p:focus-visible, .btn-p-ghost:focus-visible, .side-nav-item:focus-visible {
  outline: 2px solid var(--p-accent);
  outline-offset: 2px;
}
.btn-p:disabled { opacity: 0.55; cursor: default; }

.input-p {
  font-size: 14.5px;
  color: var(--p-ink);
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: 10px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-p::placeholder { color: var(--p-faint); }
.input-p:focus {
  outline: none;
  border-color: var(--p-accent);
  box-shadow: 0 0 0 3px rgba(200, 51, 43, 0.13);
}
.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--p-muted);
  margin-bottom: 6px;
  display: block;
}

/* ---------- retention notice ---------- */

.notice-p {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--p-warn-soft);
  color: var(--p-warn);
  border: 1px solid #F0DFC0;
  border-radius: 10px;
  font-size: 13.5px;
  padding: 11px 15px;
  margin-bottom: 20px;
}
.notice-p i { margin-top: 3px; }
.notice-p a { color: var(--p-warn); font-weight: 600; text-decoration: underline; }

/* ---------- invoice search ---------- */

.invoice-search {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.invoice-search .input-p { flex: 1; min-width: 220px; max-width: 480px; }

.cell-actions { white-space: nowrap; }
.btn-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--p-ink);
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.portal-section a.btn-row { color: var(--p-ink); text-decoration: none; }
.btn-row:hover { background: var(--p-surface); border-color: var(--p-faint); color: var(--p-ink); }
.btn-row i { font-size: 11.5px; color: var(--p-accent-deep); }
.btn-row + .btn-row { margin-left: 6px; }

.pdf-modal .modal-header { gap: 12px; }
.pdf-modal-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.pdf-modal-body { padding: 0; background: #525659; }
.pdf-modal-body iframe { display: block; width: 100%; height: 78vh; border: 0; }

/* tracking details expand under each invoice row */
.track-detail-row:hover { background: transparent !important; }
.track-detail-cell { padding: 0 !important; border-bottom: 1px solid var(--p-line); }
.track-detail {
  background: var(--p-surface);
  border-radius: 10px;
  margin: 0 14px 14px;
  padding: 14px 18px;
}
.track-dl { display: flex; flex-wrap: wrap; gap: 8px 42px; margin: 0; }
.track-dl > div { min-width: 160px; }
.track-dl dt {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-faint);
  font-weight: 600;
  margin-bottom: 2px;
}
.track-dl dd { margin: 0; font-size: 14.5px; color: var(--p-ink); }
.track-dl dd code {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  color: var(--p-ink);
}
.track-none { margin: 0; font-size: 14px; color: var(--p-muted); }
.track-none i { margin-right: 6px; }

/* inline PDF viewer (exact-match tracking search result) */
.inline-pdf {
  background: #525659;
  border-radius: 10px;
  overflow: hidden;
}
.inline-pdf iframe { display: block; width: 100%; height: 72vh; border: 0; }

.portal-pagination { margin-top: 14px; }
.portal-pagination .pagination { margin: 0; justify-content: flex-end; }
.portal-pagination .page-link { color: var(--p-ink); }
.portal-pagination .page-item.active .page-link {
  background: var(--p-ink);
  border-color: var(--p-ink);
  color: #fff;
}

/* ---------- empty states & alerts ---------- */

.empty-state { text-align: center; padding: 30px 20px; color: var(--p-muted); }
.empty-state .empty-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--p-surface);
  color: var(--p-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.empty-state p { margin: 0; font-size: 14px; }

.alert-p {
  border-radius: 10px;
  font-size: 14px;
  padding: 12px 15px;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert-p i { margin-top: 3px; }
.alert-p.ok { background: var(--p-good-soft); color: var(--p-good); }
.alert-p.err { background: var(--p-crit-soft); color: var(--p-crit); }

/* ---------- login card (inside site chrome) ---------- */

.auth-section { background: var(--p-surface); padding: 60px 0 80px; }
.auth-card {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  box-shadow: var(--p-shadow);
  max-width: 440px;
  margin: 0 auto;
  padding: 34px 34px 30px;
}
.auth-card h2 { font-size: 22px; font-weight: 700; color: var(--p-ink); margin: 0 0 6px; }
.auth-card .auth-sub { color: var(--p-muted); font-size: 14.5px; margin: 0 0 22px; }
/* matches the site header menu items: 18px Hind, near-black */
.auth-note { font-size: 18px; line-height: 1.55; color: var(--p-ink); margin: 22px 0 0; }
.auth-note a { color: var(--p-accent-deep); font-weight: 600; }

/* ---------- responsive ---------- */

@media (max-width: 991.98px) {
  .portal-side-card { position: static; }
  .portal-page { padding: 20px 18px 24px; }
  .stat-row { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .side-nav-item, .btn-p, .btn-p-ghost, .input-p { transition: none; }
}
