:root {
  --portal-night: #07131f;
  --portal-paper: #eef4f7;
  --portal-panel: #0d2230;
  --portal-line: rgba(139, 185, 204, 0.28);
  --portal-gold: #8bd0e3;
  --portal-muted: #d3dee4;
  --portal-danger: #ff8b8b;
  --portal-success: #8fd5a6;
}

/* Same navigation frame used by the NORMA public screens. */
.portal-admin .site-top {
  background: var(--portal-night);
  border-bottom: 1px solid rgba(216, 189, 131, 0.18);
}

.portal-admin .top-nav {
  width: min(1120px, calc(100% - 40px));
  min-height: 66px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.portal-admin .brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: #fffaf1;
  font-family: Georgia, "Times New Roman", serif;
}

.portal-admin .brand-mark {
  padding: 5px 8px;
  border: 1px solid rgba(217, 196, 152, 0.28);
  color: #d8bd83;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.portal-admin .nav-links {
  display: flex;
  gap: 18px;
  color: rgba(255, 250, 241, 0.72);
  font-size: 0.84rem;
}

.portal-admin .nav-links a:hover { color: #fffaf1; }

.portal-shell {
  min-height: 100vh;
  padding: 108px 20px 40px;
  color: var(--portal-paper);
  background:
    radial-gradient(circle at top right, rgba(216, 189, 131, 0.14), transparent 26%),
    linear-gradient(180deg, #07131f 0%, #0b202a 100%);
}

.portal-dashboard {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.portal-login-wrap {
  width: min(620px, calc(100% - 40px));
  margin: 0 auto;
}

.portal-login-card {
  max-width: 620px;
  margin: 0 auto;
}

.portal-grid {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 24px;
  grid-template-columns: 1.05fr 1fr;
}

.portal-card {
  padding: 28px;
  border: 1px solid var(--portal-line);
  border-radius: 6px;
  background: rgba(16, 35, 48, 0.88);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.portal-card-wide {
  width: 100%;
}

.portal-card h1,
.portal-card h2,
.portal-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.portal-card p {
  color: var(--portal-muted);
}

.portal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.portal-actions,
.portal-tabs,
.portal-service-grid,
.portal-list-actions,
.portal-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.portal-tabs {
  margin: 18px 0 22px;
}

.portal-inline-note {
  margin: 0;
  color: #ffffff;
  font-size: 0.95rem;
  text-align: center;
}

.portal-inline-note a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-tab {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  color: var(--portal-paper);
  background: transparent;
  cursor: pointer;
}

.portal-tab.is-active {
  color: #07131f;
  background: var(--portal-gold);
  border-color: var(--portal-gold);
}

.portal-form {
  display: grid;
  gap: 14px;
}

.portal-form label,
.portal-profile-grid label,
.portal-checklist label,
.portal-table label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  color: #ffffff;
}

.portal-form input,
.portal-form select,
.portal-profile-grid input,
.portal-profile-grid select,
.portal-table select,
.portal-table input,
.portal-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  color: #0f1f2b;
  border: 1px solid rgba(139, 185, 204, 0.4);
  border-radius: 8px;
  background: #eef4f7;
}

.portal-form input::placeholder,
.portal-form textarea::placeholder {
  color: #727980;
}

.portal-status {
  min-height: 24px;
  margin: 0;
  color: var(--portal-gold);
}

.portal-status.error {
  color: var(--portal-danger);
}

.portal-status.success {
  color: var(--portal-success);
}

.portal-service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-service-grid-single {
  gap: 14px;
}

.portal-service {
  padding: 18px;
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.portal-service h3 {
  margin-bottom: 8px;
}

.portal-service p {
  min-height: 48px;
}

.portal-service.is-disabled {
  opacity: 0.58;
}

.portal-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.portal-metric {
  padding: 16px;
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.portal-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
}

.portal-table-wrap {
  overflow: auto;
}

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

.portal-table th,
.portal-table td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-table th {
  color: var(--portal-gold);
  font-size: 0.82rem;
}

.portal-table-light th,
.portal-table-light td {
  color: #f2f7fa;
}

.portal-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid var(--portal-line);
}

.portal-pill.warn {
  color: #f0cf8e;
}

.portal-pill.success {
  color: #8dd8a6;
}

.portal-pill.danger {
  color: #f2a1a1;
}

.portal-profile-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-profile-view {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-profile-view div {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-profile-view span {
  display: block;
  margin-bottom: 6px;
  color: #f2f7fa;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.portal-profile-view strong {
  color: #ffffff;
  font-weight: 600;
}

.portal-checklist {
  display: grid;
  gap: 10px;
}

.portal-admin-user {
  display: grid;
  gap: 4px;
}

.portal-admin-user strong {
  font-size: 1rem;
}

.portal-admin-user span,
.portal-admin-user small {
  color: inherit;
}

.portal-service-dropdown {
  min-width: 280px;
  border: 1px solid rgba(11, 32, 42, 0.22);
  border-radius: 6px;
  background: #f8fbfd;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.portal-service-dropdown[open] {
  border-color: rgba(11, 32, 42, 0.28);
  box-shadow: 0 14px 28px rgba(11, 32, 42, 0.08);
}

.portal-service-dropdown-summary {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(180deg, #ffffff 0%, #f2f6f8 100%);
}

.portal-service-dropdown-summary::-webkit-details-marker {
  display: none;
}

.portal-service-dropdown-title {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #49606d;
}

.portal-service-dropdown-value {
  color: #0b202a;
  font-size: 0.92rem;
  line-height: 1.2;
}

.portal-admin-services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px 14px 12px;
  border-top: 1px solid rgba(11, 32, 42, 0.08);
  background: #ffffff;
}

.portal-table label.portal-service-pick,
.portal-service-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: auto;
  padding-top: 0;
  color: #0b202a;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  grid-template-columns: none;
}

.portal-service-pick input[type="checkbox"] {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: #83bfd0;
}

.portal-service-pick span {
  display: inline;
  color: #0b202a;
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 500;
}

.portal-admin-billing {
  display: grid;
  gap: 10px;
}

.portal-admin-field {
  display: grid;
  gap: 6px;
}

.portal-admin-field span {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-checklist-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.portal-checklist-columns label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 0.95rem;
}

.portal-checklist-columns input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  accent-color: #8bd0e3;
}

.portal-note {
  padding: 14px 16px;
  border-left: 3px solid var(--portal-gold);
  border-radius: 8px;
  background: rgba(139, 208, 227, 0.1);
}

.portal-mail-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 0.95rem;
}

.portal-mail-select-all input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  accent-color: #8bd0e3;
}

.portal-inline-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-icon-button {
  min-width: 36px;
  min-height: 36px;
  border: 1px solid rgba(139, 185, 204, 0.38);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  cursor: pointer;
}

.btn.btn-quiet {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0;
  background: transparent;
  color: #ffffff;
}

.portal-admin .portal-shell {
  padding: 32px 20px 40px;
  background: linear-gradient(180deg, #e8edf0 0%, #f3f6f8 100%);
  color: #1d2c36;
}

.portal-admin .portal-toolbar {
  width: calc(100% + 40px);
  margin: 0 -20px 24px;
  padding: 18px 42px;
  border: 0;
  border-radius: 0;
  background: #0b202a;
  box-shadow: none;
}

.portal-admin .site-top {
  background: #0b202a;
}

.portal-admin .top-nav {
  width: min(1180px, 100% - 40px);
  margin: 0 auto;
}

.portal-admin .brand,
.portal-admin .brand-text,
.portal-admin [data-auth-user-name] {
  color: #f2f7fa;
}

.portal-admin .brand-mark {
  border-color: rgba(216, 189, 131, 0.35);
  color: #d8bd83;
}

.portal-admin .portal-card {
  background: rgba(255, 255, 255, 0.98);
  color: #1d2c36;
  border-color: rgba(11, 32, 42, 0.14);
  box-shadow: 0 16px 40px rgba(22, 30, 39, 0.08);
}

.portal-admin .portal-card p,
.portal-admin .portal-card h1,
.portal-admin .portal-card h2,
.portal-admin .portal-card h3,
.portal-admin .portal-table-light th,
.portal-admin .portal-table-light td,
.portal-admin .portal-table th,
.portal-admin .portal-table td {
  color: #1d2c36;
}

.portal-admin .portal-pill,
.portal-admin .portal-inline-actions,
.portal-admin .cmpl-auth-userlabel {
  color: #1d2c36;
}

.portal-admin .btn.btn-secondary {
  border-color: rgba(11, 32, 42, 0.2);
  color: #1d2c36;
  background: #ffffff;
}

.portal-admin .portal-pill {
  border-color: rgba(255, 255, 255, 0.2);
}

.portal-admin .portal-table th {
  color: #0b202a;
}

.portal-admin .portal-table td,
.portal-admin .portal-table th {
  border-bottom-color: rgba(11, 32, 42, 0.1);
}

.portal-admin .portal-metric {
  border-color: rgba(11, 32, 42, 0.14);
  background: #ffffff;
}

.portal-admin .portal-metric strong {
  color: #0b202a;
}

.portal-card-collapsible {
  padding-bottom: 0;
}

.portal-card-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.portal-card-toggle::-webkit-details-marker {
  display: none;
}

.portal-card-toggle h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.portal-card-toggle [data-rejected-count] {
  font-size: 0.92rem;
  color: #49606d;
}

.portal-card-toggle::after {
  content: "+";
  color: #0b202a;
  font-size: 1.5rem;
  line-height: 1;
}

.portal-card-collapsible[open] .portal-card-toggle::after {
  content: "-";
}

.portal-card-content {
  margin-top: 18px;
}

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

.portal-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.portal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 19, 31, 0.52);
}

.portal-modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid rgba(11, 32, 42, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(7, 19, 31, 0.22);
}

.portal-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.portal-modal-header h3 {
  color: #0b202a;
}

.portal-modal-field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: #0b202a;
}

.portal-modal-field span {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-modal textarea {
  width: 100%;
  min-height: 132px;
  padding: 12px 14px;
  color: #0f1f2b;
  border: 1px solid rgba(11, 32, 42, 0.16);
  border-radius: 8px;
  background: #f8fbfd;
  resize: vertical;
}

body.portal-modal-open {
  overflow: hidden;
}

.portal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: min(1180px, 100%);
  margin: 0 auto 24px;
}

.portal-guard {
  display: grid;
  place-items: center;
}

.cmpl-auth-shortcuts,
.cmpl-auth-usernav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.cmpl-auth-link,
.cmpl-auth-logout {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(139, 185, 204, 0.22);
  border-radius: 0;
  background: transparent;
  color: var(--portal-paper);
}

.cmpl-auth-link.is-panel,
.cmpl-auth-link.is-admin {
  background: transparent;
}

.cmpl-auth-userlabel {
  color: var(--portal-paper);
  font-size: 0.92rem;
}

.cmpl-auth-logout {
  cursor: pointer;
}

.cmpl-nav-dropdown {
  position: relative;
}

.cmpl-nav-trigger {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.cmpl-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 240px;
  padding: 10px 0;
  border: 1px solid rgba(139, 185, 204, 0.24);
  background: rgba(9, 25, 35, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  display: none;
  z-index: 30;
}

.cmpl-nav-dropdown.is-open .cmpl-nav-dropdown-menu {
  display: block;
}

.cmpl-nav-dropdown-menu a {
  display: block;
  padding: 9px 14px;
  color: #f5f8fb;
}

.cmpl-nav-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cmpl-nav-profile-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

@media (max-width: 980px) {
  .portal-grid,
  .portal-metrics,
  .portal-service-grid,
  .portal-profile-grid,
  .portal-profile-view,
  .portal-checklist-columns,
  .portal-admin-services {
    grid-template-columns: 1fr;
  }

  .cmpl-auth-shortcuts,
  .cmpl-auth-usernav {
    width: 100%;
  }

  .portal-admin .portal-toolbar {
    width: calc(100% + 40px);
    margin: 0 -20px 20px;
    padding: 18px 20px;
  }

  .portal-admin .portal-shell {
    padding: 24px 20px 40px;
  }

  .portal-admin .top-nav {
    width: calc(100% - 40px);
  }
}
