:root {
  --main-red: #b22222;
  --main-bg: #f9f6ff;
  --section-bg: #fff;
  --accent: #276ef1;
  --section-header: #b22222;
  --header-bg: #b22222;
  --header-fg: #fff;
  --input-bg: #fff;
  --input-border: #b22222;
  --input-note: #b22222;
  --label-color: #323bb5;
  --container-shadow: 0 6px 32px rgba(178,34,34,0.08), 0 1.5px 6px rgba(178,34,34,0.05);
}
html { font-size: 16px; }
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  background: var(--main-bg);
  color: #243046;
  min-height: 100vh;
  line-height: 1.5;
}
form { margin: 0; padding: 0; }

.main-header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(178,34,34,0.08);
  margin-bottom: 1.5rem;
}
.main-header h1 {
  margin: 0 auto;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  width: 100%;
}

.container {
  max-width: 1100px;
  margin: 0.5rem auto 2.5rem auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--container-shadow);
  padding: 1.5rem 1.8rem;
}

.section {
  margin-bottom: 2.2rem;
  padding-bottom: 1.1rem;
  border: 1.5px solid #69359c ;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1.5px 7px rgba(44,64,128,0.04);
}
.section:last-child { border-bottom: none; }
.section h2 {
  text-align: center;
  font-size: 1.25rem;
  color: var(--section-header);
  margin-top: 0;
  margin-bottom: 0.7em;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.section h3 {
  text-align: center;
  color: var(--section-header);
  font-size: 1.08rem;
  margin-bottom: 0.3em;
  margin-top: 1em;
  font-weight: 600;
}

.flex-row, .input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 0.05rem;
}
.input-row { margin-bottom: 0.01rem; }
.input-group {
  flex: 1 1 230px;
  min-width: 220px;
  margin-bottom: 0.05rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.input-group label {
  margin-bottom: 0.3rem;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--label-color);
  letter-spacing: 0.01em;
}
.input-group input[type="number"], .input-group input[type="text"], .input-group select {
  padding: 0.2em 0.88em 0.18em 0.88em;
  font-size: 1rem;
  border: 1.4px solid var(--input-border);
  border-radius: 5px;
  background: var(--input-bg);
  color: #222;
  min-height: 28px;
  font-weight: 500;
  box-shadow: 0 1.5px 3px rgba(178,34,34,0.04);
  transition: border 0.22s, box-shadow 0.22s;
}
.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus,
.input-group select:focus {
  border: 2px solid var(--section-header);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 1.5px #ffd4d4;
}
.input-group input[readonly] {
  background: #9d9d8a52;
  color: #b22222;
  border: 1.2px solid #e5b3b3;
  font-weight: 700;
}

.input-group.total-income-highlight input[readonly] {
  background: #9d9d8a52;
  color: #b22222;
  font-weight: bold;
  text-align: left;
}
.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-note {
  font-size: 0.81em;
  color: #3a3030;
  margin-top: 1px;
}

.hidden { display: none !important; }
.radio-group {
  display: flex;
  align-items: center;
  gap: 1.4em;
  margin-bottom: 0.7em;
  flex-wrap: wrap;
  justify-content: center;
  color: #222;
}
.radio-group label {
  font-weight: 400;
  font-size: 1.04rem;
  margin-bottom: 0;
  color: #222;
}

.result-section {
  background: linear-gradient(8deg, #dceeed 0%, #f4f2f2d4 100%);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  margin-top: 2.1rem;
  font-size: 1rem;
  box-shadow: 0 1.5px 7px rgba(178,34,34,0.09);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}
.result-section h2 {
  margin-bottom: 1.1em;
  color: var(--main-red);
  font-size: 1.18rem;
  background: none;
  text-align: center;
}
.result-row {
  display: flex;
  justify-content: flex-start;      /* aligns items to start instead of full width */
  align-items: center;
  margin-bottom: 0.32em;
  font-weight: 500;
  color: #902222;
  gap: 1.2em;                       /* smaller horizontal gap between columns */
}
.result-row span:first-child {
  min-width: 140px;
}
.result-row strong {
  font-weight: 700;
  color: var(--section-header);
}
.result-row span {
  font-family: 'Roboto Mono', 'SFMono-Regular', 'Menlo', monospace;
  color:#000000;
}


.result-loss-red {
  color: #d10000 !important;
  font-weight: bold;
}
.result-loss-green {
  color: #009900 !important;
  font-weight: bold;
}
.result-percentage-green {
  color: #009900 !important;
  font-weight: bold;
}
.result-percentage-red {
  color: #d10000 !important;
  font-weight: bold;
}



.print-btn {
  border: none;
  background: transparent;
  position: absolute;
  /* left: 13px;  <-- remove this line */
  right: 13px;    /* add this line */
  top: 13px;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: background 0.18s;
  z-index: 2;
}
.print-btn:hover {
  background: #ffd1d1;
  border-radius: 50%;
}
.print-btn svg {
  display:block;
}

.btn-main {
  background: linear-gradient(90deg, var(--main-red) 0%, #e24545 100%);
  color: #fff;
  padding: 0.65em 2.2em;
  border-radius: 6px;
  border: none;
  margin-top: 1.25em;
  font-size: 1.08rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 0.5px 3px rgba(178,34,34,0.07);
}
.btn-main:hover, .btn-main:focus {
  background: linear-gradient(90deg, #e24545 0%, var(--main-red) 100%);
  outline: none;
}

/* Print only the result section */
@media print {
  body * {
    visibility: hidden !important;
  }
  .result-section, .result-section * {
    visibility: visible !important;
  }
  .result-section {
    position: static !important;
    max-width: 100vw !important;
    margin: 0 !important;
    box-shadow: none !important;
    padding: 0;
    background: #fff !important;
  }
  .print-btn {
    display:none !important;
  }
}

@media (max-width: 700px) {
  .container { max-width: 99vw; }
  .section { padding-bottom: 0.15rem; margin-bottom: 0.15rem;}
}

@media (max-width: 600px) {
  html { font-size: 15px; }
  .container { padding: 0.01rem 0.01rem; }
  .section {margin-bottom: 0.05rem; padding-bottom: 0.01rem;}
  .flex-row, .input-row {
    flex-direction: column;
    gap: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
  }
  
      
  .input-group {
    flex: unset !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 10px !important;
    padding-bottom: 0 !important;
  }
  .input-group label {
    font-size: 1rem;
    margin-bottom: 0;
    margin-top: 0;
    padding: 0;
    line-height: 1.1;
  }
  .input-group input[type="number"], .input-group input[type="text"], .input-group select {
    font-size: 1rem;
    padding: 4px 7px 4px 7px;
    margin-bottom: 0;
    min-height: 32px;
    border: 1.3px solid var(--input-border);
    line-height: 1;
    box-sizing: border-box;
  }
  .input-note { font-size: 0.8em; margin-bottom: 0; margin-top: 0;}
  .result-section { padding: 1rem 0.3rem;}
  .section h2, .section h3 { font-size: 1.4rem; margin-top:20px}
}

@media (max-width: 425px) {
  html { font-size: 13.5px;}
  .main-header h1 { height:50px;font-size: 1.2rem;}
  .container { padding: 0.01rem 0;}
  .section { margin-bottom: 0.03rem;}
  .input-group label { font-size: 1.2rem; margin-bottom:5px; margin-left:5px;}
  
  
}