@import url("/fonts/schibsted/400.css");
@import url("/fonts/schibsted/500.css");
@import url("/fonts/schibsted/700.css");
@import url("/fonts/schibsted/800.css");
@import url("/fonts/jetbrains/400.css");
@import url("/fonts/jetbrains/500.css");

/* Düzen: defter mantığı. Üstte ayın toplam satırı, altında kayıt sütunu ve hareket defteri yan yana. */
:root {
  --paper: #f3f5f4;
  --surface: #ffffff;
  --ink: #15201c;
  --muted: #5a6963;
  --line: #dbe2df;
  --line-strong: #c3cdc9;
  --accent: #0d5c4c;      /* kasa yeşili: marka ve ana düğmeler */
  --accent-ink: #ffffff;
  --accent-soft: #e2efeb;
  --income: #1f6db0;      /* veri: gelir */
  --expense: #d2541f;     /* veri: gider */
  --danger: #b42318;
  --ok: #0d7a4f;

  --f-display: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --f-body: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --s-xs: 0.75rem;
  --s-sm: 0.875rem;
  --s-md: 1rem;
  --s-lg: 1.25rem;
  --s-xl: 1.75rem;
  --s-2xl: 2.5rem;
  --s-3xl: clamp(2.5rem, 6vw, 4.25rem);

  --r: 6px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1513;
    --surface: #161e1b;
    --ink: #e4ebe8;
    --muted: #93a49d;
    --line: #26322e;
    --line-strong: #364540;
    --accent: #5cc3a7;
    --accent-ink: #08201a;
    --accent-soft: #17302a;
    --income: #4b92d6;
    --expense: #e0703a;
    --danger: #f97066;
    --ok: #4cc38a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1513;
  --surface: #161e1b;
  --ink: #e4ebe8;
  --muted: #93a49d;
  --line: #26322e;
  --line-strong: #364540;
  --accent: #5cc3a7;
  --accent-ink: #08201a;
  --accent-soft: #17302a;
  --income: #4b92d6;
  --expense: #e0703a;
  --danger: #f97066;
  --ok: #4cc38a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--s-md);
  line-height: 1.5;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.label {
  font-size: var(--s-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Kontroller ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: 500 var(--s-sm)/1 var(--f-body);
  padding: 0.7rem 1rem;
  border-radius: var(--r);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 0.45rem 0.65rem; font-size: var(--s-xs); }

.field { display: grid; gap: 0.35rem; }
.field > span { font-size: var(--s-sm); font-weight: 500; }
.field small { color: var(--muted); font-size: var(--s-xs); }
input, select, textarea {
  font: inherit;
  font-size: var(--s-md);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 0.6rem 0.7rem;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input.amount { font-family: var(--f-num); font-size: var(--s-lg); font-variant-numeric: tabular-nums; }

/* Gelir / gider anahtarı */
.kind-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 3px; gap: 3px; }
.kind-switch input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.kind-switch label {
  text-align: center; padding: 0.5rem; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: var(--s-sm);
  display: flex; align-items: center; justify-content: center; gap: 0.45rem;
}
.kind-switch input:checked + label { background: var(--ink); color: var(--paper); }
.kind-switch input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }

.dot { width: 0.6rem; height: 0.6rem; border-radius: 2px; display: inline-block; flex: none; }
.dot.income { background: var(--income); }
.dot.expense { background: var(--expense); }

.alert { font-size: var(--s-sm); padding: 0.6rem 0.75rem; border-radius: var(--r); border: 1px solid; }
.alert-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.alert-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }

.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: var(--s-xs); font-weight: 500;
  padding: 0.15rem 0.45rem; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted);
  white-space: nowrap;
}
.chip.auto { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Marka ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--f-display); font-weight: 800; font-size: var(--s-lg); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 1.6rem; height: 1.6rem; flex: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { stroke: var(--paper); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--paper);
  padding: 0.7rem 1rem; border-radius: var(--r);
  font-size: var(--s-sm); box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  z-index: 50; max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 180ms ease-out; }
  @keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0; } }
}
