:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --text: #1b1b1f;
  --muted: #6b6b75;
  --border: #e3e3e8;
  --accent: #f27a1a;
  --accent-ink: #ffffff;
  --accent-soft: #fdebdc;
  --danger: #d92d20;
  --danger-soft: #fde8e7;
  --ok: #12805c;
  --ok-soft: #dcf3ea;
  --info: #1d6fd8;
  --info-soft: #e1edfc;
  --store-1: #1d6fd8;
  --store-1-soft: #e1edfc;
  --store-2: #8a3ffc;
  --store-2-soft: #efe5ff;
  --store-3: #0f8a83;
  --store-3-soft: #dbf3f1;
  --store-4: #c2410c;
  --store-4-soft: #fde6da;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 8px rgba(0, 0, 0, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --surface: #1c1c21;
    --surface-2: #26262c;
    --text: #f1f1f4;
    --muted: #9c9ca8;
    --border: #2e2e36;
    --accent: #ff8a2a;
    --accent-ink: #1a0d00;
    --accent-soft: #3a2412;
    --danger: #ff6b5e;
    --danger-soft: #3b1715;
    --ok: #4cd29a;
    --ok-soft: #133528;
    --info: #6aa8ff;
    --info-soft: #172a45;
    --store-1: #6aa8ff;
    --store-1-soft: #172a45;
    --store-2: #b48cff;
    --store-2-soft: #2a1d45;
    --store-3: #4fd1c8;
    --store-3-soft: #123533;
    --store-4: #ff9a66;
    --store-4-soft: #3d2216;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; margin: 2px 0 0; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }

/* ---------- Giriş ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  text-align: center;
}
.login-box img { margin: 0 auto; border-radius: 16px; }
.login-box p { margin: 0; }
.login-box input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 16px;
}
.btn-primary {
  border: 0;
  border-radius: 12px;
  padding: 13px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 16px;
}

/* ---------- Üst çubuk ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 0;
}
.titlebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.actions { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px;
  border: 0; border-radius: 12px;
  background: transparent;
  display: grid; place-items: center;
  color: var(--muted);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn { position: relative; }
#pushBtn.on { color: var(--accent); }
.push-dot {
  position: absolute; top: 8px; right: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}
.icon-btn.spinning svg { animation: spin .8s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 12px;
}
.segment button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badge {
  min-width: 20px; padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1.4;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.tabs { display: flex; margin: 8px -16px 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  border: 0;
  background: none;
  padding: 10px 12px 11px;
  font-size: 14.5px;
  color: var(--muted);
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tab .count {
  display: inline-block; min-width: 22px;
  margin-left: 4px; padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px; font-weight: 600;
}
.tab[aria-selected="true"] .count { background: var(--accent); color: var(--accent-ink); }

/* ---------- İçerik ---------- */
main { padding: 12px 16px calc(env(safe-area-inset-bottom) + 32px); max-width: 720px; margin: 0 auto; }

.pull {
  height: 0; overflow: hidden;
  text-align: center; font-size: 13px; color: var(--muted);
  transition: height .15s;
}
.pull.show { height: 28px; }

.banner {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 10px;
}
.banner.info { background: var(--info-soft); color: var(--info); }

.summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 560px) { .summary { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.hl .value { color: var(--accent); }

.search input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 16px;
}
.search { margin-bottom: 12px; }

.list { display: grid; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  cursor: pointer;
}
.card.is-new { outline: 2px solid var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.tag {
  font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.store-1 { background: var(--store-1-soft); color: var(--store-1); }
.store-2 { background: var(--store-2-soft); color: var(--store-2); }
.store-3 { background: var(--store-3-soft); color: var(--store-3); }
.store-4 { background: var(--store-4-soft); color: var(--store-4); }
.dot.store-1 { background: var(--store-1); }
.dot.store-2 { background: var(--store-2); }
.dot.store-3 { background: var(--store-3); }
.dot.store-4 { background: var(--store-4); }

.st { background: var(--surface-2); color: var(--muted); }
.st-new { background: var(--accent-soft); color: var(--accent); }
.st-ship { background: var(--info-soft); color: var(--info); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-bad { background: var(--danger-soft); color: var(--danger); }

.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.customer { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.items { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; display: grid; gap: 6px; }
.items li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Ürün görselleri */
.thumb, .photo, .mini {
  flex: none;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.thumb { width: 44px; height: 58px; border-radius: 8px; }
.photo { width: 76px; height: 100px; border-radius: 10px; cursor: zoom-in; }
.mini { width: 36px; height: 48px; border-radius: 6px; cursor: zoom-in; }
.noimg {
  background:
    linear-gradient(135deg, transparent 46%, var(--border) 46%, var(--border) 54%, transparent 54%),
    var(--surface-2);
}
.minis { display: flex; gap: 6px; margin-top: 6px; }
.line-info { min-width: 0; flex: 1; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .88);
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px);
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; background: #fff; }
.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  right: 16px;
  color: #fff;
  font-size: 22px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .15);
  border-radius: 50%;
}
.items .qty { font-weight: 600; color: var(--muted); margin-right: 4px; }
.deadline { margin-top: 8px; font-size: 13px; color: var(--muted); }
.deadline.soon { color: var(--accent); font-weight: 600; }
.deadline.late { color: var(--danger); font-weight: 600; }
.cargo-line { margin-top: 8px; font-size: 13px; color: var(--info); }

.details { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 10px; display: grid; gap: 10px; font-size: 14px; cursor: default; }
.details h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 3px; }
.details p { margin: 0; }
.line-detail { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.line-detail:last-child { border-bottom: 0; }
.line-detail .sub { font-size: 12.5px; color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  text-decoration: none;
  color: var(--text);
}

/* ---------- Sorular ---------- */
.qcard { cursor: default; }
.tag-group { display: inline-flex; gap: 6px; min-width: 0; }
.qproduct { display: flex; gap: 10px; align-items: center; margin: 4px 0 8px; }
.qproduct .thumb { cursor: zoom-in; }
.qproduct-info { min-width: 0; }
.qproduct-name {
  font-size: 13.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.small-link { font-size: 13px; color: var(--info); text-decoration: none; }
.qtext { margin: 6px 0 0; font-size: 15.5px; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer {
  margin-top: 10px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--ok);
}
.answer.pending { border-left-color: var(--info); }
.answer-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.answer p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.answer-form { margin-top: 10px; display: grid; gap: 8px; }
.answer-form textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 16px;
  line-height: 1.4;
}
.answer-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.answer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.counter { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.bad { color: var(--danger); }
.btn-send { padding: 10px 16px; font-size: 15px; }
.btn-send:disabled { opacity: .45; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 50;
  max-width: calc(100% - 32px);
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
