/* ===================== ClipBot dashboard ===================== */
:root {
  --bg:        #0f1115;
  --bg-2:      #161922;
  --card:      #1b1f2a;
  --card-2:    #20252f;
  --line:      #2a3040;
  --line-2:    #353d50;
  --text:      #e8ecf3;
  --text-2:    #aab2c5;
  --muted:     #7b8499;
  --accent:    #6d8bff;
  --accent-2:  #8aa2ff;
  --accent-ink:#0b1020;
  --green:     #34d399;
  --green-bg:  rgba(52,211,153,.12);
  --red:       #f87171;
  --red-bg:    rgba(248,113,113,.12);
  --amber:     #fbbf24;
  --amber-bg:  rgba(251,191,36,.12);
  --blue-bg:   rgba(109,139,255,.14);
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 6px 24px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 70% -10%, #1a2030 0%, var(--bg) 55%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; margin: 0; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ----- buttons ----- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  transition: .15s ease; color: var(--text); background: var(--card-2);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn--primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); }
.btn--primary:hover { box-shadow: 0 6px 18px rgba(109,139,255,.35); }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn--ghost:hover { color: var(--text); border-color: var(--accent); }
.btn--ok { background: var(--green-bg); color: var(--green); border-color: rgba(52,211,153,.3); }
.btn--ok:hover { background: rgba(52,211,153,.2); }
.btn--danger { background: var(--red-bg); color: var(--red); border-color: rgba(248,113,113,.3); }
.btn--danger:hover { background: rgba(248,113,113,.2); }
.btn--sm { padding: 7px 12px; font-size: .85rem; }
.btn--block { width: 100%; justify-content: center; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px;
  width: 100%; transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--blue-bg);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
select { appearance: none; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b8499' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* ===================== LOGIN ===================== */
.login-wrap {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 30px; text-align: center;
}
.login-sub { color: var(--text-2); margin: 6px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-msg { min-height: 20px; margin: 14px 0 0; font-size: .9rem; }
.login-msg.ok { color: var(--green); }
.login-msg.err { color: var(--red); }
.login-foot { color: var(--muted); font-size: .82rem; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0;
  color: var(--muted); font-size: .8rem; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#github-btn { gap: 10px; }

/* ===================== BRAND ===================== */
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { font-size: 1.2em; }
.brand-name { font-size: 1.15rem; }
.brand--lg { justify-content: center; font-size: 1.6rem; }
.brand--lg .brand-name { font-size: 1.6rem; }

/* ===================== TOPBAR ===================== */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(15,17,21,.8);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; }
.tabs { display: flex; gap: 4px; margin: 0 auto 0 8px; background: var(--bg-2);
  padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab { appearance: none; border: 0; background: transparent; color: var(--text-2);
  font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 9px; cursor: pointer; transition: .15s; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--card-2); color: var(--text); box-shadow: var(--shadow-sm); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-email { color: var(--muted); font-size: .85rem; max-width: 180px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

/* ===================== MAIN / PANELS ===================== */
.main { max-width: 1080px; margin: 0 auto; padding: 26px 20px 80px; }
.panel-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* filters */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { appearance: none; border: 1px solid var(--line-2); background: transparent;
  color: var(--text-2); font: inherit; font-size: .85rem; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: .15s; }
.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.is-active { background: var(--blue-bg); color: var(--accent-2); border-color: var(--accent); }

/* ===================== REVIEW FEED ===================== */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.post-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.post-media { position: relative; background: #000; aspect-ratio: 9 / 16; max-height: 520px; }
.post-media video { width: 100%; height: 100%; object-fit: contain; display: block; background:#000; }
.score-badge { position: absolute; top: 12px; left: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  font-weight: 800; font-size: .9rem; backdrop-filter: blur(6px); background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.14); }
.score-badge.hi { color: var(--green); }
.score-badge.mid { color: var(--amber); }
.score-badge.lo { color: var(--red); }
.status-chip { position: absolute; top: 12px; right: 12px; z-index: 2; font-size: .72rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 5px 9px;
  border-radius: 7px; backdrop-filter: blur(6px); }
.status-chip.pending { background: var(--amber-bg); color: var(--amber); }
.status-chip.approved { background: var(--blue-bg); color: var(--accent-2); }
.status-chip.posted { background: var(--green-bg); color: var(--green); }
.status-chip.rejected, .status-chip.failed { background: var(--red-bg); color: var(--red); }

.post-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.post-meta { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.post-meta .src { color: var(--text-2); font-weight: 600; }
.field-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.original-cap { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .88rem; color: var(--text-2); max-height: 90px; overflow: auto; }

.cap-variants { display: flex; flex-direction: column; gap: 6px; }
.cap-variant { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; transition: .15s; font-size: .88rem; }
.cap-variant:hover { border-color: var(--accent); }
.cap-variant.is-active { border-color: var(--accent); background: var(--blue-bg); }
.cap-variant .plat { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 800;
  color: var(--accent-2); padding-top: 2px; min-width: 56px; }

.refine { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); padding: 11px; }
.refine-row { display: flex; gap: 8px; }
.refine-row input { background: var(--card); }
.refine-hint { font-size: .76rem; color: var(--muted); margin: 8px 0 0; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.chip { font-size: .76rem; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text-2); cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--accent); color: var(--text); }

.sched-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sched-row label { font-size: .8rem; color: var(--muted); }
.post-actions { display: flex; gap: 10px; }
.post-actions .btn { flex: 1; justify-content: center; }

.platform-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.plat-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-2);
  color: var(--text-2); cursor: pointer; user-select: none; transition: .15s; }
.plat-toggle input { width: auto; margin: 0; accent-color: var(--accent); }
.plat-toggle.on { border-color: var(--accent); color: var(--text); background: var(--blue-bg); }

/* ===================== SOURCES ===================== */
.source-form { padding: 16px; margin-bottom: 22px; }
.source-form-row { display: grid; grid-template-columns: 150px 1fr 180px auto; gap: 10px; }
.form-msg { font-size: .85rem; margin: 10px 0 0; min-height: 18px; }
.form-msg.ok { color: var(--green); } .form-msg.err { color: var(--red); }
.sources-list { display: flex; flex-direction: column; gap: 10px; }
.source-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.source-row .src-info { flex: 1; min-width: 0; }
.source-row .src-label { font-weight: 600; }
.source-row .src-url { color: var(--muted); font-size: .82rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; display: block; }
.plat-tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 800;
  color: var(--accent-2); background: var(--blue-bg); padding: 4px 8px; border-radius: 6px; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; cursor: pointer; background: var(--line-2);
  border-radius: 999px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ===================== INSIGHTS ===================== */
.insights-card { padding: 22px 24px; }
.insights-summary { font-size: 1.02rem; line-height: 1.65; white-space: pre-wrap; }
.insights-meta { color: var(--muted); font-size: .82rem; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line); }
.insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-top: 18px; }
.insight-stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.insight-stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.insight-stat .v { font-size: 1.05rem; font-weight: 700; margin-top: 4px; }

/* ===================== MISC ===================== */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: .95rem; }
.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 100; width: min(92vw, 380px); }
.toast { background: var(--card-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 12px 16px; box-shadow: var(--shadow); font-size: .9rem; animation: rise .25s ease; }
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .brand-name { display: none; }
  .tabs { margin: 0; order: 3; width: 100%; justify-content: center; }
  .topbar-right { margin-left: auto; }
  .user-email { display: none; }
  .main { padding: 18px 14px 90px; }
  .feed { grid-template-columns: 1fr; }
  .source-form-row { grid-template-columns: 1fr 1fr; }
  .source-form-row input[type=url] { grid-column: 1 / -1; }
}
