/* Our Investment v2 — framework'süz arayüz */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --border: #e2e7eb;
  --text: #13202b;
  --muted: #5d6b78;
  --accent: #0f766e;
  --accent-soft: #d5f0ec;
  --accent-text: #ffffff;
  --pos: #15803d;
  --pos-soft: #dcf5e3;
  --neg: #c2410c;
  --neg-soft: #fde7dc;
  --warn: #a16207;
  --shadow: 0 1px 2px rgba(16, 32, 43, .06), 0 4px 16px rgba(16, 32, 43, .05);
  --radius: 14px;
  --c1: #0f766e; --c2: #2563eb; --c3: #d97706; --c4: #9333ea; --c5: #db2777; --c6: #65a30d; --c7: #64748b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1419; --surface: #151f26; --surface-2: #1c2932; --border: #263640;
    --text: #e6edf2; --muted: #93a3b0; --accent: #2dd4bf; --accent-soft: #123b38; --accent-text: #052e2b;
    --pos: #4ade80; --pos-soft: #12321f; --neg: #fb923c; --neg-soft: #3a2113; --warn: #facc15;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --c1: #2dd4bf; --c2: #60a5fa; --c3: #fbbf24; --c4: #c084fc; --c5: #f472b6; --c6: #a3e635; --c7: #94a3b8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1419; --surface: #151f26; --surface-2: #1c2932; --border: #263640;
  --text: #e6edf2; --muted: #93a3b0; --accent: #2dd4bf; --accent-soft: #123b38; --accent-text: #052e2b;
  --pos: #4ade80; --pos-soft: #12321f; --neg: #fb923c; --neg-soft: #3a2113; --warn: #facc15;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --c1: #2dd4bf; --c2: #60a5fa; --c3: #fbbf24; --c4: #c084fc; --c5: #f472b6; --c6: #a3e635; --c7: #94a3b8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hidden-values .money { filter: blur(7px); user-select: none; }

/* ---------- Yerleşim ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--surface) 232px, var(--bg) 232px); }
.side {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 10px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-text); }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.main { min-width: 0; padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .side { display: none; }
  .main { padding: 18px 16px 96px; }
  .topbar h1 { font-size: 21px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar .nav-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; justify-content: center; }
  .tabbar .nav-link[aria-current="page"] { background: none; }
}

/* ---------- Bileşenler ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2 { font-size: 16px; margin: 0 0 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.two { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
@media (max-width: 1020px) { .kpis { grid-template-columns: repeat(2, 1fr); } .two { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .kpis { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi .hint { font-size: 13px; margin-top: 2px; }
.kpi.hero { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.kpi.hero .label, .kpi.hero .hint { color: inherit; opacity: .85; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
a.btn { text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--neg); }
.btn.danger.fill { background: var(--neg); border-color: var(--neg); color: var(--surface); }
.btn.danger.fill:hover { background: var(--neg); filter: brightness(1.07); }
.btn.icon { padding: 8px; }
.btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
svg.i { width: 20px; height: 20px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 9px 12px; outline: none; min-height: 40px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.invalid { border-color: var(--neg); }
.input-lg { font-size: 22px; font-weight: 700; padding: 12px 14px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }

/* ---------- Tablo / liste ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th.r, td.r { text-align: right; }
th button { all: unset; cursor: pointer; }
th button:hover { color: var(--text); }
td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.asset-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.asset-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.asset-name b { display: block; }
.asset-name small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.asset-name > div { min-width: 0; }
@media (max-width: 1240px) { .col-cost { display: none; } }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.asset-cards { display: none; }
@media (max-width: 680px) {
  .asset-table { display: none; }
  .asset-cards { display: flex; flex-direction: column; gap: 10px; }
}
.asset-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
.asset-card .r { text-align: right; }

/* ---------- Grafik ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.donut { width: 190px; height: 190px; flex: none; }
.donut text { fill: var(--text); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 180px; font-size: 14px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
.legend li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bars { width: 100%; height: auto; display: block; max-height: 240px; }
.chart-bars .axis { stroke: var(--border); }
.chart-bars text { fill: var(--muted); font-size: 11px; }

/* ---------- Form satırları ---------- */
.rows { display: flex; flex-direction: column; gap: 12px; }
.row-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); position: relative; }
.row-grid { display: grid; gap: 12px; grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1.3fr; align-items: end; }
.row-grid.alloc { grid-template-columns: 2fr 1.2fr 1.2fr 1fr .8fr; }
@media (max-width: 1020px) { .row-grid, .row-grid.alloc { grid-template-columns: 1fr 1fr; } .row-grid .wide { grid-column: 1 / -1; } }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.row-total { font-weight: 700; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

.ac { position: relative; }
.ac-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  list-style: none; margin: 0; padding: 4px;
}
.ac-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; }
.ac-list li[aria-selected="true"], .ac-list li:hover { background: var(--surface-2); }
.ac-list li b { flex: none; }
.ac-list li span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pct-meter { display: flex; align-items: center; gap: 12px; }
.pct-meter .bar { flex: 1; height: 10px; }
.pct-meter .bar > i.over { background: var(--neg); }
.pct-meter .bar > i.full { background: var(--pos); }

/* ---------- Durumlar ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--accent); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 16px; }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert.err { background: var(--neg-soft); border-color: transparent; color: var(--neg); }
.alert.info { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { to { background-position: -200% 0; } }

#toasts { position: fixed; z-index: 100; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
@media (max-width: 860px) { #toasts { left: 16px; top: calc(12px + env(safe-area-inset-top)); } }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: tin .2s ease-out; }
.toast.err { background: var(--neg); color: #fff; }
@keyframes tin { from { transform: translateY(-8px); opacity: 0; } }

/* ---------- Giriş ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art {
  background: linear-gradient(150deg, #0f766e, #134e4a 60%, #0b2f2c); color: #ecfdf8;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art h2 { font-size: 34px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -.02em; max-width: 420px; }
.auth-art p { opacity: .82; max-width: 420px; margin: 0; }
.auth-art svg.spark { width: 100%; max-width: 440px; height: auto; opacity: .9; }
.auth-panel { display: grid; place-items: center; padding: 32px 16px; }
.auth-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-box h1 { margin: 0; font-size: 26px; }
.auth-tools { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

.legal-links { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; }
.legal-links a { color: var(--muted); }
.legal-links a:hover { color: var(--accent); }

.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.16); padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.menu-pop .lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* resimden doldur */
.ai-drop { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; border: 1.5px dashed var(--border); transition: border-color .15s, background .15s; }
.ai-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.ai-drop .ai-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ai-drop .ai-txt { flex: 1; min-width: 0; font-size: 14px; }
.ai-drop .ai-txt .muted { font-size: 13px; margin-top: 2px; }
.badge.ai { background: var(--accent-soft); color: var(--accent); }
.row-card.ai { border-color: var(--accent); }
@media (max-width: 640px) { .ai-drop { flex-wrap: wrap; } .ai-drop > div:last-child { width: 100%; } .ai-drop #ai-btn { width: 100%; justify-content: center; } }

/* ---------- Bütçe ---------- */
.warn { color: var(--warn); }
.bud-nav { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.bud-month { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 18px; text-align: center; }
.bud-sec { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 18px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.bud-sec h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.bud-head, .bud-row { display: grid; gap: 10px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(0, 1.1fr); }
.bud-head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 0 2px; }
.bud-head .r { text-align: right; }
.bud-row { padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.bud-row.archived { opacity: .8; }
.bud-row .lbl { display: none; }
.bud-row small, .bud-name small { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.bud-name { min-width: 0; padding-top: 9px; }
.bud-name b { display: block; overflow-wrap: anywhere; }
.bud-exp > div { padding-top: 9px; text-align: right; }
.bud-exp b { display: block; }
@media (max-width: 1020px) {
  .bud-head { display: none; }
  .bud-row { grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; }
  .bud-row .lbl { display: block; }
  .bud-name { grid-column: 1 / -1; padding-top: 0; }
  .bud-exp > div { padding-top: 0; text-align: left; }
}
.bud-none { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 0 4px; font-size: 14px; }
.bud-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.bud-add .input { flex: 1; min-width: 180px; }
.bud-sug { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: 13px; }
.chip { border: 1px dashed var(--border); background: none; border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.grp { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.bud-cat-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .bud-cat-grid { grid-template-columns: 1fr; } }
.bud-cats { list-style: none; margin: 0; padding: 0; }
.bud-cats li { display: flex; align-items: center; gap: 10px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.bud-cats li:last-child { border-bottom: 0; }
.bud-cat-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bud-cat-acts { display: flex; gap: 2px; }
.bud-arch { margin-top: 14px; }
.bud-arch summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.bud-cmp th, .bud-cmp td { white-space: nowrap; }
.bud-cmp td small { display: block; font-size: 12px; }
.bud-cmp .cur { background: var(--accent-soft); }
.bud-cmp tr.sec td { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 16px 10px 6px; }
.bud-cmp tr.tot td { font-weight: 600; }
.bud-cmp th:first-child, .bud-cmp td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
