/* Gruvbox dark. Two-pane desktop layout, sized in percentages.
   Deliberately no breakpoints: this is an internal tool used on a laptop.

   Styled to look nothing like WhatsApp Web on purpose — when a screen recording
   or a screenshot ends up in front of a client, it should be obvious which one
   is the archive and which one is WhatsApp. */

:root {
  --bg0-hard: #1d2021;
  --bg0:      #282828;
  --bg1:      #3c3836;
  --bg2:      #504945;
  --bg3:      #665c54;
  --fg0:      #fbf1c7;
  --fg1:      #ebdbb2;
  --fg3:      #bdae93;
  --gray:     #928374;
  --red:      #fb4934;
  --green:    #b8bb26;
  --yellow:   #fabd2f;
  --blue:     #83a598;
  --aqua:     #8ec07c;
  --orange:   #fe8019;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font: 13px/1.5 "JetBrains Mono", "Fira Code", "DejaVu Sans Mono",
        ui-monospace, monospace;
  color: var(--fg1);
  background: var(--bg0-hard);
}

.app { display: flex; height: 100%; overflow: hidden; }

/* ---------- sidebar ---------- */

.sidebar {
  width: 30%;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg0);
  border-right: 1px solid var(--bg2);
}

.sidebar-head {
  padding: 14px 16px;
  background: var(--bg0-hard);
  border-bottom: 1px solid var(--bg2);
}
.brand {
  font-weight: 700; font-size: 14px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--yellow);
}
.brand::before { content: "▎"; color: var(--orange); margin-right: 4px; }

.notify {
  margin-left: 10px; font: inherit; font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 8px; border: none; border-radius: 2px;
  background: var(--yellow); color: var(--bg0); cursor: pointer;
}
.notify:hover { background: var(--orange); }
.notify:disabled { background: var(--bg2); color: var(--bg3); cursor: not-allowed; }

.sidebar-head { display: block; }
.search { margin-top: 10px; }
.search input {
  width: 100%; padding: 7px 10px; font: inherit;
  color: var(--fg1); background: var(--bg1);
  border: 1px solid var(--bg2); border-radius: 3px;
}
.search input:focus { outline: none; border-color: var(--yellow); }
.search input::placeholder { color: var(--gray); }

.list { flex: 1; min-height: 0; overflow-y: auto; }

.row {
  display: flex; gap: 11px; align-items: center;
  padding: 11px 16px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--bg1);
  border-left: 3px solid transparent;
}
.row:hover { background: var(--bg1); }
.row.on { background: var(--bg1); border-left-color: var(--yellow); }

.avatar {
  width: 34px; height: 34px; flex: none;
  border-radius: 3px; background: var(--bg2); color: var(--yellow);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.avatar.big { width: 32px; height: 32px; }

.row-body { flex: 1; min-width: 0; }
.row-top, .row-bottom {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.who { font-weight: 700; color: var(--fg0); }
.when, .dim { color: var(--gray); font-size: 11px; }
.num { color: var(--gray); font-size: 10px; margin-left: 6px; }
.row-top { flex-wrap: nowrap; }
.row-top .who { flex: none; }
.row-top .num { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview {
  color: var(--fg3); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tick { color: var(--blue); }

/* The 24-hour window is the whole economics of this thing, so it is visible
   on every row rather than buried in the thread. */
.pill {
  flex: none; font-size: 10px; padding: 1px 6px;
  border-radius: 2px; white-space: nowrap; font-weight: 700;
}
.badges { display: flex; align-items: center; gap: 6px; flex: none; }

/* WhatsApp-style unread count. */
.unread {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--green); color: var(--bg0);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

.pill.open { background: var(--bg2); color: var(--fg3); }
.pill.shut { background: var(--bg2); color: var(--red); }

/* ---------- thread ---------- */

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.thread-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--bg0);
  border-bottom: 1px solid var(--bg2);
}
.thread-who { flex: 1; display: flex; flex-direction: column; }

/* The conversation list auto-refreshes; a thread cannot, because a refresh would
   discard whatever is half-typed in the reply box. */
.refresh {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--bg0); background: var(--blue);
  padding: 3px 9px; border-radius: 2px; text-decoration: none;
}
.refresh:hover { background: var(--aqua); }
.refresh.stale { background: var(--red); }
.thread-who strong { color: var(--fg0); }
.thread-who small { color: var(--gray); font-size: 11px; }

.messages {
  flex: 1; min-height: 0; overflow-y: auto; padding: 20px 8%;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--bg0-hard);
}

.msg {
  max-width: 65%; width: fit-content;
  padding: 7px 10px 5px;
  border-radius: 3px;
  background: var(--bg1);
  border-left: 2px solid var(--bg3);
}
.msg.out {
  align-self: flex-end;
  background: var(--bg2);
  border-left: none;
  border-right: 2px solid var(--aqua);
}
.msg p { white-space: pre-wrap; word-wrap: break-word; color: var(--fg1); }

.msg footer {
  font-size: 10px; color: var(--gray);
  text-align: right; margin-top: 3px;
}

.status { margin-left: 6px; text-transform: uppercase; letter-spacing: .05em; }
.status.accepted { color: var(--gray); }
.status.sent { color: var(--fg3); }
.status.delivered { color: var(--blue); }
.status.read { color: var(--aqua); }
.status.failed { color: var(--red); font-weight: 700; }

video.media, img.media { max-width: 320px; border-radius: 3px; display: block; }
.audio { width: 280px; display: block; margin: 2px 0; }
.file {
  display: block; padding: 6px 8px; margin: 2px 0;
  color: var(--blue); background: var(--bg0); border-radius: 3px;
  text-decoration: none; font-size: 12px;
}
.file:hover { background: var(--bg0-hard); }

/* ---------- composer ---------- */

.composer {
  display: flex; gap: 10px; padding: 12px 20px;
  background: var(--bg0); border-top: 1px solid var(--bg2);
}
.composer input {
  flex: 1; padding: 9px 12px; font: inherit;
  color: var(--fg1); background: var(--bg1);
  border: 1px solid var(--bg2); border-radius: 3px;
}
.composer input:focus { outline: none; border-color: var(--yellow); }
.composer input::placeholder { color: var(--gray); }
.composer input:disabled { background: var(--bg0); color: var(--bg3); }

.composer button {
  padding: 9px 20px; font: inherit; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  border: none; border-radius: 3px;
  background: var(--yellow); color: var(--bg0);
  cursor: pointer;
}
.composer button:hover { background: var(--orange); }
.composer button:disabled {
  background: var(--bg2); color: var(--bg3); cursor: not-allowed;
}

.note {
  padding: 0 20px 12px; background: var(--bg0);
  color: var(--red); font-size: 11px;
}
.banner { padding: 10px 20px; font-size: 12px; }
.banner.bad { background: var(--red); color: var(--bg0); font-weight: 700; }

/* ---------- search + empty ---------- */

.hit {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
  padding: 10px 12px; background: var(--bg1);
  border-left: 2px solid var(--bg3); border-radius: 3px;
  text-decoration: none; color: inherit;
}
.hit:hover { border-left-color: var(--yellow); background: var(--bg2); }
.hit-top { display: flex; justify-content: space-between; gap: 10px; }
.hit-top strong { color: var(--fg0); }
.dir {
  font-size: 10px; color: var(--bg0); background: var(--gray);
  padding: 0 5px; border-radius: 2px; margin-right: 7px;
  text-transform: uppercase;
}
.dir.out { background: var(--aqua); }

.blank {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; color: var(--gray); background: var(--bg0-hard);
}
.blank h1 {
  font-size: 20px; font-weight: 700; color: var(--yellow);
  text-transform: uppercase; letter-spacing: .2em;
}

.empty { padding: 24px; color: var(--gray); text-align: center; }

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

.login {
  width: 22%; margin: 0 auto; position: relative; top: 18vh; padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg0); border: 1px solid var(--bg2); border-radius: 3px;
}
.login label { display: flex; flex-direction: column; gap: 5px; color: var(--fg3); }
.login input {
  padding: 8px 10px; font: inherit;
  color: var(--fg1); background: var(--bg1);
  border: 1px solid var(--bg2); border-radius: 3px;
}
.login input:focus { outline: none; border-color: var(--yellow); }
.login button {
  margin-top: 4px; padding: 9px; font: inherit; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  border: none; border-radius: 3px;
  background: var(--yellow); color: var(--bg0); cursor: pointer;
}
.login button:hover { background: var(--orange); }
.login-error { color: var(--red); font-size: 12px; }

.logout {
  float: right; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--gray); text-decoration: none; line-height: 20px;
}
.logout:hover { color: var(--yellow); }

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

/* Pinned under the conversation list: one tab per business number. */
.numbers {
  display: flex; flex: none;
  border-top: 1px solid var(--bg2); background: var(--bg0-hard);
}
.tab {
  flex: 1; min-width: 0; position: relative;
  display: flex; flex-direction: column; gap: 1px;
  padding: 9px 14px 10px; text-decoration: none; color: var(--fg3);
  border-top: 3px solid transparent;
}
.tab + .tab { border-left: 1px solid var(--bg2); }
.tab:hover { background: var(--bg1); }
.tab.on { color: var(--fg0); background: var(--bg0); border-top-color: var(--yellow); }
.tab-num { font-weight: 700; font-size: 12px; white-space: nowrap; }
.tab-kind {
  font-size: 10px; color: var(--gray);
  text-transform: uppercase; letter-spacing: .06em;
}
.tab .unread { position: absolute; top: 9px; right: 10px; }

/* Sent from the WhatsApp Business app on the phone, not from here. */
.via {
  margin-right: 6px; padding: 0 4px; border-radius: 2px;
  background: var(--bg3); color: var(--fg1);
  text-transform: uppercase; letter-spacing: .05em;
}
