/* ==========================================================================
   LimAPI Ops Assistant — light zinc theme
   Reference: limapi.com (ink #111 / hairline #e5e7eb / surface #f8f9fa)
   ========================================================================== */

:root {
  --ink: #111111;
  --body: #374151;
  --muted: #6b7280;
  --muted-soft: #898989;
  --hairline: #e5e7eb;
  --hairline-soft: #f3f4f6;
  --canvas: #ffffff;
  --surface-soft: #f8f9fa;
  --surface-card: #f5f5f5;
  --surface-dark: #101010;
  --surface-dark-elevated: #1a1a1a;
  --brand-navy: #0c2d55;
  --success: #0f9f6e;
  --warning: #d97706;
  --error: #dc2626;
  --radius: 12px;
  --shadow-card: 0 24px 80px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04);
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  --font-serif: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

::selection {
  background: #111111;
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 6% -8%, rgba(12, 45, 85, 0.08), transparent 62%),
    radial-gradient(900px 520px at 98% 0%, rgba(15, 159, 110, 0.06), transparent 58%),
    var(--surface-soft);
}

.login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image: radial-gradient(rgba(17, 17, 17, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 56px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  align-items: center;
  gap: 72px;
}

.login-intro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.intro-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.16);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  min-width: 0;
}

.brand-text strong {
  display: block;
  overflow: hidden;
  color: var(--brand-navy);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
}

.intro-copy .eyebrow {
  margin-bottom: 18px;
}

.intro-copy h1 {
  margin: 0 0 22px;
  font-size: clamp(44px, 5.2vw, 66px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.intro-desc {
  max-width: 540px;
  margin: 0 0 28px;
  color: var(--body);
  font-size: 15.5px;
  line-height: 1.8;
}

.intro-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.intro-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--body);
  font-size: 13.5px;
}

.intro-points li span {
  flex: 0 0 26px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--canvas);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.intro-panel {
  width: min(100%, 560px);
  padding: 18px 20px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 250, 0.82));
  box-shadow: 0 18px 44px -30px rgba(12, 45, 85, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--brand-navy);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.live-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(15, 159, 110, 0.4);
  border-radius: 50%;
  animation: live-pulse 2.4s ease-out infinite;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 14px;
}

.panel-grid span,
.panel-grid strong {
  display: block;
}

.panel-grid span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10.5px;
}

.panel-grid strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intro-foot {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.intro-foot em {
  margin-left: 6px;
  color: var(--muted-soft);
  font-family: var(--font-serif);
  font-style: italic;
}

.login-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 40px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--canvas);
  box-shadow: var(--shadow-card);
}

.login-card-head .eyebrow {
  margin-bottom: 14px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.login-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--body);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input::placeholder {
  color: #9ca3af;
}

.field input:hover {
  border-color: #d1d5db;
}

.field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.06);
}

.form-error {
  min-height: 18px;
  margin: 2px 0 10px;
  color: var(--error);
  font-size: 12px;
  line-height: 1.5;
}

.btn-primary {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.btn-primary:hover {
  background: #242424;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary.loading .spinner {
  display: block;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
  color: var(--muted);
  font-size: 11px;
}

.login-foot svg {
  width: 13px;
  height: 13px;
}

.login-copyright {
  margin: 0;
  color: var(--muted-soft);
  font-size: 10.5px;
  text-align: right;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  margin: 0;
  color: var(--error);
  font-size: 12px;
  text-align: center;
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(12, 45, 85, 0.05), transparent 60%),
    var(--surface-soft);
}

.app-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: relative;
  z-index: 10;
  flex: 0 0 64px;
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(1200px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.app-header .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: none;
}

.app-header .brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-text h1 {
  margin: 0;
  overflow: hidden;
  color: var(--brand-navy);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
}

.header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-status {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--body);
  font-size: 11px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(15, 159, 110, 0.11);
}

.service-status.busy .dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.header-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 500;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.header-btn:hover {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.header-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.banner {
  flex: 0 0 auto;
  width: min(1080px, calc(100% - 32px));
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11.5px;
  line-height: 1.5;
}

/* ==========================================================================
   Chat surface
   ========================================================================== */

.chat-main {
  flex: 1 1 auto;
  min-height: 0;
  width: min(1080px, calc(100% - 32px));
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--canvas);
  box-shadow: var(--shadow-soft);
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px 36px 20px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  border: 3px solid var(--canvas);
  border-radius: 999px;
  background: #d1d5db;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Welcome */

.welcome {
  width: min(100%, 720px);
  margin: 4vh auto 0;
}

.welcome[hidden] {
  display: none !important;
}

.welcome-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 13px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(17, 17, 17, 0.18);
}

.welcome-mark svg {
  width: 24px;
  height: 24px;
}

.welcome .eyebrow {
  margin-bottom: 12px;
}

.welcome h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.08;
}

.welcome-desc {
  max-width: 620px;
  margin: 0 0 20px;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.8;
}

.capability-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 20px;
}

.capability-strip span {
  padding: 5px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--body);
  font-size: 11px;
  line-height: 1.5;
}

.welcome-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 620px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
}

.welcome-note svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: var(--ink);
}

.welcome-note p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.65;
}

.welcome-hint {
  margin: 0;
  color: var(--muted-soft);
  font-size: 11px;
}

/* Messages */

.msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 840px;
  margin-bottom: 20px;
  animation: msg-in 0.22s ease both;
}

.msg.user {
  justify-content: flex-end;
  margin-left: auto;
}

.msg.assistant {
  margin-right: auto;
}

.mini-avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
}

.mini-avatar svg {
  width: 14px;
  height: 14px;
}

.bubble {
  min-width: 0;
  max-width: min(100%, 720px);
  padding: 13px 16px;
  border: 1px solid var(--hairline-soft);
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: var(--surface-soft);
  color: var(--body);
  font-size: 13.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg.user .bubble {
  border-color: var(--ink);
  border-radius: 14px;
  border-bottom-right-radius: 5px;
  background: var(--ink);
  color: #ffffff;
  white-space: pre-wrap;
}

.bubble > *:first-child {
  margin-top: 0;
}

.bubble > *:last-child {
  margin-bottom: 0;
}

.bubble p {
  margin: 0 0 10px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.bubble h3 {
  font-size: 15px;
}

.bubble h4,
.bubble h5,
.bubble h6 {
  font-size: 14px;
}

.bubble ul,
.bubble ol {
  margin: 8px 0 10px;
  padding-left: 20px;
}

.bubble li {
  margin: 4px 0;
}

.bubble li::marker {
  color: var(--muted);
}

.bubble strong {
  color: var(--ink);
  font-weight: 600;
}

.bubble code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef0f3;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
}

.bubble pre.code-block {
  position: relative;
  margin: 12px 0;
  padding: 28px 14px 14px;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--surface-dark);
  color: #e5e7eb;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre;
}

.bubble pre.code-block[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 9px;
  left: 14px;
  color: #9ca3af;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bubble pre.code-block code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

.bubble blockquote {
  margin: 12px 0;
  padding: 9px 14px;
  border-left: 3px solid var(--hairline);
  background: #fafafa;
  color: var(--muted);
}

.bubble.blocked {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.bubble.blocked strong {
  color: #78350f;
}

.bubble.busy {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

.msg.error .bubble {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

/* Markdown tables */

.table-wrap {
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.table-wrap table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.55;
}

.table-wrap th,
.table-wrap td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline-soft);
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.table-wrap tbody tr:hover td {
  background: #fcfcfd;
}

/* Typing / streaming */

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.typing-label {
  margin-right: 3px;
}

.typing-bubble i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #9ca3af;
  animation: blink 1.2s infinite ease-in-out;
}

.typing-bubble i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-bubble i:nth-child(3) {
  animation-delay: 0.3s;
}

.typing-cancel {
  margin-left: 8px;
  padding: 3px 9px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--muted);
  font-size: 10px;
}

.typing-cancel:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.typing-cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  margin-left: 2px;
  border-radius: 1px;
  background: var(--ink);
  vertical-align: -2px;
  animation: caret 0.9s steps(2, start) infinite;
}

.bubble-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.retry-btn {
  padding: 4px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
}

.retry-btn:hover {
  border-color: var(--ink);
}

/* ==========================================================================
   Prompt bar + composer
   ========================================================================== */

.prompt-bar {
  flex: 0 0 auto;
  padding: 12px 24px 0;
  border-top: 1px solid var(--hairline-soft);
  background: var(--canvas);
}

.prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.prompt-row:last-child {
  margin-bottom: 0;
}

.prompt-label {
  flex: 0 0 auto;
  padding-top: 6px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prompt-list {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.prompt-chip {
  max-width: min(100%, 420px);
  padding: 6px 11px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--body);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.prompt-chip:hover {
  border-color: var(--ink);
  background: var(--surface-soft);
  color: var(--ink);
}

.prompt-chip.system {
  background: var(--surface-soft);
}

.composer {
  flex: 0 0 auto;
  padding: 12px 24px 8px;
  background: var(--canvas);
}

.composer-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--canvas);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.composer-input:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.05);
}

#input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 24px;
  max-height: 132px;
  padding: 7px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.6;
  resize: none;
}

#input::placeholder {
  color: #9ca3af;
}

.send-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #ffffff;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.send-btn:hover {
  background: #242424;
}

.send-btn:active {
  transform: translateY(1px);
}

.send-btn:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  width: 17px;
  height: 17px;
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 0;
  flex-wrap: wrap;
}

.readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.readonly-badge svg {
  width: 12px;
  height: 12px;
}

.readonly-badge em {
  padding-left: 5px;
  border-left: 1px solid #bbf7d0;
  color: #15803d;
  font-style: normal;
  font-weight: 500;
  opacity: 0.85;
}

.readonly-badge.off {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.safety-hint {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.safety-hint.off {
  color: var(--error);
}

.footnote {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 0 24px 14px;
  color: var(--muted-soft);
  font-size: 10px;
  line-height: 1.5;
}

.build {
  flex: 0 0 auto;
  color: #b3b8c0;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-dark);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes live-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes caret {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

.login-card.shake {
  animation: shake 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .login-shell {
    width: min(100% - 40px, 620px);
    min-height: auto;
    padding: 40px 0 52px;
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }

  .login-intro {
    gap: 30px;
  }

  .intro-copy h1 {
    font-size: clamp(40px, 8vw, 54px);
  }

  .intro-panel {
    width: 100%;
  }

  .login-panel {
    align-items: stretch;
  }

  .login-card {
    max-width: none;
  }

  .login-copyright {
    text-align: center;
  }
}

@media (max-width: 760px) {
  .app-header {
    flex-basis: 58px;
  }

  .header-inner {
    width: calc(100% - 24px);
    gap: 12px;
  }

  .app-header .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-text h1 {
    font-size: 13.5px;
  }

  .brand-text p {
    display: none;
  }

  .service-status {
    height: 30px;
    padding: 0 9px;
    font-size: 10px;
  }

  .header-btn {
    height: 30px;
    padding: 0 10px;
    font-size: 10.5px;
  }

  .chat-main {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .banner {
    width: calc(100% - 24px);
    margin-top: 8px;
  }

  .messages {
    padding: 22px 16px 12px;
  }

  .welcome {
    margin-top: 2vh;
  }

  .welcome-mark {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    margin-bottom: 18px;
  }

  .welcome h2 {
    font-size: 28px;
  }

  .welcome-desc {
    font-size: 13.5px;
  }

  .welcome-note {
    padding: 10px 12px;
  }

  .prompt-bar {
    padding: 10px 12px 0;
  }

  .prompt-row {
    gap: 8px;
  }

  .prompt-label {
    display: none;
  }

  .prompt-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .prompt-list::-webkit-scrollbar {
    display: none;
  }

  .prompt-chip {
    flex: 0 0 auto;
  }

  .composer {
    padding: 10px 12px 6px;
  }

  .composer-input {
    padding-left: 13px;
  }

  .composer-tools {
    gap: 8px;
  }

  .safety-hint {
    font-size: 10px;
  }

  .footnote {
    padding: 0 12px 10px;
    font-size: 9.5px;
  }

  .bubble {
    max-width: 100%;
    font-size: 13px;
  }

  .msg {
    max-width: 100%;
  }

  .mini-avatar {
    flex-basis: 26px;
    width: 26px;
    height: 26px;
  }

  .toast {
    bottom: 16px;
  }
}

@media (max-width: 480px) {
  .login-shell {
    width: calc(100% - 28px);
    padding: 26px 0 36px;
    gap: 22px;
  }

  .login-intro {
    gap: 20px;
  }

  .intro-copy .eyebrow {
    margin-bottom: 12px;
  }

  .intro-copy h1 {
    margin-bottom: 14px;
    font-size: 36px;
  }

  .intro-desc {
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.7;
  }

  /* 小屏优先露出登录表单：介绍卡与要点在小屏收起 */
  .intro-panel,
  .intro-points {
    display: none;
  }

  .login-card {
    padding: 22px;
    border-radius: 14px;
  }

  .login-card h2 {
    font-size: 24px;
  }

  .login-sub {
    margin-bottom: 20px;
  }

  .login-foot {
    margin-top: 14px;
    padding-top: 14px;
  }

  .intro-foot em {
    display: none;
  }

  .service-status {
    display: none;
  }

  .welcome h2 {
    font-size: 25px;
  }

  .capability-strip {
    gap: 5px;
  }

  .capability-strip span {
    padding: 4px 8px;
    font-size: 10.5px;
  }

  .footnote .build {
    display: none;
  }
}
