:root {
  --bg0: #ecefee;
  --bg1: #e4e9e6;
  --panel: #ffffff;
  --panel-2: #f4f6f5;
  --ink: #1f2623;
  --muted: #66706b;
  --line: rgba(31, 38, 35, 0.1);
  --accent: #1f6b54;
  --accent-deep: #185544;
  --warn: #8f5524;
  --danger: #b42318;
  --ok: #1f6b54;
  --font: "Poppins", system-ui, sans-serif;
  --radius: 16px;
  --shadow: 0 10px 28px rgba(31, 38, 35, 0.08);
  --app-w: min(1280px, calc(100% - 48px));
  --chrome: #1f2623;
  --chrome-muted: rgba(31, 38, 35, 0.55);
  --chip-bg: #ffffff;
  --chip-border: rgba(31, 38, 35, 0.12);
  --seg-bg: rgba(31, 38, 35, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
  line-height: 1.45;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(31, 107, 84, 0.07), transparent 55%),
    linear-gradient(180deg, #f3f5f4 0%, var(--bg0) 45%, var(--bg1) 100%);
}

.page-bg::after {
  content: none;
}

/* App frame — tek kolon, hizalı */
.app {
  width: var(--app-w);
  margin: 0 auto;
  padding: 24px 0 56px;
  display: grid;
  gap: 16px;
  animation: fadeUp 0.5s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Topbar: marka | sekmeler | çıkış — 3 eşit kolon */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}

.topbar-brand {
  justify-self: start;
}

.brand {
  margin: 0;
  font-size: clamp(1.35rem, 3.2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--chrome);
  line-height: 1.1;
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--chrome-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-chip {
  appearance: none;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chrome);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-chip:hover {
  border-color: rgba(31, 107, 84, 0.35);
  box-shadow: 0 0 0 3px rgba(31, 107, 84, 0.08);
}

.profile-avatar,
.profil-resim-onizleme {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background-color: var(--accent);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-weight: 600;
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.75rem;
}

.profile-initials { line-height: 1; }

.modal-panel--profil {
  width: min(420px, 100%);
}

.profil-form {
  gap: 18px;
}

.profil-photo-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px 14px 14px;
  border-radius: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.profil-resim-onizleme {
  position: relative;
  width: 96px;
  height: 96px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 1.75rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 0 3px rgba(28, 34, 31, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.profil-resim-onizleme:hover {
  transform: scale(1.03);
  box-shadow: 0 0 0 3px rgba(31, 107, 84, 0.28);
}

.profil-photo-hint {
  position: absolute;
  inset: auto 0 0;
  padding: 6px 0 8px;
  background: rgba(31, 38, 35, 0.7);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.profil-resim-onizleme:hover .profil-photo-hint,
.profil-resim-onizleme:focus-visible .profil-photo-hint {
  opacity: 1;
}

.profil-resim-aksiyon {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.profil-photo-note {
  text-align: center;
  max-width: 28ch;
}

.profil-section {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.profil-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profil-section-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.profil-pin-alan {
  display: grid;
  gap: 10px;
}

.btn-text {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 550;
  padding: 4px 2px;
  cursor: pointer;
}

.btn-text:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

.btn-text[aria-expanded="true"] {
  color: var(--ink);
}

.btn-danger-ghost {
  color: var(--danger);
}

.btn-danger-ghost:hover {
  color: #8a2f29;
}

.file-btn {
  display: inline-flex;
  justify-content: center;
  cursor: pointer;
}

.muted.small {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

.logout {
  color: var(--chrome-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.logout:hover {
  color: var(--chrome);
  border-color: rgba(31, 38, 35, 0.2);
}

/* Segment nav */
.seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--seg-bg);
  border: 1px solid var(--chip-border);
  width: min(420px, 100%);
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--chrome-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.seg-btn.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31, 38, 35, 0.08);
}

.seg-btn:not(.is-active):hover {
  color: var(--chrome);
  background: rgba(255, 255, 255, 0.55);
}

/* Summary — 3 eşit kart */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-card {
  appearance: none;
  border: 1px solid var(--chip-border);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  padding: 16px 18px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  display: grid;
  gap: 6px;
  min-height: 88px;
  box-shadow: 0 1px 2px rgba(31, 38, 35, 0.04);
}

.summary-card:hover {
  border-color: rgba(31, 107, 84, 0.28);
  transform: translateY(-1px);
}

.summary-card.is-active {
  background: var(--panel);
  border-color: rgba(31, 107, 84, 0.35);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.summary-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 1;
}

.summary-card.is-active .summary-label {
  color: var(--muted);
  opacity: 1;
}

.summary-value {
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

/* Workspace */
.workspace {
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--chip-border);
  padding: 26px 26px 30px;
  min-height: 48vh;
}

.panel[hidden] { display: none !important; }

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.6rem);
  letter-spacing: -0.03em;
}

.muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.btn-primary,
.btn-ghost {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover { color: var(--ink); }

/* Filter bar */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(16, 24, 20, 0.05);
  border-radius: 12px;
}

.filter-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  color: var(--muted);
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-btn.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31, 38, 35, 0.08);
}

.filter-btn:not(.is-active):hover {
  color: var(--ink);
}

.stat-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.month-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

#ay-sec {
  justify-self: start;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(31, 107, 84, 0.1);
}

.stat-pill span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-pill strong {
  font-size: 1.1rem;
  color: var(--accent-deep);
  letter-spacing: -0.02em;
}

/* Feed */
.feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px 14px;
  align-items: start;
  padding: 14px 14px;
  border-radius: 14px;
  background: rgba(16, 24, 20, 0.03);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  animation: fadeUp 0.3s ease both;
}

.row-item:hover {
  background: rgba(16, 24, 20, 0.05);
  border-color: var(--line);
}

.row-item.is-done .row-title {
  text-decoration: line-through;
  opacity: 0.5;
}

.row-item.is-done {
  opacity: 0.85;
}

.feed-notes .row-item,
.feed-spend .row-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.check {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 2px solid rgba(16, 24, 20, 0.25);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.check.is-on {
  background: var(--accent);
  border-color: var(--accent);
}

.check.is-on::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.row-main {
  min-width: 0;
}

.row-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.row-meta {
  margin: 5px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.row-body {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.amount {
  font-weight: 650;
  color: var(--warn);
  white-space: nowrap;
  font-size: 1rem;
}

.prio {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 24, 20, 0.06);
  color: var(--muted);
}

.prio.yuksek {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.prio.dusuk {
  background: rgba(16, 24, 20, 0.05);
}

.badge {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  margin-left: 6px;
}

.btn-icon {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}

.btn-icon:hover {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.08);
}

.empty {
  padding: 48px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

/* Modal */
.modal[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 38, 35, 0.35);
  backdrop-filter: blur(4px);
  animation: fade 0.2s ease both;
}

.modal-panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  animation: modalIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.modal-x {
  appearance: none;
  border: 0;
  background: rgba(16, 24, 20, 0.06);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal-x:hover { color: var(--ink); }

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-form label {
  display: grid;
  gap: 6px;
}

.modal-form label > span {
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--muted);
}

.modal-form input,
.modal-form textarea,
.modal-form select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  resize: vertical;
}

.modal-form input:focus,
.modal-form textarea:focus,
.modal-form select:focus,
#ay-sec:focus {
  outline: 2px solid rgba(31, 107, 84, 0.28);
  outline-offset: 1px;
  border-color: transparent;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
}

.modal-panel--confirm {
  width: min(380px, 100%);
}

.confirm-msg {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.45;
}

.modal-panel--wide {
  width: min(520px, 100%);
}

.chatgpt-baglanti {
  gap: 14px;
}

.copy-field {
  display: grid;
  gap: 6px;
}

.copy-label {
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--muted);
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.copy-value {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--ink);
}

.copy-value.mono {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  letter-spacing: 0.02em;
}

.copy-btn {
  flex-shrink: 0;
}

.copy-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
}

.chatgpt-adimlar {
  margin: 0;
  padding: 12px 12px 12px 28px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.55;
}

.chatgpt-adimlar li + li {
  margin-top: 4px;
}

.chatgpt-ucus {
  margin: 0;
  padding: 12px 12px 12px 28px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.5;
}

.chatgpt-ucus li + li {
  margin-top: 2px;
}

.modal-foot--split {
  justify-content: space-between;
}

body.modal-open { overflow: hidden; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 420px at 15% 0%, rgba(31, 107, 84, 0.08), transparent 55%),
    linear-gradient(180deg, #f3f5f4, var(--bg1));
}

.login-shell {
  width: min(400px, 100%);
  padding: 28px 26px;
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--chip-border);
  animation: fadeUp 0.5s ease both;
}

.login-shell .brand {
  color: var(--ink);
  font-size: clamp(1.7rem, 5vw, 2.1rem);
}

.login-shell h1 {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.login-shell .lead {
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
}

.login-form button {
  appearance: none;
  border: 0;
  margin-top: 4px;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.login-form button:hover { background: var(--accent-deep); }

.form-error {
  margin: 0 0 10px;
  color: var(--danger);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  :root { --app-w: calc(100% - 20px); }

  .app { padding-top: 16px; gap: 12px; }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "nav nav";
    gap: 12px;
  }

  .topbar-brand { grid-area: brand; }
  .header-actions { grid-area: actions; }
  .seg {
    grid-area: nav;
    width: 100%;
  }

  .profile-chip-text { display: none; }
  .chatgpt-chip .profile-chip-text {
    display: inline;
    font-size: 0.78rem;
  }

  .summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .summary-card {
    min-height: auto;
    padding: 12px 14px;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .summary-value { font-size: 1.15rem; }

  .workspace {
    padding: 20px 16px 24px;
    border-radius: 18px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary { width: 100%; }

  .seg-btn { font-size: 0.8rem; padding: 9px 6px; }

  .stat-row {
    grid-template-columns: 1fr;
  }

  .stat-pill { width: 100%; justify-content: space-between; }

  .modal-grid { grid-template-columns: 1fr; }

  .row-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .feed-notes .row-item,
  .feed-spend .row-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .row-side {
    grid-column: 2 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .feed-notes .row-side,
  .feed-spend .row-side {
    grid-column: 1;
  }
}
