:root {
  --navy: #002d62;
  --navy-deep: #001a3a;
  --navy-ink: #0f1c2e;
  --green: #5da91b;
  --green-press: #4d8f16;
  --green-soft: #f4fbf0;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #d7e0ea;
  --muted: #5a6b7d;
  --text: #0f1c2e;
  --danger: #bf000f;
  --shadow: 0 18px 50px rgba(0, 45, 98, 0.08);
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: Manrope, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 18px 10px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}
.brand img { height: 36px; width: auto; display: block; }
.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.icon-btn, .qty-btn, .btn {
  border: 0;
  border-radius: 12px;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #eef3f7;
  color: var(--navy);
  position: relative;
  text-decoration: none;
}
.icon-btn:hover { background: #e2ebf3; }
.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 8px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -.03em;
  line-height: 1.15;
}
.hero p { margin: 0; color: var(--muted); max-width: 46ch; }

.search-wrap {
  max-width: 1100px;
  margin: 18px auto 0;
  padding: 0 18px;
}
.search-wrap input, .field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  color: var(--text);
}
.search-wrap input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,45,98,.12);
}
.field input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 40, 40, .12);
}

.chips {
  max-width: 1100px;
  margin: 14px auto 0;
  padding: 0 18px 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: calc(64px + var(--safe-t));
  z-index: 15;
  background: linear-gradient(var(--bg), var(--bg) 80%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.chip:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.catalog {
  max-width: 1100px;
  margin: 8px auto 140px;
  padding: 0 18px 24px;
}
.cat-block { margin-top: 22px; }
.cat-block h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-head {
  margin: 14px 0 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}
.cat-block .brand-head:first-of-type { margin-top: 0; }
.list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  align-items: center;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row h3 { margin: 0 0 4px; font-size: 15px; font-weight: 800; }
.meta { color: var(--muted); font-size: 12px; font-weight: 600; }
.price {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--navy);
  font-size: 15px;
  text-align: right;
}
.price small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  margin: 10px auto 0;
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.qty-btn {
  width: 44px;
  height: 44px;
  background: var(--navy);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  pointer-events: auto;
}
.qty-btn:hover { background: var(--navy-deep); }
.qty {
  min-width: 44px;
  text-align: center;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.qty small {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
}
.cart-item .stepper { margin-top: 0; flex-shrink: 0; }
.cart-line-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.palet-badge {
  display: inline-flex;
  align-items: center;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-b));
  transform: translateX(-50%);
  width: min(640px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--navy);
  color: #fff;
  border-radius: 18px;
  padding: 12px 12px 12px 18px;
  box-shadow: 0 16px 40px rgba(0,26,58,.35);
  z-index: 30;
}
.cart-bar.hidden { display: none; }
.btn {
  background: var(--green);
  color: #fff;
  font-weight: 800;
  padding: 12px 16px;
  border-radius: 12px;
}
.btn:hover { background: var(--green-press); }
.btn.ghost {
  background: #eef3f7;
  color: var(--navy);
}
.btn.full { width: 100%; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #9b2c2c; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 46, .45);
  z-index: 40;
  display: none;
}
.overlay.open { display: block; }
.sheet {
  position: fixed;
  z-index: 50;
  background: #fff;
  width: min(520px, 100%);
  right: 0;
  top: 0;
  bottom: 0;
  transform: translateX(110%);
  transition: transform .28s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,.18);
}
.sheet.open { transform: none; }
.sheet header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: calc(18px + var(--safe-t)) 18px 16px;
  border-bottom: 1px solid var(--line);
}
.sheet header .icon-btn { font-size: 22px; line-height: 1; }
.cart-bar.sheet-open { display: none; }
.sheet footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  padding: 16px 18px;
  padding-bottom: calc(16px + var(--safe-b));
}
.sheet .body { overflow: auto; padding: 16px 18px; flex: 1; }
.sheet h2 { margin: 0; font-size: 20px; }
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list > .cart-item:last-child {
  border-bottom: 0;
}
.cart-item .prod-thumb { width: 48px; height: 48px; }
.cart-item > div:nth-child(2) { flex: 1; min-width: 0; }
.totals { margin-top: 14px; color: var(--muted); font-size: 14px; }
.totals strong { color: var(--text); float: right; }
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.opt { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; font-size: 14px; }
.opt.compact { margin: 0; font-size: 13px; font-weight: 700; }
.price-offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.price-offer-head > label { margin: 0; }
.price-offer-head .opt {
  display: flex;
  align-items: center;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.success {
  text-align: center;
  padding: 32px 8px;
}
.success h3 { margin: 8px 0; font-size: 22px; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 18px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }

.row.stacked { grid-template-columns: 1fr; align-items: stretch; }
.prod-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}
.prod-thumb,
.prod-thumb-sm,
#prodPreview.prod-thumb,
.prod-photo img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex: 0 0 auto;
}
.prod-thumb-sm { width: 44px; height: 44px; border-radius: 10px; display: block; }
.prod-thumb.empty,
.prod-thumb-sm.empty {
  display: inline-block;
  background:
    linear-gradient(135deg, #eef3f8 25%, transparent 25%) 0 0 / 10px 10px,
    #f4f7fb;
}
.prod-photo {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.prod-photo .filepick { flex: 1; }
.prod-photo img,
.prod-photo .prod-thumb {
  width: 88px;
  height: 88px;
}
.prod-main > div { flex: 1; min-width: 0; }
.prices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin: 10px 0 8px;
  position: relative;
  z-index: 3;
}
.price-opt {
  appearance: none;
  width: 100%;
  text-align: left;
  background: #f4f7fb;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 8px;
  color: inherit;
  cursor: default;
  font: inherit;
}
.price-opt.selected {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.price-opt.selected small,
.price-opt.selected em { color: rgba(255,255,255,.88); }
.price-opt:disabled,
.price-opt.disabled {
  opacity: .42;
}
.prices small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.prices em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}
.totals-box {
  margin-top: 16px;
  padding: 14px;
  background: #f4f7fb;
  border-radius: 14px;
}
.totals.grand { color: var(--navy); font-size: 16px; margin-top: 8px; }
.variant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  min-height: 56px;
}
.variant-row > span {
  flex: 1;
  min-width: 0;
  font-weight: 700;
}
.variant-row .stepper {
  margin: 0;
  flex: 0 0 auto;
}
.fulfill { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

@media (min-width: 900px) {
  .row { grid-template-columns: 1fr auto; }
  .row.stacked { grid-template-columns: 1fr; }
}

/* Panel */
.panel-body { background: #eef3f7; }
.shell { display: grid; min-height: 100dvh; }
.side {
  display: none;
  background: var(--navy-deep);
  color: #fff;
  padding: calc(18px + var(--safe-t)) 14px 18px;
}
.side img { height: 28px; filter: brightness(0) invert(1); }
.side nav { margin-top: 28px; display: grid; gap: 6px; }
.side a, .tab {
  color: #d7e0ea;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 10px;
  font-weight: 700;
  border: 0;
  background: transparent;
  text-align: left;
}
.side a.active, .tab.active, .side a:hover { background: rgba(255,255,255,.1); color: #fff; }
.main { padding: calc(16px + var(--safe-t)) 16px 96px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; }
.cards-4 { grid-template-columns: repeat(2, 1fr); }
.report-range { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.day-bars { display: grid; gap: 8px; }
.day-row {
  display: grid;
  grid-template-columns: 52px 1fr 56px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}
.day-row b { text-align: right; font-variant-numeric: tabular-nums; }
.day-track {
  height: 8px;
  background: #eef3f7;
  border-radius: 99px;
  overflow: hidden;
}
.day-track i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 99px;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.pill.yeni { background: #fffbeb; color: #7b3306; }
.pill.tamamlandi { background: #ecf9f0; color: #1ebe57; }
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding-bottom: var(--safe-b);
  z-index: 20;
}
.bottom-nav button {
  background: none;
  border: 0;
  padding: 12px 4px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.bottom-nav button.active { color: var(--navy); }
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.auth-card img { height: 40px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }
.clickable:hover { background: #f7fafc; }

.page-head { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.page-head h1, .page-actions { margin:0; }
.page-actions { display:flex; gap:8px; flex-wrap:wrap; }
.card-block {
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px;
  margin-bottom:16px;
  box-shadow: var(--shadow);
}
.card-block h2 { margin:0 0 12px; font-size:13px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.dt-bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; align-items:center; }
.dt-bar input, .dt-bar select {
  border:1px solid var(--line); border-radius:12px; padding:10px 12px; background:#fff;
}
.dt-bar input[type=search] { flex:1; min-width:180px; }
.dt-actions { margin-left:auto; display:flex; gap:8px; }
.form-card { max-width:640px; }
.tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:16px; }
.tabs button {
  border:1px solid var(--line); background:#fff; border-radius:999px; padding:8px 14px; font-weight:800; color:var(--navy);
}
.tabs button.active { background:var(--navy); color:#fff; border-color:var(--navy); }
#modal-root, #confirm-root { position:fixed; inset:0; z-index:80; display:grid; place-items:center; padding:18px; }
#confirm-root { z-index: 90; }
.confirm-modal { max-width: 420px; }
.modal-foot .push-left { margin-right: auto; }
.modal-backdrop { position:absolute; inset:0; background:rgba(15,28,46,.5); }
.modal {
  position:relative; width:100%; background:#fff; border-radius:20px; max-height:min(90dvh, 860px);
  display:flex; flex-direction:column; box-shadow:0 24px 80px rgba(0,26,58,.28);
}
.modal header { display:flex; justify-content:space-between; align-items:center; padding:16px 18px; border-bottom:1px solid var(--line); }
.modal header h2 { margin:0; font-size:18px; }
.modal-body { overflow:auto; padding:16px 18px; }
.modal-foot { display:flex; justify-content:flex-end; gap:8px; padding:14px 18px calc(14px + var(--safe-b)); border-top:1px solid var(--line); }
.order-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.order-addr {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
}
.order-addr p { margin: 4px 0 0; }
.order-lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.order-lines th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.order-lines td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.order-lines .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-lines .fill-row td { color: var(--muted); }
.order-totals { margin-top: 8px; max-width: 420px; margin-left: auto; }
.order-totals .totals { overflow: hidden; }
.filepick {
  display:flex; gap:14px; align-items:center; border:1.5px dashed var(--line); border-radius:16px;
  padding:18px; background:#f7fafc; cursor:pointer;
}
.filepick.drag { border-color:var(--green); background:var(--green-soft); }
.filepick-ico { width:48px; height:48px; border-radius:12px; display:grid; place-items:center; background:#fff; color:var(--navy); }
.filepick small { display:block; margin-top:4px; }
.perm-grid { display:grid; gap:8px; margin:8px 0 16px; }
.check { display:flex; gap:8px; align-items:flex-start; font-size:14px; font-weight:600; }
.iban-mono { font-variant-numeric: tabular-nums; letter-spacing:.04em; font-weight:800; }
.iban-card {
  display: grid;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 10px;
}
.iban-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.iban-line .btn { flex: 0 0 auto; white-space: nowrap; }
#toast-host { position:fixed; right:16px; bottom: calc(24px + var(--safe-b)); z-index:100; display:grid; gap:8px; }
.toast { background:var(--navy); color:#fff; padding:12px 16px; border-radius:12px; font-weight:700; box-shadow:var(--shadow); }
.toast-err { background:var(--danger); }

@media (min-width: 960px) {
  .shell { grid-template-columns: 240px 1fr; }
  .side { display: block; }
  .bottom-nav { display: none; }
  .main { padding: 28px 32px; }
  .cards-4 { grid-template-columns: repeat(4, 1fr); }
}

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