/* Inter Variable — self-hosted, no external requests (2026-07-28 rebrand).
   font-weight: 100 900 covers the whole variable axis, so every existing
   font-weight rule (400/600/700 etc.) already used across the app "just
   works" against this one file — no other CSS needed to change. */
@font-face {
  font-family: 'Inter Variable';
  src: url('/static/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter Variable';
  src: url('/static/fonts/InterVariable-Italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Ember — refined Zed BPO brand: warm near-black + precise logo orange
     (matches Zed Payroll's identical refresh), a raised surface tone for
     hover/elevation, and a muted semantic green. */
  --bg: #0b0f17;
  --panel: #17140f;
  --panel-2: #1e1a14;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5efe6;
  --muted: #948a7c;
  --accent: #2f7df6;
  --accent-soft: rgba(47, 125, 246, 0.16);
  --ok: #4caf7d;
  --bad: #e2685f;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  /* Renders native widget internals (select arrow + popup list, date picker)
     dark — CSS can style the control box but not those parts. */
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; }
.brand-logo { height: 24px; width: auto; display: block; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 12px; border-radius: 8px; transition: color .15s ease, background .15s ease; }
.topbar nav a:hover { color: var(--text); background: var(--panel-2); }
.who { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.who button { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; transition: border-color .15s ease, color .15s ease; }
.who button:hover { border-color: var(--accent); color: var(--accent); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; margin-bottom: 20px; box-shadow: 0 20px 45px -32px rgba(0, 0, 0, 0.7);
}
.card h2 { margin-top: 0; font-size: 16px; }

.grid-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form label, .inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.grid-form input, .grid-form select,
.inline-form input, .inline-form select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-top: 2px;
}
.inline-form { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 12px; }

button, .btn-secondary {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-block; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(47, 125, 246, 0.5); }
button:active { transform: translateY(0); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
td { transition: background .15s ease; }
tr:hover td { background: var(--panel-2); }

.pill { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--border); color: var(--text); text-transform: capitalize; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--bad); font-size: 13px; }

/* login page */
.login-wrap { max-width: 360px; margin: 100px auto; padding: 0 20px; }
.login-wrap .card { text-align: center; }
.login-logo { height: 46px; width: auto; display: block; margin: 0 auto 12px; }

/* chat layout */
.chat-shell { display: grid; grid-template-columns: 260px 1fr; gap: 0; height: calc(100vh - 65px); }
.contacts { border-right: 1px solid var(--border); overflow-y: auto; padding: 12px; }
.contacts a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 14px; margin-bottom: 2px;
  transition: background .15s ease;
}
.contacts a:hover { background: var(--panel-2); }
.contacts a.active { background: var(--panel-2); border: 1px solid var(--border); }
.contacts a .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  /* Neutral background (not --accent-soft) — this file is shared by the
     Zednex (violet) and Medical instances too, which override --accent per
     view but have no matching "soft" tint; a neutral chip + accent-colored
     initials looks right under any of the three brand colors. */
  width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.unread-badge { background: var(--bad); color: #fff; flex-shrink: 0; }
.conversation { display: flex; flex-direction: column; height: 100%; }
.thread-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.thread-name { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }
.thread-header .btn-secondary {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: 12.5px; margin-left: 0;
}
.thread-header .btn-secondary:disabled { opacity: .6; cursor: default; }
.refresh-icon { display: inline-block; font-size: 14px; line-height: 1; }
.btn-secondary.spinning .refresh-icon { animation: spin .6s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  /* Without pre-wrap a multi-line message collapses into one run-on paragraph.
     Any message with deliberate line breaks — an announcement, a list, an
     address — was silently being flattened. */
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-width: 60%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4;
  opacity: 0; animation: msg-in .28s ease forwards;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.msg.mine { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.theirs { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); }
.msg-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.msg-time { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg.mine .msg-time { color: rgba(255, 255, 255, 0.75); }
/* Read receipts — WhatsApp-style double check. Gray = sent, not yet read;
   blue = read. Blue is a fixed hex (not --accent) so it reads correctly and
   consistently regardless of which of the 3 brand accents this instance uses. */
.ticks { display: inline-flex; color: rgba(255, 255, 255, 0.55); flex-shrink: 0; transition: color .2s ease; }
.ticks.read { color: #53bdeb; }
.ticks svg { display: block; }
.composer { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--border); }
.composer input { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 14px; transition: border-color .15s ease; }
.composer input:focus { border-color: var(--accent); outline: none; }
.empty-state { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); }

/* ---- File attachments (2026-08-19) ---------------------------------------
   Shared verbatim across all three instances, so nothing here may derive from
   --accent in a way that assumes a particular brand colour (same reasoning as
   the read-receipt ticks). */
.attach-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 4px;
  border-radius: 8px; text-decoration: none;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14);
  color: inherit; max-width: 100%; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.attach-chip:hover { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .28); }
.msg.theirs .attach-chip { background: rgba(255, 255, 255, .05); }
.ac-clip { flex-shrink: 0; font-size: 15px; line-height: 1; }
.ac-name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-size { flex-shrink: 0; font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }

.composer-wrap { border-top: 1px solid var(--border); }
.composer-wrap .composer { border-top: none; }

.attach-btn {
  flex-shrink: 0; background: transparent; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 16px; line-height: 1;
  cursor: pointer; color: var(--text); transition: border-color .15s ease, background .15s ease;
}
.attach-btn:hover { border-color: var(--accent); background: rgba(255, 255, 255, .05); }

.pending-file {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 16px 0; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
}
.pf-name {
  flex: 1; min-width: 0; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-size { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-bar { width: 90px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.pf-bar-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.pf-clear {
  flex-shrink: 0; background: transparent; border: none; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.pf-clear:hover { color: var(--text); }

.composer-error { margin: 10px 16px 0; font-size: 12px; color: #f87171; }

/* Any element given an explicit `display:` above would otherwise ignore the
   `hidden` attribute entirely — the UA rule [hidden]{display:none} loses to a
   class selector. Caught in local testing: the empty attachment bar rendered
   permanently above the composer. */
.pending-file[hidden], .pf-bar[hidden], .composer-error[hidden] { display: none !important; }

/* Download feedback. The Tauri desktop window saves the file but shows no
   dialog, no progress and no completion notice — without this the employee
   sees nothing happen and clicks Download repeatedly. */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; z-index: 9999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Complaints channel (2026-08-19) ------------------------------------- */
.complaint-note {
  display: flex; align-items: center;
  margin: 12px 16px 0; padding: 8px 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
}
.anon-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.anon-toggle input { cursor: pointer; }
.anon-mark { font-size: 10px; opacity: .7; font-style: italic; margin-top: 3px; }

.complaint { border-left: 3px solid var(--accent); }
.complaint.is-anon { border-left-color: var(--muted); }
.complaint-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.complaint-who { font-weight: 600; font-size: 14px; }
.complaint-meta { display: flex; align-items: center; gap: 10px; font-size: 11px; white-space: nowrap; }
.complaint-body { white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.anon-pill { background: rgba(255, 255, 255, .1); }

/* `.btn` was used by download.ejs and by the attachment 404 page's only way
   back to Chat, but never actually defined — so the escape affordance rendered
   as plain link text. */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-size: 13px; font-weight: 500; border: 1px solid transparent;
}
.btn:hover { filter: brightness(1.08); }

.complaint-intro {
  align-self: center; max-width: 460px; margin: 10px 0 2px;
  font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center;
}
