:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --bg-elev: #1c2230;
  --border: #2a3140;
  --text: #e6edf3;
  --muted: #8b949e;
  --primary: #2f81f7;
  --primary-hover: #4493f8;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { text-align: right; }

/* ---- Buttons ---- */
.btn {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #232a3a; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.block { width: 100%; margin-bottom: 10px; text-align: left; }
.btn.small { padding: 6px 10px; font-size: 12px; }
a.btn { text-decoration: none; display: inline-block; }

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  width: 360px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; font-size: 24px; text-align: center; }
.login-card p { margin: 0 0 8px; text-align: center; }
.login-card .login-link { text-align: center; font-size: 13px; color: var(--muted); }
.login-card .login-link:hover { color: var(--text); }
.login-card .notice { font-size: 13px; }
#fgStep2 { display: flex; flex-direction: column; gap: 14px; }
.login-card label, .modal-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--muted);
}
input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  outline: none;
}
input:focus, select:focus { border-color: var(--primary); }

/* ---- App layout ---- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 20px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.sidebar-spacer { flex: 1; }
.user-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.user-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.role-badge { font-size: 10px; padding: 1px 7px; border-radius: 20px; width: fit-content; text-transform: uppercase; letter-spacing: .5px; }
.role-badge.admin { background: rgba(219,97,162,.18); color: #db61a2; }
.role-badge.normal { background: rgba(47,129,247,.15); color: var(--primary-hover); }

.content { flex: 1; padding: 24px 32px; max-width: 1400px; }
.content h2 { margin: 0 0 20px; }

/* ---- Dashboard sekmeleri ---- */
.dash-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.dash-tabs .tab { background: transparent; border: none; color: var(--muted); padding: 10px 18px; cursor: pointer; font-size: 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dash-tabs .tab:hover { color: var(--text); }
.dash-tabs .tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

/* ---- Cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.card-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card-value { font-size: 24px; font-weight: 600; }
/* Son snapshot'a gore yon gostergesi (canli deger yaninda) */
.snap-ind { font-size: 0.6em; margin-left: 8px; vertical-align: middle; line-height: 1; }
.snap-ind.up { color: var(--green, #3fb950); }
.snap-ind.down { color: var(--red, #f85149); }
.snap-ind.flat { color: #58a6ff; }
.card.clickable { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card.clickable:hover { border-color: var(--accent, #2f81f7); transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.card.highlight { background: linear-gradient(135deg, rgba(47,129,247,0.18), rgba(47,129,247,0.04)); border-color: var(--accent, #2f81f7); }
.card-spark { margin-top: 10px; height: 36px; }
.card-spark svg { width: 100%; height: 36px; display: block; overflow: visible; }
.card-spark .spark-empty { color: var(--muted); font-size: 11px; line-height: 36px; }

/* ---- Genel% sekmesi (buyuk kartlar + yuzde grafikleri) ---- */
.cards.cards-lg { grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 20px; }
.pct-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.pct-info { flex: 1; min-width: 260px; margin: 0; }
.pct-card { padding: 20px 22px; }
.pct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pct-card .card-value { font-size: 22px; }
.pct-big { font-size: 26px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.pct-chart { margin-top: 14px; }
.pct-chart .zeroline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }

/* ---- Basarimlar ---- */
.achv-banner { background: linear-gradient(135deg, rgba(255,215,0,0.18), rgba(255,215,0,0.04)); border: 1px solid #ffd700; color: #ffe680; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.achv-level { display: flex; align-items: center; gap: 16px; }
.achv-level-badge { flex-shrink: 0; width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #0d1117; background: linear-gradient(135deg, #ffd700, #d29922); }
.achv-level-info { flex: 1; min-width: 0; }
.achv-level-name { font-size: 18px; font-weight: 700; }
.achv-pts-total { font-size: 13px; font-weight: 600; color: var(--accent, #2f81f7); margin-left: 6px; }
.achv-level-bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; margin: 8px 0 6px; }
.achv-level-bar span { display: block; height: 100%; background: linear-gradient(90deg, #2f81f7, #3fb950); border-radius: 6px; }
.achv-level-sub { font-size: 12px; color: var(--muted); }

.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.achv-card { display: flex; gap: 12px; padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); }
.achv-card.locked { opacity: 0.55; filter: grayscale(0.7); }
.achv-card.unlocked.tier-bronze { border-color: #cd7f32; box-shadow: 0 0 0 1px rgba(205,127,50,0.25); }
.achv-card.unlocked.tier-silver { border-color: #b8c0c8; box-shadow: 0 0 0 1px rgba(184,192,200,0.25); }
.achv-card.unlocked.tier-gold { border-color: #ffd700; box-shadow: 0 0 0 1px rgba(255,215,0,0.3); }
.achv-icon { font-size: 30px; line-height: 1; flex-shrink: 0; }
.achv-main { flex: 1; min-width: 0; }
.achv-title { font-weight: 600; font-size: 14px; }
.achv-desc { font-size: 12px; color: var(--muted); margin: 3px 0 7px; }
.achv-pts { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.achv-pts.tier-bronze { color: #cd7f32; background: rgba(205,127,50,0.15); }
.achv-pts.tier-silver { color: #c7ced6; background: rgba(184,192,200,0.15); }
.achv-pts.tier-gold { color: #ffd700; background: rgba(255,215,0,0.15); }
.achv-date { font-size: 12px; color: var(--green); font-weight: 600; }
.achv-date.locked { color: var(--muted); font-weight: 400; }
.achv-progress { height: 6px; background: var(--bg); border-radius: 5px; overflow: hidden; margin-bottom: 4px; }
.achv-progress span { display: block; height: 100%; background: var(--accent, #2f81f7); border-radius: 5px; }
.achv-prog-sub { font-size: 11px; color: var(--muted); }
.card.highlight .card-value { color: var(--accent, #2f81f7); font-size: 28px; }
.card-sub { font-size: 13px; margin-top: 4px; color: var(--muted); }
#genTotalUsd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#genTotalUsd .ng-val { white-space: nowrap; }
.pos { color: var(--green) !important; }
.neg { color: var(--red) !important; }
.price-old-flag { color: var(--yellow); font-weight: 700; margin-left: 3px; cursor: help; }

/* ---- Panels & tables ---- */
.panel { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 20px; }
.panel h3 { margin: 0 0 14px; font-size: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }

/* Grafik donem secici (1A/3A/6A/1Y/Tumu) */
.range-btns { display: flex; gap: 4px; }
.range-btns button { background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.range-btns button:hover { color: var(--text); background: #232a3a; }
.range-btns button.active { color: var(--text); background: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ---- Pie chart ---- */
.chart-wrap { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.pie { width: 200px; height: 200px; flex-shrink: 0; }
.pie svg { width: 100%; height: 100%; }
.pie-lg { width: 260px; height: 260px; }
.pie-pct { fill: #fff; font-size: 11px; font-weight: 700; pointer-events: none; }
.pie-center-lbl { fill: var(--muted); font-size: 11px; }
.pie-center-val { fill: var(--text, #e6edf3); font-size: 17px; font-weight: 700; }
.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 160px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-item .lg-name { font-weight: 600; }
.legend-item .lg-val { margin-left: auto; color: var(--muted); }
.chart-empty { color: var(--muted); padding: 30px 0; }

/* ---- Zaman serisi (cizgi grafik) ---- */
.value-chart { position: relative; width: 100%; }
.value-chart svg { width: 100%; height: auto; display: block; }
.value-chart .grid { stroke: var(--border); stroke-width: 1; }
.value-chart .ytick { fill: var(--muted); font-size: 11px; text-anchor: end; }
.value-chart .xtick { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.value-chart .vline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.value-chart .livelbl { fill: var(--green); font-size: 11px; font-weight: 600; }
.chart-legend { display: flex; gap: 18px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.chart-legend .cl-item { display: flex; align-items: center; gap: 6px; }
.chart-legend .cl-line { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend .cl-line.dash { background: repeating-linear-gradient(90deg, #d29922 0 4px, transparent 4px 7px) !important; }
.vc-tip { position: absolute; transform: translate(-50%, -130%); background: var(--bg); border: 1px solid var(--primary); border-radius: 8px; padding: 6px 10px; font-size: 12px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); z-index: 5; }
.vc-tip strong { color: var(--primary-hover); }

/* ---- Filtreler ---- */
.filters { display: flex; gap: 8px; }
.filters select { padding: 6px 8px; font-size: 12px; }

/* ---- Temettu istatistikleri ---- */
.div-stats { display: flex; flex-direction: column; gap: 14px; }
.div-year { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.div-year-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.div-year-head .yr { font-size: 16px; font-weight: 600; }
.div-year-head .yr-right { display: flex; flex-direction: column; align-items: flex-end; }
.div-year-head .yr-total { font-size: 16px; font-weight: 600; color: var(--green); }
.div-year-head .yr-avg { font-size: 11px; color: var(--muted); }
.div-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.div-month { text-align: center; padding: 6px 2px; border-radius: 6px; background: var(--bg-elev); }
.div-month.zero { opacity: .35; }
.div-month .m { font-size: 10px; color: var(--muted); display: block; }
.div-month .v { font-size: 12px; font-weight: 600; }
@media (max-width: 600px) { .div-months { grid-template-columns: repeat(4, 1fr); } }
/* ---- Temettu geliri sekmesi ---- */
#tmEstimated { margin-bottom: 20px; }
.tm-bars { display: flex; flex-direction: column; gap: 8px; }
.tm-bar-row { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; }
.tm-bar-yr { font-weight: 600; }
.tm-bar-track { display: flex; height: 18px; border-radius: 4px; background: var(--bg-elev); overflow: hidden; }
.tm-bar-seg { height: 100%; }
.tm-bar-val { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
.tm-years { display: flex; flex-direction: column; }
.tm-year > summary { list-style: none; cursor: pointer; }
.tm-year > summary::-webkit-details-marker { display: none; }
.tm-year-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tm-year-head .tm-yr { font-size: 20px; font-weight: 600; }
.tm-year-head .tm-yr::before { content: '▸ '; color: var(--muted); }
.tm-year[open] .tm-year-head .tm-yr::before { content: '▾ '; }
.tm-yr-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.tm-yr-total { font-size: 18px; font-weight: 600; color: var(--green); }
.tm-yr-avg { font-size: 12px; color: var(--muted); }
.tm-yr-avg strong { color: var(--text); }
.tm-year[open] .tm-year-head { margin-bottom: 14px; }
.tm-sub-h { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.tm-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tm-month { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tm-month.zero { opacity: .4; }
.tm-month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tm-month-head .m { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tm-month-head .v { font-size: 15px; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.tm-month.zero .tm-month-head .v { color: var(--muted); }
.tm-month-empty { font-size: 11px; color: var(--muted); }
.tm-month-split { font-size: 11px; color: var(--muted); }
.tm-month-syms { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--border); padding-top: 6px; }
.tm-sym { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; }
.tm-sym .sym { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tm-sym .sym i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tm-sym .amt { text-align: right; font-variant-numeric: tabular-nums; }
.tm-sym .usd { display: block; font-size: 10px; color: var(--muted); }
.tm-mini { height: 3px; background: var(--bg-elev); border-radius: 2px; }
.tm-mini > div { height: 100%; background: var(--green); border-radius: 2px; }
@media (max-width: 1100px) { .tm-months { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .tm-months { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .tm-yr-meta { align-items: flex-start; text-align: left; } }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
tbody tr:hover { background: var(--bg-elev); }
.empty-row td { text-align: center; color: var(--muted); padding: 18px; }
.total-row td { border-top: 2px solid var(--border); background: var(--bg-elev); }
.total-row:hover { background: var(--bg-elev); }

/* ---- Sayfalama ---- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pager:empty { display: none; }
.pager button { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.pager button:hover:not(:disabled) { background: #232a3a; }
.pager button:disabled { opacity: .4; cursor: default; }

.tag { padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.tag.normal { background: rgba(47,129,247,.15); color: var(--primary-hover); }
.tag.temettu { background: rgba(63,185,80,.15); color: var(--green); }
.tag.bedelsiz { background: rgba(163,113,247,.15); color: #a371f7; }
.tag.bedelli { background: rgba(240,136,62,.15); color: #f0883e; }
.tag.cash { background: rgba(210,153,34,.15); color: var(--yellow); }
.tag.dividend { background: rgba(63,185,80,.15); color: var(--green); }
.tag.buy { background: rgba(47,129,247,.15); color: var(--primary-hover); }
.tag.withdraw { background: rgba(248,81,73,.15); color: var(--red); }

.del-btn, .edit-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.del-btn:hover { color: var(--red); }
.edit-btn:hover { color: var(--primary-hover); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 520px; max-width: 100%; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.modal-card.wide { width: 680px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.x { background: none; border: none; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; }
.x:hover { color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .full { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; }

.calc-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; gap: 30px; }
.calc-box-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 30px; }
.calc-box span { color: var(--muted); }
.info-box { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--muted); }

/* ---- Hesap makinesi sonucu ---- */
.calc-result { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.calc-result .cr-row { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.calc-result .cr-row span { color: var(--muted); }
.calc-result .cr-row strong { font-weight: 600; }
.calc-result .cr-big { font-size: 18px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; cursor: pointer; }
.checkbox-row input { width: auto; }
.info-box.has-data { border-color: var(--primary); color: var(--text); }

.error { color: var(--red); font-size: 13px; }
