/* STR Social Engine — operator dashboard
   Brand: emerald #1B4D3E primary · accent #10b981 · off-white #F4F1EA
   Concierge, calm, readable. Not flashy. */

:root {
  --emerald: #1B4D3E;
  --emerald-dark: #133a2e;
  --accent: #10b981;
  --accent-dark: #047857;
  --offwhite: #F4F1EA;
  --ink: #1f2724;
  --muted: #6b7770;
  --line: #e2ddd2;
  --card: #ffffff;
  --shadow: 0 1px 3px rgba(27, 77, 62, 0.08), 0 1px 2px rgba(27, 77, 62, 0.06);

  /* status badge palette */
  --grey: #6b7280;
  --grey-bg: #f1f3f2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --green: #047857;
  --green-bg: #d1fae5;
  --red: #b91c1c;
  --red-bg: #fee2e2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--offwhite);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

/* ---------- Top navigation ---------- */
.topnav {
  background: var(--emerald);
  color: var(--offwhite);
  box-shadow: var(--shadow);
}
.topnav-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  flex-direction: column;
  padding: 12px 18px 12px 0;
  margin-right: 12px;
  line-height: 1.15;
}
.brand .brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: .2px;
}
.brand .brand-sub {
  font-size: .72rem;
  color: #bfe6d6;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.topnav a.navlink {
  color: #d7ece3;
  padding: 18px 14px;
  font-size: .92rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
}
.topnav a.navlink:hover {
  color: #fff;
  text-decoration: none;
  background: var(--emerald-dark);
}
.topnav a.navlink.active {
  color: #fff;
  border-bottom-color: var(--accent);
}
.topnav .nav-spacer { flex: 1; }
.topnav a.navlink.logout { color: #f1c9c2; }

/* ---------- Layout shell ---------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--emerald);
}
.page-head .subtitle { color: var(--muted); font-size: .9rem; }

h2 { color: var(--emerald); font-size: 1.15rem; margin: 28px 0 12px; }

/* ---------- Flash messages ---------- */
.flashes { margin: 0 0 18px; padding: 0; list-style: none; }
.flash {
  padding: 11px 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: .92rem;
  border: 1px solid transparent;
}
.flash.info    { background: #eef6f2; border-color: #cfe6db; color: var(--emerald); }
.flash.success { background: var(--green-bg); border-color: #a7f3d0; color: var(--green); }
.flash.error   { background: var(--red-bg);   border-color: #fecaca; color: var(--red); }
.flash pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .82rem;
  background: rgba(0,0,0,.04);
  padding: 8px 10px;
  border-radius: 6px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .stat-num { font-size: 1.7rem; font-weight: 700; color: var(--emerald); line-height: 1.1; }
.stat .stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }
.stat.accent { border-left-color: var(--green); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: .9rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data thead th {
  background: #f7f5ef;
  color: var(--emerald);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
table.data tbody tr:hover { background: #faf9f4; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Info card (e.g. Connections page explainer). */
.notice {
  background: #f3f7f4; border: 1px solid #d9e6df; border-left: 4px solid var(--emerald);
  border-radius: 10px; padding: 16px 18px; color: #2f4a40; line-height: 1.5;
}
/* Whole queue rows are clickable; the hook reads as a link. */
table.data tr.rowlink { cursor: pointer; }
a.qlink { color: var(--emerald); font-weight: 600; text-decoration: none; }
a.qlink:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}
.badge.idea,
.badge.drafted,
.badge.needs_media { background: var(--grey-bg); color: var(--grey); }
.badge.ready_for_review,
.badge.scheduled   { background: var(--amber-bg); color: var(--amber); }
.badge.approved    { background: var(--blue-bg); color: var(--blue); }
.badge.published   { background: var(--green-bg); color: var(--green); }
.badge.failed      { background: var(--red-bg); color: var(--red); }

.pill {
  display: inline-block;
  padding: 2px 9px;
  margin: 1px 2px 1px 0;
  border-radius: 6px;
  font-size: .76rem;
  background: #eef6f2;
  color: var(--emerald);
  border: 1px solid #d9ece3;
}
.pill.platform { background: #eef2ff; color: var(--blue); border-color: #dbe1ff; }
.pill.hashtag  { background: #ecfdf5; color: var(--accent-dark); border-color: #c8f0de; }

/* ---------- Forms & buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #f5f3ec; text-decoration: none; }
.btn.primary { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.btn.primary:hover { background: var(--emerald-dark); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-dark); }
.btn.approve { background: var(--green); color: #fff; border-color: var(--green); font-size: 1rem; padding: 11px 22px; }
.btn.approve:hover { background: #036549; }
.btn.danger { background: #fff; color: var(--red); border-color: #f3c4c0; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 6px 12px; font-size: .82rem; }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label.field { display: block; margin-bottom: 12px; font-size: .85rem; color: var(--muted); font-weight: 600; }
label.field span { display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=datetime-local],
input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .92rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}
.checkbox-inline { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--ink); }
.checkbox-inline input { width: auto; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 16px;
  align-items: end;
}

/* ---------- Filter bar ---------- */
.filterbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: center;
}
.filterbar .chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}
.filterbar .chip:hover { text-decoration: none; background: #f5f3ec; }
.filterbar .chip.active { background: var(--emerald); color: #fff; border-color: var(--emerald); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, #235e4b, var(--emerald) 60%);
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  padding: 38px 34px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-card .login-brand { font-size: 1.35rem; font-weight: 700; color: var(--emerald); }
.login-card .login-sub {
  font-size: .76rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 24px;
}
.login-card form { text-align: left; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-error {
  background: var(--red-bg); color: var(--red);
  border: 1px solid #fecaca; border-radius: 8px;
  padding: 9px 12px; font-size: .88rem; margin-bottom: 16px;
}

/* ---------- Detail / queue view ---------- */
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }

.kv { margin: 0 0 14px; }
.kv .kv-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.kv .kv-value { font-size: .96rem; white-space: pre-wrap; word-break: break-word; }
.hook-block {
  background: #f7f5ef; border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 14px 16px; font-size: 1.05rem; font-weight: 500;
  color: var(--ink);
}
.caption-block { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.caption-block .cap-platform { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--accent-dark); font-weight: 700; margin-bottom: 4px; }
.caption-block .cap-text { white-space: pre-wrap; font-size: .92rem; }

/* approval gate emphasis */
.gate {
  border: 2px solid var(--green);
  background: #f4fbf7;
  border-radius: 12px;
  padding: 18px 20px;
}
.gate h3 { margin: 0 0 6px; color: var(--green); }
.gate .gate-note { font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
.gate-divider { border: none; border-top: 1px dashed #bfe0cf; margin: 16px 0; }

/* media preview */
.media-preview { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.media-preview img, .media-preview video { display: block; width: 100%; height: auto; max-height: 540px; object-fit: contain; background: #111; }

/* ---------- Media gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.media-tile {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.media-tile .thumb { aspect-ratio: 9 / 12; background: #111; display: flex; align-items: center; justify-content: center; }
.media-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-tile .thumb .noimg { color: #88a; font-size: .8rem; padding: 12px; text-align: center; }
.media-tile .meta { padding: 10px 12px; font-size: .8rem; }
.media-tile .meta .mt-title { font-weight: 600; color: var(--emerald); }
.media-tile .meta .mt-row { color: var(--muted); margin-top: 2px; }

/* license / ai flags */
.flag { display:inline-block; font-size:.68rem; padding:1px 7px; border-radius:5px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; }
.flag.owned { background: var(--green-bg); color: var(--green); }
.flag.licensed { background: #eef2ff; color: var(--blue); }
.flag.ai { background: #fde8d4; color: #9a3412; }
.flag.real { background: var(--green-bg); color: var(--green); }

/* facts active split */
.fact-active td { }
.fact-inactive { opacity: .62; }
.fact-inactive td .badge { }
.facts-legend { font-size: .82rem; color: var(--muted); margin-bottom: 12px; }

footer.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 24px 0 8px; }

@media (max-width: 600px) {
  .topnav a.navlink { padding: 14px 10px; font-size: .85rem; }
  .page-head h1 { font-size: 1.25rem; }
}
