/* Uzman Ürün Analiz — SaaS panel teması (koyu varsayılan, tek dosya, framework yok) */

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1e2632;
  --border: #2a3242;
  --text: #e6e9ef;
  --text-dim: #9aa4b2;
  --accent: #4f8cff;
  --accent-hover: #3b76e8;
  --green: #3fb950;
  --red: #f85149;
  --orange: #f0883e;
  --yellow: #e3b341;
  --blue: #58a6ff;
  --gray: #8b949e;
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 1rem; }
h2 { font-size: 1.08rem; margin: 1.6rem 0 0.8rem; }
h3 { font-size: 1rem; margin: 0 0 0.4rem; }
p { margin: 0.4rem 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.muted { color: var(--text-dim); }
.small { font-size: 0.8rem; }

/* ---------------------------------------------------------------- Yerleşim */
.layout { display: flex; min-height: 100vh; }
.sidenav {
  width: 225px; flex: 0 0 225px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  font-weight: 700; padding: 18px 16px; font-size: 0.98rem;
  border-bottom: 1px solid var(--border);
}
.sidenav nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; flex: 1; }
.sidenav nav a { color: var(--text-dim); padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.sidenav nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidenav nav a.active { background: var(--surface-2); color: var(--accent); }
.sidenav-foot {
  padding: 12px 16px; color: var(--text-dim); font-size: 0.75rem;
  border-top: 1px solid var(--border);
}
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 22px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.store-name { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-email { color: var(--text-dim); font-size: 0.85rem; word-break: break-all; }
.content { padding: 22px; max-width: 1280px; width: 100%; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.page-head h1 { margin: 0; }

/* ------------------------------------------------------------ Uyarı şeritleri */
.banner { padding: 10px 22px; font-weight: 600; font-size: 0.9rem; }
.banner-yellow { background: #3a2f05; color: #f2d34c; border-bottom: 1px solid #5c4a06; }
.banner-orange { background: #3c2205; color: #f0a35e; border-bottom: 1px solid #6b3b08; }
/* Operatörün "müşteri gözüyle bak" önizlemesi — mor, uyarı şeritleriyle
   karışmasın diye: bu bir sorun bildirimi değil, bir mod göstergesi. */
.banner-onizleme {
  background: #2a1f3d; color: #c4b5fd; border-bottom: 1px solid #4c3a75;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  justify-content: space-between;
}
.banner-onizleme form { margin: 0; }

/* ------------------------------------------------------------------- Kartlar */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat-label {
  color: var(--text-dim); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.stat-value { font-size: 1.45rem; font-weight: 700; margin-top: 6px; }
.stat-sub { color: var(--text-dim); font-size: 0.82rem; margin-top: 4px; }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.two-col {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; align-items: start;
}

/* -------------------------------------------------------------- Kota çubuğu */
.quota-line { margin-top: 8px; font-size: 0.84rem; }
.quota-bar {
  background: var(--surface-2); border-radius: 6px; height: 8px;
  overflow: hidden; margin-top: 4px;
}
.quota-bar > span { display: block; height: 100%; background: var(--accent); }
.quota-bar > span.warn { background: var(--orange); }
.quota-bar > span.full { background: var(--red); }

/* ------------------------------------------------------------------ Rozetler */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-green { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.badge-red { background: rgba(248, 81, 73, 0.15); color: var(--red); }
.badge-blue { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.badge-gray { background: rgba(139, 148, 158, 0.15); color: var(--gray); }
.badge-orange { background: rgba(240, 136, 62, 0.15); color: var(--orange); }
.badge-yellow { background: rgba(227, 179, 65, 0.15); color: var(--yellow); }

/* ------------------------------------------------------------------ Tablolar */
.table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 560px; }
table.data th { white-space: nowrap; }
table.data th {
  color: var(--text-dim); text-align: left; font-weight: 600;
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em;
}
table.data th, table.data td {
  padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
tr.row-error-detail td {
  color: var(--red); font-size: 0.8rem; background: rgba(248, 81, 73, 0.06);
}
tr.problem td { background: rgba(248, 81, 73, 0.08); }
table.data input[type="text"], table.data input[type="number"] {
  padding: 5px 8px; font-size: 0.8rem; min-width: 60px;
}
table.data select { padding: 5px 8px; font-size: 0.8rem; min-width: 90px; }
.actions-cell { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.cell-error { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ Butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 8px; padding: 8px 14px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: inherit; line-height: 1.3;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 0.78rem; border-radius: 6px; }
.btn-block { width: 100%; }
.spinner {
  width: 14px; height: 14px; display: inline-block; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------- Formlar */
label { display: block; margin: 12px 0 4px; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 9px 12px;
  font-size: 0.9rem; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
select { width: auto; min-width: 130px; background: var(--surface-2); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.field-hint { color: var(--text-dim); font-size: 0.76rem; margin-top: 3px; }
.form-msg { margin-top: 12px; font-size: 0.85rem; display: none; padding: 9px 12px; border-radius: 8px; }
.form-msg.ok { display: block; background: rgba(63, 185, 80, 0.12); color: var(--green); }
.form-msg.err { display: block; background: rgba(248, 81, 73, 0.12); color: var(--red); }
.filter-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row label { margin: 0 0 4px; }
.pkg-checks { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; }
.pkg-checks label {
  display: inline-flex; gap: 4px; align-items: center;
  margin: 0; font-weight: 500; color: var(--text);
}

/* ---------------------------------------------------------- Uyarı kutuları */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 0.86rem; margin-bottom: 14px; }
.alert-error { background: rgba(248, 81, 73, 0.12); color: var(--red); }
.alert-success { background: rgba(63, 185, 80, 0.12); color: var(--green); }
.note-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-size: 0.84rem; color: var(--text-dim);
}

/* ---------------------------------------------------- Giriş / kayıt sayfaları */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 34px 30px; width: 100%; max-width: 400px;
}
.auth-logo { font-size: 2rem; text-align: center; }
.auth-card h1 { text-align: center; font-size: 1.2rem; margin: 8px 0 2px; }
.auth-sub { text-align: center; color: var(--text-dim); margin: 0 0 18px; font-size: 0.88rem; }
.auth-card .btn-block { margin-top: 18px; }
.auth-links {
  margin-top: 16px; text-align: center; font-size: 0.85rem;
  color: var(--text-dim); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.auth-note { margin-top: 14px; text-align: center; color: var(--text-dim); font-size: 0.78rem; }

/* --- İki adımlı doğrulama ekranları (operatör hesabı) ------------------- */
.auth-card-genis { max-width: 460px; }
.auth-uyari { margin-top: 16px; color: var(--text-dim); font-size: 0.8rem; line-height: 1.6; }
.kurulum-adimlar {
  margin: 0 0 18px; padding-left: 20px; color: var(--text-dim);
  font-size: 0.85rem; line-height: 1.75;
}
/* Karekod beyaz zeminde okunur — koyu temada bile kontrast şart, yoksa
   telefon kamerası okuyamaz. */
.qr-kutu {
  background: #fff; border-radius: 10px; padding: 12px; margin: 0 auto 16px;
  width: max-content; max-width: 100%;
}
.qr-kutu svg { display: block; width: 200px; height: 200px; }
.qr-elle { margin-bottom: 16px; font-size: 0.82rem; color: var(--text-dim); }
.qr-elle summary { cursor: pointer; }
.totp-sir {
  display: block; margin: 8px 0; padding: 9px 11px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem; letter-spacing: 0.09em; word-break: break-all; color: var(--text);
}
.ipucu-not { color: var(--text-dim); font-size: 0.78rem; margin: 6px 0 0; }
.yedek-kod-listesi {
  list-style: none; padding: 14px; margin: 0 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px;
}
.yedek-kod-listesi code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem; letter-spacing: 0.05em; color: var(--text);
}
.onay-satiri {
  display: flex; align-items: center; gap: 9px; margin-top: 14px;
  font-size: 0.85rem; color: var(--text-dim);
}
.onay-satiri input { width: auto; margin: 0; }

/* Kayıt onay kutuları — zorunlu sözleşme kabulü, aydınlatma teyidi ve
   isteğe bağlı ticari ileti rızası ayrı satırlarda durur (KVKK 2026/347). */
.onay-grubu {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 11px;
}
.onay {
  display: flex; gap: 9px; align-items: flex-start; margin: 0;
  font-size: 0.79rem; line-height: 1.45; color: var(--text-dim); font-weight: 400;
}
.onay input[type="checkbox"] { flex-shrink: 0; margin-top: 1px; }
.onay a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.onay-istege-bagli { color: var(--text-dim); opacity: 0.92; }

/* ------------------------------------------------------------ Analiz kartları */
.analysis-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.analysis-card p { margin: 0; color: var(--text-dim); font-size: 0.83rem; flex: 1; }
.analysis-card.locked { opacity: 0.55; }
.locked-note { font-size: 0.8rem; color: var(--yellow); }
.analysis-card .btn { align-self: flex-start; }

/* --------------------------------------------------------------------- Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: none; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; z-index: 100; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); width: 100%; max-width: 860px; padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.modal-body { max-height: 65vh; overflow: auto; }
.modal-body pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-size: 0.78rem; overflow-x: auto;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 12px; font-size: 0.8rem;
}
.result-section h4 { margin: 14px 0 6px; font-size: 0.9rem; color: var(--accent); }

/* --------------------------------------------------------------------- Toast */
#toast-root {
  position: fixed; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 10px 16px; font-size: 0.86rem; box-shadow: var(--shadow); max-width: 360px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--orange); }

/* ------------------------------------------------------------- Sekmeler (admin) */
.tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.tabs button {
  border: 1px solid transparent; background: transparent; color: var(--text-dim);
  border-radius: 8px; padding: 7px 14px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.active { background: var(--accent); color: #fff; }
.tab-section { display: none; }
.tab-section.active { display: block; }

/* Sekmenin ne işe yaradığını anlatan giriş satırı — ipucu işaretleri burada. */
.tab-intro {
  margin: 0 0 14px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  line-height: 1.55;
}

/* Katalogda toplu işlem çubuğu (seç → pakete ekle / aktifleştir). */
.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.82rem;
}
.bulk-bar .bulk-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.bulk-bar select { padding: 5px 8px; font-size: 0.8rem; }
.bulk-sep { width: 1px; height: 20px; background: var(--border); }
.ipucu-wrap { display: inline-flex; align-items: center; margin-left: auto; }

/* Katalog tablosu: seçim sütunu dar, açıklama sütunu geniş kalsın. */
table.data th.col-check, table.data td.col-check { width: 28px; text-align: center; }
table.data input.w-title { min-width: 190px; }
table.data input.w-desc { min-width: 280px; }

/* -------------------------------------------------------------- Bağlantı kartı */
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-head h3 { margin: 0; }
.conn-info { margin: 8px 0; }

/* ----------------------------------------------------------------- Responsive */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidenav { width: 100%; flex: none; height: auto; position: static; }
  .sidenav nav { flex-direction: row; overflow-x: auto; padding: 6px; }
  .sidenav nav a { white-space: nowrap; }
  .sidenav-foot { display: none; }
  .content { padding: 14px; }
  .topbar { padding: 10px 14px; }
}

/* --------------------------------------------------------------- Mini ipucu
   Form alanı / metrik başlığı yanındaki "?" işareti. Hedef verilirse yardım
   sayfasının ilgili bölümüne bağlanır. Balon `position: fixed` konumlanır
   (JS: UP.ipucuKur) — .table-wrap gibi overflow'lu kapsayıcılar kırpmasın. */
.ipucu {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; flex-shrink: 0;
  margin-left: 5px; vertical-align: middle;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface-2); color: var(--text-dim);
  font-size: 10px; font-weight: 700; line-height: 1;
  cursor: help; text-decoration: none; user-select: none;
}
.ipucu:hover, .ipucu:focus-visible {
  background: var(--accent); border-color: var(--accent);
  color: #fff; text-decoration: none;
}
.ipucu:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ipucu-balon {
  position: fixed; top: 0; left: 0; z-index: 300; display: none;
  width: max-content; max-width: min(300px, calc(100vw - 24px));
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 9px 12px;
  font-size: 0.79rem; font-weight: 400; line-height: 1.45;
  /* Başlık/th içindeki ipuçlarında miras kalan biçimi sıfırla. */
  text-align: left; text-transform: none; letter-spacing: normal;
  white-space: normal; cursor: default; pointer-events: none;
}
.ipucu-balon.acik { display: block; }
.ipucu-git { display: block; margin-top: 6px; color: var(--accent); font-size: 0.73rem; }

/* --------------------------------------------------------------- Yardım sayfası */
.yardim-icindekiler {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px;
  padding: 0; list-style: none;
}
.yardim-icindekiler a {
  display: inline-block; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 13px; font-size: 0.82rem; color: var(--text);
}
.yardim-icindekiler a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.yardim-bolum { scroll-margin-top: 18px; margin-bottom: 16px; }
.yardim-bolum h2 { margin-top: 0; }
.yardim-bolum ol, .yardim-bolum ul { margin: 6px 0; padding-left: 20px; }
.yardim-bolum li { margin: 5px 0; font-size: 0.9rem; }
.yardim-bolum dt { font-weight: 600; margin-top: 12px; font-size: 0.9rem; }
.yardim-bolum dd { margin: 3px 0 0; color: var(--text-dim); font-size: 0.86rem; }
.yardim-bolum code {
  background: var(--bg); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; font-size: 0.82rem; word-break: break-all;
}
/* Tarayıcı #hedef ile geldiğinde ilgili bölümü kısaca vurgula. */
.yardim-bolum:target { border-color: var(--accent); }
