:root{
  --bg: #14181d;
  --bg-soft: #1a2027;
  --surface: #20262e;
  --surface-2: #252c34;
  --surface-3: #313b47;
  --surface-green: #1f2d25;
  --surface-warning: #33281a;
  --border: #3b4653;
  --border-strong: #536273;
  --text: #e7edf4;
  --text-soft: #c5d0db;
  --muted: #95a3b3;
  --heading: #f4f7fb;
  --accent: #5aa07a;
  --accent-strong: #4b8e6a;
  --accent-soft: #23352b;
  --warning: #d59a3a;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.30);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.20);
  --radius: 16px;
}

*{
  box-sizing: border-box;
}

html{
  color-scheme: dark;
}

body{
  margin: 0;
  min-height: 100vh;
  padding: 40px 18px 56px;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow-x: hidden;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #232a33 0%, #171c22 38%, #12161b 100%);
  box-sizing: border-box;
}


.container{
  width: 100%;
  max-width: 1140px;
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  padding: 0;
  min-width: 0;
}

.box{
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 22px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.box-small{
  width: 100%;
  max-width: 520px;
  margin: 0 auto 22px;
}

#strategy-box{
  max-width: 760px;
  align-items: stretch;
}

#strategy-box h2{
  margin-bottom: 22px;
}

#strategy-box .strategy-grid{
  gap: 18px;
  margin-top: 6px;
}

#strategy-box .strategy-card{
  min-height: 118px;
  padding: 22px 18px;
  border-radius: 20px;
}

#strategy-box .strategy-title{
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
}

#strategy-box .strategy-subtitle{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

#strategy-box button{
  margin-top: 14px;
}


.screen-center-box{
  margin-top: auto;
  margin-bottom: auto;
}

h2,
h3{
  margin-top: 0;
  color: var(--heading);
  letter-spacing: -0.02em;
  text-align: center;
}

h2{
  margin-bottom: 18px;
  font-size: 28px;
}

h3{
  margin-bottom: 12px;
  font-size: 18px;
}

p{
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

label{
  display: block;
  width: 100%;
  margin: 12px 0 6px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

input,
button,
select{
  width: 100%;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background-color .18s ease,
    transform .18s ease;
}

input::placeholder{
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus{
  outline: none;
  border-color: #73af8b;
  box-shadow: 0 0 0 4px rgba(77, 154, 114, 0.16);
  background: var(--surface-3);
}

button{
  border: none;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f7fbf8;
  background: linear-gradient(180deg, #5ea67f 0%, #4a8b68 100%);
  box-shadow: 0 10px 22px rgba(22, 42, 31, 0.28);
}

button[type="button"]{
  color: var(--text);
  background: linear-gradient(180deg, #39434f 0%, #313945 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}


textarea{
  width: 100%;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  resize: vertical;
}

.strategy-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 12px;
}


.strategy-card-wide{
  grid-column: span 2;
}


.strategy-card{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 104px;
  padding: 18px;
  text-align: center;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%), var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition:
    transform .16s ease,
    border-color .16s ease,
    background-color .16s ease,
    box-shadow .16s ease;
}



.strategy-card.active{
  background: linear-gradient(180deg, rgba(90, 160, 122, 0.18) 0%, rgba(90, 160, 122, 0.08) 100%), var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(12, 24, 18, 0.36);
}

.strategy-card strong{
  color: var(--heading);
  font-size: 15px;
  text-align: center;
}

.two-col-grid{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

table{
  width: 100%;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

th,
td{
  padding: 10px 11px;
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid #313b46;
}

thead th{
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #2b333d;
}

tbody tr:last-child td{
  border-bottom: none;
}

.etf-row{
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease;
}


.etf-row.selected{
  background: #25372d;
  box-shadow: inset 3px 0 0 var(--accent);
}

.etf-row td{
  vertical-align: middle;
}

.etf-row input{
  width: auto;
  margin-top: 0;
  padding: 0;
  cursor: pointer;
  border: none;
  box-shadow: none;
  background: transparent;
}

.etf-row input[type="radio"],
.etf-row input[type="checkbox"]{
  transform: scale(1.15);
  accent-color: var(--accent);
}

#etf-box{
  align-items: flex-start;
}

#etf-box h2{
  align-self: center;
  margin-bottom: 14px;
}

#etf-tables{
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.etf-table-block + .etf-table-block{
  margin-top: 10px;
}

#etf-info{
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 18px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

#etf-info.is-visible{
  display: grid;
}

.etf-info-card{
  min-width: 0;
  padding: 16px 16px 14px;
  color: var(--text-soft);
  background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.01) 100%), var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.etf-info-card-head{
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.etf-info-card-title{
  color: var(--heading);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.etf-info-card-wkn{
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.etf-info-card-body{
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

#rebalancing-box{
  width: 100%;
  margin-top: 18px;
  padding: 20px;
  color: var(--text-soft);
  background: linear-gradient(180deg, rgba(213,154,58,0.06) 0%, rgba(213,154,58,0.025) 100%), var(--surface-2);
  border: 1px solid #5b4930;
  border-left: 4px solid var(--warning);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

#rebalancing-box h3{
  text-align: left;
  margin-bottom: 14px;
}

.rebalance-note{
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.65;
}

.custom-flex{
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.custom-left{
  flex: 2;
}

.custom-right{
  flex: 1;
}

.add-box{
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
}

.button-stack{
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
}

.result-container{
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.result-box{
  flex: 1 1 auto;
  min-width: 0;
}

.result-side{
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.info-box{
  width: 100%;
  max-width: 340px;
  padding: 26px;
  color: var(--text-soft);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.01) 100%), var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.info-box h3{
  color: var(--heading);
  margin-bottom: 14px;
  text-align: left;
}

.info-box p{
  line-height: 1.65;
}

.info-box hr{
  margin: 18px 0;
  border: none;
  border-top: 1px solid var(--border);
}

#chart-wrap{
  position: relative;
  width: 100%;
  margin-top: 22px;
  padding: 22px 20px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.01) 100%), var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

#avgChart{
  display: block;
  width: 100%;
  /* Höhe wird dynamisch in JS gesetzt */
}

.chart-tooltip{
  position: absolute;
  z-index: 50;
  display: none;
  padding: 10px 12px;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  background: #1e242b;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.28);
  transform: translate(0, -50%);
}

.chart-tooltip .row{
  display: flex;
  justify-content: space-between;
  gap: 10px;
}


/* Touch-optimierte Tooltip-Darstellung */
.is-touch .chart-tooltip {
  min-width: 200px;
  max-width: 280px;
  font-size: 12px;
  padding: 8px 10px;
}

.is-mobile .chart-tooltip {
  font-size: 11px;
  padding: 7px 9px;
}

.is-mobile .chart-tooltip .row {
  font-size: 11px;
}

/* ========================================
   Mobile-optimiertes Modal (Fullscreen)
   ======================================== */

.is-mobile #advanced-sim-modal {
  padding: 0 !important;
}

.is-mobile .advanced-modal-inner {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.is-mobile .advanced-modal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.is-mobile #advanced-overlay-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.is-mobile .advanced-close-btn {
  position: relative;
  z-index: 11;
}

/* Body-Lock für geöffnetes Modal */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}



.chart-tooltip .dot{
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}

.chart-legend{
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-soft);
}

.legend-item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
}

.legend-dot{
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(244,247,251,0.9);
  box-sizing: border-box;
  flex: 0 0 auto;
}

.legend-dot-invested{
  background: #4CAF50;
}

.legend-dot-gain{
  background: #2196F3;
}

.legend-dot-bad-year{
  background: #f4c542;
}

#portfolio-box .saved-portfolio-card,
#saved-portfolios-list > div{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

#calc-btn{
  align-self: center;
  min-width: 220px;
  max-width: 280px;
  margin-top: 22px;
  padding: 14px 18px;
  font-size: 15px;
}

#ergebnis-box{
  align-items: stretch;
}

#ergebnis-box h2{
  margin-bottom: 22px;
}

#vergleich td,
#vergleich th{
  padding-top: 12px;
  padding-bottom: 12px;
}

#info-inputs p,
#info-etfs p{
  margin-bottom: 10px;
}

#info-etfs small{
  color: var(--muted);
  line-height: 1.55;
}



.result-note-box{
  display: none;
  margin-top: 18px;
  padding: 16px 18px;
  color: var(--text-soft);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.01) 100%), var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid #73af8b;
  border-radius: 16px;
  line-height: 1.55;
}

.result-note-box.is-visible{
  display: block;
}


@media (max-width: 1050px){
  body{
    padding: 24px 14px 36px;
  }

  .container{
    max-width: 100%;
  }

  .box{
    padding: 20px;
  }

  .result-container{
    flex-wrap: wrap;
    gap: 18px;
  }

  .result-box,
  .info-box{
    flex: 1 1 100%;
    max-width: 100%;
  }

  #etf-info{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px){
  h2{
    font-size: 24px;
  }

  .strategy-grid{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .two-col-grid{
    grid-template-columns: 1fr;
  }

  .custom-flex{
    flex-direction: column;
  }

  th,
  td{
    padding: 9px 7px;
    font-size: 12px;
  }

  #chart-wrap{
    padding: 14px 12px 8px;
  }

  .screen-center-box{
    margin-top: 20px;
    margin-bottom: 20px;
  }
}
#advanced-sim-modal{
  backdrop-filter: blur(4px);
}

#advanced-sim-modal > div{
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, rgba(255,255,255,0.01) 100%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.42);
}

#advanced-sim-modal h3{
  text-align: left;
}

#advanced-overlay-panel > div{
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

#advanced-overlay-panel > div:last-child{
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

#advanced-sim-modal label{
  display: block;
  width: 100%;
  margin: 12px 0 6px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

#advanced-sim-modal label.inline-check{
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  font-weight: 600;
}

#advanced-sim-modal input[type="checkbox"]{
  width: auto;
  margin: 0;
  padding: 0;
  transform: scale(1.12);
  accent-color: var(--accent);
  background: transparent;
  border: none;
  box-shadow: none;
}

#advanced-sim-modal input[type="text"],
#advanced-sim-modal select{
  width: 100%;
}

#close-advanced-overlay-btn{
  flex: 0 0 auto;
  min-width: 110px;
}

#open-advanced-overlay-btn{
  margin-top: 2px;
}

#tax-overlay-box h3,
#timeline-preview-box h3{
  margin-bottom: 12px;
}

#tax-overlay-content,
#timeline-preview-content{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#tax-overlay-content hr,
#timeline-preview-content hr{
  width: 100%;
  margin: 10px 0 4px;
  border: none;
  border-top: 1px solid var(--border);
}

#tax-overlay-content p,
#timeline-preview-content p{
  margin: 0;
  color: var(--text-soft);
}



#info-inputs button{
  margin-top: 2px;
}

@media (max-width: 760px){
  #advanced-sim-modal{
    padding: 14px !important;
  }

  #advanced-sim-modal > div{
    padding: 18px;
    border-radius: 16px;
  }

  .partial-sale-row .partial-sale-remove-btn{
    width: 100%;
    min-width: 0;
  }
}


.inline-check{
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-check input[type="checkbox"]{
  width: auto;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}



.advanced-open-wrap button{
  margin-top: 0;
}



#timeline-preview-content > div,
#tax-overlay-content > div{
  width: 100%;
}

.timeline-summary-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.timeline-stat-card{
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
}

.timeline-stat-card.is-sale{
  background: linear-gradient(180deg, rgba(213,154,58,0.10) 0%, rgba(213,154,58,0.04) 100%);
  border-color: rgba(213,154,58,0.35);
}

.timeline-stat-card.is-weak{
  background: linear-gradient(180deg, rgba(140,80,80,0.16) 0%, rgba(140,80,80,0.06) 100%);
  border-color: rgba(210,120,120,0.30);
}

.timeline-stat-label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.timeline-stat-value{
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.timeline-card-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-entry-card{
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
}

.timeline-entry-card.is-sale{
  border-left: 4px solid var(--warning);
  background: linear-gradient(180deg, rgba(213,154,58,0.10) 0%, rgba(213,154,58,0.03) 100%);
}

.timeline-entry-card.is-weak{
  box-shadow: inset 0 0 0 1px rgba(210,120,120,0.18);
}

.timeline-entry-card.is-sale.is-weak{
  background:
    linear-gradient(180deg, rgba(213,154,58,0.10) 0%, rgba(213,154,58,0.03) 100%),
    linear-gradient(180deg, rgba(140,80,80,0.10) 0%, rgba(140,80,80,0.03) 100%);
}

.timeline-entry-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.timeline-badge-row{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}


.timeline-entry-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 12px;
}

.timeline-entry-grid p{
  margin: 0;
}

.timeline-extra-row{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.timeline-note{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 760px){
  .timeline-entry-head{
    flex-direction: column;
    align-items: flex-start;
  }

  .timeline-entry-grid,
  .timeline-extra-row,
  .timeline-summary-grid{
    grid-template-columns: 1fr;
  }
}


@media (max-width: 760px){
  .timeline-table-toolbar{
    width: 100%;
  }

  .timeline-table-toolbar button{
    flex: 1 1 100%;
    min-width: 0;
  }
}


.advanced-close-btn{
  width: 42px !important;
  min-width: 42px;
  height: 42px;
  margin-top: 0 !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  border-radius: 12px;
}


.field-error {
  margin-top: 6px;
  color: #ff6b6b;
  font-size: 0.92rem;
}




.advanced-section{
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.advanced-section-no-border{
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.advanced-section-title{
  text-align: left;
  margin-bottom: 10px;
}

.advanced-open-wrap{
  margin-top: 12px;
}

#advanced-overlay-panel{
  display: flex;
  flex-direction: column;
  gap: 0;
}

#advanced-overlay-panel .info-box{
  margin-top: 18px;
}

#tax-overlay-box,
#timeline-preview-box,
#timeline-table-box,
#timeline-details-box{
  width: 100%;
  max-width: none;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.01) 100%),
    var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.timeline-panel-box{
  margin-top: 18px;
}

.timeline-panel-title{
  text-align: left;
  margin: 0 0 12px 0;
}

.timeline-table-head,
.timeline-details-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-table-toolbar{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-table-toolbar button{
  width: auto;
  min-width: 140px;
}

.timeline-table-toolbar button.active{
  background: linear-gradient(180deg, #5ea67f 0%, #4a8b68 100%);
  color: #f7fbf8;
}

.timeline-table-scroll{
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.timeline-big-table{
  width: 100%;
  min-width: 920px;
  margin-top: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.timeline-big-table th,
.timeline-big-table td{
  padding: 9px 10px;
  font-size: 12px;
  white-space: nowrap;
  vertical-align: middle;
}

.timeline-big-table tbody tr.is-sale-row,
.timeline-big-table tbody tr.timeline-row-sale{
  background: rgba(213, 154, 58, 0.10);
}

.timeline-big-table tbody tr.is-sale-row td,
.timeline-big-table tbody tr.timeline-row-sale td{
  border-bottom-color: rgba(213, 154, 58, 0.20);
}

.timeline-big-table tbody tr.is-weak-row{
  box-shadow: inset 3px 0 0 rgba(210,120,120,0.55);
}

.timeline-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.timeline-badge.is-sale,
.timeline-badge-sale{
  color: #f4d39b;
  background: rgba(213, 154, 58, 0.18);
  border: 1px solid rgba(213, 154, 58, 0.28);
}

.timeline-badge.is-weak,
.timeline-badge-weak{
  color: #ffb8b8;
  background: rgba(185, 74, 72, 0.18);
  border: 1px solid rgba(185, 74, 72, 0.28);
}

.timeline-detail-card{
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

.timeline-detail-card.is-sale{
  border-color: rgba(213,154,58,0.45);
  background: linear-gradient(180deg, rgba(213,154,58,0.10) 0%, rgba(213,154,58,0.04) 100%);
}

#timeline-details-toggle-btn{
  width: auto;
  min-width: 150px;
  margin-top: 0;
}

.partial-sales-toolbar{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.partial-sales-toolbar button{
  width: auto;
}

#partial-sales-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.partial-sale-row{
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

.partial-sale-row label{
  margin-top: 0;
}

.partial-sale-row input[type="text"],
.partial-sale-row select{
  width: 100%;
  min-width: 0;
  margin-top: 6px;
}

.partial-sale-row .partial-sale-note{
  min-height: 44px;
}

.partial-sale-row .partial-sale-remove-btn{
  width: auto;
  min-width: 240px;
}

.advanced-close-btn{
  width: 42px !important;
  min-width: 42px;
  height: 42px;
  margin-top: 0 !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  border-radius: 12px;
}

@media (max-width: 760px){
  .timeline-table-head,
  .timeline-details-head{
    flex-direction: column;
    align-items: stretch;
  }

  .timeline-table-toolbar{
    width: 100%;
    flex-direction: column;
  }

  .timeline-table-toolbar button,
  #timeline-details-toggle-btn,
  .partial-sales-toolbar button,
  .partial-sale-row .partial-sale-remove-btn{
    width: 100%;
    min-width: 0;
  }

  .partial-sales-toolbar{
    flex-direction: column;
  }

  .timeline-big-table{
    min-width: 760px;
  }
}





.result-edit-field{
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-edit-field label{
  margin: 0 0 5px;
}

.result-edit-field input,
.result-edit-field select{
  margin-top: 0;
}

.result-input-with-unit{
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background-color .18s ease;
}

.result-input-with-unit:focus-within{
  border-color: #73af8b;
  box-shadow: 0 0 0 4px rgba(77, 154, 114, 0.16);
  background: var(--surface-3);
}

.result-input-with-unit input{
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.result-input-with-unit input:focus{
  border: none;
  box-shadow: none;
  background: transparent;
}

.result-input-unit{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  padding: 0 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,0.04);
  border-left: 1px solid var(--border);
}

.result-input-compact{
  min-height: 40px;
  padding: 8px 11px;
  font-size: 14px;
}

.result-return-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.result-return-field{
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-return-field label{
  margin: 0 0 5px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.result-return-field input{
  margin-top: 0;
}

.result-years-editor{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.result-years-controls{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
}

.result-years-range{
  width: 100%;
  height: 8px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
  border: none;
  box-shadow: none;
}

.result-years-range::-webkit-slider-runnable-track{
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.result-years-range::-moz-range-track{
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.result-years-range::-webkit-slider-thumb{
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.result-years-range::-moz-range-thumb{
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.result-years-range:focus{
  outline: none;
  box-shadow: none;
}

.result-years-range:focus::-webkit-slider-thumb{
  box-shadow: 0 0 0 4px rgba(90, 160, 122, 0.16);
}

.result-years-range:focus::-moz-range-thumb{
  box-shadow: 0 0 0 4px rgba(90, 160, 122, 0.16);
}

.result-years-display{
  color: var(--text-soft);
  font-size: 14px;
  text-align: left;
}

.result-years-meta{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
}

.result-years-meta-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-years-meta-label{
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.result-years-meta-value{
  color: var(--heading);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.result-years-invested{
  color: var(--text-soft);
  font-size: 14px;
  text-align: left;
}

.result-override-hint{
  display: inline-block;
  margin-top: 10px;
  padding: 8px 12px;
  color: var(--warning);
  background: rgba(213, 154, 58, 0.08);
  border: 1px solid rgba(213, 154, 58, 0.25);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}

.result-override-reset{
  display: inline-block;
  margin-top: 12px;
  padding: 0;
  color: var(--accent);
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s ease;
  box-shadow: none;
}


@media (max-width: 760px){
  #result-edit-box{
    padding: 18px;
  }

  .result-edit-grid{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .result-return-grid{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .result-years-controls{
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-input-unit{
    flex-basis: 40px;
  }

  .result-years-meta{
    padding: 10px;
  }
}



.optional-input-details{
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  margin-top: 2px;
}

.optional-input-details summary{
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.optional-input-details summary::-webkit-details-marker{
  display: none;
}

.optional-input-body{
  margin-top: 12px;
}

.optional-input-body input{
  width: 100%;
}




.inline-error {
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: rgba(220, 60, 60, 0.15);
  border: 1px solid rgba(220, 60, 60, 0.4);
  border-radius: var(--radius);
  color: #ff8a8a;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  animation: fadeInError 0.25s ease;
}

@keyframes fadeInError {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}


.field-has-error {
  border-color: rgba(220, 60, 60, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(220, 60, 60, 0.2);
}

.field-error-msg {
  color: #ff8a8a;
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.strategy-page-hint{
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.is-mobile .box { padding: 16px; }

/* ========================================
   1.1 - Hover-Effekte nur auf Pointer-Geräten
   ======================================== */

/* Alle bestehenden Hover-Effekte nur auf feinen Zeigern (Maus) */
@media (hover: hover) and (pointer: fine) {
  button:hover {
    background: linear-gradient(180deg, #68ae88 0%, #4f916d 100%);
    box-shadow: 0 12px 24px rgba(20, 38, 29, 0.32);
    transform: translateY(-1px);
  }
  
  button[type="button"]:hover {
    background: linear-gradient(180deg, #414c5a 0%, #36404c 100%);
  }
  
  .strategy-card:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.015) 100%), var(--surface-3);
    border-color: #5d6d7f;
  }
  
  .etf-row:hover {
    background: #2c343e;
  }
  
  .result-years-range::-webkit-slider-thumb:hover {
    background: var(--accent-strong);
    transform: scale(1.1);
  }
  
  .result-years-range::-moz-range-thumb:hover {
    background: var(--accent-strong);
    transform: scale(1.1);
  }
  
  .result-override-reset:hover {
    color: var(--accent-strong);
    background: none;
    transform: none;
    box-shadow: none;
  }
}

/* Touch-Feedback: Active-States für sofortiges visuelles Feedback */
.is-touch button:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.is-touch .strategy-card:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

.is-touch .etf-row:active {
  background: #2c343e;
}

/* ========================================
   1.2 - Touch-Targets auf 44×44px minimum
   ======================================== */

.is-touch button {
  min-height: 48px;
}

.is-touch input,
.is-touch select,
.is-touch textarea {
  min-height: 48px;
  padding: 14px;
  font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
}

.is-touch .inline-check {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.is-touch .strategy-card {
  min-height: 64px;
}

.is-touch .etf-row td {
  padding: 14px 10px;
}

.is-touch table th,
.is-touch table td {
  padding: 12px 10px;
  font-size: 13px;
}

/* ========================================
   1.3 - Safe-Area-Insets für Notch/Punch-Hole
   ======================================== */

/* Desktop: Standard Padding mit Safe-Area-Support */
body {
  padding: calc(40px + env(safe-area-inset-top)) 18px calc(56px + env(safe-area-inset-bottom));
}

/* Mobil: Reduziertes Padding mit Safe-Area-Support */
.is-mobile body {
  padding: calc(16px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
}

/* Zusätzlich: Safe-Area für seitliche Insets */
@supports (padding: max(0px)) {
  body {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
  
  .is-mobile body {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}


/* ========================================
   Mobile-Back-Button (persistent am unteren Rand)
   ======================================== */

.mobile-back-bar {
  display: none; /* Standardmäßig versteckt */
}

.is-mobile .mobile-back-bar {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(
    to top,
    rgba(11, 14, 17, 0.98) 0%,
    rgba(11, 14, 17, 0.95) 70%,
    rgba(11, 14, 17, 0) 100%
  );
  pointer-events: none;
}

.mobile-back-btn {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
}

.mobile-back-btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.mobile-back-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Back-Button auf Startseite verstecken */
.is-mobile.at-start .mobile-back-bar {
  display: none;
}



/* ----------------------------------------
   Ergebnisseite: Sidebar in 2 Spalten
   ---------------------------------------- */
.is-tablet .result-side {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
 
/* result-edit-box und result-info-box nebeneinander */
.is-tablet .result-side > * {
  margin: 0;
}
 
/* ----------------------------------------
   Custom-ETF-Builder: Row-Layout
   ---------------------------------------- */
.is-tablet .custom-flex {
  flex-direction: row;
  gap: 16px;
}
 
.is-tablet .custom-left {
  flex: 1.5;
}
 
.is-tablet .custom-right {
  flex: 1;
}
 
/* ----------------------------------------
   ETF-Info-Cards: 2-spaltig
   ---------------------------------------- */
.is-tablet #etf-info {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
 
/* ----------------------------------------
   Rebalancing-Box: Custom-Flex in Row
   ---------------------------------------- */
.is-tablet #rebalancing-box .custom-flex {
  flex-direction: row;
}
 
/* ----------------------------------------
   Strategy-Grid: 2-spaltig
   ---------------------------------------- */
.is-tablet .strategy-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
 
/* Falls strategy-grid bereits ein two-col-grid ist, beibehalten */
.is-tablet .strategy-grid.two-col-grid {
  grid-template-columns: repeat(2, 1fr);
}
 
/* ----------------------------------------
   Timeline-Summary: 2-spaltig
   ---------------------------------------- */
.is-tablet .timeline-summary-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
 
.is-tablet .timeline-entry-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
 
/* ----------------------------------------
   Allgemeine Tablet-Optimierungen
   ---------------------------------------- */
.is-tablet .two-col-grid {
  grid-template-columns: repeat(2, 1fr);
}
 
.is-tablet .box {
  padding: 22px;
}
 
.is-tablet h2 {
  font-size: 26px;
  margin-bottom: 16px;
}
 
.is-tablet h3 {
  font-size: 18px;
  margin-bottom: 12px;
}
 
.is-tablet .result-container {
  flex-wrap: wrap;
  gap: 18px;
}
 
/* result-box soll auf Tablet volle Breite haben */
.is-tablet .result-box {
  flex: 1 1 100%;
}
 
/* Chart-Wrap etwas mehr Padding */
.is-tablet #chart-wrap {
  padding: 14px 12px 10px;
}
 
/* Buttons etwas größer */
.is-tablet button {
  font-size: 15px;
  padding: 13px 22px;
}
 
/* Tabellen-Schrift */
.is-tablet table th {
  padding: 10px 8px;
  font-size: 13px;
}
 
.is-tablet table td {
  padding: 10px 8px;
  font-size: 14px;
}
 
/* Container-Höhe */
.is-tablet .container {
  min-height: calc(100vh - 100px);
}
 




/* ========================================
   1.4 - Mobile-spezifische Layout-Anpassungen
   ======================================== */

.is-mobile h2 {
  font-size: 22px;
  margin-bottom: 14px;
}

.is-mobile h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.is-mobile .result-container {
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.is-mobile .result-box,
.is-mobile .result-side,
.is-mobile .info-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.is-mobile .info-box {
  padding: 12px 10px;
  border-radius: 14px;
}

.is-mobile .custom-flex {
  flex-direction: column;
  gap: 14px;
}

.is-mobile #chart-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 8px 8px;
  overflow: hidden;
  border-radius: 14px;
  box-sizing: border-box;
}

.is-mobile .chart-legend {
  font-size: 10px;
  gap: 6px;
  line-height: 1.35;
}

.is-mobile .strategy-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.is-mobile .two-col-grid {
  grid-template-columns: 1fr;
}

.is-mobile .button-stack button {
  font-size: 15px;
}

.is-mobile .container {
  min-height: auto;
  width: 100%;
  max-width: 100%;
}

.is-mobile #avgChart {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: 220px;
}



/* ========================================
   1.5 - Tablet-spezifische Anpassungen (760px-1050px)
   ======================================== */

.is-tablet .strategy-grid.two-col-grid {
  grid-template-columns: repeat(2, 1fr);
}

.is-tablet .result-container {
  flex-wrap: wrap;
  gap: 18px;
}

.is-tablet .custom-flex {
  flex-direction: row;
  gap: 16px;
}

.is-tablet .box {
  padding: 22px;
}

.is-tablet h2 {
  font-size: 26px;
}

.is-tablet .strategy-card {
  min-height: 84px;
}


/* ========================================
   1.6 - Landscape-Modus auf Mobilgeräten
   ======================================== */

.is-mobile.is-landscape body {
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.is-mobile.is-landscape .screen-center-box {
  margin-top: 10px;
  margin-bottom: 10px;
}

.is-mobile.is-landscape #avgChart {
  height: 200px;
}

.is-mobile.is-landscape .strategy-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.is-mobile.is-landscape .box {
  padding: 14px;
}


/* ========================================
   1.7 - Scroll-Verhalten & Performance
   ======================================== */

/* Smooth Scrolling nur wenn keine reduced-motion Präferenz */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Touch-Scrolling-Optimierung */
.is-touch .box,
.is-touch .result-container,
.is-touch #etf-tables,
.is-touch .timeline-table-wrapper {
  -webkit-overflow-scrolling: touch;
}

/* Verhindert Durch-Scrollen bei Modals/Overlays */
.is-touch .modal,
.is-touch .overlay,
.is-touch .advanced-overlay {
  overscroll-behavior: contain;
}

/* Container mit Scroll-Unterstützung */
.is-touch .timeline-big-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}





/* ========================================
   2.5 - Chart Touch-Optimierungen
   ======================================== */

.is-touch #avgChart {
  touch-action: pan-y; /* Erlaubt vertikales Scrollen, verhindert Zoom */
  cursor: default;
}

.is-touch .chart-tooltip {
  pointer-events: none; /* Tooltip blockiert keine Touch-Events */
  transition: opacity 0.15s ease; /* Sanftes Ein-/Ausblenden */
}



/* ========================================
   Scrollbare Tabellen mit Fade-Indicator
   ======================================== */
/* Füge nach den Tabellen-Styles ein (ca. nach Zeile 600 in style.css) */

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

/* Fade-Indicator am rechten Rand (nur auf Mobile) */
.is-mobile .table-scroll-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32px;
  background: linear-gradient(to left, var(--surface), transparent);
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* Indicator ausblenden wenn am Ende gescrollt */
.table-scroll-wrap.scrolled-end::after {
  opacity: 0;
}

/* Tabelle innerhalb des Wrappers */
.table-scroll-wrap table {
  margin: 0;
  min-width: 600px; /* Verhindert Quetschen auf sehr kleinen Screens */
}


/* Timeline-Table-Scroll auch mit der Klasse ausstatten */
.timeline-table-scroll {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.is-mobile .timeline-table-scroll::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 32px;
  background: linear-gradient(to left, var(--surface), transparent);
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.timeline-table-scroll.scrolled-end::after {
  opacity: 0;
}






/* ========================================
   Portrait vs. Landscape auf Tablet
   ======================================== */
/* Füge NACH den Tablet-Styles ein */

/* ----------------------------------------
   Portrait-Modus (768px breit, hochkant)
   ---------------------------------------- */
.is-tablet.is-portrait .result-container {
  flex-direction: column;
}

.is-tablet.is-portrait .result-side {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
  gap: 14px;
}

.is-tablet.is-portrait .custom-flex {
  flex-direction: column;
}

.is-tablet.is-portrait .strategy-grid {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
}

.is-tablet.is-portrait #etf-info {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
}

.is-tablet.is-portrait .timeline-summary-grid,
.is-tablet.is-portrait .timeline-entry-grid {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
}

/* ----------------------------------------
   Landscape-Modus (1024px breit, quer)
   ---------------------------------------- */
.is-tablet.is-landscape .result-container {
  flex-direction: row;
  flex-wrap: wrap;
}

.is-tablet.is-landscape .result-side {
  grid-template-columns: 1fr 1fr; /* 2-spaltig im Landscape */
  gap: 16px;
}

.is-tablet.is-landscape .custom-flex {
  flex-direction: row;
}

.is-tablet.is-landscape .strategy-grid {
  grid-template-columns: repeat(2, 1fr); /* 2-spaltig im Landscape */
}

.is-tablet.is-landscape #etf-info {
  grid-template-columns: repeat(2, 1fr); /* 2-spaltig im Landscape */
}

.is-tablet.is-landscape .timeline-summary-grid,
.is-tablet.is-landscape .timeline-entry-grid {
  grid-template-columns: repeat(2, 1fr); /* 2-spaltig im Landscape */
}

/* result-box nimmt volle Breite, dann Sidebar darunter */
.is-tablet.is-landscape .result-box {
  flex: 1 1 100%;
}

.is-tablet.is-landscape .result-side {
  flex: 1 1 100%;
}




/* ========================================
   Portrait vs. Landscape auf Tablet
   KORRIGIERTE VERSION
   ======================================== */
/* Füge NACH den Tablet-Styles ein */

/* WICHTIG: device.js setzt die Klassen auf <html>, nicht auf <body>
   Daher verwenden wir den :root Selektor oder html.is-tablet */

/* ----------------------------------------
   Portrait-Modus (768px breit, hochkant)
   ---------------------------------------- */
html.is-tablet.is-portrait .result-container {
  flex-direction: column;
}

html.is-tablet.is-portrait .result-side {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
  gap: 14px;
}

html.is-tablet.is-portrait .custom-flex {
  flex-direction: column;
}

html.is-tablet.is-portrait .strategy-grid {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
}

html.is-tablet.is-portrait #etf-info {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
}

html.is-tablet.is-portrait .timeline-summary-grid,
html.is-tablet.is-portrait .timeline-entry-grid {
  grid-template-columns: 1fr; /* 1-spaltig im Portrait */
}

html.is-tablet.is-portrait .two-col-grid {
  grid-template-columns: 1fr;
}

/* ----------------------------------------
   Landscape-Modus (1024px breit, quer)
   ---------------------------------------- */
html.is-tablet.is-landscape .result-container {
  flex-direction: row;
  flex-wrap: wrap;
}

html.is-tablet.is-landscape .result-side {
  grid-template-columns: 1fr 1fr; /* 2-spaltig im Landscape */
  gap: 16px;
}

html.is-tablet.is-landscape .custom-flex {
  flex-direction: row;
}

html.is-tablet.is-landscape .strategy-grid {
  grid-template-columns: repeat(2, 1fr); /* 2-spaltig im Landscape */
}

html.is-tablet.is-landscape #etf-info {
  grid-template-columns: repeat(2, 1fr); /* 2-spaltig im Landscape */
}

html.is-tablet.is-landscape .timeline-summary-grid,
html.is-tablet.is-landscape .timeline-entry-grid {
  grid-template-columns: repeat(2, 1fr); /* 2-spaltig im Landscape */
}

html.is-tablet.is-landscape .two-col-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* result-box nimmt volle Breite, dann Sidebar darunter */
html.is-tablet.is-landscape .result-box {
  flex: 1 1 100%;
}

html.is-tablet.is-landscape .result-side {
  flex: 1 1 100%;
}

/* ----------------------------------------
   Alternative: Native CSS Media Queries
   (falls device.js nicht läuft)
   ---------------------------------------- */

/* Portrait-spezifisch */
@media (orientation: portrait) and (min-width: 760px) and (max-width: 1050px) {
  .result-container {
    flex-direction: column;
  }
  
  .result-side {
    grid-template-columns: 1fr;
  }
  
  .strategy-grid {
    grid-template-columns: 1fr;
  }
  
  #etf-info {
    grid-template-columns: 1fr;
  }
  
  .timeline-summary-grid,
  .timeline-entry-grid {
    grid-template-columns: 1fr;
  }
  
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

/* Landscape-spezifisch */
@media (orientation: landscape) and (min-width: 760px) and (max-width: 1050px) {
  .result-container {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .result-side {
    grid-template-columns: 1fr 1fr;
  }
  
  .strategy-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #etf-info {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .timeline-summary-grid,
  .timeline-entry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .two-col-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}



/* ========================================
   Typografie-Feintuning pro Gerät
   ======================================== */
/* Optional: Füge nach den Device-spezifischen Styles ein */

/* ----------------------------------------
   Mobile: Kompakte, lesbare Schrift
   ---------------------------------------- */
.is-mobile {
  font-size: 15px;
  line-height: 1.5;
}

.is-mobile h1 {
  font-size: 24px;
  line-height: 1.2;
  margin-bottom: 16px;
}

.is-mobile h2 {
  font-size: 20px;
  line-height: 1.3;
  margin-bottom: 14px;
}

.is-mobile h3 {
  font-size: 16px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.is-mobile p {
  margin-bottom: 12px;
}

.is-mobile button {
  font-size: 15px;
  font-weight: 600;
}

.is-mobile label {
  font-size: 14px;
  font-weight: 600;
}

.is-mobile input,
.is-mobile select {
  font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
}

/* ----------------------------------------
   Tablet: Ausgewogene Schrift
   ---------------------------------------- */
.is-tablet {
  font-size: 16px;
  line-height: 1.6;
}

.is-tablet h1 {
  font-size: 32px;
  line-height: 1.2;
  margin-bottom: 20px;
}

.is-tablet h2 {
  font-size: 26px;
  line-height: 1.3;
  margin-bottom: 16px;
}

.is-tablet h3 {
  font-size: 18px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.is-tablet p {
  margin-bottom: 14px;
}

.is-tablet button {
  font-size: 15px;
  font-weight: 600;
}

.is-tablet label {
  font-size: 14px;
  font-weight: 600;
}

.is-tablet input,
.is-tablet select {
  font-size: 16px;
}

/* ----------------------------------------
   Desktop: Großzügige Schrift
   ---------------------------------------- */
.is-desktop {
  font-size: 16px;
  line-height: 1.65;
}

.is-desktop h1 {
  font-size: 38px;
  line-height: 1.2;
  margin-bottom: 24px;
}

.is-desktop h2 {
  font-size: 30px;
  line-height: 1.3;
  margin-bottom: 18px;
}

.is-desktop h3 {
  font-size: 20px;
  line-height: 1.4;
  margin-bottom: 14px;
}

.is-desktop p {
  margin-bottom: 16px;
}

.is-desktop button {
  font-size: 16px;
  font-weight: 600;
}

.is-desktop label {
  font-size: 14px;
  font-weight: 600;
}

.is-desktop input,
.is-desktop select {
  font-size: 16px;
}

/* ----------------------------------------
   Spezielle Text-Elemente
   ---------------------------------------- */

/* Hinweis-Texte */
.is-mobile .rebalance-note,
.is-mobile .info-text {
  font-size: 13px;
  line-height: 1.5;
}

.is-tablet .rebalance-note,
.is-tablet .info-text {
  font-size: 14px;
  line-height: 1.6;
}

.is-desktop .rebalance-note,
.is-desktop .info-text {
  font-size: 14px;
  line-height: 1.65;
}

/* Chart-Legende */
.is-mobile .chart-legend {
  font-size: 11px;
}

.is-tablet .chart-legend {
  font-size: 12px;
}

.is-desktop .chart-legend {
  font-size: 13px;
}

/* Tabellen-Text */
.is-mobile table {
  font-size: 12px;
}

.is-tablet table {
  font-size: 14px;
}

.is-desktop table {
  font-size: 15px;
}




/* ========================================
   Mobile Slider / Result-Duration-Slot
   ======================================== */

#result-mobile-duration-slot{
  display: none;
}

.is-mobile #result-mobile-duration-slot{
  display: block;
  margin-top: 12px;
  margin-bottom: 14px;
}

.is-desktop #result-mobile-duration-slot,
.is-tablet #result-mobile-duration-slot{
  display: none !important;
}

.is-mobile .result-years-range{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  touch-action: pan-x;
  -webkit-user-select: none;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.is-mobile body{
  padding-bottom: 92px;
}


html.is-mobile,
html.is-mobile body {
  overflow-x: hidden;
}

.is-mobile #ergebnis-box {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.is-mobile #ergebnis-box > * {
  min-width: 0;
}

.is-mobile .result-compare-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.is-mobile .result-compare-scroll table {
  min-width: 520px;
  margin-top: 0;
}

.is-mobile .result-compare-scroll::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  pointer-events: none;
  background: linear-gradient(to left, var(--surface), transparent);
}

.is-mobile .result-years-editor,
.is-mobile .result-years-controls,
.is-mobile .result-years-meta,
.is-mobile .result-edit-box,
.is-mobile .result-edit-section,
.is-mobile .result-edit-grid,
.is-mobile .result-edit-field,
.is-mobile .result-input-with-unit {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.is-mobile .result-years-meta-row {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.is-mobile .result-years-meta-value {
  text-align: left;
}

.is-mobile input,
.is-mobile select,
.is-mobile textarea,
.is-mobile button {
  max-width: 100%;
}


.is-mobile input[type="range"]{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  touch-action: manipulation;
}

.is-mobile #etf-tables,
.is-mobile .etf-selection-wrap,
.is-mobile .etf-table-wrap,
.is-mobile .etf-ui-wrap,
.is-mobile .etf-box,
.is-mobile .etf-card,
.is-mobile .etf-table-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.is-mobile .etf-table-wrap,
.is-mobile .etf-table-box {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.is-mobile .etf-table-wrap table,
.is-mobile .etf-table-box table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.is-mobile .etf-table-wrap th,
.is-mobile .etf-table-wrap td,
.is-mobile .etf-table-box th,
.is-mobile .etf-table-box td {
  padding: 8px 6px;
  font-size: 12px;
  word-break: break-word;
}




.is-mobile body{
  padding-left: 8px;
  padding-right: 8px;
}

.is-mobile .container{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
}

.is-mobile .box,
.is-mobile .screen-center-box,
.is-mobile .box-small,
.is-mobile .box-medium,
.is-mobile .box-large {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}



.is-mobile #main-category-box,
.is-mobile #mode-box,
.is-mobile #strategy-box,
.is-mobile #finder-box,
.is-mobile #strategy-result-box,
.is-mobile #etf-box {
  margin-left: auto;
  margin-right: auto;
}

.is-mobile #main-category-box .strategy-grid,
.is-mobile #mode-box .strategy-grid {
  width: 100%;
  justify-items: center;
}

.is-mobile #main-category-box .strategy-card,
.is-mobile #mode-box .strategy-card {
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.is-mobile * {
  min-width: 0;
}

.is-mobile img,
.is-mobile canvas,
.is-mobile svg {
  max-width: 100%;
  height: auto;
}

.is-mobile table {
  max-width: 100%;
}



.is-mobile .result-years-editor,
.is-mobile .result-years-controls,
.is-mobile .result-years-field,
.is-mobile .result-years-slider-wrap{
  position: relative;
  z-index: 4;
  overflow: visible;
}

.is-mobile #chart-wrap,
.is-mobile .chart-legend,
.is-mobile .result-note-box{
  position: relative;
  z-index: 1;
}

.is-mobile .result-years-range{
  touch-action: pan-x;
}


.is-mobile #main-category-box{
  display: flex;
  justify-content: center;
  align-items: center;
}

.is-mobile #main-category-box .strategy-grid{
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  justify-items: center;
  align-items: stretch;
}

.is-mobile #main-category-box .strategy-card{
  width: 100%;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}


.is-mobile #mode-box{
  display: flex;
  justify-content: center;
  align-items: center;
}

.is-mobile #mode-box .strategy-grid{
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  justify-items: center;
}

.is-mobile #mode-box .strategy-card{
  width: 100%;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}


.is-mobile .etf-mobile-scroll{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.is-mobile #etf-tables{
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.is-mobile #etf-tables > *{
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.is-mobile #etf-tables table{
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.is-mobile #etf-tables th,
.is-mobile #etf-tables td{
  padding: 8px 6px;
  font-size: 12px;
  white-space: normal;
  word-break: break-word;
  box-sizing: border-box;
}



.is-mobile .etf-card,
.is-mobile .etf-box,
.is-mobile .etf-table-box,
.is-mobile .etf-selection-wrap{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
