/* Rakumachi-like UI for CF Simulator Pro v3.0.0 */
.rk-wrap{
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans JP",
               "Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
}
.rk-title{
  text-align:center;
  font-weight:700;
  margin:10px 0 12px;
}

/* boxes */
.rk-box{
  border:1px solid #d7d7d7;
  background:#fff;
  padding:12px;
  margin:12px 0;
}

/* top inputs */
.rk-top-grid{
  display:grid;
  grid-template-columns: 1.1fr 1fr 1fr 0.8fr 1fr;
  gap:10px;
}
.rk-field label{
  display:block;
  font-size:12px;
  color:#333;
  margin:0 0 4px;
}
.rk-unit{
  display:flex;
  gap:6px;
  align-items:center;
}
.rk-unit span{
  font-size:12px;
  color:#333;
  white-space:nowrap;
}
.cfsp-currency-unit{
  white-space:nowrap;
}
.cfsp-currency-unit-intl{
  display:none;
}
html.translated-ltr .cfsp-currency-unit-ja,
html.translated-rtl .cfsp-currency-unit-ja{
  display:none;
}
html.translated-ltr .cfsp-currency-unit-intl,
html.translated-rtl .cfsp-currency-unit-intl{
  display:inline;
}
.rk-field input,
.rk-field select{
  width:100%;
  padding:6px 8px;
  border:1px solid #bdbdbd;
  border-radius:3px;
  font-size:14px;
}
.rk-actions{
  text-align:right;
  margin-top:8px;
}
.rk-btn{
  background:#7aa7c7;
  color:#fff;
  border:0;
  border-radius:3px;
  padding:8px 14px;
  cursor:pointer;
  font-weight:700;
}
.rk-btn:hover{ filter:brightness(0.97); }

/* chart */
.rk-chart .rk-subtitle{
  text-align:center;
  font-weight:700;
  margin:0 0 8px;
  color:#333;
}
.rk-legend{
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:6px;
}
.rk-leg{
  border:0;
  background:transparent;
  cursor:pointer;
  font-size:12px;
  color:#111;
  display:flex;
  align-items:center;
  gap:6px;
}
.rk-leg.off{ opacity:0.45; }
.rk-swatch{
  width:10px;
  height:10px;
  border-radius:2px;
  display:inline-block;
}

/* scrollable chart area */
.rk-chart-scroll{
  position:relative;
  overflow-x:auto;
  overflow-y:hidden;
  border:1px solid #e5e5e5;
  padding:6px;
}
#chart_canvas{ display:block; }

/* tooltip */
.rk-tooltip{
  position:absolute;
  z-index:5;
  width:240px;
  background:rgba(255,255,255,0.96);
  border:1px solid rgba(0,0,0,0.18);
  border-radius:8px;
  box-shadow:0 6px 18px rgba(0,0,0,0.12);
  padding:10px;
  pointer-events:none; /* hoverを途切れさせない */
}
.rk-tt-title{ font-weight:700; margin-bottom:6px; }
.rk-tt-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
  margin:4px 0;
}
.rk-tt-row span{ color:#6b7280; }
.rk-tt-row b{ color:#111827; font-weight:700; }

.rk-note-right{
  text-align:right;
  font-size:12px;
  margin-top:4px;
}
.rk-note-right a{
  color:#1d4ed8;
  text-decoration:none;
}

/* conditions */
.rk-cond-title{
  font-weight:700;
  margin-bottom:10px;
}
.rk-cond-sub{
  font-weight:400;
  color:#666;
  margin-left:8px;
  font-size:12px;
}

/* sliders row */
.rk-sliders{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:12px;
  margin-bottom:10px;
}
.rk-sitem{
  border-right:1px solid #e3e3e3;
  padding-right:10px;
  box-sizing:border-box;
  min-width:0;
}
.rk-sitem:last-child{ border-right:0; }

.rk-shead{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
  font-size:12px;
}
.rk-shead input{
  width:70px;
  padding:4px 6px;
  border:1px solid #bdbdbd;
  border-radius:3px;
}
.rk-sunit{ color:#333; }
.rk-sitem input[type="range"]{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
}

/* table-like blocks */
.rk-table{ border-top:1px solid #d7d7d7; }
.rk-trow{
  display:grid;
  grid-template-columns: 120px 1fr;
  border-bottom:1px solid #d7d7d7;
}
.rk-tlabel{
  padding:10px;
  font-weight:700;
  background:#f6f6f6;
  border-right:1px solid #d7d7d7;
}
.rk-tcells{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:0;
}
.rk-tcell{
  padding:10px;
  border-right:1px solid #efefef;
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.rk-tcell:last-child{ border-right:0; }

.rk-k{
  font-size:12px;
  color:#333;
  min-width:120px;
}
.rk-u{ font-size:12px; color:#333; }
.rk-v{ font-weight:700; }

.rk-bigv{
  font-size:18px;
  font-weight:800;
}
.rk-big{ align-items:flex-end; }
.rk-small{ font-size:11px; color:#666; }

.rk-tcell input,
.rk-tcell select{
  padding:4px 6px;
  border:1px solid #bdbdbd;
  border-radius:3px;
  font-size:13px;
}
.rk-tcell input{ width:90px; }

.rk-radio{
  font-size:12px;
  color:#333;
  display:inline-flex;
  gap:6px;
  align-items:center;
  margin-right:8px;
}

/* capex area */
.rk-capex{
  flex-direction:column;
  align-items:flex-start;
}
.rk-capex-row{
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:6px;
}
.rk-capex-row input{ width:80px; }

.rk-link{
  border:0;
  background:transparent;
  color:#1d4ed8;
  cursor:pointer;
  padding:6px 0 0;
  font-size:12px;
}

/* howto/formula */
.rk-howto-title{
  font-weight:800;
  margin-bottom:8px;
}
.rk-formula{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}
.rk-formula th,
.rk-formula td{
  border:1px solid #d7d7d7;
  padding:8px;
  vertical-align:top;
}
.rk-formula th{
  width:140px;
  background:#f6f6f6;
  text-align:left;
}

.rk-foot{
  margin:10px 0 0;
  padding-left:18px;
  color:#333;
  font-size:12px;
}
.rk-foot li{ margin:6px 0; }
.rk-disclaimer{
  margin-top:8px;
  font-size:12px;
  color:#666;
}

/* responsive */
@media (max-width: 1024px){
  .rk-top-grid{ grid-template-columns: 1fr 1fr; }
  .rk-sliders{ grid-template-columns: 1fr 1fr; }
  .rk-trow{ grid-template-columns: 1fr; }
  .rk-tlabel{
    border-right:0;
    border-bottom:1px solid #d7d7d7;
  }
  .rk-tcells{ grid-template-columns: 1fr; }
}

/* ▼矢印が末尾文字（% / 後）にかぶるのを防ぐ */
#rejp-cfsp #p_tax_rate,
#rejp-cfsp #p_rent_g,
#rejp-cfsp #p_capex_year1,
#rejp-cfsp #p_capex_year2,
#rejp-cfsp #p_capex_year3,
#rejp-cfsp #p_capex_year4,
#rejp-cfsp #p_capex_year5 {
  min-width: 108px;         /* -x.x% / xx年後 が欠けない幅 */
  padding-right: 40px;      /* ネイティブ矢印ぶん余白を確保 */
  height: 34px;
  line-height: 1.4;
  font-size: 14px;
  font-weight: 600;
  box-sizing: border-box;
}

.rk-capex-extra .rk-capex-remove{
  border:0;
  background:#eef5fb;
  color:#2563eb;
  width:26px;
  height:26px;
  line-height:26px;
  text-align:center;
  border-radius:4px;
  cursor:pointer;
  font-weight:700;
}
.rk-capex-extra .rk-capex-remove:hover{
  background:#dbeafe;
}
.rk-capex-row{
  flex-wrap:wrap;
}


/* capex/tax row - make layout closer to Rakumachi */
.rk-tcells-capex{
  grid-template-columns: 220px minmax(420px, 1fr);
  align-items:start;
}
.rk-tcells-capex > .rk-tcell:last-child{
  display:none;
}
.rk-tcells-capex .rk-taxcell{
  align-self:start;
  min-height:0;
}
.rk-tcells-capex .rk-capex{
  align-self:start;
}
.rk-tcells-capex .rk-taxcell,
.rk-tcells-capex .rk-capex{
  height:auto;
}
#rejp-cfsp #p_tax_rate,
#rejp-cfsp [id^="p_capex_year"] {
  min-width: 106px;
  padding-right: 38px;
  height: 34px;
  line-height: 1.4;
  font-size: 14px;
  font-weight: 600;
  box-sizing: border-box;
}
.rk-capex-row{
  width:100%;
  gap:8px;
  align-items:center;
  flex-wrap:nowrap;
}
.rk-capex-row > span:first-child{
  min-width:46px;
}
.rk-capex-row select{
  flex:0 0 106px;
}
.rk-capex-row input{
  width:72px;
}
.rk-capex-row .rk-u{
  min-width:28px;
}
.rk-capex-extra .rk-capex-remove{
  flex:0 0 26px;
}
@media (max-width: 1024px){
  .rk-tcells-capex{
    grid-template-columns: 1fr;
  }
  .rk-tcells-capex > .rk-tcell:last-child{
    display:none;
  }
  .rk-capex-row{
    flex-wrap:wrap;
  }
}

/* 家賃増減率：% と ▼ の重なり防止 */
#rejp-cfsp #p_rent_g + .rk-u{
  white-space: nowrap;
}

/* property detail integration */
#rejp-cfsp.rejp-cfsp-property .rk-top{
  display:none;
}
#rejp-cfsp.rejp-cfsp-property.rejp-cfsp-needs-input .rk-top{
  display:block;
}
#rejp-cfsp.rejp-cfsp-property .rk-property-notice{
  margin:0 0 14px;
  padding:10px 12px;
  border:1px solid #f0c36d;
  border-radius:6px;
  background:#fff8e5;
  color:#5f4500;
  font-size:13px;
  line-height:1.6;
}
#rejp-cfsp.rejp-cfsp-property .rk-property-notice[hidden],
#rejp-cfsp.rejp-cfsp-property .rk-conds[hidden]{
  display:none !important;
}
#rejp-cfsp.rejp-cfsp-property .rk-property-controls{
  display:flex;
  justify-content:center;
  margin:14px 0;
}
#rejp-cfsp.rejp-cfsp-property .rk-btn-secondary{
  border:1px solid #2563eb;
  background:#fff;
  color:#1d4ed8;
}
#rejp-cfsp.rejp-cfsp-property .rk-btn-secondary:hover,
#rejp-cfsp.rejp-cfsp-property .rk-btn-secondary:focus-visible{
  background:#eff6ff;
}
#rejp-cfsp.rejp-cfsp-property .rk-property-reset-actions{
  margin-top:16px;
  padding-top:16px;
  border-top:1px solid #e5e7eb;
}

@media (max-width: 480px){
  #rejp-cfsp .rk-sliders{
    grid-template-columns:1fr;
  }
  #rejp-cfsp .rk-sitem{
    border-right:0;
    border-bottom:1px solid #e3e3e3;
    padding:0 0 10px;
  }
  #rejp-cfsp .rk-sitem:last-child{
    border-bottom:0;
  }
  #rejp-cfsp.rejp-cfsp-property .rk-property-controls .rk-btn,
  #rejp-cfsp.rejp-cfsp-property .rk-property-reset-actions .rk-btn{
    width:100%;
  }
}
