:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #d7dce5;
  --text: #1d2736;
  --muted: #5b6575;
  --primary: #124191;
  --primary-strong: #0d3170;
  --accent: #13795b;
  --warning: #b7791f;
  --danger: #a11d2a;
  --radius: 12px;
  --shadow: 0 8px 20px rgba(12, 24, 45, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: var(--primary);
}

.container {
  width: min(1080px, 94vw);
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}

.logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-strong);
  text-decoration: none;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex-shrink: 0;
}

.auth-link {
  text-decoration: none;
  color: var(--primary-strong);
  font-weight: 600;
  font-size: 0.92rem;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-sep {
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-user {
  position: relative;
  padding-bottom: 8px;
  margin-bottom: -8px;
}

.auth-avatar {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  background: #e8edf8;
  color: var(--primary-strong);
  border: 1px solid #cfdaef;
}

.auth-user:hover .auth-menu,
.auth-user:focus-within .auth-menu {
  display: block;
}

.auth-user.open .auth-menu {
  display: block;
}

.auth-menu {
  display: none;
  position: absolute;
  top: calc(100% - 2px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
}

.auth-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.auth-menu a {
  display: block;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
}

.auth-menu a:hover {
  background: #f2f5fb;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

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

.nav a.active,
.nav a:hover {
  color: var(--primary-strong);
  background: #eaf0fb;
}

.hero {
  padding: 48px 0 24px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.15;
}

.hero p {
  margin: 0 0 20px;
  max-width: 65ch;
  color: var(--muted);
}

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

button,
.button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

button:disabled,
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  background: #e8edf8;
  color: var(--primary-strong);
}

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

.grid {
  display: grid;
  gap: 16px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.card h2 {
  margin-bottom: 10px;
  font-size: 1.15rem;
}

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

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e8edf8;
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.tag-warning {
  background: #f8efd9;
  color: var(--warning);
}

.tag-accent {
  background: #dcf3e9;
  color: var(--accent);
}

label {
  display: block;
  font-weight: 600;
  margin: 10px 0 6px;
}

.label-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.label-line label {
  margin: 0;
}

.help-toggle {
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #d7bc45;
  border-radius: 999px;
  background: #f7d45d;
  color: #4c3902;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 800;
}

.help-toggle:hover {
  background: #f0ca4d;
}

.help-toggle:focus {
  outline: 2px solid #efd991;
}

.help-copy {
  margin: 6px 0 8px;
  padding: 7px 9px;
  border: 1px solid #efde9b;
  border-radius: 8px;
  background: #fff8dc;
  color: #6a5210;
  font-size: 0.84rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #d8e4fb;
  border-color: var(--primary);
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-field input[type="checkbox"] {
  width: auto;
}

.section {
  padding: 12px 0 24px;
}

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

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
}

.result-row:last-child {
  border-bottom: 0;
}

.result-value {
  font-weight: 700;
}

.result-value.accent {
  color: var(--accent);
}

.result-value.warning {
  color: var(--warning);
}

.details {
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

.note {
  font-size: 0.9rem;
  color: var(--muted);
}

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

.footer {
  margin-top: 26px;
  padding: 18px 0 26px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-rich {
  margin-top: 26px;
  border-top: 1px solid var(--border);
  background: #fbfcff;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 0 10px;
}

.footer-grid h2,
.footer-grid h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.footer-grid h2 {
  font-size: 1rem;
}

.footer-grid h3 {
  font-size: 0.95rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 10px 0 16px;
  font-size: 0.86rem;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.history-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

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

.scenario-slot {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.scenario-slot h4 {
  margin: 0 0 6px;
}

.faq-section details {
  border-top: 1px dashed var(--border);
  padding: 10px 0;
}

.faq-section details:first-of-type {
  border-top: 0;
}

.faq-section details p {
  margin: 8px 0 0;
}

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

.blog-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.blog-card .note {
  margin: 0 0 10px;
}

.blog-meta {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.prose p,
.prose li {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    margin-left: 0;
  }

  .header-auth {
    align-self: flex-end;
    margin-left: 0;
  }
}
