/* Chrome for the Django-rendered pages: sign-in, sign-up, the broker's
   customer picker and the insights dashboard. The catalog SPA itself keeps its
   own stylesheet; only the brand tokens are shared, copied from app.css so this
   file stands alone on the pages that never load the app. */

:root {
  --purple:        #4D148C;
  --purple-hover:  #671CAA;
  --orange:        #FF6200;
  --tech-blue:     #0CC0DF;
  --link:          #007AB7;
  --green-ink:     #008A00;
  --red-ink:       #DE002E;
  --amber-ink:     #BC8300;
  --ink:           #333333;
  --ink-2:         #565656;
  --ink-3:         #8E8E8E;
  --line:          #E3E3E3;
  --line-soft:     #F2F2F2;
  --bg:            #FAFAFA;
  --panel:         #FFFFFF;
  --purple-bg:     #F3EDF9;
  --amber-bg:      #FEF6E4;
  --red-bg:        #FDE8ED;
  --green-bg:      #E5F5E8;
  --blue-bg:       #E5F2F8;
  --row-hover:     #F7F9FB;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--link); }

/* -- top bar --------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  background: var(--purple); color: #fff;
  padding: 0 20px; height: 52px;
}
.topbar .brand {
  font-weight: 700; letter-spacing: .02em; font-size: 15px;
  display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none;
}
.topbar .brand .mark { color: var(--orange); }
.topbar nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar nav a {
  color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 4px;
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase; opacity: .85;
}
.topbar nav a:hover { background: var(--purple-hover); opacity: 1; }
.topbar nav a.on { background: var(--purple-hover); opacity: 1; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12px; opacity: .9; text-align: right; line-height: 1.25; }
.topbar .who b { display: block; font-size: 13px; }
.topbar form { margin: 0; }
.topbar .signout {
  background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
  border-radius: 4px; padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer;
}
.topbar .signout:hover { background: var(--purple-hover); }

/* -- act-as banner ---------------------------------------------------- */
.viewing-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 20px; font-size: 13px;
  background: var(--amber-bg); border-bottom: 1px solid #F0DCAE; color: #6b4c00;
}
.viewing-bar.writing { background: var(--red-bg); border-bottom-color: #F5C2CE; color: #8a0020; }
.viewing-bar .tag {
  text-transform: uppercase; letter-spacing: .07em; font-size: 11px; font-weight: 700;
}
.viewing-bar .spacer { flex: 1; }
.viewing-bar form { margin: 0; display: inline; }
.viewing-bar button {
  font: inherit; font-size: 12px; cursor: pointer; border-radius: 4px;
  border: 1px solid currentColor; background: transparent; color: inherit; padding: 4px 10px;
}
.viewing-bar button:hover { background: rgba(0,0,0,.06); }

/* -- layout ----------------------------------------------------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.wrap.narrow { max-width: 460px; padding-top: 56px; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
.sub { color: var(--ink-2); margin: 0 0 22px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 20px; margin-bottom: 18px;
}
.card > h2 { display: flex; align-items: baseline; gap: 10px; }
.card > h2 .hint { font-weight: 400; font-size: 12px; color: var(--ink-3); }

/* -- forms ------------------------------------------------------------ */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 5px; font-weight: 600;
}
.field input, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px;
  font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-bg);
}
.field .help { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.field .help ul { margin: 4px 0 0; padding-left: 16px; }
.field .err { font-size: 12px; color: var(--red-ink); margin-top: 5px; }

.btn {
  display: inline-block; background: var(--purple); color: #fff; border: 1px solid var(--purple);
  border-radius: 4px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn:hover { background: var(--purple-hover); border-color: var(--purple-hover); }
.btn.wide { width: 100%; }
.btn.ghost { background: #fff; color: var(--purple); }
.btn.ghost:hover { background: var(--purple-bg); }
.btn.small { padding: 5px 12px; font-size: 12px; font-weight: 500; }
.btn.danger { background: var(--red-ink); border-color: var(--red-ink); }

.alt { text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-2); }

/* -- messages --------------------------------------------------------- */
.messages { margin: 0 0 18px; padding: 0; list-style: none; }
.messages li {
  padding: 9px 13px; border-radius: 4px; margin-bottom: 8px; font-size: 13px;
  background: var(--blue-bg); border: 1px solid #BFDCEA;
}
.messages li.success { background: var(--green-bg); border-color: #B9E3C3; }
.messages li.error { background: var(--red-bg); border-color: #F5C2CE; }
.messages li.warning { background: var(--amber-bg); border-color: #F0DCAE; }
.form-error {
  background: var(--red-bg); border: 1px solid #F5C2CE; color: #8a0020;
  padding: 9px 13px; border-radius: 4px; font-size: 13px; margin-bottom: 16px;
}

/* -- tables ----------------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 8px 10px; font-weight: 600;
  white-space: nowrap;
}
table.data td { border-bottom: 1px solid var(--line-soft); padding: 8px 10px; vertical-align: middle; }
table.data tr:hover td { background: var(--row-hover); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--ink-3); }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px;
  font-weight: 600; letter-spacing: .04em;
}
.pill.customer { background: var(--blue-bg); color: var(--link); }
.pill.broker { background: var(--purple-bg); color: var(--purple); }
.pill.admin { background: var(--amber-bg); color: var(--amber-ink); }
.pill.ok { background: var(--green-bg); color: var(--green-ink); }
.pill.bad { background: var(--red-bg); color: var(--red-ink); }
.pill.unclaimed { background: var(--line-soft); color: var(--ink-3); }

/* -- search / filter row ---------------------------------------------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 180px; }

/* -- dashboard -------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px;
}
.tile .k {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  margin-bottom: 6px; font-weight: 600;
}
.tile .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .n { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.tile.alert .v { color: var(--red-ink); }

.range { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.range a {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none;
  font-size: 12px; color: var(--ink-2); background: #fff;
}
.range a.on { background: var(--purple); border-color: var(--purple); color: #fff; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin: 6px 0 4px; }
.bars .bar {
  flex: 1 1 auto; max-width: 64px; background: var(--purple);
  border-radius: 2px 2px 0 0; min-height: 2px; position: relative;
}
.bars .bar:hover { background: var(--purple-hover); }
.bars .bar .cap { display: none; }
.bar-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }

.meter { background: var(--line-soft); border-radius: 3px; height: 6px; overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; background: var(--purple); }

.empty { color: var(--ink-3); font-size: 13px; padding: 18px 0; text-align: center; }

/* ---------- site-wide AI disclaimer ---------- */
/* Present on every page, below the content, never dismissible. */
.site-disclaimer {
  max-width: 1560px;
  margin: 8px auto 34px;
  padding: 12px 16px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border-top: 1px solid var(--line, #E3E3E3);
  color: var(--ink-2, #565656);
  font-size: 12.5px;
  line-height: 1.55;
}
.site-disclaimer p { margin: 0; }
.site-disclaimer b { color: var(--ink, #333333); }
.site-disclaimer .sd-mark {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--data-6, #C0870C);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}
@media (max-width: 900px) { .site-disclaimer { margin: 8px 16px 28px; } }
