:root {
  --bg: #07111a;
  --bg-deep: #050c12;
  --panel: #0d1b26;
  --panel-2: #112534;
  --line: rgba(153, 190, 204, 0.16);
  --text: #edf6f7;
  --muted: #8fa8b3;
  --teal: #51d6c6;
  --teal-soft: rgba(81, 214, 198, 0.12);
  --orange: #ffb46b;
  --danger: #ff8383;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 74% 4%, rgba(30, 154, 150, 0.16), transparent 32rem),
    radial-gradient(circle at 10% 90%, rgba(43, 88, 116, 0.2), transparent 38rem),
    var(--bg);
  overflow: hidden;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.is-hidden { display: none !important; }

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(430px, 0.8fr);
  min-height: 100vh;
  background: #07111a;
}

.login-visual {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px 56px 48px;
  background:
    linear-gradient(115deg, rgba(6, 24, 34, 0.96), rgba(9, 35, 45, 0.82)),
    radial-gradient(circle at 68% 40%, #226c70, transparent 25rem);
}

.login-visual::before,
.login-visual::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(93, 227, 212, 0.11);
  border-radius: 50%;
}
.login-visual::before { width: 620px; height: 620px; right: -240px; top: 13%; }
.login-visual::after { width: 860px; height: 860px; right: -360px; top: 1%; }
.login-grid {
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(117, 210, 213, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 210, 213, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom right, black, transparent 70%);
}

.login-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #c5e4e3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 13px;
  color: #05231f;
  background: linear-gradient(135deg, #83ebde, #39afbd);
  font-weight: 900;
  letter-spacing: -1px;
}
.brand-mark.large { width: 48px; height: 48px; flex-basis: 48px; font-size: 17px; }

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 580px;
  margin-top: auto;
  margin-bottom: 58px;
}
.eyebrow {
  margin: 0 0 12px;
  color: #87a5ac;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.login-copy h1 {
  margin: 0;
  font-size: clamp(38px, 4.5vw, 68px);
  font-weight: 620;
  line-height: 1.12;
  letter-spacing: -0.055em;
}
.login-copy > p:last-child {
  max-width: 490px;
  margin: 24px 0 0;
  color: #a5bdc4;
  font-size: 15px;
  line-height: 1.8;
}
.login-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 54px;
}
.login-stats b {
  display: block;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.login-stats span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 44px;
  border-left: 1px solid var(--line);
  background: rgba(8, 18, 26, 0.96);
}
.login-card {
  width: min(380px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(21, 45, 57, 0.82), rgba(9, 24, 34, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}
.login-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 24px;
  place-items: center;
  border: 1px solid rgba(81, 214, 198, 0.22);
  border-radius: 13px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 19px;
}
.login-card h2 { margin: 0; font-size: 25px; }
.login-subtitle { margin: 8px 0 28px; color: var(--muted); font-size: 12px; }
.login-card label,
.modal label {
  display: block;
  margin-top: 17px;
}
.login-card label span,
.modal label span {
  display: block;
  margin: 0 0 7px 2px;
  color: #9db3bb;
  font-size: 11px;
}
.login-card input,
.modal input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(5, 16, 24, 0.58);
}
.login-card input:focus,
.modal input:focus { border-color: rgba(81, 214, 198, 0.48); }
.primary-button {
  width: 100%;
  min-height: 44px;
  margin-top: 22px;
  border: 0;
  border-radius: 11px;
  color: #07251f;
  background: linear-gradient(135deg, #85eadb, #43bdb4);
  font-weight: 800;
}
.primary-button:disabled { opacity: 0.5; }
.form-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 11px;
}
.login-foot {
  margin: 22px 0 0;
  color: #5f7881;
  text-align: center;
  font-size: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100vh;
}
.sidebar {
  display: flex;
  overflow-y: auto;
  flex-direction: column;
  gap: 24px;
  padding: 28px 22px 20px;
  border-right: 1px solid var(--line);
  background: rgba(9, 24, 34, 0.86);
  backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 15px; }
.brand span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.coverage-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(24, 56, 68, 0.76), rgba(12, 31, 42, 0.72));
}
.coverage-card > strong { font-size: 14px; }
.coverage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.coverage-grid div { padding: 10px; border-radius: 11px; background: rgba(4, 18, 27, 0.42); }
.coverage-grid span { display: block; color: var(--muted); font-size: 11px; }
.coverage-grid b { display: block; margin-top: 4px; font-size: 17px; font-variant-numeric: tabular-nums; }
.status-line { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: #aac4c9; font-size: 11px; }
.status-line i, .live-pill i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 0 5px rgba(81, 214, 198, 0.1);
}
.examples { display: flex; flex-direction: column; gap: 8px; }
.examples .eyebrow { margin-bottom: 2px; }
.examples button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #c8dadd;
  background: rgba(19, 43, 56, 0.55);
  text-align: left;
  transition: 160ms ease;
}
.examples button i { color: #627f87; font-style: normal; }
.examples button:hover {
  border-color: rgba(81, 214, 198, 0.28);
  color: var(--text);
  background: rgba(25, 58, 70, 0.8);
  transform: translateX(2px);
}
.sidebar-foot {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.main-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  flex-direction: column;
}
.topbar {
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 38px 17px;
  border-bottom: 1px solid rgba(153, 190, 204, 0.09);
  background: rgba(7, 17, 26, 0.72);
  backdrop-filter: blur(18px);
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -0.025em; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.account { position: relative; display: flex; align-items: center; gap: 10px; }
.live-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 999px;
  color: #b8d3d3; background: rgba(13, 37, 48, 0.7); font-size: 10px; white-space: nowrap;
}
.account-button {
  display: flex; align-items: center; gap: 8px; padding: 5px 9px 5px 5px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); background: rgba(13, 37, 48, 0.7); font-size: 11px;
}
.account-button b { color: var(--muted); font-size: 10px; }
.user-avatar {
  display: grid; width: 27px; height: 27px; place-items: center;
  border-radius: 50%; color: #08261f;
  background: linear-gradient(135deg, #90ebdf, #43b9b3);
  font-size: 11px; font-weight: 900;
}
.account-menu {
  position: absolute; z-index: 10; top: 44px; right: 0; width: 190px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 14px;
  background: #0f202c; box-shadow: 0 20px 55px rgba(0, 0, 0, 0.38);
}
.account-summary { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.account-summary strong, .account-summary span { display: block; font-size: 11px; }
.account-summary span { margin-top: 3px; color: var(--muted); }
.account-menu a, .account-menu button {
  display: block; width: 100%; padding: 11px 14px; border: 0;
  color: #cadbdd; background: transparent; text-align: left;
  text-decoration: none; font-size: 11px;
}
.account-menu a:hover, .account-menu button:hover { background: rgba(81, 214, 198, 0.07); }
.account-menu .danger-text { color: #ff9b9b; }

.conversation {
  width: min(980px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: 28px 34px 180px;
  overflow-y: auto;
  scroll-behavior: smooth;
  flex: 1;
}
.message { display: flex; gap: 13px; margin-bottom: 24px; animation: message-in 220ms ease both; }
@keyframes message-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }
.avatar {
  display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center;
  border-radius: 11px; font-size: 11px; font-weight: 800;
}
.assistant-avatar { color: #11302e; background: linear-gradient(135deg, #8cebdd, #43b6b8); }
.user-avatar.message-avatar { color: #2d261d; background: linear-gradient(135deg, #ffd5a2, #eaa158); }
.message-body { width: min(780px, calc(100% - 48px)); }
.message.user .message-body { display: flex; flex-direction: column; align-items: flex-end; }
.message-meta { margin: 0 0 6px 3px; color: var(--muted); font-size: 10px; }
.bubble {
  padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 5px 17px 17px 17px;
  background: rgba(15, 34, 46, 0.92);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.13);
  line-height: 1.72; font-size: 14px;
}
.message.user .bubble {
  border-color: rgba(255, 180, 107, 0.22);
  border-radius: 17px 5px 17px 17px;
  background: rgba(69, 51, 37, 0.72);
}
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.query-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 9px; }
.query-chip {
  padding: 4px 8px; border: 1px solid rgba(81, 214, 198, 0.18);
  border-radius: 999px; color: #a8c4c6; background: rgba(81, 214, 198, 0.05); font-size: 10px;
}
.result-block {
  margin-top: 12px; overflow: hidden; border: 1px solid var(--line);
  border-radius: 15px; background: rgba(7, 20, 29, 0.9);
}
.result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
}
.result-head strong { font-size: 12px; }
.result-actions { display: flex; align-items: center; gap: 12px; }
.download-button { border: 0; color: var(--teal); background: transparent; font-size: 11px; }
.download-button:hover, .expand-button:hover { text-decoration: underline; }
.expand-button { border: 0; color: #a9c2c7; background: transparent; font-size: 11px; }
.table-wrap {
  max-height: 400px;
  overflow: auto;
  overscroll-behavior: auto;
  touch-action: pan-x pan-y;
  scrollbar-color: #55737c #0a1a23;
  scrollbar-width: thin;
}
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; white-space: nowrap; }
th, td { padding: 9px 11px; border-bottom: 1px solid rgba(153, 190, 204, 0.08); text-align: left; }
th { position: sticky; top: 0; z-index: 1; color: #91adb5; background: #102631; font-weight: 600; }
td { color: #d7e4e6; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(81, 214, 198, 0.035); }
th:first-child, td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #0c202b;
  box-shadow: 1px 0 rgba(153, 190, 204, 0.1);
}
th:first-child { z-index: 4; background: #102631; }
.empty-result { padding: 20px; color: var(--muted); text-align: center; }
.loading-bubble { display: flex; gap: 5px; width: max-content; }
.loading-bubble span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal);
  animation: bounce 1s infinite ease-in-out;
}
.loading-bubble span:nth-child(2) { animation-delay: 120ms; }
.loading-bubble span:nth-child(3) { animation-delay: 240ms; }
@keyframes bounce { 0%, 80%, 100% { opacity: 0.32; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.error .bubble { border-color: rgba(255, 117, 117, 0.28); color: #ffd0d0; }

.composer-wrap {
  position: fixed; right: 0; bottom: 0; left: 292px;
  padding: 28px 34px 18px;
  background: linear-gradient(transparent, rgba(7, 17, 26, 0.97) 38%);
  pointer-events: none;
}
.composer {
  display: flex; width: min(900px, 100%); margin: 0 auto; align-items: flex-end; gap: 10px;
  padding: 9px 9px 9px 13px;
  border: 1px solid rgba(81, 214, 198, 0.25); border-radius: 17px;
  background: rgba(13, 32, 43, 0.98); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.composer:focus-within {
  border-color: rgba(81, 214, 198, 0.48);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(81, 214, 198, 0.05);
}
.composer-prefix {
  display: grid; width: 29px; height: 29px; flex: 0 0 29px; margin-bottom: 4px;
  place-items: center; border-radius: 9px; color: #0d302d; background: #72ddd1;
  font-size: 9px; font-weight: 900;
}
.composer textarea {
  width: 100%; max-height: 140px; padding: 9px 0 7px; resize: none;
  border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.5;
}
.composer textarea::placeholder { color: #6e8993; }
.composer button {
  display: grid; width: 39px; height: 39px; place-items: center;
  border: 0; border-radius: 11px; color: #062822;
  background: linear-gradient(135deg, #83e9da, #46bfb4);
}
.composer button:disabled { opacity: 0.48; cursor: default; }
.composer button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.composer-note { width: min(900px, 100%); margin: 8px auto 0; color: #607b86; text-align: center; font-size: 10px; }

.modal {
  width: min(420px, calc(100% - 28px)); padding: 0;
  border: 1px solid var(--line); border-radius: 18px;
  color: var(--text); background: #0f202c; box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}
.modal::backdrop { background: rgba(1, 8, 12, 0.72); backdrop-filter: blur(5px); }
.modal form { padding: 24px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; }
.modal h2 { margin: 0; font-size: 20px; }
.icon-button { border: 0; color: var(--muted); background: transparent; font-size: 22px; }

.table-dialog {
  width: min(1450px, calc(100% - 42px));
  height: min(820px, calc(100vh - 70px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: #0a1922;
  box-shadow: 0 35px 120px rgba(0, 0, 0, 0.55);
}
.table-dialog::backdrop { background: rgba(1, 8, 12, 0.78); backdrop-filter: blur(6px); }
.table-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 19px 22px 15px;
  border-bottom: 1px solid var(--line);
}
.table-dialog-head h2 { margin: 0; font-size: 19px; }
.table-dialog-body { height: calc(100% - 79px); overflow: auto; }
.table-dialog-body table { min-width: 100%; }
.table-dialog-body .table-wrap { max-height: none; }

@media (hover: hover) {
  .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
  .table-wrap::-webkit-scrollbar-track { background: #0a1a23; }
  .table-wrap::-webkit-scrollbar-thumb { border: 2px solid #0a1a23; border-radius: 999px; background: #587780; }
}

@media (max-width: 900px) {
  .login-screen { display: block; overflow-y: auto; }
  .login-visual { min-height: 46vh; padding: 28px; }
  .login-copy { margin: 70px 0 35px; }
  .login-copy h1 { font-size: 39px; }
  .login-stats { gap: 28px; }
  .login-panel { padding: 26px 18px 42px; border-left: 0; }
  .login-card { padding: 27px; }
  body { overflow: auto; }
  .app-shell { display: block; height: auto; min-height: 100vh; }
  .sidebar { display: none; }
  .main-panel { min-height: 100vh; height: 100vh; }
  .topbar { padding: 15px 16px; }
  .topbar p, .live-pill { display: none; }
  .conversation { padding: 20px 14px 180px; }
  .composer-wrap { left: 0; padding: 28px 12px 12px; }
  .composer-note { font-size: 9px; }
}
