/* Retirement Withdrawal Calculator */
.hidden { display: none !important; }

.rw-hero h1 { margin-bottom: 0.35rem; }
.rw-hero .lead { margin: 0.5rem 0 0.75rem; color: var(--muted); }
.rw-hero .rw-intro { margin: 0 0 1.25rem; }

.rw-calc h2 { margin-top: 0; }

.rw-main-grid {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 14px;
}

.rw-input-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rw-output-column {
  position: sticky;
  top: 12px;
  align-self: start;
}

@media (max-width: 980px) {
  .rw-main-grid {
    grid-template-columns: 1fr;
  }
  .rw-output-column {
    position: static;
  }
}

.rw-subhead {
  margin: 0.25rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.rw-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
}
.rw-toggle-row label { cursor: pointer; }
.rw-toggle-row input { margin-right: 0.35rem; }

.rw-calc .inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rw-calc .inline input {
  flex: 1 1 auto;
  min-width: 0;
}

.rw-calc .inline .unit {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1;
}

.rw-hidden { display: none !important; }

.rw-error {
  margin: 0 0 0.75rem;
  padding: 10px 12px;
  border: 1px solid rgba(220, 100, 100, 0.35);
  background: rgba(220, 100, 100, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.rw-summary {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  line-height: 1.6;
  font-size: 0.98rem;
}

.rw-outputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 700px) {
  .rw-outputs { grid-template-columns: 1fr; }
}
.rw-out-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.rw-out-card.rw-out-important {
  border-color: rgba(217, 180, 106, 0.55);
  background: linear-gradient(180deg, rgba(217, 180, 106, 0.14), rgba(217, 180, 106, 0.06));
}

.rw-out-card.rw-out-important .rw-out-label {
  color: var(--accent2);
  font-weight: 700;
}

.rw-out-card.rw-out-important .rw-out-value {
  color: var(--text);
}
.rw-out-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.2rem;
}
.rw-out-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  word-break: break-word;
}

.rw-chart-card { margin-top: 18px; }
.rw-chart-wrap {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  overflow: hidden;
}
#rwChart {
  display: block;
  width: 100%;
  height: 300px;
}
@media (max-width: 520px) {
  #rwChart { height: 240px; }
}
.rw-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.75rem 0 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.rw-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.rw-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  display: none;
  max-width: min(360px, calc(100% - 16px));
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(20, 24, 32, 0.95);
  color: var(--text);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.rw-tooltip strong { color: #fff; }

.rw-table details { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.rw-table summary { cursor: pointer; font-weight: 600; }
.rw-table .schedule-table { margin-top: 8px; }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.schedule-table { width: 100%; }

.rw-below, .rw-faq { margin-top: 18px; }
.rw-below h2, .rw-faq h2 { margin-top: 0.25rem; }

.faq-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.faq-section h2 {
  margin: 0 0 20px;
  font-size: 20px;
  color: var(--text);
}

.faq-accordion {
  margin: 0;
}

.faq-accordion-item {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.faq-accordion-item summary {
  cursor: pointer;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-accordion-item summary::-webkit-details-marker {
  display: none;
}

.faq-accordion-item summary::after {
  content: "+";
  font-size: 1.2em;
  color: var(--accent);
  flex-shrink: 0;
}

.faq-accordion-item[open] summary::after {
  content: "-";
}

.faq-accordion-item summary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.faq-accordion-body {
  padding: 0 18px 16px;
  background: var(--surface);
}

.faq-accordion-body p {
  margin: 0 0 0.9em 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.faq-accordion-body p:last-child {
  margin-bottom: 0;
}

.rw-calc .export-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}
.rw-calc .export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
}

.rw-calc .result-share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rw-calc .result-share-actions button {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .rw-calc .result-share-actions {
    grid-template-columns: 1fr;
  }
}

/* Hide non-functional "Ready to share" badge for this calculator. */
#rw_share_block.result-share-block.is-ready-to-share .result-share-title::after {
  display: none;
  content: none;
}

/* -------------------------------------------------------
   MOBILE OVERRIDES
   ------------------------------------------------------- */
@media (max-width: 640px) {
  /* Input column panels: remove individual borders to avoid
     border-inside-border with the outer .card.rw-calc.
     Use top-border as a section divider instead. */
  .rw-input-column .panel {
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    padding-left: 0;
    padding-right: 0;
    background: transparent;
  }
  .rw-input-column .panel:first-child {
    border-top: none;
  }
  .rw-input-column {
    gap: 0;
  }

  /* Toggle rows: allow wrapping so checkboxes don't squish */
  .rw-toggle-row {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
  }

  /* Export controls: stack on phones */
  .rw-calc .export-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .rw-calc .export-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Summary box: tighter padding */
  .rw-summary {
    font-size: 0.93rem;
    padding: 10px 11px;
  }
}
