:root{
  --bg:#eef4e7;
  --panel:#f7f9ef;
  --panel-2:#f1f5e7;
  --panel-3:#fbfcf8;
  --text:#2f3a38;
  --muted:#66706d;
  --muted-2:#7f887f;
  --border:#c8d4bf;
  --border-soft:rgba(127,155,104,0.14);
  --primary:#7f9b68;
  --primary-dark:#627a50;
  --danger:#b95b5b;
  --danger-dark:#974545;
  --success:#5f8b63;
  --success-soft:rgba(95,139,99,0.10);
  --warning:#b58b4f;
  --shadow:0 10px 30px rgba(29, 37, 33, 0.08);
  --shadow-soft:0 6px 18px rgba(29, 37, 33, 0.05);
  --radius:18px;
  --radius-sm:14px;
}

*{
  box-sizing:border-box;
}

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family:"Poppins", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.6), transparent 30%),
    linear-gradient(180deg, #f3f8ed 0%, #edf3e5 100%);
  color:var(--text);
  font-size:16px;
  line-height:1.5;
}

.wrapper{
  width:min(1320px, calc(100% - 32px));
  margin:0 auto;
  padding:32px 0 52px;
}

header{
  text-align:center;
  margin-bottom:28px;
}

.topbar{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  margin-bottom:12px;
}

.lang-switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(255,255,255,0.72);
  border:1px solid rgba(127,155,104,0.18);
  box-shadow:var(--shadow-soft);
  text-decoration:none;
  color:var(--text);
  transition:transform .2s ease, box-shadow .2s ease, opacity .2s ease, background-color .2s ease;
}

.lang-switch:hover{
  transform:translateY(-1px);
  opacity:.94;
  background:rgba(255,255,255,0.9);
}

.lang-switch img{
  width:26px;
  height:18px;
  object-fit:cover;
  border-radius:4px;
  flex-shrink:0;
}

h1{
  margin:0;
  font-size:clamp(34px, 5vw, 54px);
  line-height:1.04;
  letter-spacing:-0.03em;
  color:var(--primary);
}

.subtitle{
  margin-top:12px;
  font-size:clamp(17px, 2vw, 22px);
  color:var(--muted);
}

.intro{
  width:min(880px, 100%);
  margin:18px auto 0;
  color:var(--muted);
  font-size:15px;
  line-height:1.65;
}

.panel{
  background:rgba(247,249,239,0.88);
  border:1px solid rgba(127,155,104,0.12);
  backdrop-filter:blur(6px);
  box-shadow:var(--shadow);
  border-radius:var(--radius);
}

form{
  padding:26px;
  margin-top:30px;
}

.section{
  padding:20px;
  background:var(--panel-2);
  border:1px solid var(--border);
  border-radius:16px;
  position:relative;
}

.section + .section{
  margin-top:18px;
}

.section-soft{
  background:rgba(255,255,255,0.44);
  border:1px dashed rgba(127,155,104,0.24);
}

.section-title{
  margin:0 0 14px;
  font-size:18px;
  font-weight:700;
  color:var(--primary-dark);
  line-height:1.3;
}

.section-note{
  margin:-4px 0 14px;
  color:var(--muted);
  font-size:13px;
  line-height:1.6;
}

.subsection-card{
  background:rgba(255,255,255,0.62);
  border:1px solid rgba(127,155,104,0.14);
  border-radius:14px;
  padding:16px;
  box-shadow:var(--shadow-soft);
}

.subsection-card + .subsection-card{
  margin-top:14px;
}

.subsection-title{
  margin:0 0 14px;
  font-size:15px;
  font-weight:700;
  color:var(--primary-dark);
  line-height:1.35;
}

.form-row{
  display:grid;
  grid-template-columns:repeat(12, minmax(0, 1fr));
  gap:14px;
  margin-bottom:14px;
}

.form-row:last-child{
  margin-bottom:0;
}

.field{
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:0;
}

.field label{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  line-height:1.35;
}

.span-12{ grid-column:span 12; }
.span-8{ grid-column:span 8; }
.span-6{ grid-column:span 6; }
.span-5{ grid-column:span 5; }
.span-4{ grid-column:span 4; }
.span-3{ grid-column:span 3; }

input,
select,
textarea{
  width:100%;
  min-height:48px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fbfcf8;
  font:inherit;
  color:var(--text);
  outline:none;
  transition:
    border-color .2s ease,
    box-shadow .2s ease,
    transform .15s ease,
    background-color .2s ease;
}

select{
  appearance:none;
  background-image:
    linear-gradient(45deg, transparent 50%, #7b8777 50%),
    linear-gradient(135deg, #7b8777 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px);
  background-size:6px 6px, 6px 6px;
  background-repeat:no-repeat;
  padding-right:40px;
}

input[readonly]{
  background:#f2f5ed;
  color:#647060;
}

input::placeholder,
textarea::placeholder{
  color:#9aa39a;
}

input:hover,
select:hover,
textarea:hover{
  border-color:rgba(127,155,104,0.35);
}

input:focus,
select:focus,
textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px rgba(127,155,104,0.12);
  background:#ffffff;
}

input:disabled,
select:disabled,
textarea:disabled{
  background:#eef2e8;
  color:#8e968b;
  cursor:not-allowed;
}

input:-webkit-autofill{
  -webkit-box-shadow:0 0 0 1000px #fbfcf8 inset !important;
  -webkit-text-fill-color:var(--text) !important;
}

.checkbox-row{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:48px;
  padding:10px 0 0;
  color:var(--text);
  flex-wrap:wrap;
}

.checkbox-row span{
  line-height:1.45;
}

input[type="checkbox"]{
  width:18px;
  height:18px;
  min-height:auto;
  padding:0;
  margin:0;
  accent-color:var(--primary);
  cursor:pointer;
  flex-shrink:0;
  box-shadow:none;
}

#rateInfo,
.rate-info{
  display:block;
  margin-top:6px;
  font-size:12px;
  line-height:1.45;
  color:var(--muted);
  opacity:0.95;
}

.actions{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:14px;
  margin-top:24px;
}

button{
  min-width:220px;
  min-height:54px;
  padding:14px 18px;
  border:none;
  border-radius:14px;
  font:inherit;
  font-weight:700;
  cursor:pointer;
  transition:transform .18s ease, opacity .2s ease, background-color .2s ease, box-shadow .2s ease;
  box-shadow:var(--shadow-soft);
}

button:hover{
  transform:translateY(-1px);
}

button:active{
  transform:translateY(0);
}

button:focus-visible{
  outline:none;
  box-shadow:0 0 0 4px rgba(127,155,104,0.18), var(--shadow-soft);
}

.btn-primary{
  background:var(--primary);
  color:#ffffff;
}

.btn-primary:hover{
  background:var(--primary-dark);
}

.btn-secondary{
  background:#d7e2cb;
  color:var(--text);
}

.btn-secondary:hover{
  background:#cddabf;
}

.btn-danger{
  background:var(--danger);
  color:#ffffff;
}

.btn-danger:hover{
  background:var(--danger-dark);
}

.result-section{
  margin-top:28px;
  padding:26px;
  display:none;
  overflow:hidden;
}

.result-top{
  display:flex;
  justify-content:space-between;
  gap:18px;
  flex-wrap:wrap;
  margin-bottom:20px;
}

.clean-result-top{
  align-items:flex-start;
  gap:20px;
  margin-bottom:22px;
}

.result-meta{
  color:var(--muted);
  font-size:14px;
  line-height:1.55;
}

.result-title{
  margin:0 0 8px;
  font-size:24px;
  color:var(--primary-dark);
  line-height:1.25;
}

.result-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  justify-content:flex-end;
}

.result-actions button{
  min-width:170px;
}

.results-master-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:16px;
  align-items:stretch;
}

.results-master-grid > *{
  min-width:0;
}

.hero-card{
  background:linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(247,249,239,0.94) 100%);
  border:1px solid var(--border-soft);
  border-radius:16px;
  padding:18px;
  box-shadow:var(--shadow-soft);
  min-height:132px;
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.hero-label{
  font-size:12px;
  color:var(--muted);
  margin-bottom:8px;
  text-transform:uppercase;
  letter-spacing:0.04em;
}

.hero-value{
  font-size:clamp(22px, 2vw, 28px);
  font-weight:700;
  color:var(--primary-dark);
  line-height:1.15;
  word-break:break-word;
}

.hero-sub{
  margin-top:8px;
  font-size:12px;
  color:var(--muted-2);
  line-height:1.45;
}

.card{
  background:var(--panel-2);
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px;
  box-shadow:var(--shadow-soft);
  min-height:540px;
  height:100%;
  display:flex;
  flex-direction:column;
}

.card h3{
  margin:0 0 14px;
  font-size:17px;
  color:var(--primary-dark);
  min-height:28px;
  display:flex;
  align-items:center;
  line-height:1.35;
}

.line{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  padding:10px 0;
  border-bottom:1px solid rgba(127,155,104,0.15);
  font-size:14px;
}

.line span:first-child{
  color:var(--muted);
  flex:1;
}

.line span:last-child{
  text-align:right;
  color:var(--text);
  font-weight:500;
  min-width:96px;
}

.line:last-child{
  border-bottom:none;
}

.line strong{
  font-size:16px;
  color:var(--primary-dark);
}

.separator{
  height:1px;
  background:#d6dbc9;
  margin:14px 0;
}

.big-total{
  margin-top:12px;
  padding-top:14px;
  border-top:2px solid rgba(127,155,104,0.2);
}

.empty-state{
  padding:14px;
  background:#f8f8f4;
  border:1px dashed #c9cfba;
  border-radius:12px;
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
  min-height:56px;
  display:flex;
  align-items:center;
}

.info-note{
  background:rgba(255,255,255,0.72);
  border:1px solid #d3d8c7;
  border-radius:12px;
  padding:14px;
  margin-bottom:14px;
  font-size:12.5px;
  line-height:1.6;
  color:#5f6654;
}

.mini-lines{
  flex:1;
}

.mini-lines .line{
  margin-bottom:0;
  padding:9px 0;
}

.info-box{
  margin-top:18px;
  padding:16px 18px;
  border-radius:14px;
  background:rgba(255,255,255,0.72);
  border:1px solid rgba(127,155,104,0.15);
  color:var(--muted);
  font-size:14px;
  line-height:1.6;
}

.clean-info-box{
  margin-top:20px;
}

.form-status,
.inline-status{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
}

.success-box{
  background:var(--success-soft);
  border:1px solid rgba(95,139,99,0.22);
  color:var(--success);
  border-radius:12px;
  padding:12px 14px;
}

.warning-box{
  background:rgba(181,139,79,0.10);
  border:1px solid rgba(181,139,79,0.20);
  color:var(--warning);
  border-radius:12px;
  padding:12px 14px;
}

.hidden{
  display:none !important;
}

@media (max-width:1180px){
  .results-master-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .card{
    min-height:520px;
  }
}

@media (max-width:1024px){
  .wrapper{
    width:min(100% - 24px, 1320px);
  }

  .results-master-grid{
    grid-template-columns:1fr;
  }

  .result-actions{
    justify-content:flex-start;
  }

  .card{
    min-height:auto;
  }
}

@media (max-width:760px){
  .wrapper{
    width:min(100% - 20px, 1320px);
    padding:20px 0 34px;
  }

  form,
  .result-section{
    padding:18px;
  }

  .section{
    padding:16px;
  }

  .topbar{
    justify-content:center;
    margin-bottom:16px;
  }

  .intro{
    font-size:14px;
  }

  .form-row{
    grid-template-columns:1fr;
  }

  .span-12,
  .span-8,
  .span-6,
  .span-4,
  .span-3{
    grid-column:auto;
  }

  .actions button,
  .result-actions button{
    width:100%;
    min-width:100%;
  }

  .clean-result-top{
    flex-direction:column;
  }

  .results-master-grid{
    grid-template-columns:1fr;
  }

  .hero-card,
  .card{
    min-height:auto;
  }

  .line{
    flex-direction:column;
    gap:4px;
  }

  .line span:last-child{
    text-align:left;
    min-width:0;
  }

  .checkbox-row{
    align-items:flex-start;
  }
}

@media print{
  body{
    background:#ffffff;
  }

  .topbar,
  form,
  .actions,
  .result-actions,
  .info-box.print-hide{
    display:none !important;
  }

  .wrapper{
    width:100%;
    padding:0;
  }

  .panel,
  .card,
  .hero-card{
    box-shadow:none !important;
    backdrop-filter:none !important;
  }

  .result-section{
    display:block !important;
    margin-top:0;
    border:none;
    padding:0;
    box-shadow:none;
  }

  .results-master-grid{
    gap:12px;
  }

  .hero-card,
  .card{
    break-inside:avoid;
    page-break-inside:avoid;
    min-height:auto;
  }
}