/* ==========================================================================
   InstaBot — koyu tema
   Kural: hiçbir metin --text-dim'den soluk olmayacak. Rozetler dolgulu ve
   kenarlıklı; her durumun kendi rengi var. Kartın sol şeridi durumu gösterir.
   ========================================================================== */

:root {
  --bg: #0D1411;
  --sidebar: #0A100E;
  --surface: #151E1A;
  --surface-2: #1D2823;
  --surface-3: #24312B;
  --border: #27332D;
  --border-strong: #35453D;

  --text: #E9EFEC;
  --text-dim: #98A8A1;

  --accent: #3DD9A0;
  --accent-ink: #06231A;

  --ok: #34D399;
  --danger: #F0554B;
  --warn: #F5A524;
  --info: #5AA9F5;
  --muted: #6B7C75;
  --neutral: #7E8F88;

  --radius: 14px;
  --gap: 14px;
  --sidebar-w: 224px;
}

/* tone yardımcıları — kart şeridi, rozet ve nokta aynı değişkeni kullanır */
.t-ok      { --tone: var(--ok); }
.t-danger  { --tone: var(--danger); }
.t-warn    { --tone: var(--warn); }
.t-info    { --tone: var(--info); }
.t-muted   { --tone: var(--muted); }
.t-neutral { --tone: var(--neutral); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: rgba(61, 217, 160, .28); }

/* ------------------------------------------------------------------ kabuk */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 7px); grid-gap: 3px; }
.brand-mark i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); display: block; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .45; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 650;
}
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-icon {
  width: 18px; height: 18px; flex: 0 0 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.bot-state {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 9px; }
.dot.is-running { background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, .16); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, .06); } }
.sidebar-logout { padding: 0 12px; font-size: 13px; color: var(--text-dim); }
.sidebar-logout:hover { color: var(--text); }

/* ---------------------------------------------------------------- içerik */
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--border);
}
.page-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.runbar { height: 3px; background: var(--surface-2); overflow: hidden; }
.runbar span { display: block; height: 100%; width: 30%; background: var(--accent); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* Geniş ekranda kart içeriği aşırı yayılmasın: rozet isimden kopuyor,
   satırlar okunmaz uzunluğa çıkıyor. */
.page { padding: 18px 26px 40px; max-width: 1180px; }
.topbar { max-width: 1180px; }

/* --------------------------------------------------------------- butonlar */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 14px; font-weight: 550;
}
.btn:hover { background: var(--surface-3); border-color: #435449; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); font-weight: 700;
}
.btn-primary:hover { background: #4CE7AE; border-color: #4CE7AE; }

.btn-danger { color: #FF8A82; border-color: #4A2C2A; background: #241816; }
.btn-danger:hover { background: #2E1D1A; border-color: #6A3A36; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }

/* filtre pill'leri */
.filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: var(--gap); }
.filters .spacer { margin-left: auto; }
.chip {
  height: 32px; padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13px; font-weight: 550;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chip .count { opacity: .75; margin-left: 5px; }

/* ------------------------------------------------------------ özet şeridi */
.summary {
  display: flex; align-items: center; gap: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: var(--gap);
  flex-wrap: wrap;
}
.summary-item { display: flex; align-items: baseline; gap: 8px; }
.summary-num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.summary-num.is-ok { color: var(--ok); }
.summary-num.is-problem { color: var(--danger); }
.summary-label { color: var(--text-dim); font-size: 13px; }
.summary-spark { margin-left: auto; display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.summary-spark i {
  width: 6px; border-radius: 2px; background: var(--surface-3); display: block; min-height: 2px;
}
.summary-spark i.is-today { background: var(--accent); }
.summary-spark i.has-value { background: #2A7F63; }

/* ------------------------------------------------------------ hesap kartı */
.accounts { display: flex; flex-direction: column; gap: var(--gap); }

.acc {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 18px 28px;
  overflow: hidden;
}
.acc::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 5px; background: var(--tone, var(--muted));
}
.acc.is-problem { border-color: color-mix(in srgb, var(--tone) 40%, var(--border)); }

.acc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.acc-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.acc-name .unnamed { color: var(--text-dim); font-weight: 600; }
.acc-rename {
  border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: 12.5px; padding: 2px 6px; border-radius: 6px;
}
.acc-rename:hover { color: var(--accent); background: var(--surface-2); }
.acc-head .badge { margin-left: auto; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent);
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }

.acc-target { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.acc-target .arrow { color: var(--text-dim); }
.acc-target .handle { color: var(--accent); font-weight: 600; }
.acc-target .handle.is-empty { color: var(--text-dim); font-weight: 500; font-style: italic; }
.acc-target .suffix { color: var(--text-dim); }

.acc-note { margin-top: 8px; font-size: 13px; color: var(--tone); font-weight: 500; }
.acc-note.is-plain { color: var(--text-dim); font-weight: 400; }

.acc-stats { margin-top: 14px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 7px; }
.stat-label { color: var(--text-dim); font-size: 12.5px; }
.stat-value { font-size: 17px; font-weight: 700; }
.acc-progress { flex: 1 1 160px; min-width: 120px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.acc-progress i { display: block; height: 100%; border-radius: 999px; background: var(--tone, var(--accent)); }

.acc-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acc-file { margin-left: auto; color: var(--muted); font-size: 12px; font-family: ui-monospace, Consolas, monospace; }

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 40px 20px; text-align: center; color: var(--text-dim);
}

/* ----------------------------------------------------------------- kartlar */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: var(--gap); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-title { margin: 0; font-size: 16px; font-weight: 650; }
.card-accessory { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------- form */
.form-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px 18px; align-items: center; }
@media (max-width: 780px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid > label { color: var(--text-dim); font-size: 13.5px; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; height: 40px; padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit; outline: none;
}
textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input::placeholder, textarea::placeholder { color: #6C7B75; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61, 217, 160, .18); }
select option { background: var(--surface); color: var(--text); }

.pair { display: flex; align-items: center; gap: 10px; }
.pair span { color: var(--text-dim); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .15s; flex: 0 0 40px; border: 1px solid var(--border-strong); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #8A9A93; transition: transform .15s, background .15s; }
.switch input:checked + .track { background: rgba(61, 217, 160, .25); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); background: var(--accent); }
.switch .hint { color: var(--text-dim); font-size: 12.5px; }

.field-hint { color: var(--text-dim); font-size: 12.5px; margin-top: 8px; }
.field-hint code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ----------------------------------------------------------------- loglar */
.log-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.log-toolbar input[type="text"] { width: 240px; }
.log-toolbar select { width: auto; min-width: 130px; }

.log-view {
  height: calc(100vh - 300px); min-height: 340px; overflow: auto;
  background: #0A100D;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12.5px; line-height: 1.7;
}
.log-line { white-space: pre-wrap; word-break: break-word; color: var(--text); }
.log-line .lt { color: var(--muted); }
.log-line .ln { color: var(--accent); }
.log-line.lv-DEBUG { color: var(--text-dim); }
.log-line.lv-WARNING { color: var(--warn); }
.log-line.lv-ERROR, .log-line.lv-CRITICAL { color: #FF8A82; }

/* ----------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 9, 7, .72);
  display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 40;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  width: 100%; max-width: 980px; max-height: 92vh; overflow: auto; padding: 24px;
}
.modal-sm { max-width: 460px; }
.modal h2 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.modal p.sub { margin: 0 0 18px; color: var(--text-dim); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }

.vnc-embed, .vnc-frame {
  width: 100%; height: 470px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: #050A08;
}

.note {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--text);
  margin-bottom: 14px;
}
.note.is-warn { background: rgba(245, 165, 36, .12); border-color: rgba(245, 165, 36, .4); color: #FFC97A; }
.note.is-ok { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .4); color: #6EE7B7; }
.note.is-danger { background: rgba(240, 85, 75, .12); border-color: rgba(240, 85, 75, .4); color: #FF9A93; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5); max-width: 400px;
}
.toast[hidden] { display: none; }
.toast.is-error { background: #2E1A18; border-color: #6A3A36; color: #FF9A93; }

/* ------------------------------------------------------------ giriş sayfası */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 390px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 18px; padding: 32px 28px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 7px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 22px; height: 42px; }
.login-error { background: rgba(240, 85, 75, .14); border: 1px solid rgba(240, 85, 75, .4); color: #FF9A93; border-radius: 10px; padding: 11px 13px; font-size: 13.5px; }
.login-setup { background: rgba(245, 165, 36, .12); border: 1px solid rgba(245, 165, 36, .4); color: #FFC97A; border-radius: 10px; padding: 11px 13px; font-size: 13px; }
.login-setup code { background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: 4px; }

/* ------------------------------------------------------------ scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3A4A42; }

/* --------------------------------------------------------------- ajan tanısı
   Ev bilgisayarından gelen kurulum/bağlantı raporları. Liste kasıtlı olarak
   "teşhis önce" düzeninde: sorunun ne olduğu ilk satırda, makine bilgisi
   altta. Destek çağrısında ilk bakılan yer burası. */
.tani-liste { display: flex; flex-direction: column; gap: 8px; }

.tani-satir {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}
.tani-satir:hover { border-color: var(--border-strong); background: var(--surface-3); }
.tani-satir-ust { font-size: 14px; line-height: 1.35; }
.tani-satir-alt { color: var(--text-dim); font-size: 12px; line-height: 1.4; }

.tani-yapistir { margin-top: 14px; }
.tani-yapistir > summary {
  cursor: pointer; color: var(--text-dim); font-size: 13px; padding: 6px 0;
}
.tani-yapistir > summary:hover { color: var(--text); }
.tani-yapistir textarea {
  width: 100%; margin: 8px 0; padding: 10px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px;
  resize: vertical;
}

.tani-detay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 10, 8, .72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.tani-detay-kutu {
  width: min(1000px, 100%); max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 16px;
}
.tani-detay-kutu pre {
  margin: 10px 0 0; overflow: auto; flex: 1;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px; line-height: 1.5; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}

/* bir makinede birden fazla sorun aynı anda olabiliyor: ilki başlıkta,
   kalanı burada — ikincisini görmeden birincisini düzeltmek müşteriyi
   ikinci kez boşa uğraştırıyor */
.tani-uyarilar { display: flex; flex-wrap: wrap; gap: 6px; }
.tani-uyari {
  font-size: 11.5px; line-height: 1.3;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(245, 165, 36, .12);
  border: 1px solid rgba(245, 165, 36, .35);
  color: #FFC97A;
}
.tani-rozet {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: rgba(240, 85, 75, .14);
  border: 1px solid rgba(240, 85, 75, .4);
  color: #FF9A93;
}
