:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #0f172a;     
  --muted: #475569;   
  --border: #e2e8f0;    
  --border2: #cbd5e1;  
  --accent: #2563eb;    
  --accent2: #0ea5e9;   
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

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

html,
body {
  height: 100%;
}

html {
  font-size: 16px;
}

h1, h2, h3, h4, h5 {
  margin-top: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
               Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";

  font-size: 16px;
  line-height: 1.55;

  padding: 0 18px 48px;
}

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

h1, h2, h3 { line-height: 1.2; }

.header {
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);

  border-bottom: 1px solid var(--border);
}

#logo {
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: #000;
}

#feedback-btn,
#homepage {
  font-weight: 550;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
}

#feedback-btn:hover,
#homepage:hover {
  background: rgba(37, 99, 235, 0.08);
}

#story,
#disclaimer,
#main-form,
#results,
.legals,
body > div:last-of-type,
#header-after-submit {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

#main-form > div:first-child {
  color: var(--muted);
  margin: 14px 0 18px;
}

#story > div:first-child {
  color: var(--muted);
  margin: 14px 0 18px;
}

#disclaimer,
#story,
#main-form,
.legals {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.heading-background,
.heading-disclaimer,
.heading-isItems,
.heading-bsItems {
  margin: 22px 0 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 1rem;
}

#main-form label {
  display: inline-block;
  width: 320px;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 1rem;
}

#main-form :is(input:not([type="submit"]):not([type="button"]), select, textarea),
textarea {
  width: min(420px, 100%);
  padding: 10px 12px;
  margin-bottom: 10px;

  border: 1px solid var(--border2);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;

  font: inherit;
  line-height: 1.2;
}

#main-form :is(input[type="submit"], input[type="button"], button) {
  width: auto;
  margin-bottom: 0;
}


#main-form :is(input, select, textarea):focus {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

#main-form input[type="text"]::placeholder {
  color: #94a3b8; 
}

#main-form input[type="text"]:focus,
#main-form select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

#main-form select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

#main-form br {
  display: block;
  content: "";
  margin-bottom: 6px;
}

.input-table,
.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;

  margin: 10px 0 16px;
}

.input-table thead th,
.results-table thead th {
  text-align: left;
  font-size: 1rem;
  color: var(--muted);
  background: #f8fafc;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

table th,
table td {
  text-align: left;
}

.input-table th,
.input-table td,
.results-table th,
.results-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
}

.input-table tr > *:last-child,
.results-table tr > *:last-child {
  border-right: none;
}

.input-table tbody tr:last-child > *,
.results-table tbody tr:last-child > * {
  border-bottom: none;
}

.table-section th {
  background: #f1f5f9; 
  color: var(--text);
  font-weight: 650;
}

.input-table input[type="text"] {
  width: 100%;
  margin: 0;
}

.results-table {
  table-layout: fixed;
}

.results-table th,
.results-table td {
  font-size: 0.92rem;
  padding: 8px;
}


.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll .results-table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

.range-card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  background: #fff;
}

.range-row{
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.range-label{
  font-weight: 650;
  letter-spacing: -0.01em;
}

.range-meta{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.range-track{
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
  border: 1px solid var(--border);
}

.range-fill{
  position: absolute;
  inset: 0;
  background: rgba(37, 99, 235, 0.25);
}

.range-marker{
  position: absolute;
  top: -4px;
  width: 2px;
  height: 20px;
  background: #111827;
  border-radius: 2px;
}

.range-footnote{
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

#clear-inputs-btn{
  margin-left: auto; 
}

.results-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.results-actions .clear-valuation-btn{
  margin-left: auto; 
}

#main-form-submit-btn,
#feedback-submit,
.results-actions button {
  appearance: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
  padding: 10px 14px;
}

#main-form-submit-btn,
#feedback-submit {
  border: none;
  background: var(--accent);
  color: #fff;
}

#main-form-submit-btn:hover,
#feedback-submit:hover {
  filter: brightness(0.95);
}

#clear-inputs-btn,
.results-actions button {
  border: 1px solid var(--border2);
  background: #fff;
  color: var(--text);
  font-weight: 600;
}

#clear-inputs-btn {
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}

#clear-inputs-btn:hover,
.results-actions button:hover {
  background: #f8fafc;
}

#header-after-submit {
  margin: 20px auto 10px;
  color: var(--muted);
  font-size: 1rem;
}

#results {
  margin: 0 auto;
}

.results-block {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#results h2,
.results-section h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.results-section .stat-row .stat-value-eqv {
  margin-bottom: 1rem;
}

.results-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

.stat-row {
  display: flex;
  align-items: baseline;
  gap: 3rem;
}

.stat-label {
  white-space: nowrap;
}

.stat-value {
  font-variant-numeric: tabular-nums;
}

#feedback-form {
  width: 100%;
  max-width: 700px;
  margin: 40px auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  display: flex;
  flex-direction: column;
  align-items: stretch;
}

textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  margin-bottom: 14px;
}

.sensitivity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 10px;
}

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

.sensitivity-toggle .toggle-label {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e5e7eb;
  transition: 0.2s ease;
  cursor: pointer;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: #111827;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  outline: 2px solid rgba(17, 24, 39, 0.25);
  outline-offset: 2px;
}

.field-error {
  border: 1px solid #d64545 !important;
}

.form-errors {
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid #d64545;
  border-radius: 10px;
  background: rgba(214, 69, 69, 0.08);
}

.form-errors ul {
  margin: 0;
  padding-left: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);

  background: rgba(212, 225, 255, 0.92);
  color: var(--text);

  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);

  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

@media (max-width: 720px) {
  body { padding: 0 14px 28px; }

  .header {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;

    padding: 12px 14px;
    background: #ffffff;
    backdrop-filter: none;

    flex-wrap: wrap;
    gap: 8px;
  }

  #logo {
    font-size: 16px;
  }

  #feedback-btn {
    font-size: 13px;
    padding: 6px 8px;
  }

  #main-form { padding: 14px; }

  #main-form label {
    width: 100%;
    display: block;
    margin-top: 12px;
  }

  #main-form input[type="text"],
  #main-form select {
    width: 100%;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .input-table,
  .results-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .input-table th,
  .input-table td,
  .results-table th,
  .results-table td {
    white-space: nowrap;
  }

  .stat-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stat-label {
    white-space: normal;
    flex: 1 1 100%;
  }

  .stat-value,
  .stat-value-EV,
  .stat-value-eqv {
    flex: 1 1 auto;
    text-align: left;
    word-break: break-word;
  }
}

@media print {
  
  .table-scroll {
    overflow: visible !important;
  }

  .results-table,
  .table-scroll .results-table {
    width: 100%;
    table-layout: fixed;
    font-size: 9pt;
  }

  .results-table th,
  .results-table td {
    padding: 4pt;
    white-space: normal !important;
    word-break: break-word;
  }

  table, tr, td, th {
    page-break-inside: avoid;
  }
}
.footer {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid #e5e5e5;
  max-height: 135px;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;              
  max-width: 66%;       
  min-width: 260px;      
}

.footer-message {
  color: #4b5563;      
  font-size: 0.85rem;   
  line-height: 1.25;     
  margin: 0;
}

.footer-copy {
  color: #4b5563;
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  margin-top: auto;
}

.footer a {
  text-decoration: none;
}

.bmac-btn img {
  height: 33px; 
  width: auto;
  display: block;
}

@media (max-width: 720px) {
  .footer-left {
    max-width: 100%;
  }
}

.cookie-banner[hidden] { display: none !important; }

.cookie-banner{
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
}

.cookie-banner__inner{
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;

  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.cookie-banner__text{
  max-width: 640px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.25;
}

.cookie-banner__text strong{
  color: var(--text);
}

.cookie-banner__text p{
  margin: 6px 0 0;
}

.cookie-banner__text a{
  color: var(--accent);
  text-decoration: none;
}
.cookie-banner__text a:hover{
  text-decoration: underline;
}

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

.cookie-btn{
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
  padding: 10px 14px;
  border: 1px solid var(--border2);
  background: #fff;
}

.cookie-btn--primary{
  border: none;
  background: var(--accent);
  color: #fff;
}
.cookie-btn--primary:hover{
  filter: brightness(0.95);
}
.cookie-btn--secondary:hover{
  background: #f8fafc;
}

@media (max-width: 720px){
  .cookie-banner__inner{
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-banner__actions{
    justify-content: flex-start;
  }
}
