:root {
  --bg-1: #050b12;
  --bg-2: #071b2d;
  --blue: #00477f;
  --blue-light: #0b75bd;
  --royal-green: #11543f;
  --gold: #f3b338;
  --text: #f5f9fc;
  --muted: #b9c8d4;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.16);
  --shadow: rgba(0, 0, 0, 0.38);
  --danger: #ff8f8f;
  --success: #6fedb0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(11, 117, 189, 0.42), transparent 32%),
    radial-gradient(circle at 90% 78%, rgba(17, 84, 63, 0.42), transparent 34%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

code {
  font-family: Consolas, "Courier New", monospace;
}

.portal-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.portal-topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 0;
}

.portal-topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.portal-topbar-brand img {
  width: 78px;
  max-width: 78px;
  height: auto;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  padding: 10px 12px;
}

.portal-topbar-brand strong,
.portal-topbar-brand span {
  display: block;
}

.portal-topbar-brand strong {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-topbar-brand span {
  color: var(--muted);
  font-size: 0.93rem;
}

.portal-topbar-env-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(243, 179, 56, 0.18);
  border: 1px solid rgba(243, 179, 56, 0.35);
  color: #ffe6ad;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.portal-topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-topbar-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

.portal-topbar-nav a.is-active,
.portal-topbar-nav a:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.portal-nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), #dd7d0c);
  color: #18222d;
  font-size: 0.76rem;
  font-weight: 800;
}

.portal-env-banner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(243, 179, 56, 0.92), rgba(221, 125, 12, 0.92));
  color: #18222d;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal-flash-stack {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.portal-flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.portal-flash.error {
  color: #ffd3d3;
  background: rgba(164, 27, 27, 0.22);
}

.portal-flash.success {
  color: #e7fff1;
  background: rgba(9, 104, 61, 0.24);
}

.portal-schedule-banner {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(243, 179, 56, 0.24);
  background: rgba(243, 179, 56, 0.12);
}

.portal-schedule-banner strong {
  color: #ffe6ad;
}

.portal-schedule-banner span {
  color: #f5f9fc;
  line-height: 1.5;
}

.portal-schedule-banner.active {
  border-color: rgba(255, 143, 143, 0.35);
  background: rgba(164, 27, 27, 0.24);
}

.portal-schedule-banner.active strong {
  color: #ffd3d3;
}

.portal-landing-card,
.portal-page-card,
.portal-module-card,
.portal-ticket-card,
.portal-user-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 30px;
  box-shadow: 0 26px 78px var(--shadow);
  backdrop-filter: blur(16px);
}

.portal-landing-card {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 420px);
  gap: 22px;
  padding: 32px;
}

.portal-landing-copy,
.portal-login-panel,
.portal-page-card,
.portal-module-card,
.portal-ticket-card {
  position: relative;
  z-index: 2;
}

.portal-login-panel,
.portal-page-card {
  padding: 24px;
}

.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(11, 117, 189, 0.18);
  border: 1px solid rgba(120, 201, 255, 0.34);
  color: #d8efff;
  font-size: 0.84rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 800;
}

.portal-badge-pulse {
  width: 10px;
  height: 10px;
  background: #28dd85;
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(40, 221, 133, 0.72);
  animation: portal-pulse 1.8s infinite;
}

@keyframes portal-pulse {
  0% { box-shadow: 0 0 0 0 rgba(40, 221, 133, 0.72); }
  70% { box-shadow: 0 0 0 12px rgba(40, 221, 133, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 221, 133, 0); }
}

.portal-brand-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
  margin-bottom: 22px;
}

.portal-brand-logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
}

.portal-brand-text {
  color: #18222d;
  font-weight: 900;
  font-size: clamp(24px, 4vw, 42px);
  letter-spacing: -0.8px;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(34px, 6vw, 66px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -1.6px;
}

h1 span {
  color: #86d4ff;
}

.portal-lead,
.portal-page-head p,
.portal-login-panel p,
.portal-panel-note,
.portal-module-card p,
.portal-ticket-card p {
  color: var(--muted);
  line-height: 1.6;
}

.portal-login-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(243, 179, 56, 0.12);
  border: 1px solid rgba(243, 179, 56, 0.28);
  color: #ffe6ad;
  line-height: 1.5;
  font-size: 0.92rem;
}

.portal-feature-grid,
.portal-dashboard-grid,
.portal-admin-grid,
.portal-checkbox-grid,
.portal-select-grid {
  display: grid;
  gap: 14px;
}

.portal-feature-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 28px 0;
}

.portal-feature-card {
  min-height: 132px;
  padding: 18px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.portal-feature-icon {
  font-size: 30px;
  margin-bottom: 10px;
}

.portal-feature-card strong,
.portal-module-card strong,
.portal-ticket-card strong {
  display: block;
  color: #ffffff;
  margin-bottom: 7px;
}

.portal-feature-card small {
  color: var(--muted);
  line-height: 1.42;
}

.portal-message-box {
  padding: 20px;
  border-radius: 20px;
  background: rgba(0, 71, 127, 0.28);
  border: 1px solid rgba(120, 201, 255, 0.24);
  color: #eaf7ff;
  line-height: 1.62;
}

.portal-login-panel {
  align-self: start;
}

.portal-login-panel h2,
.portal-page-card h2,
.portal-page-head h1 {
  margin-top: 0;
}

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

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

.portal-field span {
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-field input,
.portal-field select,
.portal-field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.portal-field select {
  color-scheme: light;
}

.portal-field select option {
  color: #18222d;
  background: #f5f9fc;
}

.portal-field textarea {
  min-height: 130px;
  resize: vertical;
}

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}

.portal-button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), #dd7d0c);
  color: #18222d;
  font-weight: 700;
}

.portal-button.danger {
  border-color: rgba(255, 143, 143, 0.4);
  background: rgba(164, 27, 27, 0.22);
  color: #ffd7d7;
}

.portal-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.portal-text-link {
  color: #d8efff;
  font-weight: 600;
}

.portal-footer {
  margin-top: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
  line-height: 1.6;
}

.portal-footer a {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.portal-page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.portal-dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.portal-legal-doc {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
}

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

.portal-legal-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.portal-legal-link strong {
  display: block;
}

.portal-legal-link span {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.portal-legal-link:hover,
.portal-legal-link.is-active {
  border-color: rgba(243, 179, 56, 0.45);
  background: rgba(243, 179, 56, 0.08);
}

.portal-markdown-content {
  display: grid;
  gap: 12px;
  line-height: 1.7;
}

.portal-markdown-content h1,
.portal-markdown-content h2,
.portal-markdown-content h3 {
  margin: 0;
}

.portal-markdown-content p,
.portal-markdown-content ul,
.portal-markdown-content ol {
  margin: 0;
  color: var(--text);
}

.portal-markdown-content ul,
.portal-markdown-content ol {
  padding-left: 1.25rem;
}

.portal-markdown-content a {
  color: #d8efff;
}

.portal-module-card {
  min-height: 220px;
  padding: 24px;
}

.portal-module-card-head,
.portal-ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.portal-module-key {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d8efff;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.portal-module-actions {
  margin-top: 16px;
}

.portal-admin-grid {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.portal-admin-span-2 {
  grid-column: 1 / -1;
}

.portal-admin-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.portal-user-list,
.portal-ticket-list {
  display: grid;
  gap: 12px;
}

.portal-user-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
}

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

.portal-user-card > form {
  padding: 0 20px 20px;
}

.portal-inline-actions {
  padding: 0 20px 20px;
}

.portal-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.portal-select-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.portal-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.portal-checkbox-row span small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.portal-checkbox-row input {
  width: auto;
  margin: 0;
}

.portal-ticket-card {
  padding: 18px 20px;
}

.portal-ticket-thread {
  padding: 0;
}

.portal-ticket-summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
}

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

.portal-ticket-thread-body {
  display: grid;
  gap: 14px;
  padding: 0 20px 20px;
}

.portal-thread-message {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.portal-thread-message.admin {
  background: rgba(0, 71, 127, 0.22);
  border-color: rgba(120, 201, 255, 0.24);
}

.portal-thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-ticket-admin-tools {
  padding-top: 4px;
}

.portal-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-empty-state {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--muted);
}

.portal-note-box {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-note-box p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.portal-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 1.5rem 0;
}

.portal-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.portal-stat-grid div {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.portal-stat-grid strong,
.portal-stat-grid span {
  display: block;
}

.portal-stat-grid strong {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.portal-stat-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

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

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

.portal-table th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

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

@media (max-width: 980px) {
  .portal-topbar,
  .portal-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-landing-card,
  .portal-admin-grid,
  .portal-legal-doc {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .portal-shell,
  .portal-topbar {
    width: min(100%, calc(100% - 20px));
  }

  .portal-landing-card,
  .portal-login-panel,
  .portal-page-card,
  .portal-module-card {
    border-radius: 22px;
  }

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

  h1 {
    letter-spacing: -0.8px;
  }
}
