/*
 * Cheep portal.
 *
 * Hand-written rather than Tailwind: the portal is a handful of pages, and a
 * build step would have to be added to a deploy pipeline that currently copies
 * files and runs migrations. One cacheable stylesheet, no npm.
 *
 * Green is Cheep's own identity here. That is deliberate and the opposite of
 * the widget, which wears the client's colours because it sits on their site.
 */

:root {
  --green: #1DB954;
  --green-dark: #12803a;
  --green-wash: #eaf7ef;
  --beak: #F5A524;
  --ink: #12181f;
  --muted: #65727f;
  --line: #e3e8ee;
  --bg: #f4f7fa;
  --card: #ffffff;
  --danger: #b3261e;
  --danger-wash: #fdecec;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-dark); }

/* ---------------------------------------------------------------- chrome -- */

.topbar {
  background: var(--ink);
  color: #fff;
  padding: 0 20px;
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .2px;
  color: #fff;
  text-decoration: none;
}

.topbar nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }

.topbar nav a,
.topbar nav button {
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.topbar nav a:hover,
.topbar nav button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.topbar nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 26px 20px 60px; }
.narrow { max-width: 620px; }

/* ----------------------------------------------------------------- type -- */

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 0 0 14px; }
.lede { color: var(--muted); margin: 0 0 24px; }
.eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 700; margin: 0 0 10px;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------------------------------------------------------------- cards -- */

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

.card-head {
  display: flex; align-items: center; gap: 12px;
  margin: -4px 0 16px; flex-wrap: wrap;
}
.card-head h2 { margin: 0; }

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

/* ---------------------------------------------------------------- stats -- */

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.attention { background: #fff8e6; }
.stat.attention b { color: #8a6100; }

/* --------------------------------------------------------------- badges -- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.live { background: var(--green-wash); color: var(--green-dark); }
.badge.paused { background: #eef2f6; color: var(--muted); }
.badge.stopped { background: var(--danger-wash); color: var(--danger); }

/* -------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 9px 16px; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #cfd8e3; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-danger { background: #fff; border-color: #f0c9c6; color: var(--danger); }
.btn-danger:hover { background: var(--danger-wash); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- forms -- */

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--green); outline-offset: -1px; border-color: transparent;
}
input[type="color"] {
  width: 52px; height: 40px; padding: 3px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; cursor: pointer;
}
.inline { display: flex; gap: 10px; align-items: center; }

.error { color: var(--danger); font-size: 13px; margin: 6px 0 0; }

/* -------------------------------------------------------------- notices -- */

.notice {
  border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px;
  border: 1px solid transparent;
}
.notice.ok { background: var(--green-wash); border-color: #bfe6cd; color: var(--green-dark); }
.notice.bad { background: var(--danger-wash); border-color: #f0c9c6; color: var(--danger); }
.notice.warn { background: #fff8e6; border-color: #f2e0b5; color: #8a6100; }

/* ----------------------------------------------------------------- code -- */

.code {
  background: var(--ink); color: #e9eef4; border-radius: 10px;
  padding: 14px 16px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto; white-space: pre; -webkit-user-select: all; user-select: all;
}
.key {
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 9px; -webkit-user-select: all; user-select: all;
}

ol.steps { padding-left: 20px; margin: 0; }
ol.steps li { margin-bottom: 14px; }

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

.login-page {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-brand {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 20px; font-weight: 700; font-size: 21px;
}

/* ----------------------------------------------------------------- tabs -- */

.tabs {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.tab:hover { background: #eef2f6; }
.tab.on { background: var(--ink); color: #fff; }

.pill {
  background: rgba(0, 0, 0, .09); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 700;
}
.tab.on .pill { background: rgba(255, 255, 255, .22); }

.small-btn { padding: 6px 12px; font-size: 13px; }

/* ----------------------------------------------------------------- rows -- */

.row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; text-decoration: none; color: inherit;
}
.row:hover { border-color: #cfd8e3; }
.row-urgent { border-left: 4px solid var(--danger); }
.row-main { min-width: 0; flex: 1; }
.row-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.row-quote { margin: 0 0 6px; overflow-wrap: anywhere; }
.row-meta { margin: 0; }
.row-go { color: var(--muted); font-size: 22px; line-height: 1; }

.tag {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em;
}
.tag-needs_you { background: var(--danger-wash); color: var(--danger); }
.tag-guarded   { background: #fff4d6; color: #8a6100; }
.tag-knowledge { background: #eaf1fb; color: #23548f; }
.tag-noise     { background: #eef2f6; color: var(--muted); }
.tag-technical { background: #eef2f6; color: var(--muted); }
.tag-lead      { background: var(--green-wash); color: var(--green-dark); }

/* ----------------------------------------------------------- transcript -- */

.turn { margin-bottom: 16px; padding-left: 12px; border-left: 3px solid var(--line); }
.turn .who {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.turn p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-them { border-left-color: var(--green); }
.turn-blocked { border-left-color: var(--beak); background: #fffdf5; padding: 8px 12px; border-radius: 0 8px 8px 0; }

/* ----------------------------------------------------------- pagination -- */

.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 18px 0 0; flex-wrap: wrap; }
.pagination li span, .pagination li a {
  display: inline-block; padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; text-decoration: none; font-size: 14px;
}
.pagination .active span { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .disabled span { color: var(--muted); opacity: .6; }

/* ---------------------------------------------------------- facts editor -- */

.facts-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }

@media (min-width: 900px) {
  .facts-layout { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
}

.req { color: var(--danger); margin-left: 2px; }

.sticky-actions { position: sticky; bottom: 14px; box-shadow: 0 6px 22px rgba(0, 0, 0, .10); }

/* the sandbox */
.try-log {
  max-height: 360px; overflow-y: auto; background: var(--bg);
  border-radius: 10px; padding: 12px; min-height: 90px;
}
.try-log:empty::after {
  content: "Nothing asked yet.";
  color: var(--muted); font-size: 13px;
}
.try-turn { margin-bottom: 12px; }
.try-turn span {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.try-turn p { margin: 2px 0 0; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.try-turn.me p { color: var(--green-dark); font-weight: 600; }
.try-turn.muted-turn p { color: var(--muted); font-style: italic; }
.try-turn.note-turn p {
  color: #8a6100; background: #fff8e6; border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
}

/* --------------------------------------------------------------- footer -- */

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 34px; }

@media (max-width: 560px) {
  .topbar nav { margin-left: 0; width: 100%; padding-bottom: 8px; }
  .wrap { padding-top: 18px; }
}
