:root {
  --ink: #172329;
  --muted: #6e7f84;
  --line: #dce4e2;
  --paper: #f4f3ec;
  --panel: #fffefa;
  --teal: #0b6f68;
  --teal-dark: #075651;
  --coral: #e86647;
  --sg: #267b8b;
  --cn: #b64d36;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at 75% 5%, #dcece4 0, transparent 25rem), var(--paper); font-family: Georgia, "Noto Serif SC", "Songti SC", serif; }
button, textarea, input { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 285px minmax(0, 1fr); max-width: 1500px; margin: auto; background: color-mix(in srgb, var(--panel) 86%, transparent); box-shadow: 0 0 80px rgba(17, 42, 38, .08); }
.rail { padding: 30px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: #e7eee8; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: bold; letter-spacing: -.6px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; color: #fff; font: 700 13px/1 ui-monospace, monospace; background: var(--teal); border-radius: 10px 10px 2px 10px; }
.rail-label { margin: 50px 10px 12px; color: var(--muted); font: 700 10px/1.2 ui-monospace, monospace; letter-spacing: 1.3px; }
.channel-list { display: grid; gap: 7px; }
.channel { border: 0; background: transparent; padding: 12px 10px; display: flex; align-items: center; gap: 11px; text-align: left; border-radius: 12px; cursor: pointer; color: var(--ink); }
.channel:hover, .channel.active { background: rgba(255,255,255,.75); }
.channel b, .channel small { display: block; }
.channel b { font-size: 15px; }
.channel small { margin-top: 3px; color: var(--muted); font: 12px/1.2 ui-monospace, monospace; }
.avatar { display: inline-grid; flex: 0 0 auto; width: 40px; height: 40px; place-items: center; color: white; border-radius: 50% 50% 50% 8px; font: 700 12px/1 ui-monospace, monospace; }
.avatar-sg { background: var(--sg); }
.avatar-cn { background: var(--cn); }
.connection-card { margin-top: auto; padding: 14px; display: grid; gap: 9px; border: 1px solid #cbd9d4; border-radius: 12px; background: rgba(255,255,255,.55); font: 11px/1.2 ui-monospace, monospace; }
.connection-card div { display: flex; align-items: center; gap: 7px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #a8b2b0; }
.status-dot.online { background: #2fa568; box-shadow: 0 0 0 3px rgba(47,165,104,.12); }
.status-dot.offline { background: #d46b53; }
.rail-note { margin: 12px 5px 0; color: var(--muted); font: 11px/1.45 ui-monospace, monospace; }
.chat-panel { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.chat-header { padding: 20px 34px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgba(255,254,250,.76); backdrop-filter: blur(10px); }
.header-person { display: flex; align-items: center; gap: 12px; }
.header-person h1 { margin: 0; font-size: 19px; }
.header-person p { margin: 4px 0 0; color: var(--muted); font: 12px/1.2 ui-monospace, monospace; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.icon-button { border: 1px solid var(--line); width: 32px; height: 32px; background: var(--panel); border-radius: 8px; cursor: pointer; }
.secure-pill { padding: 5px 7px; color: var(--teal); border: 1px solid #a8d0c8; border-radius: 99px; font: 700 10px/1 ui-monospace, monospace; letter-spacing: 1px; }
.speak-toggle, .task-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 11px/1 ui-monospace, monospace; cursor: pointer; }
.speak-toggle input, .task-toggle input { display: none; }
.speak-toggle span, .task-toggle span { width: 24px; height: 14px; padding: 2px; background: #b9c5c2; border-radius: 20px; transition: .2s; }
.speak-toggle span::after, .task-toggle span::after { content: ""; display: block; width: 10px; height: 10px; background: white; border-radius: 50%; transition: .2s; }
.speak-toggle input:checked + span, .task-toggle input:checked + span { background: var(--teal); }
.speak-toggle input:checked + span::after, .task-toggle input:checked + span::after { transform: translateX(10px); }
.message-list { width: min(920px, 100%); margin: 0 auto; padding: 34px clamp(20px, 5vw, 60px); display: flex; flex-direction: column; gap: 22px; overflow: auto; }
.message { position: relative; max-width: min(700px, 88%); }
.message.mine { align-self: flex-end; }
.message:not(.mine) { align-self: flex-start; }
.message.error .bubble { border: 1px solid #e3a08e; background: #fff0eb; }
.message-meta { display: flex; gap: 9px; margin: 0 3px 6px; color: var(--muted); font: 11px/1 ui-monospace, monospace; }
.message.mine .message-meta { justify-content: flex-end; }
.delivery { color: var(--teal); }
.bubble { padding: 13px 16px; background: #edf2ef; border-radius: 3px 16px 16px 16px; white-space: pre-wrap; line-height: 1.55; box-shadow: 0 3px 15px rgba(22, 49, 44, .04); }
.mine .bubble { color: white; background: var(--teal); border-radius: 16px 3px 16px 16px; }
.message-actions { opacity: 0; display: flex; gap: 6px; margin-top: 6px; }
.message:hover .message-actions { opacity: 1; }
.message.mine .message-actions { justify-content: flex-end; }
.message-actions button { border: 0; padding: 3px 6px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.message-actions button:hover { color: var(--teal); }
.attachment-card { margin-top: 10px; padding: 8px; display: flex; gap: 9px; align-items: center; color: var(--ink); background: rgba(255,255,255,.78); border-radius: 9px; font: 12px/1.2 ui-monospace, monospace; }
.attachment-card img { width: 56px; height: 42px; object-fit: cover; border-radius: 5px; }
.attachment-card .file-mark { display: grid; width: 38px; height: 38px; place-items: center; color: var(--teal); background: #d9ece6; border-radius: 5px; font-size: 10px; }
.attachment-card small { color: var(--muted); display: block; margin-top: 3px; }
.task-card { margin-top: 12px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; color: var(--ink); background: rgba(255,255,255,.8); border: 1px solid #c8d8d3; border-radius: 9px; font: 11px/1.2 ui-monospace, monospace; }
.task-card small { grid-column: 1 / -1; color: var(--muted); }
.task-status { color: var(--coral); font-weight: 700; }
.task-status.ack { color: var(--teal); }
.composer { padding: 14px clamp(20px, 5vw, 60px) 42px; border-top: 1px solid var(--line); background: rgba(255,254,250,.9); }
.composer textarea { width: 100%; max-height: 160px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; line-height: 1.45; }
.composer-actions { display: flex; align-items: center; gap: 15px; padding-top: 11px; }
.attach-button { display: inline-flex; align-items: center; gap: 5px; color: var(--teal); cursor: pointer; font: 12px/1 ui-monospace, monospace; }
.attach-button span { font: 23px/1 sans-serif; }
.attach-button input { display: none; }
.hint { color: #94a2a2; font: 11px/1 ui-monospace, monospace; }
.send-button { margin-left: auto; padding: 10px 15px; color: white; border: 0; border-radius: 9px; background: var(--teal); cursor: pointer; font-weight: bold; }
.send-button:hover { background: var(--teal-dark); }
.send-button:disabled { opacity: .55; cursor: wait; }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.attachment-tray .attachment-card { margin: 0; border: 1px solid var(--line); }
.remove-file { margin-left: 3px; border: 0; color: var(--coral); background: transparent; cursor: pointer; }
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { min-height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-label, .rail-note, .connection-card { display: none; }
  .brand { display: none; }
  .channel-list { grid-template-columns: 1fr 1fr; }
  .chat-panel { min-height: calc(100vh - 88px); }
  .chat-header { padding: 14px 18px; }
  .hint, .speak-toggle { display: none; }
  .message-list { padding: 24px 18px; }
  .composer { padding: 12px 18px 40px; }
  .task-toggle { font-size: 0; }
}

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 24px 56px; }
.login-card { width: min(420px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 24px 24px 6px 24px; background: rgba(255,254,250,.92); box-shadow: 0 24px 80px rgba(17,42,38,.14); }
.login-kicker { margin: 24px 0 8px; color: var(--teal); font: 700 10px/1 ui-monospace, monospace; letter-spacing: 1.3px; }
.login-card h1 { margin: 0; font-size: 30px; }
.login-card > p:not(.login-kicker) { color: var(--muted); }
.login-card form { margin-top: 28px; display: grid; gap: 10px; }
.login-card label { color: var(--muted); font: 12px/1 ui-monospace, monospace; }
.login-card input { width: 100%; padding: 13px 14px; border: 1px solid #cbd9d4; border-radius: 10px; outline: none; background: white; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(11,111,104,.1); }
.login-card .send-button { margin: 8px 0 0; }
.login-error { min-height: 18px; margin: 0; color: var(--coral); font: 12px/1.4 ui-monospace, monospace; }
.site-filing { position: fixed; left: 50%; bottom: 7px; z-index: 20; transform: translateX(-50%); padding: 5px 11px; border-radius: 999px; background: rgba(255,254,250,.88); backdrop-filter: blur(6px); white-space: nowrap; font: 11px/1.2 ui-monospace, monospace; }
.site-filing a { color: var(--muted); text-decoration: none; }
.site-filing a:hover, .site-filing a:focus-visible { color: var(--teal); text-decoration: underline; }
