/*
 * The Pivot Console look (PP-Console, src/index.css) for MIND's console shell: the org admin and
 * /platform pages. Loaded after basecoat.css and ui.css by consolePage only, and every rule is
 * scoped to .console, so chat, home and sign-in keep their own look.
 *
 * Basecoat reads its colours from custom properties on :root (and .dark); redefining them on
 * .console restyles every Basecoat component inside it without touching their rules.
 */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/plus-jakarta-sans-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/plus-jakarta-sans-italic-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---- Tokens: PP-Console's Oxblood / Bone palette, mapped onto Basecoat's names --------------- */

.console {
  --paper: #f4f2ec;
  --ink: #181818;
  --ink-2: #3a3833;
  --mute: #5f5b52;
  --line: #e4e0d6;
  --line-2: #eeebe3;
  --oxblood: #3d1a20;
  --oxblood-2: #5a2a30;
  --oxblood-soft: #3d1a200f;
  --good: #1e7a5a;
  --good-soft: #1e7a5a14;
  --bad: #b23a3a;
  --bad-soft: #b23a3a14;
  --surface: #ffffff;
  --serif: "Instrument Serif", "Times New Roman", serif;

  --background: var(--paper);
  --foreground: var(--ink);
  --card: var(--surface);
  --card-foreground: var(--ink);
  --popover: var(--surface);
  --popover-foreground: var(--ink);
  --primary: var(--oxblood);
  --primary-foreground: #ffffff;
  --secondary: var(--line-2);
  --secondary-foreground: var(--ink);
  --muted: var(--line-2);
  --muted-foreground: var(--mute);
  --accent: var(--line-2);
  --accent-foreground: var(--ink);
  --destructive: var(--bad);
  --border: var(--line);
  --input: var(--line);
  --ring: var(--oxblood);
  --sidebar: var(--surface);
  --ok: var(--good);
  --radius: 10px;
  --font-sans: "Plus Jakarta Sans", system-ui, sans-serif;

  color: var(--ink);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* PP-Console has no dark theme; this keeps its warmth and contrast for people who choose dark. */
html.dark .console {
  --paper: #151412;
  --ink: #f2efe8;
  --ink-2: #d9d4c8;
  --mute: #a39d90;
  --line: #34312b;
  --line-2: #26241f;
  --oxblood: #c98a93;
  --oxblood-2: #dba3ab;
  --oxblood-soft: #c98a931f;
  --good: #5cc59c;
  --good-soft: #5cc59c1f;
  --bad: #e58181;
  --bad-soft: #e581811f;
  --surface: #1d1c19;
  --primary-foreground: #ffffff;
  /* Filled accents (active item, primary button) stay a deep oxblood so white text keeps its contrast. */
  --oxblood-fill: #7a3640;
  --oxblood-fill-2: #8e434e;
}
/* The logomark is drawn dark; inverted it stays legible on the dark paper, wherever it appears. */
html.dark .console img[src$="pivot-logomark.png"] {
  filter: invert(1);
}

.console ::selection {
  background: var(--ink);
  color: var(--paper);
}

/* ---- Sidebar ------------------------------------------------------------------------------ */

.console > aside {
  padding: 0;
  gap: 0;
}
.console > aside .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line-2);
  text-decoration: none;
  transition: background 0.14s;
}
.console > aside .brand:hover {
  background: var(--line-2);
}
.console > aside .brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.console > aside .brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.console > aside .brand-text b {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1;
}
.console > aside .brand-text span {
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.console > aside .side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px;
}
.console > aside .group {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  padding: 14px 12px 7px;
}
.console > aside nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition:
    background 0.15s,
    color 0.15s;
}
.console > aside nav a:hover {
  background: var(--line-2);
  color: var(--ink);
}
/* The accent bar that slides in on hover, as in PP-Console's sidebar. */
.console > aside nav a::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--oxblood);
  transform: translateY(-50%);
  transition: height 0.2s ease;
}
.console > aside nav a:not([aria-current]):hover::before {
  height: 20px;
}
.console > aside nav a[aria-current] {
  background: var(--oxblood-fill, var(--oxblood));
  color: var(--primary-foreground);
  font-weight: 600;
}
.console > aside nav a .ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.7;
}
.console > aside nav a:not([aria-current]):hover .ico {
  color: var(--oxblood);
  opacity: 1;
}
.console > aside nav a[aria-current] .ico {
  opacity: 1;
}
.console > aside .foot {
  margin-top: 0;
  padding: 12px;
  border-top: 1px solid var(--line-2);
}
.console > aside .foot .btn {
  width: 100%;
  justify-content: flex-start;
  color: var(--ink-2);
}
.console .ico {
  width: 15px;
  height: 15px;
}

/* ---- Main column: sticky top bar, then content ----------------------------------------------- */

.console > main {
  padding: 0;
  max-width: none;
  min-width: 0;
}
.console .console-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px 40px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.console .console-top .titles {
  flex: 1;
  min-width: 0;
}
.console .console-top h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.console .console-top .crumbs {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--mute);
}
.console .console-top .crumbs a {
  text-decoration: none;
}
.console .console-top .crumbs a:hover {
  color: var(--ink);
}
.console .console-top .actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.console .content {
  padding: 32px 40px 72px;
  max-width: 1240px;
  width: 100%;
}
/* ui.css spaces main's children; here the top bar and content sit flush. */
.console > main > .content {
  margin-top: 0;
}
.console .content > * + *,
.console .card > section > * + * {
  margin-top: 20px;
}
/* Section headings in the page body read as PP-Console's small uppercase labels. */
.console .content > h2,
.console .content > .page-head h1 {
  margin: 36px 0 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}
.console .content > h2 + * {
  margin-top: 14px;
}
.console .lead,
.console .content > p.muted:first-child {
  color: var(--mute);
  max-width: 78ch;
}

/* ---- Cards ------------------------------------------------------------------------------- */

.console .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  background: var(--card);
  padding-block: 24px;
}
.console .card > header,
.console .card > section {
  padding-inline: 24px;
}
.console .card > header h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.console .card > header p {
  color: var(--mute);
  font-size: 13px;
}
.console a.card {
  text-decoration: none;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.18s ease;
}
.console a.card:hover {
  border-color: var(--line);
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(24, 24, 24, 0.09);
}
/* Section icon on the overview cards, in a soft oxblood tile. */
.console a.card > header .ico {
  width: 34px;
  height: 34px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: var(--oxblood-soft);
  color: var(--oxblood);
}

/* KPI tiles: label first in small capitals, the figure large in the italic serif. */
.console .stats {
  gap: 20px;
}
.console .stats .card {
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
.console .stats .card:hover {
  border-color: var(--mute);
  box-shadow: 0 10px 26px rgba(24, 24, 24, 0.06);
}
.console .stats .card > section {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 12px;
}
.console .stats .card > section > span {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 600;
}
.console .stats strong {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 38px;
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.console .stats strong.err {
  color: var(--bad);
}
.console .cards,
.console .panels {
  gap: 20px;
}

/* ---- Tables ------------------------------------------------------------------------------ */

.console .table-container {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow-x: auto;
}
.console .table {
  font-size: 13px;
  border-collapse: collapse;
}
.console .table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.console .table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.console .table tbody tr:last-child td {
  border-bottom: none;
}
.console .table tbody tr {
  transition: background 0.12s;
}
.console .table tbody tr:hover {
  background: color-mix(in srgb, var(--line-2) 55%, transparent);
}
.console .table th.num,
.console .table td.num {
  text-align: right;
}

/* ---- Buttons ----------------------------------------------------------------------------- */

.console .btn {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    box-shadow 0.18s,
    transform 0.08s;
}
.console .btn:active {
  transform: translateY(1px);
}
.console .btn:not([data-variant]) {
  background: var(--oxblood-fill, var(--oxblood));
  color: var(--primary-foreground);
  box-shadow: 0 1px 2px rgba(61, 26, 32, 0.18);
}
.console .btn:not([data-variant]):hover {
  background: var(--oxblood-fill-2, var(--oxblood-2));
  box-shadow: 0 6px 18px rgba(61, 26, 32, 0.24);
}
.console .btn[data-variant="outline"] {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}
.console .btn[data-variant="outline"]:hover {
  border-color: var(--mute);
  background: var(--card);
}
.console .btn[data-variant="ghost"]:hover {
  background: var(--line-2);
}
/* A fixed deep red in both themes: the dark theme's pale --bad is for text on dark, not for fills. */
.console .btn[data-variant="destructive"] {
  background: #b23a3a;
  color: #fff;
}
.console .btn[data-variant="destructive"]:hover {
  background: #9c3030;
}
.console .btn[data-size="sm"] {
  font-size: 12px;
}

/* ---- Pills (badges) ------------------------------------------------------------------------ */

.console .badge {
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border: 1px solid transparent;
}
.console .badge[data-variant="secondary"] {
  background: var(--line-2);
  color: var(--mute);
}
.console .badge[data-variant="outline"] {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-2);
}
.console .badge[data-variant="destructive"] {
  background: var(--bad-soft);
  color: var(--bad);
}
.console .badge[data-tone="ok"] {
  background: var(--good-soft);
  color: var(--good);
}

/* ---- Fields ------------------------------------------------------------------------------ */

.console label.field {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.console label.field > small,
.console label.field > span.hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--mute);
}
.console
  :is(.input, .select, .textarea, input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea) {
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--card);
  color: var(--ink);
  font-size: 13px;
  box-shadow: none;
  transition:
    border-color 0.14s,
    box-shadow 0.14s;
}
.console :is(.input, .select, .textarea, input, select, textarea):hover {
  border-color: var(--mute);
}
.console :is(.input, .select, .textarea, input, select, textarea):focus,
.console :is(.input, .select, .textarea, input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--oxblood);
  box-shadow: 0 0 0 3px var(--oxblood-soft);
}
.console ::placeholder {
  color: #8f897c;
}
.console a:focus-visible,
.console button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--oxblood-soft),
    0 0 0 1.5px var(--oxblood);
}

/* ---- Notices ----------------------------------------------------------------------------- */

.console .alert {
  border-radius: var(--radius);
  border-color: var(--line);
  background: var(--card);
}
.console .alert[data-tone="ok"] {
  border-color: transparent;
  background: var(--good-soft);
  color: var(--good);
}
.console .alert[data-variant="destructive"] {
  border-color: transparent;
  background: var(--bad-soft);
  color: var(--bad);
}

/* ---- Top-bar pages: home and agent settings ------------------------------------------------- */

.console.page {
  min-height: 100vh;
  background: var(--paper);
}
.console.page > .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  padding: 10px 40px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.console.page > .topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.console.page > .topbar .brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.console.page > .topbar .brand b {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}
.console.page > .topbar .actions {
  gap: 10px;
  font-size: 12px;
  color: var(--mute);
}
.console.page > main {
  max-width: 1080px;
  min-width: 0;
  margin: 0 auto;
  padding: 40px 40px 72px;
}
.console.page main .page-head h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
/* The serif italic word in a headline, as on PP-Console's start screen. */
.console :is(h1, h2) em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--oxblood);
}
.console.page main .page-head h2,
.console.page main > h2 {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}
.console.page main > .page-head:not(:first-child) {
  margin-top: 40px;
}
.console.page main > h2 + * {
  margin-top: 14px;
}
/* Cards keep their size when an org has only one or two agents, instead of stretching across. */
.console.page .cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.console.page .card > header .av {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 700;
}
.console.page .card > header h2 a {
  text-decoration: none;
}
.console.page .card > header h2 a:hover {
  color: var(--oxblood);
}
.console.page .card > footer {
  padding-inline: 24px;
}

/* ---- Chat: chat.css lays the page out from Basecoat's tokens; these keep it in the skin ------ */

/* chat.css's narrow reading column, not the top-bar pages' wider one. */
.console.page > main.chat-main {
  max-width: 820px;
  padding-bottom: 0;
}
.console .chat-page .chat-title {
  margin: 0 0 22px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
/* The person's own messages as white cards on the bone paper; answers stay plain text. */
.console .chat-page .msg.user {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
}
.console .chat-page .model {
  font-size: 11px;
  letter-spacing: 0.04em;
}
.console .chat-page .tool {
  background: var(--card);
  font-weight: 500;
}
.console .chat-page .approval {
  border-color: var(--line);
  border-left-color: var(--oxblood);
  border-radius: var(--radius);
}
.console .chat-page .md a {
  color: var(--oxblood);
}
.console .chat-page .md th {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  background: var(--line-2);
}
.console .chat-page form.composer div {
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(24, 24, 24, 0.07);
}
.console .chat-page form.composer div:focus-within {
  border-color: var(--oxblood);
  box-shadow:
    0 0 0 3px var(--oxblood-soft),
    0 10px 30px rgba(24, 24, 24, 0.07);
}
/* The composer box carries the focus ring; the textarea inside stays bare. */
.console .chat-page form.composer textarea,
.console .chat-page form.composer textarea:hover,
.console .chat-page form.composer textarea:focus {
  border: 0;
  box-shadow: none;
  background: transparent;
}
.console .chat-page .fb-btn.on {
  color: var(--oxblood);
  border-color: var(--line);
  background: var(--oxblood-soft);
}
.console .chat-page .fb-picker {
  border-color: var(--line);
}

/* ---- Sign-in and two-factor: PP-Console's sign-in card ---------------------------------------- */

.console.gate {
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(900px 500px at 80% -10%, #3d1a2010, transparent 60%);
}
html.dark .console.gate {
  background-image: radial-gradient(900px 500px at 80% -10%, #c98a9314, transparent 60%);
}
.console.gate > main.center {
  max-width: none;
  padding: 40px 20px;
}
.console.gate .center > .card {
  max-width: 380px;
  padding: 30px 30px 26px;
  gap: 0;
}
.console.gate .card > header,
.console.gate .card > section {
  padding-inline: 0;
}
.console.gate .card > header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.console.gate .card > header img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}
.console.gate .card > header h2 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}
.console.gate .card > header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--mute);
}
.console.gate h3 {
  margin: 22px 0 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
}
.console.gate form.stack {
  max-width: none;
}
.console.gate .btn {
  width: 100%;
}

/* ---- Motion ------------------------------------------------------------------------------ */

@keyframes console-fade-up {
  from {
    transform: translateY(7px);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .console .content {
    animation: console-fade-up 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
}
/* Colour fades stay; anything that moves stays still for people who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  .console a.card:hover,
  .console .btn:active {
    transform: none;
  }
}

/* ---- Phones: ui.css stacks the sidebar above the page; keep that, with PP spacing ---------- */

@media (max-width: 800px) {
  .console > aside .side-scroll {
    padding: 8px 12px;
  }
  .console > aside nav a::before {
    display: none;
  }
  .console > aside .foot {
    border-top: none;
    padding-top: 0;
  }
  .console .console-top {
    position: static;
    padding: 12px 16px;
  }
  .console .content {
    padding: 20px 16px 40px;
  }
  .console .stats strong {
    font-size: 30px;
  }
  .console.page > .topbar {
    position: static;
    padding: 10px 16px;
  }
  .console.page > main {
    padding: 24px 16px 40px;
  }
  .console.page main .page-head h1 {
    font-size: 24px;
  }
}
