:root {
  color-scheme: light;
  --ink: #0b1f3a;
  --muted: #355b86;
  --blue: #2563eb;
  --blue-strong: #1648c7;
  --cyan: #02a7c7;
  --green: #059669;
  --red: #c32148;
  --line: #c8dcff;
  --surface: #ffffff;
  --page: #f4f9ff;
  --panel: #eaf4ff;
  --messenger: #0a7cff;
  --instagram-a: #833ab4;
  --instagram-b: #fd1d1d;
  --instagram-c: #fcb045;
  --shadow: 0 18px 45px rgba(37, 99, 235, .12);
  font: 16px/1.5 "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(2, 167, 199, .12), transparent 34%),
    linear-gradient(315deg, rgba(5, 150, 105, .10), transparent 36%),
    var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
}
header strong { font-size: 24px; color: var(--blue); margin-right: 12px; }
header span { color: var(--muted); font-weight: 700; }
main { max-width: 1480px; margin: auto; padding: 18px 24px; }
h1 { font-size: 26px; line-height: 1.16; margin: 6px 0 10px; }
h2 { font-size: 19px; margin: 0; line-height: 1.25; }
p { margin: 8px 0 16px; }
button, input, textarea { font: inherit; }
button {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 7px 12px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
button:hover { background: #f8fbff; border-color: #8ebcff; box-shadow: 0 8px 18px rgba(37,99,235,.10); }
button:active { transform: scale(.98); }
button:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; transform: none; }
.primary { background: var(--blue); color: white; border-color: var(--blue); }
.primary:hover { background: var(--blue-strong); border-color: var(--blue-strong); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.panel {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.login { max-width: 520px; padding: 32px; margin: 7vh auto; }
.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
label { display: block; font-weight: 750; margin: 12px 0 6px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
}
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.14); outline: none; }
textarea { resize: vertical; min-height: 76px; max-height: 170px; }
.login button { width: 100%; margin-top: 24px; }
.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 12px 26px rgba(37,99,235,.08);
}
.notice p { font-size: 14px; margin: 3px 0 0; color: var(--muted); }
.livePill {
  flex: 0 0 auto;
  border: 1px solid rgba(5,150,105,.28);
  border-radius: 999px;
  background: #e8fff7;
  color: #046c4c;
  font-size: 13px;
  font-weight: 850;
  padding: 8px 12px;
}
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
aside { padding: 14px; }
.sectionTitle { margin-bottom: 14px; }
nav { display: grid; gap: 12px; }
.channelGroup {
  display: grid;
  gap: 7px;
}
.channelGroupHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 2px;
}
.channelGroupHeader strong {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}
.channelGroupHeader small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}
.channelButton {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  text-align: left;
  border-radius: 10px;
}
.channelButton strong, .channelButton small { display: block; }
.channelButton strong { overflow-wrap: anywhere; font-size: 15px; }
.channelButton small { color: var(--muted); margin-top: 1px; font-size: 12px; font-weight: 800; }
.channelButton[aria-current=true] {
  background: #edf5ff;
  border-color: #7db2ff;
  box-shadow: inset 4px 0 0 var(--blue), 0 10px 22px rgba(37,99,235,.12);
}
.channelButton.messenger[aria-current=true] {
  background: #eef6ff;
  border-color: #78bbff;
  box-shadow: inset 4px 0 0 var(--messenger), 0 10px 22px rgba(10,124,255,.14);
}
.channelButton.instagram[aria-current=true] {
  background: #fff2fa;
  border-color: #ffb9df;
  box-shadow: inset 4px 0 0 #d6249f, 0 10px 22px rgba(214,36,159,.13);
}
details { margin-top: 22px; font-size: 14px; color: var(--muted); }
summary { cursor: pointer; min-height: 44px; color: var(--ink); font-weight: 750; }
.chat { min-width: 0; overflow: hidden; }
.chatHeader {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.selectedRoute { display: flex; align-items: center; gap: 12px; min-width: 0; }
.routeIcon:empty {
  width: 46px;
  height: 46px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.brandMark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 10px 22px rgba(11,31,58,.16);
  overflow: hidden;
}
.brandMark svg { width: 24px; height: 24px; }
.messengerMark {
  border-radius: 50%;
  background: linear-gradient(135deg, #00b2ff 0%, #006aff 48%, #a033ff 100%);
}
.messengerLogo .messengerBubble { fill: #fff; opacity: .98; stroke: none; }
.messengerLogo .messengerBolt { fill: #1267ff; stroke: none; }
.instagramMark {
  background:
    radial-gradient(circle at 30% 107%, #fdf497 0 16%, #fd5949 42%, #d6249f 68%, #285aeb 100%);
}
.instagramLogo rect,
.instagramLogo circle {
  fill: none;
  stroke: #fff;
  stroke-width: 2.35;
}
.instagramLogo circle:last-child { fill: #fff; stroke: none; }
.routeBadge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f7fbff;
}
.routeBadge.messenger { color: #0756ba; background: #eaf4ff; border-color: #9dc8ff; }
.routeBadge.instagram { color: #8a175f; background: #fff0f8; border-color: #ffc2e4; }
#messages {
  height: 52dvh;
  min-height: 320px;
  overflow-y: auto;
  background: linear-gradient(180deg, #eef7ff, #f7fbff);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.bubble {
  align-self: flex-start;
  max-width: min(74%, 620px);
  width: fit-content;
  padding: 9px 12px;
  background: var(--incoming);
  border: 1px solid #69d7bb;
  border-radius: 13px 13px 13px 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 18px rgba(5,150,105,.09);
}
.bubble.outbound {
  align-self: flex-end;
  background: var(--outgoing);
  border-color: #a8c4ff;
  border-radius: 13px 13px 4px 13px;
  box-shadow: 0 8px 18px rgba(37,99,235,.10);
}
.bubble.stacked { margin-top: -4px; }
.bubble p { margin: 0; font-size: 15px; }
.bubble small {
  display: block;
  text-align: right;
  font-size: 11px;
  font-weight: 750;
  margin-top: 4px;
  color: var(--muted);
}
.bubble img, .bubble video { max-width: 100%; max-height: 250px; border-radius: 8px; }
.bubble audio { width: 260px; max-width: 100%; }
#composer { padding: 12px 16px 14px; background: var(--surface); }
.actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
#send { margin-left: auto; }
svg { height: 22px; width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: middle; }
.hint { font-size: 13px; margin: 8px 0 0; color: var(--muted); }
.empty { margin: auto; font-size: 15px; text-align: center; color: var(--muted); }
#status { color: var(--red); font-weight: 800; min-height: 24px; }
footer { padding: 16px; text-align: center; }
a { color: var(--blue-strong); margin: 0 12px; font-weight: 750; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }

}
@media (max-width: 700px) {
  header { padding: 12px; }
  header span { display: block; font-size: 13px; }
  main { padding: 12px; }
  .notice { align-items: flex-start; flex-direction: column; }
  nav { grid-template-columns: 1fr; }
  aside { padding: 16px; }
  .chatHeader { grid-template-columns: 1fr; }
  .routeBadge { width: fit-content; }
  .bubble { max-width: 90%; }
  .login { padding: 24px; }
  #messages { height: 42dvh; }
  h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
