/* Shillz Desk. Built on the Shillz style guide tokens (v1.0) and the shillz.app landing page system:
   Helvetica Neue (400/500/700) + Helvetica Neue Black, SF Pro numbers, pill controls, lime-gradient selected
   states, #303035 hairlines. Status colours marked "ext" are named extensions (the guide defines none). */
@font-face { font-family: "Shillz Neue"; src: url(/static/fonts/helvetica-neue-400-500.woff2) format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Shillz Neue"; src: url(/static/fonts/helvetica-neue-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Shillz Neue Black"; src: url(/static/fonts/helvetica-neue-black.woff2) format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Shillz Numbers"; src: url(/static/fonts/sf-numbers-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Shillz Numbers"; src: url(/static/fonts/sf-numbers-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  /* style guide */
  --background: #141416;
  --border: #1F1F21;
  --accent: #A5FC10;
  --campaign-highlight: #CFFB55;
  --text: #FFFFFF;
  --icon-well: #26272A;
  --raised: #1E1E22;
  --unit: rgba(255, 255, 255, 0.56);
  /* landing page */
  --hairline: #303035;
  --muted: #8a8a8f;
  --sub: #6d6d6d;
  --ghost-text: #b3b3b3;
  --lime: linear-gradient(90deg, #a5fc10, #cffb55 50%, #a5fc10);
  --lime-edge: #e0ff8b;
  --card-bg: rgba(20, 20, 22, 0.8);
  --accent-wash: rgba(165, 252, 16, 0.10);
  /* ext: status */
  --ext-warn: #FFB27A;
  --ext-warn-wash: rgba(255, 178, 122, 0.12);
  --ext-hot: #FF9B42;
  --ext-info: #9CC3FF;
  --ext-info-wash: rgba(156, 195, 255, 0.12);

  --font: "Shillz Neue", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-black: "Shillz Neue Black", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-num: "Shillz Numbers", "Shillz Neue", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --header-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--background); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.4; font-synthesis: none; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--campaign-highlight); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }
code { background: var(--icon-well); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.lime-text { background-image: var(--lime); -webkit-background-clip: text; background-clip: text; color: transparent; padding-block: .1em; margin-block: -.1em; }
.eyebrow { font-size: 11px; font-weight: 400; letter-spacing: .4em; text-transform: uppercase; color: var(--accent); }
.title { margin: 6px 0 0; font-weight: 500; font-size: clamp(28px, 3.2vw, 44px); line-height: 1.05; letter-spacing: -.04em; }

/* ---------- header (landing pill bar) ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top { padding: 10px 14px; flex-shrink: 0; position: relative; z-index: 5; }
.top-bar { display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 12px; border: 1px solid var(--hairline); border-radius: 999px; background: rgba(14, 14, 16, .7); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500; font-size: 17px; letter-spacing: -.03em; margin-right: 6px; }
.brand:hover { color: var(--text); }
.brand em { font-style: normal; color: var(--muted); }
.status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--accent); box-shadow: 0 0 0 3px rgba(165, 252, 16, .15); }
.dot.demo { background: var(--ext-warn); }
.banner { margin: 0 14px 10px; padding: 10px 14px; border-radius: 14px; font-size: 13px; }
.banner.warn { background: var(--ext-warn-wash); color: #FFD2A8; border: 1px solid rgba(255, 178, 122, .25); }
.banner.ok { background: var(--accent-wash); color: var(--text); border: 1px solid rgba(165, 252, 16, .25); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 500; font-size: 14px; line-height: 1; white-space: nowrap; cursor: pointer; transition: filter .15s, color .15s, border-color .15s, transform .15s; }
.btn:active { transform: scale(.98); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.lime { border: 2px solid var(--lime-edge); background-image: var(--lime); color: var(--background); }
.btn.lime:hover { filter: brightness(1.08); color: var(--background); }
.btn.ghost { border: 1px solid var(--hairline); background: var(--background); color: var(--ghost-text); }
.btn.ghost:hover { color: #fff; border-color: #4a4a50; }
.btn.warn-text { color: var(--ext-warn); }
.btn:disabled { opacity: .6; cursor: wait; }

/* segmented toggle (landing-toggle) */
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--hairline); border-radius: 999px; background: rgba(0, 0, 0, .12); margin: 0; }
.seg a, .seg label { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; color: #fff; font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg a:hover, .seg label:hover { color: var(--accent); }
.seg a.on, .seg label:has(input:checked) { background-image: var(--lime); color: var(--background); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 2px; }

input[type=email], input[type=date], input:not([type]), input[type=search], select, textarea {
  width: 100%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--hairline); background: var(--raised); line-height: 1.45; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #4a4a50; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a8f' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
textarea { resize: none; }
::placeholder { color: var(--sub); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 999px; background: var(--icon-well); color: var(--ghost-text); line-height: 1.2; }
.chip:empty { display: none; }
.chip.plain { background: transparent; border: 1px solid var(--hairline); color: var(--muted); }
.st-unanswered { background: var(--ext-warn-wash); color: var(--ext-warn); }
.st-unanswered.overdue { background: var(--ext-warn); color: var(--background); }
.st-waiting { background: var(--ext-info-wash); color: var(--ext-info); }
.st-resolved, .conf-high { background: var(--accent-wash); color: var(--accent); }
.conf-medium { background: var(--ext-info-wash); color: var(--ext-info); }
.conf-low, .conf-human { background: var(--ext-warn-wash); color: var(--ext-warn); }
.pr-high { background: var(--ext-hot); color: var(--background); }
.pr-low { background: transparent; border: 1px solid var(--hairline); color: var(--muted); }

.card { border: 1px solid var(--hairline); border-radius: 20px; background: var(--card-bg); padding: 16px; }

/* ---------- inbox: three columns, each scrolls on its own ---------- */
body.is-inbox .app { height: 100vh; height: 100dvh; overflow: hidden; }
.inbox { flex: 1; min-height: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr) 290px; gap: 10px; padding: 0 14px 14px; }
.inbox > section, .inbox > aside { min-height: 0; }

.list { display: flex; flex-direction: column; border: 1px solid var(--hairline); border-radius: 20px; overflow: hidden; background: var(--card-bg); }
.search { padding: 12px 12px 0; }
.search input { border-radius: 999px; background: var(--background); }
.filters { display: flex; gap: 6px; padding: 10px 12px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.filters::-webkit-scrollbar { display: none; }
.pill { flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hairline); color: var(--ghost-text); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill span { font-family: var(--font-num); color: var(--muted); font-size: 11.5px; }
.pill:hover { color: #fff; border-color: #4a4a50; }
.pill.on { border-color: var(--lime-edge); background-image: var(--lime); color: var(--background); }
.pill.on span { color: rgba(20, 20, 22, .7); }
.rows { flex: 1; overflow-y: auto; padding: 6px; }
.row { display: flex; flex-direction: column; gap: 6px; padding: 11px 12px; border-radius: 14px; color: var(--text); border: 1px solid transparent; }
.row + .row { margin-top: 2px; }
.row:hover { background: var(--raised); color: var(--text); }
.row.on { background: var(--raised); border-color: var(--hairline); box-shadow: inset 3px 0 0 var(--accent); }
.row-top { display: flex; gap: 8px; align-items: baseline; }
.row-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.row-time { font-family: var(--font-num); color: var(--muted); font-size: 12px; flex-shrink: 0; }
.row-subject { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 32px 14px; text-align: center; color: var(--muted); }

.convo { display: flex; flex-direction: column; border: 1px solid var(--hairline); border-radius: 20px; overflow: hidden; background: var(--card-bg); }
.empty-state { align-items: center; justify-content: center; }
.convo-head { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--hairline); flex-shrink: 0; }
.convo-title { flex: 1; min-width: 0; }
.subject { margin: 0; font-weight: 500; font-size: 19px; letter-spacing: -.03em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; gap: 5px; max-width: min(78%, 640px); align-self: flex-start; }
.msg.staff { align-self: flex-end; align-items: flex-end; }
.meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.staff-tag { font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid rgba(165, 252, 16, .35); border-radius: 999px; padding: 1px 6px; }
.bubble { padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--raised); border: 1px solid var(--border); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.staff .bubble { border-radius: 18px 18px 6px 18px; background: var(--accent-wash); border-color: rgba(165, 252, 16, .18); }
.mention { color: var(--accent); background: var(--accent-wash); border-radius: 4px; padding: 0 3px; }
.attach { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 999px; font-size: 12.5px; color: var(--ghost-text); }
.attach::before { content: "📎"; font-size: 11px; }
a.attach:hover { color: #fff; border-color: #4a4a50; }
.attach-img { display: block; margin-top: 2px; }
.attach-img img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--hairline); }

/* bot / system messages: one quiet line, click to expand */
.msg.bot { align-self: stretch; max-width: none; }
.bot-note { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-left: 2px solid var(--hairline); padding: 2px 0 2px 12px; color: var(--sub); font-size: 12px; cursor: pointer; }
.bot-note:hover { color: var(--muted); border-left-color: var(--muted); }
.bot-name { color: var(--muted); font-weight: 500; }
.bot-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; margin-top: 2px; color: var(--muted); }
.bot-note[aria-expanded=true] .bot-text { -webkit-line-clamp: unset; display: block; }

.composer { border-top: 1px solid var(--hairline); padding: 12px 18px 14px; display: flex; flex-direction: column; gap: 9px; flex-shrink: 0; background: rgba(14, 14, 16, .5); }
.draft-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 34px; }
.note { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--raised); color: var(--ghost-text); font-size: 12.5px; }
.note.warn { background: var(--ext-warn-wash); color: #FFD2A8; }
.composer textarea { min-height: 72px; max-height: 260px; }
.composer-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.send-as { border: 1px solid var(--hairline); }

.side { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.side .card { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.who { flex-direction: row !important; align-items: center; gap: 12px !important; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #26272A, rgba(38, 39, 42, 0)), var(--raised); border: 1px solid var(--hairline); display: flex; align-items: center; justify-content: center; color: var(--accent); font-family: var(--font-black); font-weight: 900; font-size: 18px; }
.fields { gap: 12px !important; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); }
.past { display: flex; justify-content: space-between; gap: 8px; color: var(--ghost-text); font-size: 13px; padding: 4px 0; }
.past:hover { color: #fff; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ghost-text); }

.live-bar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; height: 40px; padding: 0 18px; border: 2px solid var(--lime-edge); border-radius: 999px; background-image: var(--lime); color: var(--background); font-weight: 500; cursor: pointer; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.live-bar[hidden] { display: none; }

@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .side { display: none; }
}
@media (max-width: 760px) {
  body.is-inbox .app { height: auto; overflow: visible; }
  .inbox { grid-template-columns: 1fr; }
  .list { max-height: 45vh; }
  .convo { min-height: 80vh; }
  .convo-head { flex-direction: column; align-items: flex-start; }
  .actions { justify-content: flex-start; }
  .msg { max-width: 92%; }
  .status, .top form { display: none; }
}

/* ---------- login ---------- */
body.is-login { overflow-x: hidden; }
.edge-light { position: fixed; left: 50%; top: -420px; width: 520px; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: var(--lime); filter: blur(220px); opacity: .55; pointer-events: none; }
.login { position: relative; max-width: 520px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.login .title { margin-top: 12px; }
.login .sub { color: var(--muted); font-size: 16px; letter-spacing: -.02em; margin: 14px 0 24px; }
.login .banner { margin: 0 0 16px; text-align: left; }
.login-form { display: flex; gap: 8px; padding: 6px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--card-bg); }
.login-form input { border: 0; background: transparent; border-radius: 999px; padding: 0 14px; }
@media (max-width: 480px) { .login-form { flex-direction: column; border-radius: 22px; } .login-form input { height: 44px; } }

/* ---------- reports ---------- */
.reports { width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.rep-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 6px; }
.rep-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range { display: flex; gap: 6px; align-items: center; }
.range input { width: auto; height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px; color-scheme: dark; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--hairline); border-radius: 20px; background: var(--card-bg); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.tile-label { color: var(--ghost-text); font-size: 13px; }
.metric { font-family: var(--font-num); font-weight: 600; font-size: 36px; line-height: 1; letter-spacing: -.03em; background-image: var(--lime); -webkit-background-clip: text; background-clip: text; color: transparent; }
.metric small { font-size: 18px; font-weight: 500; margin-left: 2px; background: none; -webkit-text-fill-color: var(--unit); color: var(--unit); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: -.02em; }

.chart { display: flex; flex-direction: column; gap: 6px; }
.bars { height: 150px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--hairline); }
.bars.tight { gap: 2px; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar { display: block; width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px; background-image: linear-gradient(180deg, #cffb55, #a5fc10); min-height: 0; }
.bars.tight .bar { opacity: .55; }
.bars.tight .bar.peak { opacity: 1; }
.bar.zero { height: 2px !important; background: var(--hairline); opacity: 1; }
.bar-col:hover .bar:not(.zero) { filter: brightness(1.15); opacity: 1; }
.bar-val { font-family: var(--font-num); font-size: 11px; color: var(--ghost-text); }
.axis { display: flex; gap: 4px; }
.bars.tight + .axis { gap: 2px; }
.axis span { flex: 1; min-width: 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; font-family: var(--font-num); }

.hbar { display: grid; grid-template-columns: minmax(0, 150px) 1fr 34px; align-items: center; gap: 10px; padding: 5px 0; }
.hbar .lbl { font-size: 13px; color: var(--ghost-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 8px; border-radius: 999px; background: var(--icon-well); overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: 999px; background-image: var(--lime); }
.hbar .num { text-align: right; font-family: var(--font-num); font-size: 13px; }
.hbar-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
pre { margin: 0; white-space: pre-wrap; font-family: var(--font); color: var(--ghost-text); line-height: 1.6; background: var(--background); padding: 14px 16px; border-radius: 14px; border: 1px solid var(--hairline); }

@media (max-width: 1000px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .hbar-cols { grid-template-columns: 1fr; }
}
