@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&family=Sora:wght@600;700&display=swap");

:root {
  --bg-0: #fff9f2;
  --bg-1: #ffe6c5;
  --bg-2: #f4d4ea;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text-main: #1d1f2b;
  --text-muted: #5b6178;
  --accent: #0a7a6f;
  --accent-strong: #065b53;
  --line: #d9d7ea;
  --danger: #b73232;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 15% 10%, var(--bg-1), transparent 34%),
    radial-gradient(circle at 90% 0%, var(--bg-2), transparent 35%),
    linear-gradient(165deg, #fffdf8 0%, var(--bg-0) 55%, #f6f5ff 100%);
}

h2,
h3 {
  margin: 0 0 12px;
  font-family: "Sora", "Trebuchet MS", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  margin: 0 0 6px;
  font-family: "Sora", "Trebuchet MS", sans-serif;
  letter-spacing: 0.01em;
  font-size: clamp(1.35rem, 3.2vw, 2rem);
}

.page {
  width: min(960px, calc(100% - 28px));
  margin: 32px auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.auth-loading p {
  margin: 0;
}

.auth-loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d5daef;
  border-top-color: var(--accent);
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.field {
  margin-bottom: 12px;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1.3fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.login-public {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfcff;
}

.login-form {
  min-width: 0;
}

.login-fields-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfcff;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-logo {
  width: 80%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  flex: 0 0 auto;
  margin: 0;
}

.brand-copy a {
  font-size: 0.95rem;
}

label {
  display: inline-block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--text-muted);
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd3ea;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #8ba6ff;
  box-shadow: 0 0 0 4px rgba(139, 166, 255, 0.2);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

#adminNav a,
a {
  color: #194fbc;
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  text-decoration: underline;
}

.module-menu {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.module-menu-toolbar {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
}

.module-menu-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 3px 4px;
  background: #f3f4f6;
  margin-left: auto;
}

.module-menu-toggle-label {
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  padding: 0 6px 0 8px;
}

.module-view-toggle {
  border: 0;
  background: transparent;
  color: #6b7280;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 8px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.module-menu-toggle-group .module-view-toggle {
  width: auto;
}

.module-view-toggle:hover {
  background: #e5e7eb;
  transform: none;
}

.module-view-toggle.is-active {
  background: #d1d5db;
  color: #4b5563;
}

.view-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.module-menu.module-menu-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.module-menu.module-menu-grid .module-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 100%;
}

.module-menu.module-menu-grid .module-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}

.module-menu.module-menu-grid .module-description {
  width: 100%;
  padding-left: 0;
}

.module-menu.module-menu-grouped {
  grid-template-columns: 1fr;
  gap: 14px;
}

.grouped-role-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f3f4f6;
  padding: 3px 4px;
}

.grouped-role-nav-label {
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin-right: 0;
  padding: 0 8px;
}

.grouped-role-nav-link {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 10px;
  line-height: 1;
}

.grouped-role-nav-link:hover {
  background: #e5e7eb;
  color: #374151;
  text-decoration: none;
}

.grouped-role-nav-link:focus-visible {
  outline: 2px solid #9ca3af;
  outline-offset: 1px;
}

.role-group {
  border: 1px solid #d4d8ec;
  border-radius: 14px;
  background: #fbfcff;
  padding: 12px;
}

.role-group-title {
  display: block;
  margin: 0 0 10px;
  padding: 0 0 0 10px;
  border-left: 3px solid #9ca3af;
  font-family: "Sora", "Trebuchet MS", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #374151;
}

.role-group-grid {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.module-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-heading-logo {
  width: auto;
  height: 1.5em;
  object-fit: contain;
}

.module-heading h3 {
  margin: 0;
}

.modules-message {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfdff;
}

.modules-message h2,
.modules-message h3,
.modules-message h4 {
  margin: 0 0 8px;
}

.modules-message p {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.modules-message ul {
  margin: 0 0 8px 18px;
  padding: 0;
  color: var(--text-muted);
}

.modules-message li {
  margin: 0 0 4px;
}

.module-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d4d8ec;
  border-radius: 14px;
  background: #fbfcff;
  color: #1c2f5f;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.module-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: #9cb3fb;
  box-shadow: 0 8px 20px rgba(28, 47, 95, 0.12);
}

.module-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.module-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.module-title {
  color: #1c2f5f;
  font-weight: 700;
  line-height: 1.2;
}

.module-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.empty-state {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.public-modules-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.page-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.account-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #cfd3ea;
  background: #fafaff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.account-summary #status {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  flex: 1 1 auto;
}

.account-summary .page-footer {
  margin-top: 0;
  flex: 0 0 auto;
}

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, #d9d7ea, transparent);
  margin: 18px 0;
}

pre {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #cfd3ea;
  background: #fafaff;
  white-space: pre-wrap;
  word-break: break-word;
}

#status {
  color: var(--text-muted);
}

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

@media (max-width: 720px) {
  .page {
    width: calc(100% - 16px);
    margin: 12px auto;
    padding: 14px;
    border-radius: 16px;
  }

  .panel {
    border-radius: 12px;
    padding: 12px;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 8px;
  }

  .module-menu.module-menu-grid {
    grid-template-columns: 1fr;
  }

  .module-menu-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .module-view-toggle {
    width: auto;
  }

  .page-footer {
    justify-content: stretch;
  }

  .account-summary {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}

@media (min-width: 721px) and (max-width: 980px) {
  .module-menu.module-menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
