:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --text: #15140f;
  --muted: #6f6c64;
  --line: #e6e4de;
  --accent: #0e7a49;
  --accent-soft: #e6f4ec;
  --warn: #a4520c;
  --warn-soft: #fcefdf;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --new: #2458e6;
  --new-soft: #e8eefd;
  --shadow: 0 1px 2px rgba(20, 18, 10, .05), 0 2px 10px rgba(20, 18, 10, .04);
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(246, 245, 242, .92);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.bar { display: flex; align-items: center; gap: 8px; max-width: 1040px; margin: 0 auto; }
.brand { font-weight: 800; letter-spacing: .04em; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-left: auto; white-space: nowrap; min-width: 0; }
.live .txt { overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--accent); animation: pulse 2s infinite; }
.dot.bad { background: var(--danger); }
.dot.warn { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(14, 122, 73, .5); } 70% { box-shadow: 0 0 0 7px rgba(14, 122, 73, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 122, 73, 0); } }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; flex: none; padding: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.tabs { display: flex; gap: 6px; max-width: 1040px; margin: 10px auto 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 10px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; font-weight: 600; font-size: 13.5px;
  color: var(--muted); border-radius: 999px; white-space: nowrap; flex: none;
}
.tabs button[aria-selected='true'] { background: var(--text); color: #fff; border-color: var(--text); }
.tabs .count { font-weight: 700; opacity: .7; margin-left: 2px; }

/* ---------- Main ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }

.notice {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--new-soft); border: 1px solid #d3defb; margin-bottom: 12px;
}
.notice-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--new); color: #fff; display: grid; place-items: center; flex: none; }
.notice-icon svg { width: 18px; height: 18px; }
.notice-body { flex: 1; min-width: 0; font-size: 13px; color: #33406b; display: flex; flex-direction: column; gap: 1px; }
.notice-body b { font-size: 14.5px; color: var(--text); }

.banner { padding: 11px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; margin-bottom: 12px; display: none; }
.banner.show { display: block; }
.banner.info { background: var(--accent-soft); color: var(--accent); }

.list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 12px; display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; scroll-margin-top: 120px;
}
.card.fresh { border-color: var(--new); box-shadow: 0 0 0 3px rgba(36, 88, 230, .18), var(--shadow); animation: pop .45s ease-out; }
.card.target { outline: 3px solid var(--new); outline-offset: 2px; }
@keyframes pop { from { transform: translateY(-6px); opacity: .3; } to { transform: none; opacity: 1; } }
.card.closed { opacity: .75; }

.thumb { width: 120px; height: 120px; border-radius: 10px; background: #fff; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.info { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.name { font-weight: 650; font-size: 14.5px; line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 1.5; }
.chip.new { background: var(--new); color: #fff; font-weight: 700; }
.sku {
  display: inline-flex; align-items: center; gap: 5px; border: 1px dashed #cfccc4; background: #fff; color: var(--text);
  font-size: 12px; padding: 2px 8px; border-radius: 999px; line-height: 1.5; max-width: 100%;
}
.sku span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sku svg { width: 13px; height: 13px; flex: none; color: var(--muted); }
.sku.copied { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.sku.copied svg { color: var(--accent); }

.money { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--accent-soft); border-radius: 12px; padding: 8px 8px 8px 12px; }
.money .amount { min-width: 0; }
.money .accept { flex: 0 1 190px; min-height: 44px; }
.meta.sub { font-size: 12.5px; color: var(--muted); gap: 6px; }
.meta.sub b { color: var(--text); font-weight: 650; }
.meta.sub .when { white-space: nowrap; }
.chip.re { background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 10.5px; padding: 1px 6px; vertical-align: 2px; }
.name .chip.new { font-size: 10.5px; padding: 1px 6px; vertical-align: 2px; }
a.thumb { display: grid; }
.money .label { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .05em; text-transform: uppercase; }
.money .net { font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.money .net.loading { font-size: 15px; opacity: .6; font-weight: 600; }
.pill { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.pill.urgent { background: var(--danger-soft); color: var(--danger); }
.pill.soon { background: var(--warn-soft); color: var(--warn); }

.btn-primary {
  flex: 1; border: 0; border-radius: 11px; background: var(--text); color: #fff; font-weight: 700; font-size: 15px;
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; transition: transform .06s;
}
.btn-primary:active { transform: scale(.985); }
.btn-primary[disabled] { opacity: .6; cursor: default; }
.btn-primary.done { background: var(--accent); opacity: 1; }
.btn-primary.fail { background: var(--danger); }
.btn-primary.sm { flex: none; min-height: 38px; font-size: 13.5px; padding: 0 12px; background: var(--new); }
.btn-ghost { border: 1px solid var(--line); background: var(--surface); border-radius: 11px; min-height: 46px; padding: 0 13px; display: grid; place-items: center; color: var(--muted); text-decoration: none; flex: none; }
.btn-ghost svg { width: 18px; height: 18px; }
.msg { grid-column: 1 / -1; font-size: 12.5px; color: var(--danger); margin-top: -2px; }
.msg.ok { color: var(--accent); }
.closed-note { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: r .7s linear infinite; }
@keyframes r { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 11px 15px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; transition: .2s; pointer-events: none; max-width: calc(100% - 32px); z-index: 50; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Ayarlar ---------- */
dialog.sheet { border: 0; padding: 0; background: transparent; width: min(440px, calc(100% - 20px)); max-height: calc(100dvh - 20px); color: var(--text); }
dialog.sheet::backdrop { background: rgba(20, 18, 10, .35); }
.sheet-inner { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 19px; }
.sheet-inner h3 { margin: 4px 0 0; font-size: 15px; }
.sheet-sub { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.sheet-inner label { font-size: 13px; font-weight: 600; margin-top: 4px; }
.sheet-inner input { font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
.sheet-inner .btn-primary { margin-top: 10px; flex: none; }
.sheet-msg { font-size: 13px; min-height: 18px; }
.sheet-msg.ok { color: var(--accent); } .sheet-msg.err { color: var(--danger); }
.sheet-inner hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0 4px; width: 100%; }
.btn-ghost.wide { width: 100%; font-weight: 600; color: var(--text); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 20px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; margin: 12px 0 4px; letter-spacing: .04em; }
.login-card p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.login-card input { width: 100%; font: inherit; font-size: 16px; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); margin-bottom: 12px; }
.login-card .btn-primary { width: 100%; }
.login-card .err { color: var(--danger); font-size: 13.5px; min-height: 20px; margin-top: 10px; }

/* ---------- Mobil ---------- */
@media (max-width: 520px) {
  .live .txt { max-width: 96px; }
  .icon-btn { width: 36px; height: 36px; }
  .tabs { gap: 5px; }
  .tabs button { padding: 6px 10px; font-size: 13px; }
  .list { gap: 8px; }
  .card { grid-template-columns: 96px 1fr; padding: 10px; gap: 8px 11px; border-radius: 13px; }
  .thumb { width: 96px; height: 96px; border-radius: 10px; }
  .info { gap: 4px; }
  .name { font-size: 13.5px; }
  .chip, .sku { font-size: 11.5px; }
  .money { padding: 6px 6px 6px 10px; }
  .money .label { font-size: 10px; }
  .money .net { font-size: 22px; }
  .money .accept { min-height: 40px; font-size: 14px; flex-basis: 150px; }
  .meta.sub .when { display: none; }
  .notice { padding: 10px 12px; gap: 10px; }
  .notice-icon { width: 32px; height: 32px; }
  .notice .btn-primary.sm { flex: 0 0 auto; }
}
@media (max-width: 360px) {
  .live { display: none; }
  .brand { margin-right: auto; }
  .money .accept { flex-basis: 128px; font-size: 13.5px; }
}

.acct { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); margin-top: 4px; }
.acct-ok { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.acct-body { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.acct-body b { color: var(--accent); font-size: 14px; }
.acct-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-body small { color: var(--muted); }
.acct.warn { background: var(--warn-soft); }
.acct.warn .acct-ok { background: var(--warn); }
.acct.warn .acct-body b { color: var(--warn); }
.btn-ghost.sm { min-height: 34px; padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--text); }

/* ---------- Sıralama ---------- */
.sortbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(20, 18, 10, .12); }

/* ---------- Onay penceresi ---------- */
.confirm h2 { margin: 0 0 6px; font-size: 19px; }
.c-prod { display: flex; gap: 12px; align-items: center; }
.c-prod .thumb { width: 72px; height: 72px; flex: none; }
.c-prod .info { min-width: 0; }
.c-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.confirm .money { margin-top: 10px; padding: 10px 12px; }
.confirm .money .net { font-size: 28px; }
.c-dl { text-align: right; font-size: 13px; color: var(--muted); }
.c-dl b { color: var(--text); display: block; font-size: 14px; }
.c-legal { font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; line-height: 1.45; }
.c-legal b { color: var(--text); }
.c-actions { display: flex; gap: 8px; margin-top: 6px; }
.c-actions .btn-ghost.wide { flex: 1; width: auto; min-height: 48px; }
.c-actions .btn-primary { flex: 1.4; margin-top: 0; min-height: 48px; background: var(--accent); }
.mark-mine { margin-left: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 3px 8px; font-size: 12px; font-weight: 600; color: var(--text); }
