:root {
  --ink: #111844;
  --muted: #5f6b7a;
  --line: #d9e0e7;
  --panel: #ffffff;
  --page: #f5f8f3;
  --green: #4F7942;
  --rose: #AA1945;
  --brown: #69524B;
  --sand: #DBB396;
}

* { box-sizing: border-box; }
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}
body {
  color: var(--ink);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
}
button, input { font: inherit; }

.customer-auth-page :where(h1, h2, p, a, span, label),
.customer-portal-page :where(h1, h2, p, a, span, label, dt, dd, th, td) {
  overflow-wrap: anywhere;
}

.customer-auth-page,
.customer-portal-page {
  background: linear-gradient(135deg, #f7faf5, #eef4f6);
  min-height: 100vh;
}

.customer-auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.customer-auth-card,
.customer-card,
.customer-modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(17, 24, 68, .1);
  padding: clamp(18px, 3vw, 28px);
}

.customer-auth-card {
  max-width: 430px;
  width: 100%;
}

.customer-brand {
  color: var(--green);
  display: inline-flex;
  font-weight: 800;
  margin-bottom: 14px;
  text-decoration: none;
}

h1, h2 {
  color: var(--ink);
  margin: 0 0 10px;
}

p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 18px;
}

.customer-form,
.customer-card dl,
.customer-modal-card {
  display: grid;
  gap: 14px;
}

label {
  color: var(--ink);
  display: grid;
  font-size: .85rem;
  gap: 7px;
}

input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.customer-primary,
.customer-secondary,
.customer-tab {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
}

.customer-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.customer-secondary,
.customer-tab {
  background: #fff;
  color: var(--ink);
}

.customer-message {
  border-radius: 8px;
  color: var(--rose);
  display: none;
  padding: 10px 12px;
}

.customer-message.show {
  background: #fff0f3;
  border: 1px solid rgba(170, 25, 69, .25);
  display: block;
}

.customer-topbar {
  align-items: center;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 24px;
}

.customer-dashboard {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1160px;
  padding: 24px;
}

.customer-top-grid,
.unit-plan-card {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-top-grid > *,
.unit-plan-card > *,
.customer-card,
.customer-modal-card {
  min-width: 0;
}

.customer-card dl {
  margin: 0;
}

.customer-card dt {
  color: var(--muted);
  font-size: .78rem;
}

.customer-card dd {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  margin: 3px 0 0;
}

.unit-plan-placeholder {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: repeating-linear-gradient(90deg, #f8faf9 0 18px, #eef4ef 18px 20px);
  border: 1px dashed rgba(79,121,66,.38);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  justify-items: center;
  overflow: hidden;
  padding: 18px;
}

.unit-plan-placeholder img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.customer-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.tab-content table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.customer-state {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.customer-state.error { color: var(--rose); }

.customer-modal {
  align-items: center;
  background: rgba(17,24,68,.52);
  display: grid;
  inset: 0;
  padding: 20px;
  position: fixed;
  z-index: 30;
}

.customer-modal[hidden] { display: none; }

.customer-modal-card {
  margin: auto;
  max-width: 420px;
  width: 100%;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .customer-top-grid,
  .unit-plan-card {
    grid-template-columns: 1fr;
  }
  .customer-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }
  .customer-dashboard {
    padding: 14px;
  }
  .customer-modal {
    padding: 12px;
  }
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .modal-actions button {
    width: 100%;
  }
}
