/* Dedykowane style dla modalowych kalkulatorów dochodu i zobowiązań */
/* Wyrównanie badge modułu i przycisku kalkulatora w panelach */

.module-toolbar{
  display:inline-flex;
  justify-content:flex-start;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
  flex-wrap:wrap;
}

.module-toolbar .hero-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:42px;
  min-height:42px;
  padding:0 16px;
  margin:0;
  line-height:1;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  letter-spacing:.12em;
  white-space:nowrap;
}

.module-toolbar .tool-trigger-btn{
  height:42px;
  min-height:42px;
  padding:0 16px;
  line-height:1;
  font-size:12px;
  font-weight:700;
  letter-spacing:.06em;
  white-space:nowrap;
}

.module-copy{
  width:100%;
  max-width:none;
}

.tool-trigger-btn{
  min-width:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 16px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.06em;
  line-height:1;
  box-shadow:none;
  border:1px solid rgba(61,132,255,.38);
  color:#9fd0ff;
  background:rgba(24,56,112,.32);
  height:42px;
  cursor:pointer;
  transition:transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.tool-trigger-btn:hover{
  transform:translateY(-1px);
  border-color:rgba(96,166,255,.58);
  background:rgba(28,72,150,.42);
  color:#d9ecff;
}

.tool-modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(4,9,18,.68);
  backdrop-filter:blur(7px);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:1200;
  padding:12px;
}

.tool-modal-overlay.open{
  display:flex;
}

.tool-modal{
  width:min(980px,100%);
  max-height:min(92vh,980px);
  overflow:auto;
  padding:20px;
  border-radius:28px;
  border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(8,16,32,.98), rgba(7,14,27,.98));
  box-shadow:0 24px 70px rgba(0,0,0,.42);
  position:relative;
}

.tool-modal-body{
  display:grid;
  gap:14px;
}

.tool-modal-header{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
}

.tool-modal-title{
  font-size:28px;
  font-weight:800;
  line-height:1.1;
}

.tool-modal-badge{
  display:inline-flex;
  align-items:center;
  height:42px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid rgba(61,132,255,.38);
  color:#9fd0ff;
  font-size:12px;
  font-weight:700;
  letter-spacing:.06em;
  white-space:nowrap;
}

.tool-close{
  position:absolute;
  top:12px;
  right:14px;
  width:42px;
  height:42px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  color:#fff;
  font-size:26px;
  cursor:pointer;
}

.tool-card{
  padding:18px;
  border-radius:22px;
  background:rgba(255,255,255,.035);
  border:1px solid rgba(255,255,255,.08);
  display:grid;
  gap:14px;
}


.tool-stack{
  display:grid;
  gap:12px;
}

.tool-subcard{
  background:rgba(255,255,255,.03);
}

.liability-structured-card .tool-grid{
  grid-template-columns:repeat(3, minmax(0, 1fr));
}
.tool-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

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

.tool-result-card{
  padding:16px 18px;
  border-radius:18px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  display:grid;
  gap:7px;
}

.tool-result-card span{
  color:#9ab0c8;
  font-size:.9rem;
}

.tool-result-card strong{
  font-size:30px;
  line-height:1;
}

.tool-result-card small{
  color:#9ab0c8;
}

.tool-result-card-accent{
  background:linear-gradient(90deg, rgba(61,132,255,.15), rgba(84,216,117,.08));
  border-color:rgba(115,214,79,.24);
}

.tool-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.tool-section-title{
  font-size:.95rem;
  font-weight:800;
  color:#dfeaff;
  margin-bottom:2px;
}

.tool-copy-btn.is-copied{
  background:rgba(115,214,79,.18);
  border-color:rgba(115,214,79,.34);
  color:#9af490;
}

/* Modal danych rynkowych */
.market-rates-overlay{
  z-index:2200;
}

.market-rates-modal{
  max-width:1080px;
  width:min(1080px, calc(100vw - 18px));
  max-height:calc(100vh - 18px);
  padding:18px 20px 16px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.market-rates-modal .tool-modal-body{
  gap:12px;
}

.market-head h3{
  margin:8px 0 4px;
  font-size:30px;
  line-height:1.02;
}

.market-head p{
  margin:0;
  color:#b9c9df;
  max-width:760px;
  line-height:1.45;
  font-size:.98rem;
}

.market-rates-loading{
  padding:18px 0;
  color:#bcd4ff;
  font-size:1rem;
}

.market-header-strip{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
  margin:14px 0 10px;
}

.market-header-meta,
.market-kpi-card,
.market-bank-card{
  padding:12px 14px;
  border-radius:18px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.market-header-meta span,
.market-kpi-card span,
.market-bank-meta{
  display:block;
  font-size:.79rem;
  color:#a8bdd7;
}

.market-header-meta strong{
  display:block;
  margin-top:5px;
  color:#f1f6ff;
  font-size:.98rem;
}

.market-rates-kpis{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:10px;
  margin:0 0 14px;
}

.market-kpi-card strong{
  display:block;
  margin-top:8px;
  font-size:1.7rem;
  line-height:1;
  color:#f3f7ff;
}

.market-kpi-card.is-recommended{
  background:linear-gradient(180deg, rgba(37,99,235,.18), rgba(12,27,57,.44));
  border-color:rgba(96,165,250,.34);
  box-shadow:inset 0 0 0 1px rgba(96,165,250,.08);
}

.market-banks-wrap{
  display:grid;
  gap:12px;
}

.market-banks-block{
  padding:14px;
  border-radius:22px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.07);
}

.market-banks-block.is-muted{
  background:rgba(255,255,255,.02);
  border-color:rgba(255,255,255,.05);
}

.market-block-title{
  font-size:.93rem;
  font-weight:800;
  letter-spacing:.02em;
  color:#dce9ff;
  margin-bottom:10px;
}

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

.market-bank-card.is-muted{
  opacity:.82;
}

.market-bank-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.market-bank-top strong{
  font-size:1rem;
  color:#edf4ff;
  line-height:1.2;
}

.market-bank-value{
  margin:10px 0 6px;
  font-size:1.7rem;
  font-weight:800;
  line-height:1;
  color:#9fd0ff;
}

.market-rate-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  font-size:.7rem;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  color:#d9e6fb;
  white-space:nowrap;
}

.market-rate-status.status-ok{
  background:rgba(34,197,94,.16);
  color:#ccffe0;
  border-color:rgba(34,197,94,.28);
}

.market-rate-status.status-error,
.market-rate-status.status-excluded,
.market-rate-status.status-fallback{
  background:rgba(239,68,68,.14);
  color:#ffd7d7;
  border-color:rgba(239,68,68,.28);
}

.market-rates-note{
  margin-top:10px;
  padding:11px 13px;
  border-radius:16px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.06);
  color:#b8cae4;
  font-size:.88rem;
}

.market-rates-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.market-rates-actions-main{
  margin-top:14px;
}

.market-rate-action.primary{
  background:linear-gradient(180deg, rgba(37,99,235,.22), rgba(18,49,108,.48));
  border-color:rgba(96,165,250,.4);
  color:#e2efff;
}

.market-rate-action.is-copied{
  background:rgba(34,197,94,.18)!important;
  border-color:rgba(34,197,94,.35)!important;
  color:#e8fff1!important;
}

.market-rates-footer{
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}

.market-rate-link,
.market-rate-close-btn{
  background:rgba(255,255,255,.04);
  border-color:rgba(255,255,255,.1);
}

.market-rate-close-btn{
  min-width:112px;
}

.market-rates-empty{
  padding:14px;
  border-radius:16px;
  background:rgba(255,255,255,.04);
  color:#c8d8f4;
}

@media (max-width: 900px){
  .market-rates-kpis{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .market-header-strip{
    grid-template-columns:1fr;
  }
}

@media (max-width: 860px){
  .tool-grid{
    grid-template-columns:1fr;
  }

  .module-toolbar{
    align-items:stretch;
  }
}

@media (max-width: 680px){
  .market-rates-modal{
    padding:18px 16px 14px;
    max-height:calc(100vh - 10px);
  }

  .market-head h3{
    font-size:26px;
  }

  .market-banks-grid,
  .market-rates-kpis{
    grid-template-columns:1fr;
  }

  .market-rates-actions-main .tool-trigger-btn,
  .market-rates-footer .tool-trigger-btn{
    width:100%;
  }

  .market-rates-footer{
    justify-content:stretch;
  }
}

@media (max-width: 860px){
  .liability-structured-card .tool-grid{
    grid-template-columns:1fr;
  }
}

.market-head-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:6px;
}

.market-mode-switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
}

.market-mode-switch input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.market-mode-switch-track{
  position:relative;
  width:58px;
  height:32px;
  border-radius:999px;
  background:rgba(255,255,255,.09);
  border:1px solid rgba(96,165,250,.28);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.03);
  transition:.2s ease;
}

.market-mode-switch-track::after{
  content:'';
  position:absolute;
  top:3px;
  left:3px;
  width:24px;
  height:24px;
  border-radius:50%;
  background:linear-gradient(180deg, #eef5ff, #9ec5ff);
  box-shadow:0 4px 14px rgba(0,0,0,.24);
  transition:.2s ease;
}

.market-mode-switch input:checked + .market-mode-switch-track{
  background:linear-gradient(180deg, rgba(37,99,235,.24), rgba(18,49,108,.52));
  border-color:rgba(96,165,250,.44);
}

.market-mode-switch input:checked + .market-mode-switch-track::after{
  transform:translateX(26px);
}

.market-mode-switch-labels{
  display:flex;
  flex-direction:column;
  line-height:1.05;
}

.market-mode-switch-labels strong,
.market-mode-switch-labels em{
  font-style:normal;
  font-size:.78rem;
}

.market-mode-switch-labels strong{ color:#e9f2ff; }
.market-mode-switch-labels em{ color:#9eb7d6; }

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

.market-manual-card{
  padding:14px;
  border-radius:18px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.market-manual-label{
  display:block;
  margin-bottom:8px;
  font-size:.95rem;
  font-weight:700;
  color:#edf4ff;
}

.market-manual-input-wrap{
  position:relative;
}

.market-manual-input{
  width:100%;
  min-height:50px;
  padding:0 42px 0 14px;
  border-radius:14px;
  border:1px solid rgba(96,165,250,.2);
  background:rgba(8,17,34,.68);
  color:#f1f6ff;
  font-size:1.15rem;
  font-weight:700;
  outline:none;
}

.market-manual-input:focus{
  border-color:rgba(96,165,250,.45);
  box-shadow:0 0 0 3px rgba(37,99,235,.16);
}

.market-manual-suffix{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  color:#9eb7d6;
  font-weight:700;
}

@media (max-width: 680px){
  .market-head-top{
    align-items:flex-start;
    flex-direction:column;
  }

  .market-mode-switch{
    align-self:flex-start;
  }

  .market-manual-grid{
    grid-template-columns:1fr;
  }
}
