/* Customer portal + login — uses site theme tokens */

.customer-portal-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-page);
  color: var(--text-body);
}

.customer-portal-header .nav {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.customer-btn-ghost {
  background: transparent;
  color: var(--text-on-brand);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.customer-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.customer-login-main {
  flex: 1;
  padding: 2.5rem 0;
}

.customer-login-inner {
  max-width: 28rem;
  margin: 0 auto;
}

.customer-login-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-card);
}

.customer-login-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  margin: 0 0 0.5rem;
  color: var(--text-heading);
}

.customer-login-lede {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.9;
}

.customer-login-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.customer-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-heading);
  opacity: 0.85;
}

.customer-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-neutral);
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--surface-page);
  color: var(--text-body);
}

.customer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.12s;
}

.customer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.customer-btn-primary {
  background: var(--cobalt);
  color: var(--text-on-brand);
  margin-top: 0.35rem;
}

.customer-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.customer-btn-secondary {
  background: var(--surface-subtle);
  color: var(--text-heading);
  border: 1px solid var(--border-subtle);
}

.customer-btn-small {
  font-size: 0.88rem;
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.75rem;
}

.customer-message {
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(198, 40, 40, 0.1);
  color: #b71c1c;
}

.customer-message--success {
  background: rgba(46, 125, 50, 0.12);
  color: #1b5e20;
}

.customer-login-foot {
  margin: 1.25rem 0 0;
  font-size: 0.92rem;
}

.customer-login-foot a {
  color: var(--cobalt);
  font-weight: 600;
}

/* Portal app */
.customer-portal-main {
  flex: 1;
  padding: 1.75rem 0 2.5rem;
}

.customer-portal-loading {
  text-align: center;
  padding: 3rem 1rem;
}

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

.customer-portal-avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border-cobalt-soft);
  background: var(--surface-subtle);
}

.customer-portal-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-portal-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cobalt);
}

.customer-portal-h1 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
  color: var(--text-heading);
}

.customer-portal-meta {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.85;
}

.customer-portal-tabwrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.customer-portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 0.35rem;
}

.customer-portal-tab {
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  opacity: 0.85;
}

.customer-portal-tab:hover {
  background: var(--surface-subtle);
  opacity: 1;
}

.customer-portal-tab.is-active {
  background: var(--surface-subtle);
  border-color: var(--border-cobalt-mid);
  color: var(--text-heading);
  opacity: 1;
}

.customer-portal-panel[hidden] {
  display: none !important;
}

.customer-portal-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: var(--shadow-tile);
}

.customer-portal-hint {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  opacity: 0.88;
}

.customer-portal-hint a {
  color: var(--cobalt);
  font-weight: 600;
}

.customer-portal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}

.customer-portal-cards--actions {
  margin-top: 0.5rem;
}

.customer-dash-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--border-cobalt-soft);
  background: var(--surface-subtle);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.customer-dash-card:hover:not(:disabled) {
  border-color: var(--border-cobalt-hover);
  box-shadow: var(--shadow-card-alt);
}

.customer-dash-card--static {
  cursor: default;
}

.customer-dash-card--btn {
  cursor: not-allowed;
}

.customer-dash-card__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

.customer-dash-card__value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text-heading);
}

.customer-doc-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 800px) {
  .customer-doc-columns {
    grid-template-columns: 1fr 1fr;
  }
}

.customer-doc-heading {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
  color: var(--text-heading);
}

.customer-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.customer-doc-item {
  margin-bottom: 0.5rem;
}

.customer-doc-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-page);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-body);
  cursor: pointer;
}

.customer-doc-link:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

.customer-doc-link__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
}

.customer-doc-link__meta {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}

.customer-doc-empty {
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 0;
}

.customer-profile-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .customer-profile-layout {
    grid-template-columns: 220px 1fr;
  }
}

.customer-profile-photo {
  padding: 0.5rem 0;
}

.customer-profile-avatar-preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border-neutral);
  margin-bottom: 0.65rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.customer-profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-file-label {
  cursor: pointer;
  display: inline-block;
}

.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.customer-profile-sub {
  font-size: 0.95rem;
  margin: 1rem 0 0.5rem;
  color: var(--text-heading);
}

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

.customer-form-field--full {
  grid-column: 1 / -1;
}

.customer-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Modal */
.customer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.customer-modal.hidden {
  display: none !important;
}

.customer-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.customer-modal__box {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(85vh, 640px);
  overflow: auto;
  background: var(--surface-card);
  border-radius: 12px;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: var(--shadow-card);
}

.customer-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-body);
  opacity: 0.7;
}

.customer-modal__title {
  margin: 0 0 0.75rem;
  padding-right: 2rem;
  font-family: var(--font-heading);
  font-size: 1.15rem;
}

.customer-modal__body {
  font-size: 0.9rem;
  line-height: 1.45;
}

.customer-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.customer-modal__table th,
.customer-modal__table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.customer-modal__table th {
  font-weight: 600;
  color: var(--text-heading);
}

@media (min-width: 768px) {
  .customer-portal-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

/* Unlisted credit application form (/apply/credit-account) */
.credit-app-main {
  flex: 1;
  padding: 2rem 0 3rem;
}

.credit-app-inner {
  max-width: 44rem;
  margin: 0 auto;
}

.credit-app-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  font-size: 0.9rem;
  line-height: 1.45;
}

.credit-app-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.5rem 1.35rem 1.35rem;
  box-shadow: var(--shadow-card);
}

.credit-app-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  margin: 0 0 0.5rem;
  color: var(--text-heading);
}

.credit-app-lede {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.92;
}

.credit-app-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.credit-app-fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.credit-app-legend {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  padding: 0 0 0.5rem;
  margin: 0 0 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
}

.credit-app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 1rem;
}

@media (min-width: 560px) {
  .credit-app-grid {
    grid-template-columns: 1fr 1fr;
  }

  .credit-app-field--full {
    grid-column: 1 / -1;
  }
}

.credit-app-field {
  min-width: 0;
}

.credit-app-textarea {
  min-height: 4rem;
  resize: vertical;
}

.credit-app-req {
  color: var(--cobalt);
  font-weight: 700;
}

.credit-app-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.92rem;
  line-height: 1.45;
  cursor: pointer;
}

.credit-app-checkbox-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.credit-app-trading-block {
  margin-top: 0.85rem;
}

.credit-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.credit-app-foot {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.credit-app-hint {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.88;
}

.credit-app-success .credit-app-title {
  color: var(--text-heading);
}

.credit-app-terms-scroll {
  max-height: 14rem;
  overflow-y: auto;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  font-size: 0.88rem;
  line-height: 1.5;
  outline: none;
}

.credit-app-terms-scroll:focus-visible {
  box-shadow: 0 0 0 2px var(--surface-card), 0 0 0 4px var(--cobalt);
}

.credit-app-terms-scroll p {
  margin: 0 0 0.65rem;
}

.credit-app-terms-scroll p:last-child {
  margin-bottom: 0;
}

.credit-app-terms-end-marker {
  text-align: center;
  font-weight: 600;
  color: var(--text-heading);
  padding-top: 0.25rem;
}

.credit-app-checkbox-label--gated input:disabled + span {
  opacity: 0.65;
}

.credit-app-declaration-hint:not(.hidden) {
  margin-top: 0;
}

.credit-app-signature-wrap {
  touch-action: none;
  margin: 0 0 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-page, #fff);
  overflow: hidden;
  max-width: 100%;
}

.credit-app-signature-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
  cursor: crosshair;
  vertical-align: top;
}
