/* Prestige Content Studio — internal tool. Dark, dense, keyboard-friendly. */

:root {
  --gold: #f09530;
  --gold-soft: rgba(240, 149, 48, 0.14);
  --purple: #7b1fa2;
  --bg: #0e1014;
  --panel: #161a21;
  --panel-2: #1d222b;
  --line: #2a303b;
  --ink: #eef1f6;
  --ink-2: #a3adbd;
  --ink-3: #6c7686;
  --ok: #3fb37f;
  --warn: #e0a53a;
  --bad: #e0605c;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- login */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate__card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.gate__mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.gate h1 { font-size: 1.15rem; margin: 0; letter-spacing: -0.01em; }
.gate p { color: var(--ink-2); font-size: 0.85rem; margin: 0 0 22px; }

/* ---------------------------------------------------------------- shell */

.shell { display: none; min-height: 100vh; grid-template-rows: auto 1fr; }
.shell.is-on { display: grid; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; }
.brand small { color: var(--ink-3); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.62rem; }

.tabs { display: flex; gap: 2px; margin-left: 12px; }

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.85rem;
  padding: 7px 13px;
  border-radius: 7px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab.is-on { color: #12161c; background: var(--gold); font-weight: 600; }

.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.main { padding: 22px; max-width: 1500px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.is-on { display: block; }

/* --------------------------------------------------------------- pieces */

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
}

.card__head h2 { font-size: 0.95rem; margin: 0; letter-spacing: -0.01em; }
.card__head .spacer { margin-left: auto; }

.hint { color: var(--ink-3); font-size: 0.78rem; margin: 0 0 12px; }

label { display: block; font-size: 0.75rem; color: var(--ink-2); margin: 0 0 5px; letter-spacing: 0.02em; }

input[type="text"], input[type="url"], input[type="date"], input[type="number"],
input[type="password"], select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  padding: 9px 11px;
  border-radius: 8px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
textarea.mono { font-family: var(--mono); font-size: 0.82rem; }

.field { margin-bottom: 13px; min-width: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 550;
  padding: 9px 15px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary { background: var(--gold); border-color: var(--gold); color: #12161c; }
.btn--primary:hover { background: #ffa845; }
.btn--purple { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn--purple:hover { background: #8f28bb; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 11px; font-size: 0.76rem; }
.btn--danger { color: var(--bad); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--panel-2);
  letter-spacing: 0.02em;
}
.pill--ok { color: var(--ok); border-color: rgba(63, 179, 127, 0.4); }
.pill--warn { color: var(--warn); border-color: rgba(224, 165, 58, 0.4); }
.pill--bad { color: var(--bad); border-color: rgba(224, 96, 92, 0.4); }
.pill--gold { color: var(--gold); border-color: rgba(240, 149, 48, 0.45); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------- channels */

.chan-list { display: grid; gap: 9px; }

.chan {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.chan input { accent-color: var(--gold); width: 16px; height: 16px; }
.chan__name { font-size: 0.85rem; font-weight: 550; }
.chan__meta { font-size: 0.72rem; color: var(--ink-3); }
.chan__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chan.is-off { opacity: 0.5; }

/* -------------------------------------------------------------- preview */

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }

.pv {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.pv__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.pv__bar .count { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.pv__bar .count.over { color: var(--bad); }
.pv__body { padding: 12px; }
.pv__body img { width: 100%; border-radius: 7px; display: block; margin-bottom: 10px; background: #000; }
.pv__text { white-space: pre-wrap; font-size: 0.83rem; line-height: 1.6; color: var(--ink); }
.pv__tags { margin-top: 9px; font-size: 0.78rem; color: #6ea8ff; word-break: break-word; }

iframe.article-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

/* -------------------------------------------------------------- library */

.lib-item {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  margin-bottom: 9px;
}
.lib-item img { width: 62px; height: 44px; object-fit: cover; border-radius: 6px; background: #000; flex: 0 0 auto; }
.lib-item__main { min-width: 0; flex: 1; }
.lib-item__title { font-size: 0.88rem; font-weight: 600; margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item__meta { font-size: 0.74rem; color: var(--ink-3); display: flex; gap: 9px; flex-wrap: wrap; }
.lib-item__actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ---------------------------------------------------------------- leads */

table.leads { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.leads th {
  text-align: left;
  color: var(--ink-3);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
table.leads td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.leads tr:hover td { background: var(--panel-2); }
.lead-text { color: var(--ink-2); max-width: 340px; }

/* --------------------------------------------------------------- toasts */

.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 9px; z-index: 90; }
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 0.83rem;
  box-shadow: var(--shadow);
  max-width: 380px;
  animation: rise 0.2s ease;
}
.toast.is-bad { border-left-color: var(--bad); }
.toast.is-ok { border-left-color: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.spin {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: turn 0.7s linear infinite;
}
@keyframes turn { to { transform: rotate(360deg); } }

.empty { color: var(--ink-3); font-size: 0.85rem; padding: 26px; text-align: center; border: 1px dashed var(--line); border-radius: 9px; }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 14px; font-size: 0.82rem; }
.kv dt { color: var(--ink-2); font-family: var(--mono); font-size: 0.78rem; }
.kv dd { margin: 0; color: var(--ink-3); }

code { font-family: var(--mono); font-size: 0.82em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* ----------------------------------------------------------------- small */

@media (max-width: 720px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    position: static;
  }
  .brand { white-space: nowrap; }
  .brand small { display: none; }
  .tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
  .topbar__right { margin-left: auto; }

  .main { padding: 14px; }
  .card { padding: 14px; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 9px; }
  .preview-grid { grid-template-columns: 1fr; }
  .lib-item { flex-wrap: wrap; }
  .lib-item__actions { width: 100%; }
  .toasts { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
  table.leads { display: block; overflow-x: auto; white-space: nowrap; }
  .lead-text { white-space: normal; min-width: 220px; }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 0.74rem;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink-2);
  cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
