/* ==========================================================================
   CATI panel görsel sistemi

   Araştırma şirketinde gün boyu açık kalan bir araç: gösterişten çok
   okunabilirlik ve yoğunluk gözetildi. Renk yalnızca anlam taşıdığı yerde
   kullanılır (durum, uyarı, sonuç kodu); geri kalanı nötr yüzeylerdir.
   ========================================================================== */

:root {
  /* Yüzeyler */
  --bg: #f1f4f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e4e9f0;
  --line-strong: #cbd5e1;

  /* Metin */
  --ink: #101a26;
  --ink-2: #3f4d5e;
  --muted: #6b7a8d;

  /* Marka */
  --brand: #1d3b63;
  --brand-2: #2c5b93;
  --brand-soft: #eaf0f8;
  --brand-ring: rgba(44, 91, 147, .22);

  /* Anlam renkleri */
  --ok: #0f7a55;
  --ok-soft: #e3f7ee;
  --warn: #9a5b06;
  --warn-soft: #fdf3e0;
  --err: #b42318;
  --err-soft: #fdeceb;
  --info-soft: #eaf0f8;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 26, 38, .05), 0 1px 3px rgba(16, 26, 38, .04);
  --shadow-lg: 0 4px 16px rgba(16, 26, 38, .10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.55 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-underline-offset: 2px; }
a:hover { color: var(--brand); }

::selection { background: var(--brand-ring); }

/* --------------------------------------------------------------------------
   Üst çubuk
   -------------------------------------------------------------------------- */

header.topbar {
  background: linear-gradient(180deg, #22456f 0%, var(--brand) 100%);
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 26px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 2px 8px rgba(16, 26, 38, .18);
}

header.topbar .brand {
  font-weight: 700;
  letter-spacing: .06em;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
header.topbar .brand .mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(255, 255, 255, .16);
  display: grid; place-items: center;
  font-size: 11px; letter-spacing: 0;
}

header.topbar nav { display: flex; gap: 2px; align-items: center; }
header.topbar nav a {
  color: #c3d2e6;
  text-decoration: none;
  font-size: 13.5px;
  padding: 6px 11px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
header.topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, .09); }
header.topbar nav a.active { color: #fff; background: rgba(255, 255, 255, .16); font-weight: 600; }
header.topbar nav a svg { width: 15px; height: 15px; opacity: .85; flex: none; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Kullanıcı bileti */
.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  padding: 4px 10px 4px 5px;
  border-radius: 99px;
  cursor: pointer;
  font: inherit; font-size: 13px;
}
.user-chip:hover { background: rgba(255, 255, 255, .18); }
.user-chip .avatar {
  width: 25px; height: 25px; border-radius: 50%;
  background: #fff; color: var(--brand);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.user-chip .who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-chip .who .role { font-size: 10.5px; color: #a9bdd6; }

.menu {
  position: absolute; top: 48px; right: 16px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 210px; padding: 6px; display: none;
}
.menu.open { display: block; }
.menu .head { padding: 9px 11px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.menu .head strong { display: block; font-size: 13.5px; }
.menu .head span { font-size: 12px; color: var(--muted); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: 0; text-align: left;
  padding: 8px 11px; border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer;
  text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--panel-2); color: var(--brand); }
.menu button.danger-text { color: var(--err); }
.menu button.danger-text:hover { background: var(--err-soft); color: var(--err); }
.menu form { margin: 0; }

/* --------------------------------------------------------------------------
   Sayfa gövdesi
   -------------------------------------------------------------------------- */

main { max-width: 1220px; margin: 26px auto; padding: 0 22px 70px; }
main.full { max-width: none; margin: 0; padding: 0; }

h1 { font-size: 21px; margin: 0 0 5px; letter-spacing: -.01em; }
h2 {
  font-size: 13px; margin: 30px 0 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
}
h3 { font-size: 15px; margin: 0 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-head > div:first-child { flex: 1; min-width: 240px; }
.page-head .subtitle { margin-bottom: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 19px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }

/* Sayaç kutuları */
.stat { position: relative; overflow: hidden; padding-left: 19px; }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand-2); opacity: .5;
}
.stat .value {
  font-size: 27px; font-weight: 700; line-height: 1.15;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat .label { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* --------------------------------------------------------------------------
   Tablolar
   -------------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--panel-2); white-space: nowrap;
}
th:first-child { border-radius: var(--radius-sm) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
tbody tr:hover { background: #fbfcfe; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num, .right { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------------
   Rozetler
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid transparent;
}
.badge.draft { background: #eef1f5; color: #55637a; }
.badge.published, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.archived { background: #eef1f5; color: #94a3b8; }
.badge.no, .badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------------------------
   Düğmeler
   -------------------------------------------------------------------------- */

button, .btn {
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  background: var(--brand); color: #fff;
  border: 1px solid var(--brand);
  padding: 8px 15px; border-radius: var(--radius-sm);
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--brand-ring);
}
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: var(--brand); border-color: var(--brand); }

button.ghost, .btn.ghost {
  background: var(--panel); color: var(--ink-2); border-color: var(--line-strong);
}
button.ghost:hover, .btn.ghost:hover {
  background: var(--panel-2); color: var(--brand); border-color: var(--brand-2);
}
button.ghost:disabled:hover { background: var(--panel); border-color: var(--line-strong); }

button.danger, .btn.danger { background: var(--err); border-color: var(--err); }
button.danger:hover, .btn.danger:hover { background: #93251c; border-color: #93251c; }

button.subtle {
  background: transparent; color: var(--muted); border-color: transparent;
  padding: 5px 9px;
}
button.subtle:hover { background: var(--panel-2); color: var(--brand); border-color: transparent; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------------
   Form öğeleri
   -------------------------------------------------------------------------- */

textarea, input[type=text], input[type=password], input[type=number],
input[type=email], input[type=search], select {
  font: inherit; font-size: 13.5px; width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: #a9b6c6;
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--panel-2); color: var(--muted); cursor: not-allowed;
}
input[type=file] {
  font: inherit; font-size: 13px; width: 100%;
  padding: 9px 11px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm); background: var(--panel-2);
}
input[type=file]:hover { border-color: var(--brand-2); background: var(--brand-soft); }

textarea { font-family: "Cascadia Mono", Consolas, "SF Mono", monospace; font-size: 12.5px; line-height: 1.5; }

label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--ink-2); margin: 13px 0 5px;
}
label.inline { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-weight: 400; }
label.inline input { width: auto; }

/* --------------------------------------------------------------------------
   Mesajlar
   -------------------------------------------------------------------------- */

.msg {
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13.5px; margin: 12px 0;
  border: 1px solid transparent; border-left-width: 3px;
}
.msg.ok { background: var(--ok-soft); color: #0a5c40; border-color: var(--ok); }
.msg.err { background: var(--err-soft); color: #8d1c14; border-color: var(--err); }
.msg.warn { background: var(--warn-soft); color: #7a4705; border-color: var(--warn); }
.msg.info { background: var(--info-soft); color: var(--brand); border-color: var(--brand-2); }
.msg strong { font-weight: 600; }

.issue { font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed rgba(0, 0, 0, .10); }
.issue:last-child { border-bottom: 0; }
.issue .path {
  font-family: Consolas, monospace; opacity: .75; margin-right: 8px;
  font-size: 12px;
}

.empty {
  text-align: center; color: var(--muted); font-size: 13.5px;
  padding: 34px 16px;
}
.empty strong { display: block; color: var(--ink-2); font-size: 14.5px; margin-bottom: 5px; }

/* --------------------------------------------------------------------------
   Yardımcılar
   -------------------------------------------------------------------------- */

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: "Cascadia Mono", Consolas, "SF Mono", monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

kbd {
  font-family: Consolas, monospace; font-size: 11px;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px;
}
code {
  font-family: Consolas, monospace; font-size: 12px;
  background: var(--panel-2); padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Sekmeler
   -------------------------------------------------------------------------- */

.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 18px; overflow-x: auto;
}
.tabs button {
  background: transparent; color: var(--muted); border: 0;
  border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px 15px; font-weight: 500;
}
.tabs button:hover { background: transparent; color: var(--brand); border-bottom-color: var(--line-strong); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* --------------------------------------------------------------------------
   İlerleme çubuğu
   -------------------------------------------------------------------------- */

.progress {
  height: 7px; background: #e8edf3; border-radius: 99px; overflow: hidden;
}
.progress > div {
  height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand));
  border-radius: 99px; transition: width .3s;
}
.progress.full > div { background: var(--ok); }

/* --------------------------------------------------------------------------
   Test araması
   -------------------------------------------------------------------------- */

.transcript {
  height: 470px; overflow-y: auto; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  scroll-behavior: smooth;
}
.bubble { margin: 9px 0; display: flex; }
.bubble .body {
  max-width: 82%; padding: 9px 13px; border-radius: 13px;
  font-size: 13.5px; white-space: pre-wrap; line-height: 1.45;
  box-shadow: var(--shadow);
}
.bubble.agent .body { background: var(--brand); color: #fff; border-bottom-left-radius: 3px; }
.bubble.respondent { justify-content: flex-end; }
.bubble.respondent .body {
  background: #fff; border: 1px solid var(--line); border-bottom-right-radius: 3px;
}
.bubble.system { justify-content: center; }
.bubble.system .body {
  background: transparent; box-shadow: none; color: var(--muted);
  font-size: 11.5px; font-family: Consolas, monospace; text-align: center;
}

.mic-bar { height: 6px; background: #e8edf3; border-radius: 99px; overflow: hidden; }
.mic-bar > div {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--ok), #34d399); transition: width .07s;
}

.mermaid {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; overflow-x: auto;
}

/* --------------------------------------------------------------------------
   Giriş sayfası
   -------------------------------------------------------------------------- */

body.login-page {
  background: linear-gradient(160deg, #1a3457 0%, #24486f 45%, #16283f 100%);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: 100%; max-width: 420px;
}
.login-brand {
  text-align: center; color: #fff; margin-bottom: 22px;
}
.login-brand .mark {
  width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 12px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
  display: grid; place-items: center; font-weight: 700; letter-spacing: .06em;
  font-size: 15px;
}
.login-brand h1 { color: #fff; font-size: 19px; margin: 0 0 4px; letter-spacing: .02em; }
.login-brand p { color: #a8bdd8; font-size: 13px; margin: 0; }

.login-card {
  background: var(--panel); border-radius: 13px; padding: 26px 26px 24px;
  box-shadow: 0 18px 44px rgba(6, 16, 30, .34);
}
.login-card h2 {
  margin: 0 0 4px; font-size: 16px; color: var(--ink);
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.login-card .lead { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-card button[type=submit] { width: 100%; justify-content: center; margin-top: 20px; padding: 10px; }
/* Geliştirme kolaylığı kutusu — yalnızca .env ile açıldığında görünür */
.demo-box {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
}
.demo-box form { margin: 0; }
.demo-box button {
  width: 100%; justify-content: center;
  border-style: dashed; font-weight: 400;
}
.demo-box button strong { font-weight: 600; }
.demo-box p {
  font-size: 11.5px; color: var(--muted); margin: 9px 0 0; line-height: 1.5;
  text-align: center;
}
.demo-box code { font-size: 11px; }

.login-foot {
  text-align: center; color: #92a9c6; font-size: 12px; margin-top: 18px;
}
/* Koyu zemin üzerindeki kod parçası */
code.on-dark {
  background: rgba(255, 255, 255, .10); border-color: transparent; color: #c7d8ee;
}

/* --------------------------------------------------------------------------
   Duyarlılık
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  header.topbar { gap: 12px; padding: 0 12px; overflow-x: auto; }
  header.topbar nav a span { display: none; }
  header.topbar nav a { padding: 7px 9px; }
  .user-chip .who { display: none; }
  main { padding: 0 14px 50px; margin-top: 18px; }
}
