.portal-auth-section,
.portal-dashboard {
  min-height: 70vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(31, 194, 183, 0.12), transparent 32rem),
    #f5f8fc;
}

.portal-auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 0.9fr);
  gap: clamp(2rem, 7vw, 6rem);
  align-items: center;
  max-width: 68rem;
  margin: 0 auto;
}

.portal-auth-copy h1,
.portal-dashboard-header h1 {
  margin: 0.65rem 0 1rem;
  color: var(--ink);
  font-size: clamp(2.25rem, 5vw, 4.2rem);
}

.portal-auth-copy > p {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.12rem;
}

.portal-benefits {
  display: grid;
  gap: 0.8rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.portal-benefits li {
  position: relative;
  padding-left: 1.75rem;
  color: var(--ink);
}

.portal-benefits li::before {
  position: absolute;
  left: 0;
  color: var(--teal);
  content: "✓";
  font-weight: 800;
}

.portal-auth-card,
.portal-panel,
.portal-empty-state {
  border: 1px solid rgba(10, 41, 71, 0.1);
  border-radius: 1.4rem;
  background: #fff;
  box-shadow: 0 1.4rem 3.5rem rgba(9, 35, 61, 0.08);
}

.portal-auth-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.portal-auth-card h2,
.portal-panel h2,
.portal-empty-state h2 {
  color: var(--ink);
}

.portal-support-note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.portal-dashboard-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.portal-dashboard-header h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.portal-dashboard-header p {
  margin: 0;
  color: var(--muted);
}

.portal-header-actions,
.portal-row-actions,
.portal-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.portal-header-actions {
  justify-content: flex-end;
}

.portal-header-actions form,
.portal-row-actions form,
.portal-form-actions form {
  margin: 0;
}

.portal-security-note {
  display: flex;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(31, 194, 183, 0.28);
  border-radius: 1rem;
  background: rgba(31, 194, 183, 0.08);
  color: var(--ink);
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 0.65fr);
  gap: 1.5rem;
  align-items: start;
}

.portal-panel {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.portal-panel-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.portal-panel-heading h2 {
  margin: 0.35rem 0 0;
}

.portal-document-count {
  border-radius: 999px;
  background: #eef4f8;
  padding: 0.4rem 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.portal-document-list {
  display: grid;
}

.portal-document {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid rgba(10, 41, 71, 0.1);
}

.portal-file-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 0.8rem;
  background: rgba(53, 120, 229, 0.1);
  color: var(--blue);
  font-weight: 800;
}

.portal-file-meta {
  min-width: 0;
}

.portal-file-meta h3 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-file-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.portal-upload-panel {
  position: sticky;
  top: 6.5rem;
}

.portal-empty-state,
.portal-empty-list {
  padding: clamp(2rem, 5vw, 4rem);
  text-align: center;
}

.portal-admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.portal-admin-metrics article {
  display: grid;
  gap: 0.2rem;
  padding: 1.2rem 1.4rem;
  border: 1px solid rgba(10, 41, 71, 0.1);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1rem 2.4rem rgba(9, 35, 61, 0.05);
}

.portal-admin-metrics strong {
  color: var(--blue);
  font-size: 1.8rem;
}

.portal-admin-metrics span {
  color: var(--muted);
}

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

.portal-admin-table {
  width: 100%;
  border-collapse: collapse;
}

.portal-admin-table th,
.portal-admin-table td {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(10, 41, 71, 0.1);
  color: var(--ink);
  text-align: left;
  vertical-align: middle;
}

.portal-admin-table th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.portal-admin-table td > span:not(.portal-status) {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.portal-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.portal-status-active,
.portal-status-ready {
  background: rgba(31, 194, 183, 0.13);
  color: #0b716b;
}

.portal-status-pending {
  background: rgba(238, 179, 56, 0.16);
  color: #87600e;
}

.portal-status-disabled {
  background: rgba(104, 122, 139, 0.14);
  color: #536272;
}

.portal-row-actions {
  min-width: 17rem;
  justify-content: flex-end;
}

.portal-admin-form {
  display: grid;
  gap: 2rem;
}

.portal-form-section {
  display: grid;
  grid-template-columns: minmax(12rem, 0.42fr) minmax(0, 1fr);
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(10, 41, 71, 0.1);
}

.portal-form-section h2 {
  margin: 0.35rem 0 0;
  font-size: 1.35rem;
}

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

.portal-form-wide,
.portal-checks {
  grid-column: 1 / -1;
}

.portal-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.portal-form-actions {
  justify-content: flex-end;
}

.portal-danger-card {
  max-width: 46rem;
  margin: 2rem auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid rgba(198, 61, 61, 0.2);
  border-radius: 1.4rem;
  background: #fff;
  box-shadow: 0 1.4rem 3.5rem rgba(9, 35, 61, 0.08);
}

.portal-danger-card h1 {
  margin: 0.65rem 0 1rem;
  color: var(--ink);
}

.portal-danger-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 1.5rem 0;
}

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

@media (max-width: 991.98px) {
  .portal-auth-layout,
  .portal-grid {
    grid-template-columns: 1fr;
  }

  .portal-admin-metrics,
  .portal-form-section,
  .portal-form-grid {
    grid-template-columns: 1fr;
  }

  .portal-upload-panel {
    position: static;
  }
}

@media (max-width: 575.98px) {
  .portal-dashboard-header,
  .portal-security-note {
    flex-direction: column;
  }

  .portal-document {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .portal-document .btn {
    grid-column: 2;
    justify-self: start;
  }

  .portal-header-actions,
  .portal-form-actions {
    width: 100%;
    justify-content: stretch;
  }

  .portal-header-actions .btn,
  .portal-form-actions .btn,
  .portal-form-actions form,
  .portal-form-actions form .btn {
    width: 100%;
  }

  .portal-admin-metrics {
    grid-template-columns: 1fr;
  }
}
