:root {
    --bg: #0b1020;
    --panel: rgba(255, 255, 255, 0.05);
    --panel-solid: #131a31;
    --line: rgba(255, 255, 255, 0.09);
    --text: #e8ecf8;
    --muted: #8f9ab8;
    --accent: #22d3a5;
    --accent2: #7c6cff;
    --pos: #2ee59d;
    --neg: #ff6b81;
    --warn: #ffc857;
    --info: #5ab0ff;
    --radius: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color: var(--text);
    background: radial-gradient(1200px 600px at 10% -10%, #1d2a5c 0%, transparent 60%),
        radial-gradient(900px 500px at 100% 0%, #3a1f6b 0%, transparent 55%), var(--bg);
    min-height: 100vh;
}
h1, h2, h3 { margin: 0; }
a { color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 140px; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0; }
.msg { margin: 0; min-height: 1.2em; color: var(--neg); font-size: 0.9rem; }
.msg.ok { color: var(--pos); }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
input, select, textarea {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    min-width: 0;
}
select option { background: #131a31; color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--accent2); outline-offset: 0; }

.btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font: inherit;
    cursor: pointer;
    transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.13); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #12a8d8); color: #04221b; border: 0; font-weight: 600; }
.btn.danger { color: var(--neg); }
.btn.sm { padding: 5px 10px; font-size: 0.82rem; border-radius: 8px; }
.btn.ghost { background: transparent; }

/* Giriş ekranı */
.auth-view { min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 40px; padding: 40px 6vw; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.15; margin: 24px 0 16px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 560px; line-height: 1.6; }
.hero-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: var(--text); }
.auth-card { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); border-radius: 22px; padding: 28px; max-width: 440px; width: 100%; justify-self: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 10px; border-radius: 9px; font: inherit; cursor: pointer; }
.seg button.active { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.logo-img { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 4px 14px rgba(34, 211, 165, 0.35)); }
.wordmark { font-weight: 800; font-size: 1.45rem; letter-spacing: -0.04em; color: #fff; }
.brand.big .logo-img { width: 56px; height: 56px; }
.brand.big .wordmark { font-size: 2.2rem; }

/* Uygulama kabuğu */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: rgba(8, 12, 28, 0.7); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
#nav button { text-align: left; background: none; border: 0; color: var(--muted); padding: 11px 12px; border-radius: 10px; font: inherit; cursor: pointer; display: flex; gap: 10px; align-items: center; }
#nav button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
#nav button.active { background: linear-gradient(90deg, rgba(34, 211, 165, 0.18), rgba(124, 108, 255, 0.12)); color: var(--text); }
.side-foot { display: grid; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.content { padding: 24px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.topbar h2 { font-size: 1.5rem; }
.menu-btn { display: none; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel h3 { margin-bottom: 14px; font-size: 1.05rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card small { color: var(--muted); display: block; margin-bottom: 8px; }
.card strong { font-size: 1.55rem; }
.card .sub { font-size: 0.85rem; margin-top: 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }

/* Tablolar */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.78rem; background: rgba(255, 255, 255, 0.08); }
.badge.income, .badge.buy, .badge.ok { background: rgba(46, 229, 157, 0.15); color: var(--pos); }
.badge.expense, .badge.sell, .badge.late { background: rgba(255, 107, 129, 0.15); color: var(--neg); }
.badge.soon { background: rgba(255, 200, 87, 0.16); color: var(--warn); }
.empty { color: var(--muted); padding: 22px; text-align: center; }

/* Grafikler */
.chart { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.legend { display: grid; gap: 8px; font-size: 0.9rem; min-width: 190px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend b { margin-left: auto; padding-left: 14px; }
.bars { width: 100%; height: 230px; }

/* Canlı takip */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile { aspect-ratio: 1 / 1; background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.tile .code { font-weight: 700; font-size: 1.1rem; }
.tile .name { color: var(--muted); font-size: 0.8rem; }
.tile .price { font-size: 1.45rem; font-weight: 700; }
.tile .chg { font-size: 0.95rem; font-weight: 600; }
.tile .x { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; }
.tile.up { box-shadow: inset 0 -4px 0 var(--pos); }
.tile.down { box-shadow: inset 0 -4px 0 var(--neg); }

/* Yapay zeka */
.ai-card { border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 18px; background: linear-gradient(160deg, rgba(124, 108, 255, 0.12), rgba(34, 211, 165, 0.05)); }
.ai-card.latest { border-color: rgba(124, 108, 255, 0.55); }
.ai-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 0.85rem; }
.ai-sum { font-size: 1.1rem; margin: 0 0 16px; line-height: 1.5; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); font-size: 0.85rem; color: var(--muted); }
.chip b { display: block; font-size: 1.1rem; color: var(--text); }
.chip b.pos { color: var(--pos); }
.chip b.neg { color: var(--neg); }
.recs { display: grid; gap: 10px; }
.rec { border-left: 4px solid var(--info); background: rgba(0, 0, 0, 0.22); padding: 12px 14px; border-radius: 0 12px 12px 0; }
.rec h4 { margin: 0 0 4px; }
.rec p { margin: 0; color: var(--muted); line-height: 1.5; }
.rec.positive { border-color: var(--pos); }
.rec.warning { border-color: var(--warn); }
.rec.danger { border-color: var(--neg); }

.subtabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.subtabs button { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; font: inherit; }
.subtabs button.active { background: rgba(255, 255, 255, 0.1); color: var(--text); }

dialog { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 22px; width: min(480px, 94vw); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1e2846; border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; z-index: 10; }

@media (max-width: 860px) {
    .auth-view { grid-template-columns: 1fr; }
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 5; transform: translateX(-100%); transition: transform 0.2s; background: #0b1020; }
    .sidebar.open { transform: none; }
    .menu-btn { display: inline-block; }
}
