:root {
  --bg: #edf3ff;
  --bg-2: #dfe9ff;
  --card: #ffffff;
  --ink: #10213f;
  --muted: #5b6b86;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbe7ff;
  --border: #c9d8f2;
  --danger: #d14343;
  --ok: #1f9d67;
  --shadow: 0 16px 36px rgba(26, 55, 110, 0.14);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 540px at 8% -10%, #f7fbff 0%, transparent 55%),
    radial-gradient(900px 420px at 92% 0%, #d7e7ff 0%, transparent 50%),
    linear-gradient(140deg, var(--bg) 0%, var(--bg-2) 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 1.2rem;
  color: #0f2957;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
}

.nav a:hover {
  background: var(--accent-soft);
}

.nav-inline-form {
  margin: 0;
}

.nav-link-button {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.nav-link-button:hover {
  background: var(--accent-soft);
}

.nav-user {
  color: var(--muted);
  font-size: 0.95rem;
  margin-left: 8px;
}

.container {
  max-width: 980px;
  margin: 30px auto 76px;
  padding: 0 20px;
}

.hero h1,
.landing h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3.7vw, 2.8rem);
  line-height: 1.1;
}

.hero p,
.landing p {
  color: var(--muted);
  max-width: 720px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 800;
  color: var(--accent-dark);
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.card {
  background: var(--card);
  padding: 24px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-top: 20px;
}

.landing {
  padding: 32px;
}

label {
  display: block;
  margin-bottom: 14px;
  font-weight: 650;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  font-weight: 550;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  font: inherit;
  color: var(--ink);
  background: #fbfdff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #bfd6ff;
  border-color: #8bb3f5;
}

textarea.result {
  min-height: 320px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.collapsible-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbff;
  margin: 12px 0;
  overflow: hidden;
}

.collapsible-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

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

.collapsible-summary small {
  color: var(--muted);
  font-weight: 600;
  margin-left: auto;
  margin-right: 6px;
}

.collapsible-summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--accent-dark);
  background: #e5efff;
  font-size: 1.1rem;
  font-weight: 800;
}

.collapsible-block[open] .collapsible-summary {
  border-bottom: 1px solid var(--border);
  background: #f1f7ff;
}

.collapsible-block[open] .collapsible-summary::after {
  content: "-";
}

.collapsible-block[open] .collapsible-summary small {
  visibility: hidden;
}

.collapsible-content {
  padding: 14px;
}

.field-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e4eeff;
  color: #1a4cb8;
  font-size: 0.83rem;
  cursor: help;
  border: none;
  padding: 0;
  line-height: 1;
}

.slider-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: #d7e3fb;
  outline: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

button,
.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: #4d6388;
}

.button.secondary:hover {
  background: #3e5171;
}

.button.danger {
  background: var(--danger);
}

.button.danger:hover {
  background: #b93737;
}

.button.cta {
  font-size: 1.05rem;
  padding: 14px 20px;
}

button:disabled {
  background: #9fb6df;
  cursor: not-allowed;
}

.notice {
  background: #eaf2ff;
  border: 1px solid #bfd2f5;
  padding: 12px 14px;
  border-radius: 11px;
  margin: 14px 0;
}

.muted {
  color: var(--muted);
}

.loading {
  position: fixed;
  inset: 0;
  background: rgba(16, 33, 63, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading.hidden {
  display: none;
}

.loading-card {
  background: #fff;
  padding: 20px 22px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 33, 63, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.info-overlay.hidden {
  display: none;
}

.info-card {
  position: relative;
  background: #fff;
  padding: 20px 22px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  width: min(520px, calc(100% - 28px));
}

.info-card h3 {
  margin: 0 24px 8px 0;
}

#info-text {
  white-space: pre-line;
}

.info-close {
  position: absolute;
  right: 12px;
  top: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.info-close:hover {
  color: var(--ink);
  background: transparent;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #d5e4ff;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.flash {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 28px));
  z-index: 1200;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.flash-item {
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16, 33, 63, 0.14);
  pointer-events: auto;
  animation: flashSlideIn 0.22s ease-out;
}

.flash-item.fade-out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.flash-item.error {
  background: #ffe9e9;
  border: 1px solid #efb8b8;
}

.flash-item.info {
  background: #dff8eb;
  border: 1px solid #94d9b2;
}

@keyframes flashSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.score-card {
  background: #f0f6ff;
  border: 1px solid #c9daf7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.toggle-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 12px;
  padding: 12px 14px;
}

.toggle-row small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  margin-top: 3px;
}

.toggle-row input[type="checkbox"] {
  width: auto;
  margin-top: 0;
  transform: scale(1.25);
}

.application-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
  background: #fbfdff;
  position: relative;
}

.bulk-toolbar {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbff;
  margin-bottom: 10px;
}

.bulk-select-all {
  font-weight: 700;
}

.bulk-select-all input[type="checkbox"] {
  width: auto;
  margin-top: 0;
  transform: scale(1.18);
}

.bulk-actions {
  margin-top: 0;
  justify-self: end;
}

.bulk-item-select {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}

.bulk-item-select input[type="checkbox"] {
  width: auto;
  margin: 0;
  transform: scale(1.22);
}

.profile-shell h1 {
  margin: 0;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.profile-quota {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.tab-nav {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.tab-link {
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  background: #f4f8ff;
}

.tab-link.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.settings-grid .collapsible-block {
  margin: 0;
}

.settings-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
}

.settings-item h3,
.settings-item h4 {
  margin-top: 0;
}

.application-list {
  display: grid;
  gap: 10px;
}

.clickable-card .application-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
  padding: 6px;
}

.clickable-card .application-link:hover {
  background: #f1f6ff;
}

.confirm-card {
  width: min(540px, calc(100% - 28px));
  display: block;
}

.confirm-card h3 {
  margin: 0 0 8px;
}

.confirm-card .confirm-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

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

.readonly-result {
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 14px;
  line-height: 1.55;
}

.percent-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.92rem;
}

.percent-green {
  color: #0f6b3b;
  background: #dff6e9;
  border: 1px solid #9ddbb7;
}

.percent-yellow {
  color: #8a6300;
  background: #fff4d1;
  border: 1px solid #f0d484;
}

.percent-red {
  color: #9e1f1f;
  background: #ffe3e3;
  border: 1px solid #f3a5a5;
}

.analysis-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
  margin: 10px 0;
}

.analysis-link strong {
  display: block;
  margin-bottom: 6px;
}

.analysis-link span {
  color: var(--muted);
}

.application-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

form {
  margin: 0;
}

.slot-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.admin-table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

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

.admin-table th,
.admin-table td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
}

.admin-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-inline-form input[type="number"] {
  width: 110px;
  margin-top: 0;
}

.inline.compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

.inline.compact input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.search-form input {
  max-width: 360px;
  margin-top: 0;
}

@media (max-width: 700px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .container {
    padding: 0 14px;
  }

  .card,
  .landing {
    padding: 18px;
  }

  .actions,
  .search-form,
  .admin-inline-form {
    width: 100%;
  }

  .toggle-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .button {
    width: 100%;
    text-align: center;
  }

  .tab-nav {
    width: 100%;
  }

  .tab-link {
    flex: 1;
    text-align: center;
  }

  .bulk-toolbar {
    grid-template-columns: 1fr;
  }

  .bulk-actions {
    justify-self: stretch;
  }

  .bulk-item-select {
    position: static;
    margin-bottom: 8px;
  }

  .profile-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-quota {
    justify-items: start;
  }

  .flash {
    top: 62px;
    width: calc(100% - 18px);
  }
}
