:root {
  --navy: #12233A;
  --text: #26333F;
  --muted: #5B6878;
  --line: #E2E7ED;
  --field: #B4BEC9;
  --wash: #F5F7F9;
  --green: #0F9648;
  --red: #9C1F18;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--wash); color: var(--text); font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", sans-serif; font-size: 0.95rem; line-height: 1.5; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
h1, h2, h3 { color: var(--navy); font-weight: 600; line-height: 1.2; }
ul, ol { list-style: none; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.logo { height: 22px; display: block; }
.muted { color: var(--muted); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

.btn { font: inherit; font-weight: 500; cursor: pointer; padding: 9px 18px; border-radius: 6px; background: var(--navy); color: #fff; border: 1px solid var(--navy); }
.btn:hover { background: #1D3553; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.plain { background: #fff; color: var(--navy); border-color: var(--field); }
.btn.plain:hover { background: var(--wash); }
input, select, textarea { width: 100%; padding: 9px 11px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--field); border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--navy); }
textarea { resize: vertical; }
label { display: block; font-weight: 500; color: var(--navy); font-size: 0.92rem; }
label input, label select { margin-top: 6px; }
.err { color: var(--red); font-weight: 500; }
.err:empty { display: none; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.box { width: min(100%, 400px); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 32px; display: grid; gap: 16px; box-shadow: 0 1px 2px rgba(18, 35, 58, .04), 0 8px 24px rgba(18, 35, 58, .06); }
.box h1 { font-size: 1.25rem; margin-top: 20px; }
.box h1 + p { margin-top: 6px; color: var(--muted); }

.bar { background: var(--navy); color: #C9D3DE; }
.bar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.bar h1 { color: #fff; font-size: 1rem; font-weight: 500; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .2); margin-right: auto; }
.bar button { font: inherit; color: #fff; background: none; border: 1px solid rgba(255, 255, 255, .3); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.bar button:hover { background: rgba(255, 255, 255, .08); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: #ECEFF3; color: #4A5664; }
.pill.new { background: #E3EDFA; color: #1B4F8C; }
.pill.contacted, .pill.quoted { background: #FFF1D6; color: #7A4A00; }
.pill.won { background: #E1F3E8; color: #0B6B33; }
.pill.alert { background: #FBE7E5; color: var(--red); }

.thread { display: flex; flex-direction: column; gap: 14px; }
.thread > li { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.thread > li.out { align-self: flex-end; align-items: flex-end; }
.thread .who { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.thread .who strong { color: var(--navy); font-weight: 600; }
.msg { background: var(--wash); border: 1px solid var(--line); border-radius: 12px; border-top-left-radius: 4px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.out .msg { background: #EAF0F8; border-color: #D3DEEC; border-radius: 12px; border-top-right-radius: 4px; }
.thread > li.note { align-self: stretch; max-width: none; }
.note .msg { background: #FFF8E3; border-color: #EEDDA6; border-radius: 8px; width: 100%; }
.thread > li.ev { align-self: center; max-width: none; font-size: 0.84rem; color: var(--muted); }

.typing .msg { display: flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #8A97A6; animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; } }

.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.out .files { justify-content: flex-end; }
.thumb img { display: block; max-width: 240px; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); }
.file { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; max-width: 260px; }
.file span { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small, .picked small { color: var(--muted); }

.compose.drop { outline: 2px dashed var(--navy); outline-offset: -6px; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; }
.picked:not(:empty) { margin-bottom: 8px; }
.picked li { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; background: var(--wash); border: 1px solid var(--line); border-radius: 999px; font-size: 0.86rem; }
.picked button { font: inherit; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 50%; }
.picked button:hover { background: var(--line); color: var(--navy); }
.attach { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; cursor: pointer; }
.attach:hover { background: var(--wash); color: var(--navy); }
.attach:focus-within { outline: 3px solid var(--green); }

[hidden] { display: none; }
