/* Telegram Inviter Panel — özel tasarım sistemi (bağımlılıksız, offline).
   Koyu, sakin, yüksek okunur bir ops/finans dashboard estetiği. */

:root {
  --bg:        #0b0f18;
  --bg-2:      #0f1523;
  --surface:   #141b2b;
  --surface-2: #1a2334;
  --border:    rgba(255,255,255,.08);
  --border-2:  rgba(255,255,255,.14);
  --text:      #e7ecf5;
  --text-mut:  #8b95ab;
  --text-dim:  #5c667c;

  --primary:   #5b8cff;
  --primary-2: #3b6fe0;
  --emerald:   #34d399;
  --amber:     #fbbf24;
  --red:       #f87171;
  --blue:      #60a5fa;
  --violet:    #a78bfa;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 6px 24px rgba(0,0,0,.35);
  --sp: 4px;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 80% -10%, #16223b 0%, var(--bg) 55%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1,h2,h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Auth (login/setup) ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow);
}
.auth-card .logo { display:flex; align-items:center; gap:10px; margin-bottom: 22px; }
.auth-card .logo .mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  display:grid; place-items:center; font-size: 18px;
}
.auth-card h1 { font-size: 18px; }
.auth-card .sub { color: var(--text-mut); font-size: 13px; margin-top: 2px; }

/* ---------- Form controls ---------- */
label { display:block; font-size: 12px; color: var(--text-mut); margin: 14px 0 6px; font-weight: 550; }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,140,255,.15);
}
input::placeholder { color: var(--text-dim); }

.btn {
  display:inline-flex; align-items:center; justify-content:center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: #22304a; border-color: var(--border-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.btn-emerald { background: linear-gradient(135deg, #34d399, #10b981); border-color: transparent; color: #05231a; }
.btn-danger  { background: transparent; border-color: rgba(248,113,113,.4); color: var(--red); }
.btn-danger:hover { background: rgba(248,113,113,.12); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-mut); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity:.5; cursor: not-allowed; }
.btn-row { display:flex; gap: 8px; flex-wrap: wrap; }

.form-error {
  background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3);
  color: #fca5a5; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; margin-top: 16px;
}
.form-hint { color: var(--text-dim); font-size: 12px; margin-top: 6px; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display:flex; align-items:center; gap: 16px;
  padding: 0 20px; height: 58px;
  background: rgba(11,15,24,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display:flex; align-items:center; gap: 10px; font-weight: 700; font-size: 15px; }
.topbar .brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  display:grid; place-items:center; font-size: 15px;
}
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--text-mut); font-size: 13px; display:flex; align-items:center; gap:12px; }

/* Project tabs */
.tabs {
  display:flex; align-items:center; gap: 4px; padding: 10px 20px 0;
  overflow-x: auto; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tab {
  padding: 9px 15px; border-radius: 9px 9px 0 0; font-size: 13.5px; font-weight: 600;
  color: var(--text-mut); cursor: pointer; white-space: nowrap; border: 1px solid transparent;
  border-bottom: none; display:flex; align-items:center; gap: 8px;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { color: var(--text); background: var(--surface); border-color: var(--border); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.tab.running .dot { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.tab.paused .dot { background: var(--amber); }
.tab-add { color: var(--primary); font-weight: 700; }

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display:flex; align-items:center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.page-head .target { color: var(--text-mut); font-size: 13px; font-family: var(--mono); }
.page-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cols-2 { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display:flex; align-items:center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 14px; }
.card-head .spacer { flex: 1; }
.card-head .count { color: var(--text-dim); font-size: 12px; font-weight: 600; }

/* Stat card */
.stat { position: relative; }
.stat .label { color: var(--text-mut); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value.sm { font-size: 24px; }
.stat .sub { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.stat .accent-bar { position:absolute; left:0; top:16px; bottom:16px; width:3px; border-radius:3px; background: var(--primary); }
.stat.emerald .accent-bar { background: var(--emerald); }
.stat.amber .accent-bar { background: var(--amber); }
.stat.violet .accent-bar { background: var(--violet); }
.stat .value.emerald { color: var(--emerald); }
.stat .value.amber { color: var(--amber); }
.stat .value.red { color: var(--red); }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 11px 14px; color: var(--text-mut);
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-mut); }
.dim { color: var(--text-dim); }

/* Badges */
.badge {
  display:inline-flex; align-items:center; gap: 6px; padding: 3px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 650;
  background: var(--surface-2); color: var(--text-mut); border: 1px solid var(--border);
}
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active   { color: var(--emerald); background: rgba(52,211,153,.1);  border-color: rgba(52,211,153,.25); }
.badge.cooldown { color: var(--amber);   background: rgba(251,191,36,.1);  border-color: rgba(251,191,36,.25); }
.badge.banned   { color: var(--red);     background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); }
.badge.unauthorized { color: var(--red); background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.2); }
.badge.paused   { color: var(--text-mut);background: var(--surface-2); }
.badge.resting  { color: var(--blue);    background: rgba(96,165,250,.1);  border-color: rgba(96,165,250,.25); }

/* ---------- Charts (CSS/SVG, kütüphanesiz) ---------- */
.bars { display:flex; align-items:flex-end; gap: 4px; height: 160px; padding-top: 10px; }
.bars .col { flex: 1; display:flex; flex-direction: column; justify-content:flex-end; align-items:center; gap: 4px; min-width: 0; }
.bars .bar-stack { width: 70%; max-width: 22px; display:flex; flex-direction: column; justify-content:flex-end; height: 100%; border-radius: 4px 4px 0 0; overflow:hidden; background: rgba(255,255,255,.03); }
.bars .bseg { width: 100%; }
.bars .bseg.joined { background: linear-gradient(180deg, var(--emerald), #10b981); }
.bars .bseg.other { background: rgba(91,140,255,.35); }
.bars .xl { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.heat { display:grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat .h { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.legend { display:flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--text-mut); }
.legend .k { display:flex; align-items:center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Live log ---------- */
.log {
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  height: 340px; overflow-y: auto; padding: 6px 4px;
}
.log .row { display:flex; gap: 8px; padding: 2px 8px; border-radius: 4px; }
.log .row:hover { background: rgba(255,255,255,.03); }
.log .t { color: var(--text-dim); flex-shrink: 0; }
.log .m { color: var(--text); word-break: break-word; }
.log .row.warning .m { color: var(--amber); }
.log .row.error .m { color: var(--red); }
.log .row.info .m { color: var(--text); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(4,7,12,.7); backdrop-filter: blur(4px);
  display:none; place-items:center; z-index: 100; padding: 20px;
}
.modal-back.open { display: grid; }
.modal {
  width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 4px; }
.modal .msub { color: var(--text-mut); font-size: 13px; margin-bottom: 8px; }
.modal .foot { display:flex; gap: 10px; justify-content:flex-end; margin-top: 22px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toggle for proxy section */
.section-toggle { display:flex; align-items:center; gap: 8px; margin-top: 16px; cursor: pointer; color: var(--text-mut); font-size: 13px; }
.switch { width: 38px; height: 22px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border-2); position: relative; transition: background .15s; flex-shrink:0; }
.switch .knob { position:absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-mut); transition: transform .15s, background .15s; }
.switch.on { background: rgba(91,140,255,.4); }
.switch.on .knob { transform: translateX(16px); background: var(--primary); }

/* Toast */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display:flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 13px; max-width: 340px; animation: slidein .2s ease;
}
.toast.ok { border-left: 3px solid var(--emerald); }
.toast.err { border-left: 3px solid var(--red); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { text-align:center; padding: 40px 20px; color: var(--text-dim); }
.empty .big { font-size: 32px; margin-bottom: 10px; }

.pulse { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.5;} }

/* Hesap avatarı (tablo) */
.ava { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  display:grid; place-items:center; font-size: 16px; overflow:hidden; position:relative;
  flex-shrink:0; color: var(--text-dim); border: 1px solid var(--border); }
.ava img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.acc-id { display:flex; align-items:center; gap: 10px; }
.acc-id .nm { font-weight: 600; white-space: nowrap; }
.acc-id .ph { font-size: 12px; }

.row-actions { display:flex; gap: 6px; justify-content:flex-end; }
.hidden { display: none !important; }
.spin { display:inline-block; width:14px;height:14px;border:2px solid rgba(255,255,255,.25); border-top-color:#fff; border-radius:50%; animation: sp .6s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
