/* WSM — Arayüz stilleri */
:root {
  color-scheme: light;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --border: #e3e6eb; --border-2: #d3d7de;
  --text: #0f172a; --text-2: #4b5563; --muted: #7c8592;
  --accent: #2a78d6; --accent-2: #1c5cab; --accent-soft: #e6effb;
  --good: #1a8f5a; --good-soft: #e3f5ec; --warn: #b26a00; --warn-soft: #fff2d9; --bad: #d23c3c; --bad-soft: #fde6e6; --info-soft: #eef2f7;
  --series-1: #2a78d6; --series-2: #eb6834; --series-1-soft: #9ec5f4;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --radius: 12px; --sidebar: 248px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318; --surface: #1a1d24; --surface-2: #20242c; --border: #2a2f39; --border-2: #363c48;
  --text: #f1f3f7; --text-2: #c2c8d2; --muted: #8b93a1;
  --accent: #3987e5; --accent-2: #5598e7; --accent-soft: #1e2b3f;
  --good: #3cc47c; --good-soft: #14301f; --warn: #e5a53a; --warn-soft: #3a2b10; --bad: #ef6b6b; --bad-soft: #3b1a1a; --info-soft: #232833;
  --series-1: #3987e5; --series-2: #d95926; --series-1-soft: #2f5a8f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 0; font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, .num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.warn-text { color: var(--warn); }

/* Layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.brand.small .logo { width: 26px; height: 26px; font-size: 14px; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; }
nav a i { font-style: normal; width: 20px; text-align: center; opacity: .85; }
nav a:hover { background: var(--surface-2); text-decoration: none; }
nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 4px; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.user { font-weight: 600; font-size: 13px; }
.user small { display: block; color: var(--muted); font-weight: 400; }
.topbar { display: none; }
.view { padding: 28px 32px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > .card + .card { margin-top: 0; }

/* Stat tiles */
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile .value { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.tile .value.hero { font-size: 34px; }
.tile .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.bad .value { color: var(--bad); }
.tile.good .value { color: var(--good); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 600; background: var(--surface-2); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--info-soft); color: var(--text-2); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; margin-right: 6px; vertical-align: middle; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.xs { padding: 2px 8px; font-size: 11px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-2); }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { min-width: 140px; }
.filters input, .filters select { padding: 6px 9px; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font: inherit; cursor: pointer; color: var(--text-2); }
.seg button.active { background: var(--accent); color: #fff; }
.hint { font-size: 12px; color: var(--muted); }
.error { color: var(--bad); font-size: 13px; background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
.notice { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice.good { background: var(--good-soft); color: var(--good); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 50; padding: 20px; overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 900px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); animation: pop .2s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 100%; max-width: 400px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { margin: 0; }

/* Rates timeline */
.rates-timeline { display: flex; flex-direction: column; gap: 10px; }
.rate-block { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.rate-block .bars { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--border); margin: 8px 0; gap: 2px; }
.rate-block .bars span { display: block; height: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; }
.chip.check { padding: 4px 10px 4px 6px; font-weight: 500; color: var(--text); }
.chip.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip.check input { margin: 0; }

/* Settlement */
.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.pair .arrow { color: var(--muted); font-size: 18px; }
.pair .amt { font-weight: 700; font-size: 16px; }
.pair-wrap { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.pair-wrap .pair { border: 0; background: transparent; }
.pair-wrap + .pair-wrap { margin-top: 10px; }
.breakdown { border-top: 1px dashed var(--border-2); padding: 8px 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.bd-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bd-row .bd-amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bd-row.minus .bd-amt { color: var(--bad); }
.bd-row.total { border-top: 1px solid var(--border-2); padding-top: 6px; margin-top: 2px; }
.bd-row.total .bd-amt { font-weight: 700; }
@media (max-width: 700px) { .bd-row { grid-template-columns: 1fr; gap: 2px; } }
.person-card { display: flex; flex-direction: column; gap: 6px; }
.person-card .big { font-size: 22px; font-weight: 700; white-space: nowrap; }
.person-card > .row { flex-wrap: wrap; gap: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv b { color: var(--muted); font-weight: 500; }
.kv span { text-align: right; font-variant-numeric: tabular-nums; }

th.col-dis { border-left: 2px solid var(--border-2); }
/* Chart */
.chart { width: 100%; height: 230px; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--muted); }
.chart line.grid { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.tooltip { position: fixed; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; z-index: 60; white-space: nowrap; }

/* Kanban-ish task list */
.task { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.task .side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 52%; margin-left: auto; }
@media (max-width: 1200px) { .task { grid-template-columns: auto 1fr; } .task .side { grid-column: 2; max-width: none; justify-content: flex-start; } }
.task + .task { margin-top: 8px; }
.task .title { font-weight: 600; }
.task .meta { font-size: 12px; color: var(--muted); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.prio { width: 4px; height: 36px; border-radius: 3px; background: var(--border-2); }
.prio.yuksek { background: var(--warn); } .prio.acil { background: var(--bad); } .prio.dusuk { background: var(--border-2); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 9px 14px; font: inherit; font-weight: 500; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-color: var(--accent); }

/* Log */
.log-row .diff { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--surface-2); padding: 8px; border-radius: 8px; white-space: pre-wrap; max-height: 260px; overflow: auto; }

/* Alloc table */
.alloc input { width: 130px; text-align: right; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; z-index: 40; width: var(--sidebar); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .view { padding: 16px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid.c3 { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; text-align: center; }
}
@media (max-width: 600px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }
@media print { .sidebar, .topbar, .btn, .filters { display: none !important; } .app { grid-template-columns: 1fr; } .view { padding: 0; } .card { box-shadow: none; } }
