/* CinefyBot dashboard — one stylesheet, no framework, no build step. */

:root {
  --bg: #0d1016;
  --panel: #141821;
  --panel-2: #1a1f2b;
  --line: #242b39;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-soft: #7c5cff26;
  --green: #3fcf8e;
  --amber: #f5b74e;
  --red: #f2585b;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.error { color: var(--red); }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---- login ---- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; padding: 32px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-mark { font-size: 32px; }
.login-card h1 { font-size: 22px; }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 20px; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; padding: 0 8px; }
.brand-mark { font-size: 18px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav a span { width: 16px; text-align: center; opacity: 0.8; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: #fff; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.bot-state {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--panel-2); border-radius: 8px; font-size: 12px; color: var(--muted);
}
.bot-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.bot-state.online .dot { background: var(--green); box-shadow: 0 0 0 3px #3fcf8e22; }
.bot-state.offline .dot { background: var(--red); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #0d1016e6; backdrop-filter: blur(8px); z-index: 5;
}
.topbar h1 { font-size: 18px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.view { padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 20px; }

/* ---- primitives ---- */
.btn {
  font: inherit; font-weight: 500; cursor: pointer;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: #33405a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #4a2427; }
.btn.danger:hover { background: #f2585b18; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

input, textarea, select {
  font: inherit; width: 100%;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; font-family: var(--mono); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 160px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card h2 { font-size: 15px; }

.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: #ffffff06; }
td.actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
.table-wrap table { min-width: 560px; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 18px; }
.table-wrap th:last-child, .table-wrap td:last-child { padding-right: 18px; }
tbody tr:last-child td { border-bottom: none; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.tag.accent { background: var(--accent-soft); color: #b9a6ff; border-color: #3a2d70; }
.tag.green { background: #3fcf8e1a; color: var(--green); border-color: #1f5a41; }
.tag.amber { background: #f5b74e1a; color: var(--amber); border-color: #5c4620; }
.tag.red { background: #f2585b1a; color: var(--red); border-color: #5c2a2c; }

code.cmd { font-family: var(--mono); color: #b9a6ff; font-weight: 600; }
pre.source {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; overflow-x: auto; margin: 0; white-space: pre;
}
.truncate { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 32px 12px; }

.checks { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; padding-right: 4px; }
.check { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.check:hover { background: var(--panel-2); }
.check input { width: auto; }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: #05070bcc; backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 24px; z-index: 50;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
}
.modal.wide { max-width: 820px; }
.modal h2 { font-size: 17px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- toasts ---- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 11px 15px; max-width: 380px; box-shadow: 0 8px 24px #0008;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0; flex-direction: row; }
  .view, .topbar { padding-inline: 16px; }
}

/* ---- login tabs + small print ---- */
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 9px; border: 1px solid var(--line); }
.tab {
  flex: 1; font: inherit; font-weight: 500; cursor: pointer; padding: 7px 10px;
  border: none; border-radius: 6px; background: transparent; color: var(--muted);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.muted.small { font-size: 12px; }

/* ---- role badge in the sidebar ---- */
.role-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: #b9a6ff;
}
.invite-link {
  font-family: var(--mono); font-size: 12px; word-break: break-all;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}
