/* Customer portal visual layer. Keep the older form and table selectors in customer.css. */
:root {
  --portal-ink: #183047;
  --portal-muted: #61758a;
  --portal-blue: #145fc6;
  --portal-blue-dark: #0b459b;
  --portal-border: #dce5ef;
  --portal-surface: #ffffff;
  --portal-background: #f3f7fb;
  --portal-shadow: 0 14px 38px rgba(20, 48, 77, .07);
}

.customer-portal,
.customer-portal td,
.customer-portal th,
.customer-portal input,
.customer-portal select,
.customer-portal textarea,
.customer-portal button {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.customer-portal {
  min-height: 100%;
  margin: 0;
  color: var(--portal-ink);
  background: var(--portal-background);
  line-height: 1.5;
  text-align: left;
}

.customer-portal *, .customer-portal *::before, .customer-portal *::after { box-sizing: border-box; }
.customer-portal a, .customer-portal a:visited { color: var(--portal-blue); }
.customer-portal a:hover { color: var(--portal-blue-dark); }
.customer-portal a:focus-visible, .customer-portal button:focus-visible,
.customer-portal input:focus-visible, .customer-portal select:focus-visible,
.customer-portal textarea:focus-visible {
  outline: 3px solid #89b8ff;
  outline-offset: 2px;
}

.customer-portal #container {
  width: min(100% - 40px, 1240px);
  min-height: calc(100vh - 120px);
  margin: 24px auto 0;
  border: 1px solid var(--portal-border);
  border-radius: 18px;
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow);
  overflow: hidden;
}

.customer-portal .portal-header {
  height: auto;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 32px;
  background: #102d4f;
  color: #fff;
}
.customer-portal .portal-brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.customer-portal .portal-brand:visited, .customer-portal .portal-brand:hover { color: #fff; }
.portal-brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #3c8ff2;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.06em;
}
.portal-brand-name { font-size: 21px; font-weight: 750; line-height: 1; letter-spacing: -.04em; }
.portal-brand-name > span { color: #79c1ff; }
.portal-brand-name small { display: block; margin-top: 6px; color: #a9c6e4; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.portal-header-actions { display: flex; align-items: center; gap: 20px; }
.portal-user { color: #c6d9eb; font-size: 13px; }
.portal-user strong { color: #fff; font-weight: 650; }
.customer-portal .portal-signout, .customer-portal .portal-signout:visited {
  display: inline-block;
  padding: 8px 13px;
  border: 1px solid #59789b;
  border-radius: 8px;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}
.customer-portal .portal-signout:hover { background: #24496f; }

.portal-nav {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid var(--portal-border);
  background: #fff;
}
.portal-nav-links { display: flex; align-items: stretch; gap: 5px; min-width: 0; }
.customer-portal .portal-nav-links a, .customer-portal .portal-nav-links a:visited {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: #51687f;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
}
.customer-portal .portal-nav-links a:hover { color: var(--portal-blue); background: #f5f9ff; }
.customer-portal .portal-nav-links a[aria-current="page"] { color: var(--portal-blue); border-bottom-color: var(--portal-blue); }
.customer-portal .portal-balance, .customer-portal .portal-balance:visited {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  border: 1px solid #b8d7fa;
  border-radius: 9px;
  background: #edf6ff;
  color: #2d526f;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.portal-balance strong { color: #0d4f9e; font-size: 17px; }
.portal-balance-add { padding-left: 10px; border-left: 1px solid #b8d7fa; color: var(--portal-blue); font-weight: 700; }

.customer-portal #nav_title_area.portal-page-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 27px 36px 10px;
}
.portal-eyebrow { margin: 0 0 4px; color: var(--portal-muted); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.portal-page-heading h1 { margin: 0; color: #173450; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; letter-spacing: -.035em; }
.customer-portal #sales_rep_div { position: static; right: auto; bottom: auto; padding: 9px 13px; border: 1px solid var(--portal-border); border-radius: 9px; background: #f7fafc; white-space: normal; font-size: 12px; }
.customer-portal #sales_rep_div > div { float: none !important; height: auto !important; line-height: normal !important; }
.customer-portal #sales_rep_div img { display: none; }

.customer-portal #contents {
  width: 100%;
  max-width: none;
  padding: 22px 36px 46px;
  overflow-x: auto;
  text-align: left;
}
.customer-portal #contents .padding { padding: 0; }
.customer-portal #contents fieldset,
.customer-portal #contents .announce,
.customer-portal #contents #suggested_leads,
.customer-portal #contents .portal-panel {
  min-width: 0;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(20, 48, 77, .04);
}
.customer-portal #contents fieldset { margin: 0 0 18px; padding: 18px 20px 20px; }
.customer-portal #contents legend { padding: 0 8px; border: 0; background: transparent; color: #24415e; font-size: 16px; font-weight: 750; }
.customer-portal #contents .acct_ov { width: min(100%, 660px); }
.customer-portal #contents p { line-height: 1.55; }
.customer-portal #contents h2, .customer-portal #contents h3 { color: #173450; }
.customer-portal #contents .smalltxt, .customer-portal #contents .medtxt, .customer-portal #contents .medtxt_l { font-size: 12px; }
.customer-portal #contents .atinfo, .customer-portal #contents .atinfo2 { width: 150px; font-weight: 650; }

.customer-portal input[type="text"], .customer-portal input[type="password"],
.customer-portal input[type="email"], .customer-portal input[type="number"],
.customer-portal select, .customer-portal textarea {
  max-width: 100%;
  min-height: 37px;
  padding: 7px 10px;
  border: 1px solid #bdcbd9;
  border-radius: 7px;
  background: #fff;
  color: var(--portal-ink);
}
.customer-portal input[type="checkbox"], .customer-portal input[type="radio"] { accent-color: var(--portal-blue); }
.customer-portal input[type="submit"], .customer-portal input[type="button"],
.customer-portal button, .customer-portal .bigsearch, .customer-portal .purch_button {
  min-height: 37px;
  padding: 8px 15px;
  border: 1px solid var(--portal-blue);
  border-radius: 8px;
  background: var(--portal-blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.customer-portal input[type="submit"]:hover, .customer-portal input[type="button"]:hover,
.customer-portal button:hover, .customer-portal .bigsearch:hover { background: var(--portal-blue-dark); }
.customer-portal .rowOdd:hover, .customer-portal .rowEven:hover { background: #eaf4ff; }
.customer-portal .rowEven, .customer-portal .row2Even { background: #f6f9fc; }
.customer-portal table.rt_summary { max-width: 100%; border: 1px solid var(--portal-border); border-collapse: collapse; border-radius: 8px; }
.customer-portal table.rt_summary th, .customer-portal table.rt_summary td { padding: 10px 12px; border: 1px solid var(--portal-border); }
.customer-portal table.rt_summary th { background: #eaf2fa; color: #284966; }

/* Lead, return, and transaction grids share the same visual treatment. */
.customer-portal #contents .portal-table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(20, 48, 77, .04);
  scrollbar-color: #b6c7db transparent;
}
.customer-portal #contents .portal-table-scroll:focus-visible {
  outline: 2px solid var(--portal-blue);
  outline-offset: 2px;
}
.customer-portal #contents .portal-table-hint { display: none; }
.customer-portal #contents .portal-leads-frame {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-spacing: 0;
  border-radius: 12px;
  background: #fff;
}
.customer-portal #contents .portal-leads-frame > tbody > tr > td {
  padding: 0;
  border: 0;
  background: #fff;
}
.customer-portal #contents .portal-leads-table {
  width: 100%;
  min-width: 850px;
  border: 0;
  border-collapse: collapse;
  border-spacing: 0;
  background: #fff;
}
.customer-portal #contents .portal-leads-table.listtable { min-width: 1090px; }
.customer-portal #contents .portal-leads-table th,
.customer-portal #contents .portal-leads-table td {
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--portal-border);
  font-size: 13px;
  line-height: 1.45;
  vertical-align: top;
}
.customer-portal #contents .portal-leads-table th {
  background: #edf4fb;
  color: #31516f;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.customer-portal #contents .portal-leads-table tr.rowOdd { background: #fff; }
.customer-portal #contents .portal-leads-table tr.rowEven { background: #f7fafc; }
.customer-portal #contents .portal-leads-table tr.rowOdd:hover,
.customer-portal #contents .portal-leads-table tr.rowEven:hover { background: #edf6ff; }
.customer-portal #contents .portal-leads-table > tbody > tr:last-child > td { border-bottom: 0; }
.customer-portal #contents .portal-leads-table a { font-weight: 650; }
.customer-portal #contents .portal-leads-table textarea { width: min(100%, 620px); }

/* Lead detail page */
.customer-portal #contents.portal-lead-view { max-width: 1160px; margin: 0 auto; }
.customer-portal #contents .portal-lead-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
}
.customer-portal #contents .portal-lead-back,
.customer-portal #contents .portal-lead-print {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--portal-border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.customer-portal #contents .portal-lead-print { border-color: #bed7f3; background: #edf6ff; }
.customer-portal #contents .lv_fs { padding: 22px 24px 26px; }
.customer-portal #contents .lv_fs legend { font-size: 17px; }
.customer-portal #contents .portal-lead-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
}
.customer-portal #contents .portal-lead-grid h2 {
  grid-column: 1 / -1;
  margin: 22px 0 2px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--portal-border);
  color: #24415e;
  font-size: 17px;
  line-height: 1.3;
}
.customer-portal #contents .portal-lead-grid h2:first-child { margin-top: 0; }
.customer-portal #contents .portal-lead-grid dl {
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e4ebf3;
  border-radius: 9px;
  background: #f8fafc;
}
.customer-portal #contents .portal-lead-grid dt,
.customer-portal #contents .portal-lead-grid dd {
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.customer-portal #contents .portal-lead-grid dt {
  color: var(--portal-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.customer-portal #contents .portal-lead-grid dd {
  margin-top: 4px;
  color: var(--portal-ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.customer-portal #contents .portal-lead-grid .portal-lead-wide { grid-column: 1 / -1; }
.customer-portal #contents .portal-lead-grid .cl { display: none; }

/* Printable lead details */
.customer-portal #contents.portal-print-view { max-width: 900px; margin: 0 auto; }
.portal-print-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.portal-print-actions a { font-weight: 700; }
.portal-print-title { margin-bottom: 25px; padding-bottom: 16px; border-bottom: 2px solid #24415e; }
.portal-print-title p { margin: 0 0 3px; color: var(--portal-muted); font-size: 11px; font-weight: 750; letter-spacing: .12em; }
.portal-print-title h2 { margin: 0; font-size: 26px; }
.portal-print-section { margin: 0 0 24px; break-inside: avoid-page; }
.portal-print-section h3 { margin: 0 0 10px; font-size: 16px; }
.portal-print-section dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; }
.portal-print-field { display: grid; grid-template-columns: minmax(130px, 42%) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-top: 1px solid var(--portal-border); }
.portal-print-field dt { color: var(--portal-muted); font-size: 12px; font-weight: 700; }
.portal-print-field dd { min-width: 0; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.customer-portal .notify_box, .customer-portal .notify_box2 { margin: 12px 36px; padding: 12px 16px; border: 1px solid #ecd48f; border-radius: 9px; background: #fff8e7; color: #604c18; }
.customer-portal #contents .notify_box, .customer-portal #contents .notify_box2 { margin: 12px 0; }
.customer-portal .pagebox, .customer-portal .pagebox_sel { display: inline-block; margin: 2px; padding: 4px 9px; border-color: var(--portal-border); border-radius: 6px; line-height: 1.4; }
.customer-portal .pagebox_sel { background: var(--portal-blue); }

.portal-terms { padding: 10px 20px; background: #fff4db; border-bottom: 1px solid #e8c675; }
.portal-terms form { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; max-width: 1240px; margin: auto; }
.portal-terms-actions { display: flex; gap: 8px; }
.customer-portal .portal-terms input[type="submit"] { min-height: 32px; padding: 5px 11px; }
.customer-portal .portal-footer { height: auto; margin: 0 auto; padding: 24px 20px 36px; color: var(--portal-muted); font-size: 12px; text-align: center; }
.portal-footer > div { display: flex; justify-content: center; gap: 24px; }
.portal-footer p { margin: 10px 0 0; }

/* Overview */
.portal-dashboard-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 25px 28px; border-radius: 14px; background: linear-gradient(110deg, #164c87, #0d3060); color: #fff; }
.portal-dashboard-hero h2 { margin: 3px 0 7px; color: #fff !important; font-size: 25px; letter-spacing: -.03em; }
.portal-dashboard-hero p { margin: 0; max-width: 560px; color: #d9eafa; }
.portal-dashboard-hero .portal-eyebrow { color: #b3d5fb; }
.customer-portal .portal-dashboard-hero a, .customer-portal .portal-dashboard-hero a:visited { flex: none; display: inline-block; padding: 10px 16px; border-radius: 8px; background: #fff; color: #1356a9; font-weight: 750; text-decoration: none; }
.portal-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.customer-portal .portal-action-card, .customer-portal .portal-action-card:visited { display: flex; flex-direction: column; gap: 8px; min-height: 160px; padding: 20px; border: 1px solid var(--portal-border); border-radius: 12px; background: #fff; color: var(--portal-ink); text-decoration: none; box-shadow: 0 5px 18px rgba(20, 48, 77, .04); }
.customer-portal .portal-action-card:hover { border-color: #91bff3; transform: translateY(-2px); box-shadow: var(--portal-shadow); }
.portal-action-card .portal-card-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; background: #e7f1ff; color: #1259b4; font-size: 19px; font-weight: 750; }
.portal-action-card strong { font-size: 17px; }
.portal-action-card span:last-child { color: var(--portal-muted); font-size: 13px; }
.portal-dashboard-bottom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.customer-portal .portal-dashboard-bottom .portal-panel { padding: 20px; }
.portal-panel h2 { margin: 0 0 12px; font-size: 17px; }
.portal-news-item { padding: 11px 0; border-top: 1px solid var(--portal-border); }
.portal-news-item:first-of-type { border-top: 0; }
.portal-news-item strong { display: block; margin-bottom: 4px; }
.portal-news-item p { margin: 0; color: var(--portal-muted); }
.portal-empty { color: var(--portal-muted); }

/* Login */
.portal-guest #container { min-height: 0; max-width: 760px; }
.portal-guest .portal-header { justify-content: center; }
.portal-guest #contents { max-width: 480px; margin: auto; padding: 42px 28px 54px; }
.portal-guest #contents .fs5 { width: 100%; margin: 0; }
.portal-login-intro { margin-bottom: 22px; text-align: center; }
.portal-login-intro h1 { margin: 0 0 6px; font-size: 29px; letter-spacing: -.04em; }
.portal-login-intro p { margin: 0; color: var(--portal-muted); }
.portal-guest #contents fieldset { padding: 22px; }
.portal-login-form label { display: block; width: auto !important; float: none !important; margin: 0 0 5px; font-weight: 650; }
.portal-login-form input[type="text"], .portal-login-form input[type="password"] { display: block; width: 100%; margin-bottom: 16px; }
.portal-login-form input[type="submit"] { width: 100%; }
.portal-login-help { margin-top: 14px; text-align: center; }

@media (max-width: 900px) {
  .customer-portal #contents .portal-lead-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-portal #contents .portal-table-hint { display: block; margin: 0 0 8px; color: var(--portal-muted); font-size: 12px; }
  .portal-nav { flex-wrap: wrap; gap: 0; padding: 0 18px 12px; }
  .portal-nav-links { width: 100%; overflow-x: auto; }
  .customer-portal .portal-nav-links a { min-height: 54px; }
  .portal-balance { margin-top: 10px; }
  .portal-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-dashboard-bottom { grid-template-columns: 1fr; }
  .customer-portal #contents #main_left, .customer-portal #contents #main_right { float: none; width: 100%; }
  .customer-portal #contents .announce, .customer-portal #contents #suggested_leads { float: none; width: 100%; }
}
@media (max-width: 620px) {
  .portal-print-section dl { grid-template-columns: 1fr; }
  .portal-print-field { grid-template-columns: minmax(110px, 42%) minmax(0, 1fr); }
  .customer-portal #contents .portal-lead-grid { grid-template-columns: 1fr; }
  .customer-portal #contents .lv_fs { padding: 16px; }
  .customer-portal #container { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .customer-portal .portal-header { padding: 13px 17px; min-height: 68px; }
  .portal-user { display: none; }
  .portal-brand-name { font-size: 18px; }
  .portal-brand-mark { width: 38px; height: 38px; }
  .portal-nav-links { flex-wrap: wrap; overflow-x: visible; }
  .customer-portal .portal-nav-links a { min-height: 42px; padding: 0 10px; }
  .customer-portal #nav_title_area.portal-page-heading { display: block; padding: 22px 18px 5px; }
  .customer-portal #sales_rep_div { margin-top: 14px; }
  .customer-portal #contents { padding: 18px 16px 30px; }
  .customer-portal #contents fieldset { padding: 14px; }
  .portal-dashboard-hero { display: block; padding: 22px; }
  .portal-dashboard-hero a { margin-top: 18px; }
  .portal-overview-grid { grid-template-columns: 1fr; }
  .customer-portal .portal-action-card { min-height: 0; }
  .customer-portal #contents .acct_ov, .customer-portal #contents #savedcc { float: none; width: 100%; }
  .customer-portal #contents .atinfo, .customer-portal #contents .atinfo2 { float: none; display: block; width: 100%; }
  .customer-portal .notify_box, .customer-portal .notify_box2 { margin: 12px 16px; }
  .customer-portal #query_window { left: 0; right: 0; width: min(90vw, 320px); }
  .portal-guest #contents { padding: 30px 16px 42px; }
}

@media print {
  @page { margin: .55in; }
  .portal-print-page { background: #fff; color: #111; font-size: 11px; }
  .portal-print-page #container { width: 100%; min-height: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .portal-print-page .portal-header, .portal-print-page .portal-nav,
  .portal-print-page .portal-page-heading, .portal-print-page .portal-terms,
  .portal-print-page .portal-footer, .portal-print-page .notify_box,
  .portal-print-page .portal-print-actions { display: none !important; }
  .portal-print-page #contents.portal-print-view { max-width: none; padding: 0; overflow: visible; }
  .portal-print-page .portal-print-title { margin-bottom: 18px; padding-bottom: 9px; }
  .portal-print-page .portal-print-title h2 { font-size: 19px; }
  .portal-print-page .portal-print-section { margin-bottom: 16px; }
  .portal-print-page .portal-print-section h3 { margin-bottom: 6px; font-size: 13px; }
  .portal-print-page .portal-print-field { padding: 4px 0; }
  .portal-print-page .portal-print-field dt, .portal-print-page .portal-print-field dd { font-size: 10px; }
}
