.portal-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 64px; }
.portal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; padding: 10px; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-nav a,
.portal-nav button { padding: 10px 14px; color: #3c3632; background: transparent; border: 0; border-radius: 6px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.portal-nav a[aria-current="page"] { color: white; background: #7b2436; }
.portal-nav form { margin-left: auto; }
.portal-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 24px; }
.portal-heading h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(32px, 5vw, 48px); }
.portal-heading p { color: #706b65; }
.portal-kicker { margin: 0 0 8px; color: #7b2436 !important; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.portal-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.portal-status-grid div { padding: 18px; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-status-grid span,
.portal-status-grid strong { display: block; }
.portal-status-grid span { margin-bottom: 8px; color: #706b65; font-size: 13px; }
.portal-pipeline { margin-bottom: 24px; padding: 22px; background: #fffdf8; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-pipeline > div { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.portal-pipeline h2 { margin: 0; font-size: 20px; }
.portal-pipeline ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.portal-stage { padding: 12px; background: white; border-left: 4px solid #287052; }
.portal-stage--failed { border-left-color: #a32840; }
.portal-stage span,
.portal-stage strong,
.portal-stage small { display: block; }
.portal-stage small { margin-top: 5px; color: #706b65; }
.portal-delivery { margin-bottom: 24px; padding: 22px; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-delivery h2 { margin-top: 0; font-size: 20px; }
.portal-delivery ul { margin: 0; padding: 0; list-style: none; }
.portal-delivery li { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; padding: 10px 0; border-top: 1px solid #e3ddd2; }
.portal-delivery small { color: #706b65; }
.portal-brief-actions { display: flex; justify-content: flex-end; margin: -10px 0 20px; }
.portal-brief-content { overflow-x: auto; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-empty { padding: 40px; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-history-table { overflow-x: auto; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-history-table table { width: 100%; border-collapse: collapse; }
.portal-history-table th,
.portal-history-table td { padding: 16px; text-align: left; border-bottom: 1px solid #e3ddd2; }
.portal-flash { padding: 14px 18px; border-radius: 8px; }
.portal-flash--notice { color: #174c38; background: #e8f5ee; border: 1px solid #b7dbc8; }
.portal-flash--alert { color: #7d1d30; background: #fff0f2; border: 1px solid #efbec7; }
.portal-connection-card { margin-bottom: 20px; padding: 24px; background: white; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-connection-card h2 { margin-top: 0; font-size: 22px; }
.portal-connection-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.portal-connection-status { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.portal-connection-status--connected { color: #174c38; background: #e8f5ee; }
.portal-connection-status--degraded { color: #754b09; background: #fff4d6; }
.portal-connection-status--revoked { color: #7d1d30; background: #fff0f2; }
.portal-connection-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.portal-connection-details div { padding: 14px; background: #f8f6f1; border-radius: 8px; }
.portal-connection-details dt { margin-bottom: 6px; color: #706b65; font-size: 12px; }
.portal-connection-details dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.portal-connection-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.portal-connection-actions form { margin: 0; }
.portal-primary-button,
.portal-secondary-button,
.portal-danger-button { display: inline-block; padding: 10px 14px; border-radius: 6px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.portal-primary-button { color: white; background: #7b2436; border: 1px solid #7b2436; }
.portal-secondary-button { color: #3c3632; background: white; border: 1px solid #bdb5aa; }
.portal-danger-button { color: #8d1e34; background: white; border: 1px solid #cf8796; }
.portal-connection-error { padding: 12px; color: #7d1d30; background: #fff0f2; border-left: 4px solid #a32840; }
.portal-module-list { margin: 0; padding: 0; list-style: none; }
.portal-module-list li { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid #e3ddd2; }
.portal-module-list span { color: #706b65; text-align: right; }
.portal-location-list { border-top: 1px solid #e3ddd2; }
.portal-location-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(190px, .7fr) auto auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid #e3ddd2; }
.portal-location-row strong,
.portal-location-row small { display: block; }
.portal-location-row small { margin-top: 4px; color: #706b65; }
.portal-location-row input[type="text"] { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #bdb5aa; border-radius: 6px; font: inherit; }
.portal-safety-note { padding: 18px; color: #59524c; background: #fffdf8; border: 1px solid #e3ddd2; border-radius: 10px; }
.portal-settings-form > .portal-primary-button { margin-top: 4px; }
.portal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.portal-field { display: grid; gap: 7px; align-content: start; font-weight: 700; }
.portal-field--wide { grid-column: 1 / -1; }
.portal-field small { color: #706b65; font-weight: 400; }
.portal-field input,
.portal-field select,
.portal-field textarea { width: 100%; box-sizing: border-box; padding: 11px; border: 1px solid #bdb5aa; border-radius: 6px; background: white; font: inherit; }
.portal-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.portal-checkbox-grid label { display: flex; gap: 9px; align-items: center; padding: 11px; background: #f8f6f1; border-radius: 7px; }
.portal-checkbox-grid--modules { margin-top: 14px; }
.portal-checkbox-grid--onboarding { margin: 14px 0 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.portal-readiness-list { margin: 0; padding: 0; list-style: none; }
.portal-readiness-list__item { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid #e3ddd2; }
.portal-readiness-list__item span { font-weight: 700; }
.portal-readiness-list__item small { color: #706b65; text-align: right; }
.portal-readiness-list__item--pass span { color: #287052; }
.portal-readiness-list__item--fail span { color: #a32840; }
.portal-danger-zone { border-color: #cf8796; }
.portal-deletion-request { padding: 16px 0; border-top: 1px solid #e3ddd2; }
.portal-deletion-request p { margin: 0 0 10px; }
.portal-section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 8px; }
.portal-section-heading h2,
.portal-section-heading p { margin: 0; }
.portal-section-heading p { margin-top: 5px; color: #706b65; }
.portal-maintenance-list { border-top: 1px solid #e3ddd2; }
.portal-maintenance-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 20px 0; border-bottom: 1px solid #e3ddd2; }
.portal-maintenance-row:last-child { border-bottom: 0; }
.portal-maintenance-row--inactive { opacity: .75; }
.portal-maintenance-main h3,
.portal-maintenance-main p { margin: 0; }
.portal-maintenance-main > p { margin-top: 7px; color: #59524c; }
.portal-maintenance-main small { display: block; margin-top: 7px; color: #706b65; }
.portal-maintenance-title { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.portal-maintenance-status { display: inline-block; padding: 4px 8px; border-radius: 999px; color: #174c38; background: #e8f5ee; font-size: 12px; font-weight: 700; }
.portal-maintenance-status--due_today { color: #754b09; background: #fff4d6; }
.portal-maintenance-status--overdue { color: #7d1d30; background: #fff0f2; }
.portal-maintenance-notes { white-space: pre-line; }
.portal-maintenance-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.portal-maintenance-actions form { margin: 0; }
.portal-empty--inside { margin-top: 12px; padding: 24px; border: 0; background: #f8f6f1; }
.portal-empty--inside h3 { margin-top: 0; }
.portal-field--checkbox { display: flex; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding-top: 28px; }
.portal-field--checkbox input { width: auto; margin-top: 4px; }
.portal-field--checkbox small { display: block; margin-top: 3px; }
.portal-input-with-suffix { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.portal-input-with-suffix > span { color: #706b65; font-weight: 400; }
.portal-form-actions { display: flex; gap: 10px; align-items: center; }

@media (max-width: 760px) {
  .portal-shell { width: min(100% - 24px, 1120px); padding-top: 12px; }
  .portal-nav { flex-wrap: wrap; }
  .portal-nav form { margin-left: 0; }
  .portal-heading { align-items: flex-start; flex-direction: column; }
  .portal-status-grid { grid-template-columns: 1fr 1fr; }
  .portal-connection-details { grid-template-columns: 1fr 1fr; }
  .portal-location-row { grid-template-columns: 1fr; align-items: stretch; }
  .portal-form-grid { grid-template-columns: 1fr; }
  .portal-field--wide { grid-column: auto; }
  .portal-readiness-list__item { grid-template-columns: 1fr auto; }
  .portal-readiness-list__item small { grid-column: 1 / -1; text-align: left; }
  .portal-maintenance-row { grid-template-columns: 1fr; }
  .portal-maintenance-actions { justify-content: flex-start; }
}

@media (max-width: 460px) {
  .portal-status-grid { grid-template-columns: 1fr; }
  .portal-connection-details { grid-template-columns: 1fr; }
}
