/* ============================================================
   MAX CUSTOMER CARE™ — stylesheet
   A helpdesk that takes itself very seriously. Visually.
   ============================================================ */

:root {
  --cream: #F4EFE6;
  --cream-2: #EBE3D3;
  --paper: #FFFCF6;
  --ink: #1A1714;
  --ink-2: #4A433D;
  --muted: #8A8178;
  --line: rgba(26, 23, 20, 0.14);
  --line-strong: rgba(26, 23, 20, 0.6);

  --coral: #FF5A36;
  --coral-deep: #C23A1C;
  --coral-soft: #FFE1D8;
  --mustard: #F2C14E;
  --mustard-deep: #9A7210;
  --mustard-soft: #FBEFC9;
  --teal: #1F8A8A;
  --teal-deep: #135E5E;
  --teal-soft: #D4ECEA;
  --lilac: #9B84E0;
  --lilac-deep: #5A43A8;
  --lilac-soft: #E6DFF8;
  --green: #2F9E5B;

  --shadow-sm: 0 1px 0 rgba(26, 23, 20, 0.05), 0 2px 8px -2px rgba(26, 23, 20, 0.12);
  --shadow: 0 1px 0 rgba(26, 23, 20, 0.06), 0 14px 40px -16px rgba(26, 23, 20, 0.35);
  --shadow-hard: 4px 4px 0 var(--ink);
  --radius: 18px;
  --radius-sm: 10px;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --header-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: var(--mustard); color: var(--ink); }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- background texture ---------- */
.app {
  min-height: 100%;
  position: relative;
  isolation: isolate;
}
.app::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60vw 60vw at 110% -10%, rgba(255, 90, 54, 0.18), transparent 60%),
    radial-gradient(50vw 50vw at -10% 110%, rgba(31, 138, 138, 0.16), transparent 60%),
    radial-gradient(40vw 40vw at 50% 50%, rgba(242, 193, 78, 0.12), transparent 60%),
    var(--cream);
}
.app::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- marquee ---------- */
.marquee {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  overflow: hidden;
  white-space: nowrap;
  padding: 7px 0;
  padding-top: calc(7px + var(--safe-t));
}
.marquee__track {
  display: inline-block;
  animation: marquee 40s linear infinite;
}
.marquee__track span { padding: 0 1.25em; }
.marquee__track span::after { content: '✦'; color: var(--coral); margin-left: 2.5em; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee__track { animation: none; } }

/* ============================================================
   LOGIN
   ============================================================ */
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.login__body {
  display: grid;
  place-items: center;
  padding: 24px 16px 40px;
}
.stub {
  width: min(100%, 440px);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard), var(--shadow);
  position: relative;
  transform: rotate(-1.2deg);
  animation: stub-in 0.7s cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
}
@keyframes stub-in {
  from { opacity: 0; transform: rotate(-6deg) translateY(30px) scale(0.96); }
  to { opacity: 1; transform: rotate(-1.2deg) translateY(0) scale(1); }
}
.stub__head {
  padding: 20px 24px 16px;
  border-bottom: 2px dashed var(--ink);
  position: relative;
}
.stub__head::before, .stub__head::after {
  content: '';
  position: absolute; bottom: -12px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--ink);
}
.stub__head::before { left: -13px; clip-path: inset(0 0 0 50%); }
.stub__head::after { right: -13px; clip-path: inset(0 50% 0 0); }
.stub__kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--coral-deep);
  display: flex; justify-content: space-between;
}
.stub__title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-weight: 900;
  font-size: clamp(36px, 9vw, 48px);
  line-height: 0.95;
  margin: 8px 0 6px;
  letter-spacing: -0.02em;
}
.stub__title em { font-style: italic; font-weight: 500; color: var(--coral); }
.stub__sub { margin: 0; color: var(--ink-2); font-size: 14px; }
.stub__body { padding: 22px 24px 24px; }
.stamp {
  position: absolute; top: -14px; right: 22px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--coral-deep);
  background: var(--paper);
  border: 2px solid var(--coral-deep);
  border-radius: 6px;
  padding: 4px 8px;
  transform: rotate(6deg);
  opacity: 0.85;
  mix-blend-mode: multiply;
}
.login__foot {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 0 16px calc(16px + var(--safe-b));
  letter-spacing: 0.04em;
}

/* ---------- form bits ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2);
}
.input {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  outline: none;
  transition: box-shadow 0.15s, transform 0.15s;
}
.input:focus { box-shadow: 3px 3px 0 var(--coral); transform: translate(-1px, -1px); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  box-shadow: 3px 3px 0 var(--coral);
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--coral); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--coral); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.btn--ghost:hover { box-shadow: 4px 4px 0 var(--ink); }
.btn--ghost:active { box-shadow: 0 0 0 var(--ink); }
.btn--sm { padding: 8px 14px; font-size: 13px; box-shadow: 2px 2px 0 var(--coral); }
.btn--sm.btn--ghost { box-shadow: 2px 2px 0 var(--ink); }
.btn--sos { background: var(--coral); border-color: var(--coral-deep); color: #fff; box-shadow: 3px 3px 0 var(--ink); animation: sos-pulse 1.2s ease-in-out infinite; }
@keyframes sos-pulse { 50% { filter: brightness(1.12); } }
.btn--icon { padding: 8px; width: 40px; height: 40px; border-radius: 50%; }

/* ============================================================
   APP SHELL
   ============================================================ */
.shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  padding-top: calc(10px + var(--safe-t));
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  position: relative; z-index: 5;
}
.brand {
  display: flex; align-items: baseline; gap: 8px;
  text-decoration: none;
  flex: 1; min-width: 0;
}
.brand__mark {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-weight: 900;
  font-size: 22px; line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand__mark sup { font-size: 9px; vertical-align: top; color: var(--coral); margin-left: 1px; }
.brand__tag {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
  padding: 6px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--cream);
  white-space: nowrap;
}
.status__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(47, 158, 91, 0.6);
  animation: blip 2s ease-out infinite;
}
@keyframes blip { 0% { box-shadow: 0 0 0 0 rgba(47, 158, 91, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(47, 158, 91, 0); } }
.userchip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 900; font-size: 15px;
  border: 2px solid var(--ink);
  background: var(--mustard);
}
.avatar--max { background: var(--coral); color: #fff; }
.avatar--aisha { background: var(--mustard); }
.avatar--sm { width: 26px; height: 26px; font-size: 12px; }

.layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
  overflow: hidden;
}
.sidebar, .main {
  min-height: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.sidebar { background: transparent; }
.main { background: transparent; }

/* mobile view switching */
@media (max-width: 899px) {
  .layout[data-view="home"] .main { display: none; }
  .layout[data-view="main"] .sidebar { display: none; }
  .brand__tag { display: none; }
  .status { display: none; }
}
@media (min-width: 900px) {
  .layout { grid-template-columns: 380px 1fr; }
  .sidebar { border-right: 2px solid var(--ink); }
  .back { display: none !important; }
}
@media (min-width: 1300px) {
  .layout { grid-template-columns: 420px 1fr; }
}

/* ---------- sidebar ---------- */
.side__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px 10px;
}
.side__title {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 60, 'opsz' 60;
  font-weight: 800; font-size: 24px; letter-spacing: -0.01em;
  margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.count {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--ink); color: var(--cream);
  padding: 2px 8px; border-radius: 999px;
}
.side__list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 4px 12px calc(24px + var(--safe-b));
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.tcard {
  display: block; width: 100%; text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.tcard:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.tcard.is-active { box-shadow: 3px 3px 0 var(--coral); border-color: var(--ink); background: #fff; }
.tcard.is-resolved { opacity: 0.72; background: var(--cream-2); }
.tcard__top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tcard__id { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-2); }
.tcard__time { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.tcard__snip {
  font-size: 14px; line-height: 1.35; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tcard__snip b { font-weight: 700; }
.tcard__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.unread {
  margin-left: auto;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px;
  background: var(--coral); color: #fff;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--ink);
}

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.chip--checkin { color: var(--teal-deep); background: var(--teal-soft); }
.chip--therapy { color: var(--lilac-deep); background: var(--lilac-soft); }
.chip--sos { color: var(--coral-deep); background: var(--coral-soft); }
.chip--idk { color: var(--mustard-deep); background: var(--mustard-soft); }
.chip--status { color: var(--ink-2); background: var(--cream); }
.chip--resolved { color: var(--green); background: #DFF3E6; }

.empty {
  padding: 30px 20px; text-align: center; color: var(--muted);
  font-size: 14px; line-height: 1.5;
}
.empty strong { display: block; font-family: var(--font-display); font-size: 22px; color: var(--ink); margin-bottom: 6px; font-weight: 700; }

/* ---------- main pane ---------- */
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.pane__scroll {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 20px 16px calc(28px + var(--safe-b));
}
@media (min-width: 900px) { .pane__scroll { padding: 32px 36px; } }
.pane__inner { max-width: 760px; margin: 0 auto; }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 6px 4px; margin: -6px 0 8px -4px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
}

/* welcome */
.welcome { padding-top: 6vh; }
.welcome h1 {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-weight: 900;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.95; letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.welcome h1 em { font-style: italic; font-weight: 400; color: var(--coral); }
.welcome p { font-size: 17px; color: var(--ink-2); max-width: 52ch; line-height: 1.5; margin: 0 0 24px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 24px 0; }
.tile {
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; padding: 14px;
  box-shadow: 3px 3px 0 var(--ink);
}
.tile__k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.tile__v { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1.1; margin-top: 4px; }
.tile__v small { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--muted); }

/* ---------- new ticket ---------- */
.h1 {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  font-weight: 900; font-size: clamp(32px, 5vw, 52px);
  line-height: 1; letter-spacing: -0.03em; margin: 0 0 8px;
}
.h1 em { font-style: italic; font-weight: 400; color: var(--coral); }
.lede { color: var(--ink-2); font-size: 15px; margin: 0 0 22px; line-height: 1.5; }
.queue-note {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px;
  padding: 6px 12px 6px 6px; margin-bottom: 22px;
}
.queue-note b { background: var(--ink); color: var(--mustard); padding: 3px 9px; border-radius: 999px; font-weight: 700; }

.reasons {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px;
}
@media (min-width: 640px) { .reasons { grid-template-columns: repeat(4, 1fr); } }
.reason {
  position: relative;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 14px 12px 12px;
  min-height: 128px;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.reason:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.reason__emoji { font-size: 28px; line-height: 1; }
.reason__name { font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1.1; letter-spacing: -0.01em; }
.reason__tag { font-size: 12px; color: var(--muted); line-height: 1.35; }
.reason__check {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--paper);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  opacity: 0; transform: scale(0.6) rotate(-20deg);
  transition: opacity 0.15s, transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.reason.is-selected .reason__check { opacity: 1; transform: scale(1) rotate(0); }
.reason--checkin.is-selected { background: var(--teal-soft); box-shadow: 4px 4px 0 var(--teal); }
.reason--therapy.is-selected { background: var(--lilac-soft); box-shadow: 4px 4px 0 var(--lilac); }
.reason--sos.is-selected { background: var(--coral-soft); box-shadow: 4px 4px 0 var(--coral); animation: shake 0.4s; }
.reason--idk.is-selected { background: var(--mustard-soft); box-shadow: 4px 4px 0 var(--mustard); }
@keyframes shake { 0%,100% { transform: translate(0); } 20% { transform: translate(-3px, 1px) rotate(-1deg); } 40% { transform: translate(3px, -1px) rotate(1deg); } 60% { transform: translate(-2px, 0); } 80% { transform: translate(2px, 0); } }

.sla {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  color: var(--ink-2);
  background: var(--cream-2); border-left: 3px solid var(--ink);
  padding: 10px 12px; border-radius: 0 10px 10px 0;
  margin-bottom: 18px;
  min-height: 42px;
}
.sla b { color: var(--ink); }
.fine { font-family: var(--font-mono); font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 12px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- ticket detail ---------- */
.thead {
  padding: 12px 16px 10px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  display: flex; flex-direction: column; gap: 8px;
}
@media (min-width: 900px) { .thead { padding: 14px 24px 12px; } }
.thead__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thead__id { font-family: var(--font-mono); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; }
.thead__title {
  font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.01em;
  margin: 0; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.thead__meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.thead__actions { margin-left: auto; display: flex; gap: 8px; }

.sosbar {
  background: repeating-linear-gradient(135deg, var(--coral) 0 18px, var(--ink) 18px 36px);
  color: #fff; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  text-align: center; padding: 6px 10px;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6), 0 0 6px rgba(0,0,0,0.5);
  animation: sosbar 1s steps(2) infinite;
}
@keyframes sosbar { 50% { filter: brightness(1.25); } }

.chat {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 14px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
@media (min-width: 900px) { .chat { padding: 24px 28px 16px; } }
.chat__inner { max-width: 820px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.msg { display: flex; gap: 8px; max-width: 82%; align-items: flex-end; animation: msg-in 0.25s ease-out both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg--me { align-self: flex-end; flex-direction: row-reverse; }
.msg--them { align-self: flex-start; }
.msg__bubble {
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  font-size: 15px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.msg--me .msg__bubble { background: var(--ink); color: var(--cream); border-bottom-right-radius: 5px; }
.msg--them .msg__bubble { border-bottom-left-radius: 5px; }
.msg--max .msg__bubble { background: var(--coral); color: #fff; border-color: var(--ink); }
.msg--aisha.msg--me .msg__bubble { background: var(--ink); }
.msg__time { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin: 2px 6px 0; }
.msg--me .msg__time { text-align: right; }
.msg__avatar { flex: none; margin-bottom: 16px; }
.msg + .msg--same { margin-top: -2px; }
.msg--same .msg__avatar { visibility: hidden; }
.sys {
  align-self: center; text-align: center;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--muted);
  padding: 6px 12px; margin: 8px 0;
  border: 1.5px dashed var(--line-strong); border-radius: 999px;
  background: rgba(255, 252, 246, 0.6);
}
.daysep { align-self: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 10px 0 4px; }

.typing {
  display: none; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  padding: 2px 14px 0;
}
.typing.is-on { display: flex; }
.typing__dots span {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--coral);
  margin-right: 3px; animation: bounce 1s infinite;
}
.typing__dots span:nth-child(2) { animation-delay: 0.15s; }
.typing__dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

.composer {
  border-top: 2px solid var(--ink);
  background: var(--paper);
  padding: 10px 12px calc(10px + var(--safe-b));
}
.composer__row { display: flex; gap: 10px; align-items: flex-end; max-width: 820px; margin: 0 auto; }
.composer textarea {
  flex: 1; min-height: 46px; max-height: 160px; resize: none;
  padding: 11px 14px; border-radius: 16px;
  font-size: 16px; line-height: 1.4;
}
.composer .send { flex: none; width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.composer__note {
  max-width: 820px; margin: 0 auto 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--green);
  display: flex; align-items: center; gap: 6px;
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed; left: 50%; top: calc(72px + var(--safe-t)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 100;
  width: min(92vw, 420px); pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--cream);
  border: 2px solid var(--ink); border-radius: 12px;
  padding: 10px 14px; font-size: 14px; line-height: 1.4;
  box-shadow: 3px 3px 0 var(--coral);
  animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.toast--err { box-shadow: 3px 3px 0 var(--coral); }
.toast--ok { box-shadow: 3px 3px 0 var(--teal); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }

/* ---------- misc ---------- */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; height: 100%; color: var(--muted); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; gap: 10px; padding: 40px; }
.wiggle { display: inline-block; animation: wiggle 2.4s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(14deg); } 90% { transform: rotate(-10deg); } 95% { transform: rotate(8deg); } }
