:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --line: #e5e5ea;
  --field: #f2f2f7;
  --accent: #0a84ff;
  --accent-soft: rgba(10, 132, 255, .1);
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff3b30;
  --yellow: #ffd60a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06);
  --shadow-lg: 0 24px 80px rgba(0,0,0,.18);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Yerleşim ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px;
  background: rgba(240, 240, 243, .82);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand b { display: block; font-size: 17px; letter-spacing: .02em; }
.brand small { color: var(--text-2); font-size: 12.5px; }
.logo { width: 40px; height: 40px; border-radius: 11px; flex: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.nav a {
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text); font-weight: 500;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav a:hover { background: rgba(0,0,0,.05); }
.nav a:active { transform: scale(.97); }
.nav a.on { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sidebar .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; background: linear-gradient(135deg, #ffb340, #ff8a00); flex: none; }
.me div { min-width: 0; flex: 1; }
.me b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--text-2); font-size: 12px; }

main { padding: 34px clamp(20px, 4vw, 48px) 48px; max-width: 1400px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.head h1 { margin: 0; font-size: 32px; letter-spacing: -.02em; line-height: 1.1; }
.head p { margin: 6px 0 0; color: var(--text-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Kartlar ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h2 { margin: 0 0 16px; font-size: 17px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card h2 small { margin-left: auto; color: var(--text-2); font-weight: 400; font-size: 13px; }
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-top: 18px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .brand { padding: 0 8px 0 0; } .brand div { display: none; }
  .nav { display: flex; gap: 2px; } .nav a span { display: none; }
  .sidebar .spacer, .me div { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  main { padding: 22px 16px 40px; }
}

.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.kpi .label { color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.bg-blue { background: linear-gradient(135deg, #5ac8fa, #0a84ff); }
.bg-green { background: linear-gradient(135deg, #63e6a0, #34c759); }
.bg-orange { background: linear-gradient(135deg, #ffcc4d, #ff9f0a); }
.bg-red { background: linear-gradient(135deg, #ff8a80, #ff3b30); }
.bg-gray { background: linear-gradient(135deg, #c7c7cc, #8e8e93); }

/* ---------- Gün durumu ve ödeme dağılımı ---------- */
.daybar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px; border-radius: 14px; background: rgba(52,199,89,.1); color: var(--text); font-size: 14px; transition: transform .25s var(--spring); }
.daybar:active { transform: scale(.99); }
.daybar.off { background: rgba(255,159,10,.12); }
.daybar span { color: var(--text-2); }
.daybar .sep { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(255,159,10,.2); }
.dot.green { background: var(--green); box-shadow: 0 0 0 4px rgba(52,199,89,.2); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px rgba(52,199,89,.08); } }
.paybar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--field); gap: 2px; }
.paybar i { display: block; height: 100%; transform-origin: left; animation: growx 1s var(--ease) both; }
.paylegend { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; color: var(--text-2); font-size: 13.5px; }
.paylegend span { display: inline-flex; align-items: center; gap: 7px; }
.paylegend b { color: var(--text); }
.paylegend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
i.cash { background: linear-gradient(90deg, #63e6a0, #34c759); }
i.card { background: linear-gradient(90deg, #5ac8fa, #0a84ff); }
i.credit { background: linear-gradient(90deg, #ff8a80, #ff3b30); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--field); border-radius: 14px; padding: 14px 16px; }
.stat small { display: block; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat b { display: block; font-size: 20px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.hl { background: var(--accent-soft); }
.stat.hl b { color: var(--accent); }
.pos { color: #1f9d45; } .neg { color: var(--red); }
details.sale summary { list-style: none; cursor: pointer; }
details.sale summary::-webkit-details-marker { display: none; }
details.sale[open] { background: #fafafa; border-radius: 12px; }
details.sale .lines { padding: 0 14px 14px 58px; animation: rise .4s var(--ease); }
details.sale .lines div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
details.sale .lines div:last-child { border-bottom: 0; }

/* ---------- Grafik ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i {
  display: block; width: 100%; max-width: 34px; border-radius: 7px 7px 4px 4px;
  background: linear-gradient(180deg, #5ac8fa, #0a84ff);
  transform-origin: bottom; animation: grow .9s var(--spring) both;
  min-height: 3px;
}
.bar i.zero { background: var(--line); }
.bar span { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.bar:hover i { filter: brightness(1.08); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------- Listeler ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.item .main { flex: 1; min-width: 0; }
.item .main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .main small { color: var(--text-2); font-size: 12.5px; }
.item .end { text-align: right; font-variant-numeric: tabular-nums; }
.item .end b { display: block; }
.item .end small { color: var(--text-2); font-size: 12.5px; }
.progress { height: 6px; background: var(--field); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #ffcc4d, #ff9f0a); transform-origin: left; animation: growx 1s var(--ease) both; }
@keyframes growx { from { transform: scaleX(0); } }
.mono { font-family: "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty svg.i { width: 44px; height: 44px; color: var(--text-3); stroke-width: 1.4; margin-bottom: 8px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding: 0 12px 10px; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tr { transition: background .15s; }
tbody tr:hover { background: #fafafa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 0 -10px; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.pill.green { background: rgba(52,199,89,.14); color: #1f9d45; }
.pill.orange { background: rgba(255,159,10,.16); color: #c76f00; }
.pill.gray { background: var(--field); color: var(--text-2); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }

/* ---------- Segmented control ---------- */
.seg { position: relative; display: inline-flex; padding: 3px; background: #e8e8ed; border-radius: 11px; }
.seg a { position: relative; z-index: 1; padding: 6px 16px; border-radius: 8px; color: var(--text); font-size: 13.5px; font-weight: 500; transition: color .2s; }
.seg .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 8px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 0 1px rgba(0,0,0,.1); transition: left .45s var(--spring), width .45s var(--spring); }

/* ---------- Form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border: 0; border-radius: 11px;
  font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer;
  background: var(--accent); color: #fff;
  transition: transform .25s var(--spring), filter .2s, background .2s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.96); }
.btn.sec { background: #e8e8ed; color: var(--text); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: rgba(255,59,48,.12); color: var(--red); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; height: 48px; font-size: 16px; border-radius: 13px; }
.btn svg.i { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 12px; }
.input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 2px solid transparent; border-radius: 12px; outline: 0;
  background: var(--field); color: var(--text); font: inherit;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.sm { height: 38px; width: auto; }
.search { position: relative; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; }
.search .input { padding-left: 38px; height: 40px; width: 260px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }

/* iOS anahtar */
.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: #e9e9eb; position: relative; cursor: pointer; transition: background .25s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.08); transition: transform .35s var(--spring); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

.alert { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; animation: pop .45s var(--spring); }
.alert.err { background: rgba(255,59,48,.1); color: #d70015; }
.alert.ok { background: rgba(52,199,89,.12); color: #1f8a3e; }

/* ---------- Açılır pencere (sheet) ---------- */
dialog {
  border: 0; padding: 0; border-radius: 22px; width: min(460px, calc(100vw - 32px));
  background: var(--card); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: sheet .5s var(--spring); }
dialog::backdrop { background: rgba(0,0,0,.28); backdrop-filter: blur(8px); animation: fade .3s var(--ease); }
dialog.closing { animation: sheetOut .22s var(--ease) forwards; }
dialog.closing::backdrop { animation: fadeOut .22s var(--ease) forwards; }
dialog .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; }
dialog .sheet-head h3 { margin: 0; font-size: 19px; }
dialog form { padding: 12px 22px 22px; }
dialog .actions { display: flex; gap: 10px; margin-top: 8px; }
dialog .actions .btn { flex: 1; height: 46px; }
.x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--field); color: var(--text-2); display: grid; place-items: center; cursor: pointer; transition: transform .2s var(--spring); }
.x:active { transform: scale(.9); }
.x svg.i { width: 16px; height: 16px; }

@keyframes sheet { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes sheetOut { to { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.rise { animation: rise .7s var(--ease) both; }
.rise:nth-child(2) { animation-delay: .05s; } .rise:nth-child(3) { animation-delay: .1s; } .rise:nth-child(4) { animation-delay: .15s; }

/* ---------- Giriş ekranı ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth::before, .auth::after { content: ""; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .55; z-index: 0; animation: drift 22s ease-in-out infinite alternate; }
.auth::before { background: radial-gradient(circle, #ffd27a, transparent 65%); top: -25vmax; left: -15vmax; }
.auth::after { background: radial-gradient(circle, #a9d4ff, transparent 65%); bottom: -25vmax; right: -15vmax; animation-delay: -11s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
.auth-card { position: relative; z-index: 1; width: min(400px, 100%); padding: 36px 32px 28px; background: rgba(255,255,255,.78); backdrop-filter: blur(30px) saturate(180%); border-radius: 26px; box-shadow: var(--shadow-lg); text-align: center; animation: sheet .8s var(--spring); }
.auth-card .logo { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 16px; animation: pop .9s var(--spring) .1s both; }
.auth-card h1 { margin: 0; font-size: 28px; letter-spacing: .04em; }
.auth-card p.sub { margin: 4px 0 26px; color: var(--text-2); }
.auth-card form { text-align: left; }
.auth-card .foot { margin-top: 18px; font-size: 12.5px; color: var(--text-3); }
.shake { animation: shake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
