:root {
  --red: #d96a12;
  --red-dark: #b35509;
  --ink: #2e2e30;
  --gray: #6b6b70;
  --line: #e4e4e8;
  --bg: #f6f6f8;
  --card: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--gray); }
.small { font-size: 12px; }

/* ---------- Giriş ---------- */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fafafa 60%, #f6ecdf);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
  text-align: center;
}
.login-logo { width: 180px; margin-bottom: 16px; }
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-sub { color: var(--gray); margin: 0 0 20px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; text-align: center;
}

/* ---------- Genel ---------- */
.btn {
  font: inherit; font-weight: 600;
  border: none; border-radius: var(--radius);
  padding: 10px 18px; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #000; }
.btn-ghost { background: transparent; color: var(--gray); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--gray); }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: none; color: var(--red);
  cursor: pointer; font: inherit; font-size: 12px; padding: 0;
}
.form-error {
  background: #fdecec; color: #a31218;
  border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 13px;
}
.state-msg { padding: 60px 20px; text-align: center; color: var(--gray); }
.state-error { color: #a31218; }

/* ---------- Üst bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--card);
  border-bottom: 3px solid var(--red);
  padding: 10px 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-logo { height: 38px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  font: inherit; font-weight: 600;
  background: none; border: none; cursor: pointer;
  padding: 10px 16px; border-radius: 8px; color: var(--gray);
}
.tab:hover { color: var(--ink); background: var(--bg); }
.tab.active { color: var(--red); background: #fdf2e7; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ---------- Araç çubuğu ---------- */
.toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap;
}
.search-input, .select {
  font: inherit; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card);
}
.search-input { flex: 1; min-width: 200px; }
.toolbar .muted { margin-left: auto; }

/* ---------- Ürün kartları ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s;
}
.product-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.07); }
.product-card .img-wrap {
  height: 120px; display: flex; align-items: center; justify-content: center;
  background: #fff;
}
.product-card img { max-height: 110px; max-width: 100%; object-fit: contain; }
.product-card .no-img {
  color: #c2c2c8; font-size: 12px; border: 1px dashed var(--line);
  border-radius: 8px; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.product-card .p-name { font-weight: 600; font-size: 13px; min-height: 34px; }
.product-card .p-cat { font-size: 11px; color: var(--gray); }
.product-card .p-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price-edit {
  font: inherit; font-weight: 700; color: var(--red);
  width: 110px; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
}
.price-edit:hover { border-color: var(--line); }
.price-edit:focus { border-color: var(--red); background: #fff; outline: none; }
.card-actions { display: flex; gap: 4px; }
.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 15px; padding: 4px 6px; border-radius: 6px; color: var(--gray);
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------- Liste oluşturucu ---------- */
.builder-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.pick-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100vh - 220px); overflow-y: auto; padding-right: 4px;
}
.pick-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 12px; cursor: pointer;
}
.pick-row:hover { border-color: #cdced6; }
.pick-row.selected { border-color: var(--red); background: #fff9f3; }
.pick-row input[type=checkbox] { accent-color: var(--red); width: 16px; height: 16px; }
.pick-row img { width: 46px; height: 46px; object-fit: contain; }
.pick-row .no-img { width: 46px; height: 46px; font-size: 9px; color: #c2c2c8;
  border: 1px dashed var(--line); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; }
.pick-row .pick-name { flex: 1; font-weight: 500; font-size: 13px; }
.pick-row .pick-price { font-weight: 700; color: var(--ink); white-space: nowrap; }

.builder-side {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  position: sticky; top: 84px;
}
.builder-side h2 { margin: 0 0 14px; font-size: 16px; }
.builder-side input[type=text] {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--gray); margin: 12px 0 6px; }
.side-meta { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 8px; font-size: 12px; color: var(--gray); }
.selected-items { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.sel-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px;
}
.sel-item .sel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-item input {
  width: 80px; font: inherit; font-size: 12px; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 6px;
}
.sel-item .icon-btn { font-size: 13px; padding: 2px 4px; }
.side-actions { display: flex; gap: 8px; margin-top: 14px; }
.side-actions .btn { flex: 1; padding: 10px 8px; font-size: 13px; }

/* ---------- Fiyat listesi oluştur ---------- */
.generate-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
  max-width: 520px; margin: 0 auto;
}
.generate-card h2 { margin: 0 0 6px; font-size: 18px; }
.generate-card p { margin: 0 0 10px; font-size: 13px; }
.generate-card .select, .generate-card input[type=text] {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.generate-card .btn { width: 100%; padding: 13px; font-size: 15px; }

/* ---------- Kayıtlı listeler ---------- */
.lists-container { display: flex; flex-direction: column; gap: 12px; }
.list-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
}
.list-card .l-info { flex: 1; }
.list-card .l-title { font-weight: 700; font-size: 15px; }
.list-card .l-meta { font-size: 12px; color: var(--gray); margin-top: 2px; }
.list-card .btn { padding: 8px 14px; font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,20,24,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--card); border-radius: 14px; padding: 26px;
  width: 460px; max-width: calc(100vw - 32px);
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 17px; }
.modal input[type=text], .modal input[type=number] {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.image-row { display: flex; align-items: center; gap: 12px; }
.pf-preview { width: 70px; height: 70px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Toplu yükleme ---------- */
.p-code { font-weight: 700; color: var(--red); }
.import-summary {
  background: #fdf2e7; border: 1px solid #f0ddc8;
  border-radius: 8px; padding: 10px 14px; font-size: 12.5px; line-height: 1.7;
}
#template-link { color: var(--red); font-weight: 600; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px;
  border-radius: 10px; font-weight: 600; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.error { background: var(--red-dark); }

@media (max-width: 900px) {
  .builder-layout { grid-template-columns: 1fr; }
  .builder-side { position: static; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}
