:root {
  --bg: #f6f6f8;
  --card: #fff;
  --ink: #17171c;
  --muted: #6b6b76;
  --line: #e6e6ec;
  --accent: #5b4bff;
  --accent-soft: #eeecff;
  --ok: #12805c;
  --warn: #a15c00;
  --bad: #c0262d;
  --tiktok: #111;
  --instagram: #d6246e;
  --youtube: #e00;
  --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
small, .muted { color: var(--muted); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

button, input, select {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button { cursor: pointer; background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 500; }
button:hover { opacity: .9; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button.small { padding: 4px 10px; font-size: 12px; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.logo { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.spacer { flex: 1; }
.banner {
  background: #fff7e6; color: var(--warn); border-bottom: 1px solid #f3e1bd;
  padding: 8px 24px; font-size: 13px;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

/* Giriş */
.auth { max-width: 400px; margin: 10vh auto; }
.auth .card { display: grid; gap: 14px; }
.auth input { width: 100%; }
.devcode {
  background: var(--accent-soft); color: var(--accent); border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}

/* Alan seçimi */
.choice {
  border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer;
  display: grid; gap: 6px; background: #fff;
}
.choice:hover, .choice.on { border-color: var(--accent); }

/* Limitler */
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.limit .bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.limit .bar i { display: block; height: 100%; background: var(--accent); }
.limit.full .bar i { background: var(--bad); }

/* Social + hesaplar */
.social-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.accounts { display: grid; gap: 8px; }
.account {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
}
.account:hover { border-color: #cfcfd8; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--line); object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; }
.pf { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; color: #fff; }
.pf.TikTok { background: var(--tiktok); }
.pf.Instagram { background: var(--instagram); }
.pf.YouTube { background: var(--youtube); }
.status { font-size: 12px; font-weight: 500; }
.status.Ready { color: var(--ok); }
.status.Pending, .status.Running { color: var(--warn); }
.status.Failed { color: var(--bad); }
.status.Unsupported { color: var(--muted); }
.spin {
  display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.add-account { margin-top: 10px; }
.add-account input { flex: 1; min-width: 200px; }

/* Hesap detayı */
.profile { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat b { display: block; font-size: 20px; }
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.post { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; display: grid; }
.post .cover { aspect-ratio: 9 / 12; background: var(--line) center / cover no-repeat; position: relative; }
.post .cover .pf { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); }
.post .cover .pf.s3 { left: auto; right: 6px; background: var(--ok); }
.post .meta { padding: 8px 10px; display: grid; gap: 4px; font-size: 12px; }
.post .caption { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); }
.post .nums { display: flex; gap: 10px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
pre.json { background: #101018; color: #d6d6e0; padding: 14px; border-radius: 10px; overflow: auto; max-height: 420px; margin: 0; }
svg.spark { width: 100%; height: 80px; display: block; }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 20;
  max-width: 90vw;
}
#toast.error { background: var(--bad); }
