:root {
  --bs-primary: #4f46e5;
  --bs-primary-soft: #eef2ff;
  --bs-secondary: #1f2937;
  --bs-border: rgba(15, 23, 42, 0.12);
  --bs-surface: rgba(255, 255, 255, 0.9);
  --bs-shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
  --bs-shadow-md: 0 18px 45px rgba(79, 70, 229, 0.12);
  --bs-body-bg: #f5f7fb;
}

body {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  color: var(--bs-secondary);
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 110px;
  flex-shrink: 0;
}

.footer-brand img {
  display: block;
  width: 110px !important;
  height: auto !important;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
  object-position: left center;
}

.site-footer {
  position: relative;
}

.footer-description {
  max-width: 18rem;
  margin: 1rem 0 0;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer-heading {
  margin: 0 0 0.85rem;
  color: #172554;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-link-list {
  display: grid;
  gap: 0.45rem;
}

.footer-link-list a,
.footer-calculator-grid a {
  color: #64748b;
  font-size: 0.84rem;
  text-decoration: none;
}

.footer-link-list a:hover,
.footer-calculator-grid a:hover {
  color: #4f46e5;
}

.footer-calculator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
}

.footer-calculator-grid a {
  color: #334155;
  font-weight: 600;
}

.footer-calculator-grid small {
  display: block;
  margin-top: 0.15rem;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 400;
}

.footer-bottom {
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

@media (max-width: 767px) {
  .footer-brand {
    max-width: 92px;
  }

  .footer-brand img {
    width: 92px !important;
    height: auto !important;
    max-width: 100%;
  }

  .footer-calculator-grid {
    grid-template-columns: 1fr;
  }
}

.calculator-page {
  background:
    radial-gradient(circle at 8% 0%, rgba(59, 130, 246, 0.1), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.calculator-page main {
  min-height: calc(100vh - 72px);
}

.calculator-shell {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(30, 41, 59, 0.1);
}

.calculator-heading {
  position: relative;
  padding: 0.35rem 0 1.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.calculator-heading::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 4rem;
  height: 3px;
  border-radius: 999px;
  background: #4f46e5;
  content: '';
}

.calculator-kicker {
  display: inline-block;
  margin-bottom: 0.65rem;
  color: #4f46e5;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculator-heading h1 {
  max-width: 38rem;
  color: #172554;
  letter-spacing: -0.03em;
}

.calculator-lede {
  max-width: 42rem;
  color: #64748b;
  line-height: 1.65;
}

.calculator-back {
  flex-shrink: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #475569;
}

.calculator-page #calculator-form {
  max-width: 42rem;
}

.calculator-page #calculator-form .form-label {
  color: #334155;
  font-size: 0.88rem;
}

.calculator-page #calculator-form .form-control,
.calculator-page #calculator-form .form-select {
  min-height: 3.1rem;
  border-color: #dbe3ef;
  background: #fbfdff;
}

.calculator-page #calculator-form .form-control:focus,
.calculator-page #calculator-form .form-select:focus {
  border-color: #818cf8;
  background: #fff;
  box-shadow: 0 0 0 0.22rem rgba(99, 102, 241, 0.13);
}

.calculator-page #calculator-form .btn-primary {
  min-width: 10rem;
}

.calculator-page .result-card {
  border-color: rgba(79, 70, 229, 0.2);
  background: linear-gradient(135deg, #f8faff 0%, #ffffff 78%);
}

.share-panel {
  border-top: 1px solid rgba(148, 163, 184, 0.24);
}

.share-panel [data-share-url] {
  justify-content: flex-end;
}

.share-panel .btn {
  padding: 0.48rem 0.8rem;
  font-size: 0.78rem;
}

.calculator-info-grid {
  display: grid;
  gap: 1rem;
}

.info-section,
.related-tools {
  padding: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.8);
}

.info-section h2 {
  margin: 0.25rem 0 0.75rem;
  color: #172554;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.info-section p {
  color: #64748b;
  line-height: 1.7;
}

.info-eyebrow {
  color: #4f46e5;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.info-steps {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.info-steps li > span {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 1.7rem;
  place-items: center;
  border-radius: 50%;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.78rem;
  font-weight: 800;
}

.info-steps strong,
.info-steps small {
  display: block;
}

.info-steps strong {
  color: #334155;
  font-size: 0.9rem;
}

.info-steps small {
  margin-top: 0.15rem;
  color: #64748b;
  line-height: 1.5;
}

.input-reference-list {
  display: grid;
  gap: 0.55rem;
}

.input-reference-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.input-reference-list div:last-child {
  border-bottom: 0;
}

.input-reference-list strong {
  color: #334155;
  font-size: 0.88rem;
}

.input-reference-list span {
  color: #64748b;
  font-size: 0.8rem;
}

.faq-section details {
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.faq-section details:last-child {
  border-bottom: 0;
}

.faq-section summary {
  cursor: pointer;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
}

.faq-section details p {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
}

.related-tools {
  margin-top: 1rem;
}

.related-tool-card {
  position: relative;
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.9rem;
  background: #fff;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.related-tool-card:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 12px 25px rgba(30, 41, 59, 0.08);
  transform: translateY(-2px);
}

.related-tool-card strong {
  color: #172554;
  font-size: 0.95rem;
}

.related-tool-card > .text-muted {
  display: -webkit-box;
  overflow: hidden;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.45;
}

.related-tool-card > i {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: #4f46e5;
}

.admin-page {
  min-height: 100vh;
  background: #f4f7fb;
  color: #1e293b;
}

.admin-page .navbar {
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(12px);
}

.admin-page .card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1rem;
  box-shadow: 0 14px 35px rgba(30, 41, 59, 0.06);
}

.admin-page-heading {
  max-width: 52rem;
}

.admin-eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: #4f46e5;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-form-card {
  background: rgba(255, 255, 255, 0.96);
}

.admin-form-card .form-label {
  color: #334155;
  font-size: 0.86rem;
  font-weight: 700;
}

.admin-form-card .form-control,
.admin-form-card .form-select {
  min-height: 2.9rem;
  border-color: #dbe3ef;
  border-radius: 0.7rem;
}

.admin-form-card .form-control:focus,
.admin-form-card .form-select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.12);
}

.code-editor {
  min-height: 10rem !important;
  background: #101827 !important;
  color: #dbeafe !important;
  font-size: 0.82rem;
  line-height: 1.6;
  tab-size: 2;
}

.admin-template-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(99, 102, 241, 0.16);
  border-radius: 0.9rem;
  background: #f5f7ff;
}

.admin-template-bar strong,
.admin-template-bar span {
  display: block;
}

.admin-template-bar span {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.8rem;
}

.admin-page .table thead th {
  color: #64748b;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-page .table tbody tr {
  height: 3.8rem;
}

.admin-page .table tbody tr:hover {
  background: #f8faff;
}

.floating-private-ad {
  position: fixed;
  top: 7rem;
  z-index: 1030;
  width: min(180px, 13vw);
  min-height: 90px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(30, 41, 59, 0.12);
}

.floating-private-ad-right {
  right: 1rem;
}

.floating-private-ad > *:not(.floating-ad-close) {
  max-width: 100%;
}

.private-ad-link,
.private-ad-link img,
.private-ad-link video {
  display: block;
  width: 100%;
}

.private-ad-link img,
.private-ad-link video {
  height: auto;
  max-height: 260px;
  object-fit: cover;
}

.floating-ad-close {
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  z-index: 1;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 576px) {
  .floating-private-ad {
    display: none;
  }

  .admin-template-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

.card {
  border: 1px solid var(--bs-border);
  border-radius: 1.25rem;
  box-shadow: var(--bs-shadow-sm);
}

.rounded-4 {
  border-radius: 1.25rem !important;
}

.navbar-brand {
  letter-spacing: -0.03em;
  font-weight: 700;
}

.form-floating > .form-control,
.form-floating > .form-select {
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  background: rgba(255, 255, 255, 0.9);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(79, 70, 229, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12);
}

.btn {
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  box-shadow: 0 12px 22px rgba(79, 70, 229, 0.22);
}

.metric-card {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(79, 70, 229, 0.08);
  border-radius: 1.2rem;
}

.result-card {
  background: linear-gradient(135deg, #ffffff, #f8faff);
  border: 1px solid rgba(79, 70, 229, 0.14);
  border-radius: 1.3rem;
  box-shadow: var(--bs-shadow-md);
  transition: all 0.25s ease;
}

.result-item {
  background: rgba(79, 70, 229, 0.03);
  border: 1px solid rgba(79, 70, 229, 0.08);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}

.ad-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 120px;
  border: 1px dashed rgba(100, 116, 139, 0.5);
  background: rgba(148, 163, 184, 0.08);
  color: #64748b;
  font-size: 0.82rem;
  border-radius: 1rem;
  text-align: center;
  padding: 1rem;
}

@media (max-width: 576px) {
  .calculator-page main {
    padding-top: 1.25rem !important;
  }

  .calculator-shell {
    border-radius: 1rem;
  }

  .calculator-heading h1 {
    font-size: 1.8rem;
  }

  .calculator-back {
    width: auto;
  }

  .share-panel [data-share-url] {
    justify-content: flex-start;
  }

  .btn {
    width: 100%;
  }

  .calculator-heading .btn,
  .share-panel .btn {
    width: auto;
  }
}
