:root {
  --bg: #f4f6fa;
  --bg2: #ffffff;
  --bg3: #eef1f7;
  --line: #e3e8f0;
  --text: #1c2536;
  --dim: #67748c;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --accent: #2563eb;
  --shadow: 0 1px 3px rgba(28,37,54,.06), 0 4px 14px rgba(28,37,54,.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1 { font-size: 17px; letter-spacing: 1.2px; font-weight: 800; }
code { background: var(--bg3); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.r { text-align: right; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---- Üst bar ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 11px; object-fit: contain;
  background: #fff; padding: 3px; border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(37,99,235,.15);
}
.sub { color: var(--dim); font-size: 11.5px; margin-top: 2px; letter-spacing: .3px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clock-wrap { text-align: right; margin-right: 6px; }
.clock { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 700; display: block; }
.date-line { font-size: 11px; color: var(--dim); }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 13px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: border-color .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(28,37,54,.04);
}
.btn:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(37,99,235,.12); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #2563eb, #4f46e5); border: none; font-weight: 600; color: #fff; }
.btn.voice-on { background: #ecfdf5; border-color: var(--green); color: #15803d; }
.btn.voice-off { background: #fef2f2; border-color: var(--red); color: #b91c1c; }
.btn.ghost { background: transparent; box-shadow: none; }

.alert-banner {
  margin: 12px 26px 0; padding: 13px 18px; border-radius: 10px;
  background: linear-gradient(90deg, #ecfdf5, #d1fae5);
  border: 1px solid var(--green); font-size: 15.5px; font-weight: 600; color: #14532d;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .72; } }

/* ---- İstatistik barı ---- */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  padding: 16px 26px 0;
}
.stat {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.stat::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), transparent);
}
.stat-num { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }

main { padding: 16px 26px; flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* ---- Platform kartları ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; position: relative; overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--pc, var(--accent)); box-shadow: 0 6px 20px rgba(28,37,54,.1); }
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--pc, var(--accent));
}
.card h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(22,163,74,.5); }
.dot.warn { background: var(--amber); box-shadow: 0 0 8px rgba(217,119,6,.5); }
.dot.err { background: var(--red); box-shadow: 0 0 8px rgba(220,38,38,.5); }
.dot.idle { background: var(--dim); }
.card .nums { display: flex; gap: 20px; margin-top: 10px; }
.card .num { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; }
.card .lbl { font-size: 10.5px; color: var(--dim); }
.card .err-msg { margin-top: 8px; font-size: 11px; color: #b91c1c; word-break: break-word; }
.card .note { margin-top: 8px; font-size: 11px; color: var(--amber); }
.card .poll { margin-top: 8px; font-size: 10.5px; color: var(--dim); }
.card .ilan { margin-top: 8px; font-size: 11.5px; color: var(--dim); }
.card .ilan b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- Paneller ---- */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.panel h2 { font-size: 14.5px; margin-bottom: 12px; letter-spacing: .3px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#searchBox, #prodSearch {
  background: #fff; border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; width: 240px; outline: none;
}
#searchBox:focus, #prodSearch:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border-radius: 20px; font-size: 12px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); color: var(--dim);
}
.chip.active { color: #fff; border-color: var(--accent); background: var(--accent); }
.chip.active .p-logo { background: #fff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 7px 9px; border-bottom: 2px solid var(--line); background: #fafbfd; }
td { padding: 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover td { background: #f6f9ff; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { padding: 3px 9px; border-radius: 6px; font-size: 11.5px; background: #fff; border: 1px solid var(--line); white-space: nowrap; }
.status-pill { padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st-green { background: #ecfdf5; color: #15803d; border: 1px solid #86efac; }
.st-amber { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.st-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.st-red { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.st-gray { background: var(--bg3); color: var(--dim); border: 1px solid var(--line); }
.empty { color: var(--dim); font-size: 13px; padding: 16px 4px; list-style: none; }
.detail-btn { font-size: 12px; padding: 5px 10px; }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .bottom-grid { grid-template-columns: 1fr; } }
.feed { list-style: none; max-height: 280px; overflow-y: auto; }
.feed li { padding: 9px 11px; border-left: 3px solid var(--accent); background: var(--bg3); border-radius: 7px; margin-bottom: 8px; font-size: 13px; }
.feed li .t { color: var(--dim); font-size: 11px; display: block; margin-top: 3px; }
.questions { list-style: none; max-height: 280px; overflow-y: auto; }
.questions li { font-size: 12.5px; padding: 8px 10px; background: var(--bg3); border-radius: 7px; margin-bottom: 7px; }
.questions .who { color: var(--accent); font-weight: 600; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(680px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15,23,42,.25);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 0; }
.modal-head h3 { font-size: 18px; margin-top: 8px; }
.modal-body { padding: 14px 20px; }
.modal-foot { display: flex; gap: 10px; padding: 0 20px 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.detail-box h4 { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 7px; }
.detail-box p { font-size: 13px; margin-bottom: 4px; word-break: break-word; }
.items-head { margin: 16px 0 8px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; }
.items-table td, .items-table th { padding: 7px 9px; }
.items-table tfoot td { border-top: 2px solid var(--line); border-bottom: none; padding-top: 10px; }

/* ---- Ayarlar çekmecesi ---- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); z-index: 110;
  background: var(--bg2); border-left: 1px solid var(--line);
  padding: 18px; overflow-y: auto; box-shadow: -18px 0 50px rgba(15,23,42,.15);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drawer-head h3 { font-size: 16px; }
.cred-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; }
.cred-card h4 { font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.cred-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.cred-row:last-child { border-bottom: none; }
.cred-row .k { color: var(--dim); }
.cred-row .v { font-family: Consolas, monospace; color: var(--text); word-break: break-all; text-align: right; }

.foot { padding: 12px 26px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--dim); flex-wrap: wrap; background: #fff; }

/* ---- Görünüm sekmeleri ---- */
.view-tabs { display: flex; gap: 8px; padding: 12px 26px 0; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--dim);
  padding: 9px 18px; border-radius: 10px 10px 0 0; cursor: pointer; font-size: 13.5px; font-weight: 600;
  border-bottom: none;
}
.tab.active { color: var(--text); background: var(--bg3); border-color: var(--accent); }
#prodPlatform {
  background: #fff; border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; outline: none;
}
.note-line { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 10px; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; justify-content: flex-end; }
.p-input {
  width: 90px; background: #fff; border: 1px solid var(--line); color: var(--text);
  padding: 6px 8px; border-radius: 6px; font-size: 13px; text-align: right; outline: none;
}
.p-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.p-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: #fff; display: block; }
.p-thumb-empty { display: grid; place-items: center; color: var(--dim); font-weight: 600; font-size: 15px; }
.save-ok { color: var(--green); font-size: 12px; }
.save-err { color: var(--red); font-size: 12px; }
@media (max-width: 768px) { .view-tabs { padding: 10px 14px 0; } .tab { padding: 8px 12px; font-size: 12.5px; } }

/* ---- Logolar ---- */
.p-logo { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; background: #fff; padding: 1px; border: 1px solid var(--line); flex: none; }
.p-logo.sm { width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 5px; }
.card h3 .p-logo { width: 24px; height: 24px; }

/* ---- Açılış animasyonu (açık tema) ---- */
#splash {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: radial-gradient(ellipse 90% 60% at 50% 30%, #ffffff 0%, #eef2f9 70%);
  animation: splashOut .6s ease 6.2s forwards; cursor: pointer;
}
#splash.gone { display: none; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }
.splash-inner { text-align: center; max-width: 860px; padding: 20px; }
.splash-logo {
  width: min(340px, 70vw); border-radius: 18px;
  animation: logoIn .9s cubic-bezier(.2,.9,.25,1.2) both;
  box-shadow: 0 18px 60px rgba(37,99,235,.18);
}
@keyframes logoIn { from { opacity: 0; transform: scale(.6) translateY(30px); } to { opacity: 1; transform: none; } }
.splash-title {
  margin-top: 18px; font-size: 22px; font-weight: 800; letter-spacing: 3px;
  animation: fadeUp .7s ease .5s both;
}
.splash-sub { color: var(--dim); font-size: 13px; margin-top: 6px; animation: fadeUp .7s ease .8s both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.splash-platforms { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.sp-item {
  display: flex; align-items: center; gap: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 14px; opacity: 0; transform: translateY(16px) scale(.92);
  animation: fadeUp .5s ease forwards; box-shadow: var(--shadow);
}
.sp-item img { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #fff; padding: 1px; }
.sp-item .sp-name { font-size: 13px; font-weight: 600; }
.sp-item .sp-count { font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; }
.sp-item .sp-count.na { color: var(--dim); font-weight: 400; }
.splash-skip { margin-top: 26px; color: var(--dim); font-size: 11.5px; animation: fadeUp .7s ease 1.4s both; }

/* ---- Yeni görünümler: iade / soru / finans / toplu işlem / ürün formu ---- */
.sel, .f-input {
  background: #fff; border: 1px solid var(--line); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; outline: none;
}
.sel:focus, .f-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea.f-input { width: 100%; resize: vertical; font-family: inherit; }
.bulk-text {
  width: 100%; min-height: 140px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; font-family: Consolas, monospace; font-size: 12.5px;
  color: var(--text); outline: none; resize: vertical;
}
.bulk-text:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.bulk-plats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.bulk-plat {
  display: flex; align-items: center; gap: 5px; font-size: 12.5px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 5px 11px;
}
.bulk-result { margin-top: 10px; font-size: 12.5px; }
.bulk-line { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.qa-item {
  background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid var(--pc, var(--accent));
  border-radius: 10px; padding: 12px; margin-bottom: 10px;
}
.qa-head { font-size: 12.5px; margin-bottom: 6px; }
.qa-text { font-size: 13px; margin-bottom: 8px; word-break: break-word; }
.qa-answer { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.qa-answer .qa-textarea { flex: 1; min-width: 200px; width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid label, .attr-row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); font-weight: 600; }
.form-grid .span2 { grid-column: span 2; }
.cat-results { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; background: #fff; }
.cat-results:empty { display: none; }
.cat-opt { padding: 8px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--line); }
.cat-opt:last-child { border-bottom: none; }
.cat-opt:hover { background: #f6f9ff; }
.attr-row { margin-top: 8px; }
.act-panel { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 4px; }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.act-row .f-input, .act-row .sel { flex: 1; min-width: 140px; }
tfoot td { border-top: 2px solid var(--line); border-bottom: none; padding-top: 10px; }
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .view-tabs { flex-wrap: wrap; }
}

/* ---- Fiş yazdırma ---- */
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: absolute; inset: 0; background: #fff; color: #000; }
}

/* ---- Tablet (≤1100px) ---- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* ---- Küçük tablet (≤768px) ---- */
@media (max-width: 768px) {
  .topbar { padding: 12px 14px; gap: 10px; }
  h1 { font-size: 14px; }
  .sub { font-size: 10.5px; }
  .brand-logo { width: 38px; height: 38px; }
  .clock-wrap { display: none; }
  .btn { padding: 7px 10px; font-size: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); padding: 12px 14px 0; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-num { font-size: 20px; }
  main { padding: 12px 14px; gap: 12px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card { padding: 10px 11px; }
  .card .num { font-size: 19px; }
  .card .nums { gap: 12px; }
  .panel { padding: 12px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  #searchBox, #prodSearch { width: 100%; }
  .bottom-grid { grid-template-columns: 1fr; }
  .modal-card { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  .drawer { width: 100vw; }
  .foot { padding: 10px 14px; font-size: 11px; }
  th, td { padding: 7px 6px; font-size: 12px; }
  .splash-logo { width: min(260px, 72vw); }
  .splash-title { font-size: 17px; }
  .sp-item { padding: 7px 10px; }
}

/* ---- Telefon (≤420px) ---- */
@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr 1fr; }
  .card h3 { font-size: 12px; flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: flex-end; }
  #voiceToggle, #testVoice { flex: 1; text-align: center; }
}
