:root {
  --bg: #eef2ef;
  --paper: #fffdf8;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel-muted: #f6f8f5;
  --ink: #16242d;
  --muted: #65717b;
  --soft: #87929b;
  --line: rgba(22, 36, 45, 0.12);
  --brand: #176b5b;
  --brand-dark: #0d4c41;
  --brand-soft: #e7f3ef;
  --accent: #b96e35;
  --accent-soft: #fff0e3;
  --assistant: #f6fbf8;
  --user: #183144;
  --danger: #a33b32;
  --shadow: 0 24px 60px rgba(20, 38, 48, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(23, 107, 91, 0.16), transparent 30%),
    radial-gradient(circle at 92% 18%, rgba(185, 110, 53, 0.13), transparent 28%),
    linear-gradient(135deg, #eef3ef 0%, #f8faf6 48%, #edf2f3 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(22, 36, 45, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 36, 45, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 86%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  padding: 2px 6px;
  border-radius: 7px;
  color: var(--brand-dark);
  background: rgba(23, 107, 91, 0.08);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.app-shell {
  width: min(1320px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
}

.sidebar,
.chat-panel,
.record-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  border-radius: var(--radius);
  padding: 24px;
  align-self: start;
  position: sticky;
  top: 26px;
}

.brand-card {
  position: relative;
  overflow: hidden;
  margin: -8px -8px 0;
  padding: 24px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(23, 107, 91, 0.12), rgba(255, 255, 255, 0.72)),
    var(--paper);
}

.brand-card::after {
  position: absolute;
  right: -56px;
  bottom: -76px;
  width: 180px;
  height: 180px;
  border: 30px solid rgba(23, 107, 91, 0.08);
  border-radius: 999px;
  content: "";
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(44px, 6vw, 60px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

.tagline {
  margin-bottom: 14px;
  color: var(--brand-dark);
  font-size: 17px;
  font-weight: 750;
}

.intro {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.78;
}

.metric-strip {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric-strip div {
  min-height: 74px;
  padding: 13px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
}

.metric-strip strong,
.metric-strip span {
  display: block;
}

.metric-strip strong {
  margin-bottom: 8px;
  color: var(--brand-dark);
  font-size: 16px;
}

.metric-strip span {
  color: var(--soft);
  font-size: 12px;
  line-height: 1.35;
}

.info-block {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.info-block h2 {
  font-size: 17px;
}

.info-block p,
.info-block li {
  color: var(--muted);
  line-height: 1.78;
  font-size: 14px;
}

.info-block ul {
  margin: 12px 0 0;
  padding-left: 19px;
}

.info-block li + li {
  margin-top: 8px;
}

.secure-block {
  padding: 18px;
  border: 1px solid rgba(23, 107, 91, 0.14);
  border-radius: 18px;
  background: rgba(231, 243, 239, 0.68);
}

.secure-block p {
  margin: 10px 0 0;
}

.chat-panel {
  min-height: calc(100vh - 52px);
  border-radius: var(--radius);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.record-panel {
  grid-column: 2 / 3;
  min-height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
}

.record-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 248, 0.9));
}

.record-header h2 {
  font-size: clamp(23px, 3vw, 30px);
}

.record-body {
  min-height: 246px;
  padding: 20px 26px 24px;
  background: rgba(255, 255, 255, 0.48);
}

.record-toolbar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.record-source {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.record-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.record-search,
.record-model-select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.record-search {
  width: 194px;
}

.record-search:focus,
.record-model-select:focus {
  border-color: rgba(23, 107, 91, 0.56);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.1);
}

.record-table-scroll {
  max-height: 620px;
  overflow: auto;
  border: 1px solid rgba(23, 107, 91, 0.16);
  border-radius: 12px;
  background: #ffffff;
}

.record-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.5;
}

.record-table th,
.record-table td {
  min-width: 132px;
  max-width: 210px;
  padding: 10px 12px;
  border-right: 1px solid rgba(22, 36, 45, 0.09);
  border-bottom: 1px solid rgba(22, 36, 45, 0.1);
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
}

.record-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 86px;
  color: var(--brand-dark);
  background: #e7f3ef;
  font-weight: 800;
  white-space: nowrap;
}

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

.record-table th:last-child,
.record-table td:last-child {
  border-right: 0;
}

.record-table .record-model-column,
.record-table .record-aircraft-column {
  position: sticky;
  z-index: 1;
  background: #fbfdfc;
  font-weight: 700;
}

.record-table .record-model-column {
  left: 0;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
}

.record-table .record-aircraft-column {
  left: 112px;
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  box-shadow: 2px 0 0 rgba(22, 36, 45, 0.06);
}

.record-table th.record-model-column,
.record-table th.record-aircraft-column {
  z-index: 3;
  background: #d9ebe4;
}

.record-empty {
  margin: 0;
  padding: 28px;
  border: 1px dashed rgba(23, 107, 91, 0.28);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  grid-column: 1 / -1;
  padding: 2px 0 12px;
  text-align: center;
  color: var(--soft);
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease;
}

.site-footer a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.chat-header {
  padding: 24px 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 248, 0.9));
}

.chat-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.chat-header h2 {
  font-size: clamp(23px, 3vw, 32px);
}

.chat-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.icon-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--brand);
  background: var(--panel-solid);
  box-shadow: 0 10px 24px rgba(20, 38, 48, 0.06);
  transition: 0.18s ease;
}

.icon-button:hover {
  color: #ffffff;
  background: var(--brand);
  transform: translateY(-1px);
}

.quick-prompts-wrap {
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 249, 0.82);
}

.quick-prompts-head {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-prompts-head p {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
}

.quick-prompts-head span {
  color: var(--soft);
  font-size: 12px;
}

.quick-prompts {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-prompts button {
  flex: 0 0 auto;
  max-width: 370px;
  border: 1px solid rgba(23, 107, 91, 0.18);
  border-radius: 15px;
  padding: 11px 13px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  text-align: left;
  line-height: 1.55;
  font-size: 13px;
  transition: 0.18s ease;
}

.quick-prompts button:hover {
  border-color: rgba(23, 107, 91, 0.34);
  background: #eff9f5;
  transform: translateY(-1px);
}

.messages {
  padding: 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(247, 249, 248, 0.86)),
    radial-gradient(circle at 78% 18%, rgba(23, 107, 91, 0.08), transparent 24%);
}

.message {
  width: min(820px, 92%);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.message-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message-bubble {
  padding: 14px 16px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.78;
  box-shadow: 0 12px 28px rgba(20, 38, 48, 0.07);
}

.message.user .message-bubble {
  border-top-right-radius: 6px;
  color: #ffffff;
  background: linear-gradient(145deg, #1d3b51, var(--user));
}

.message.assistant .message-bubble {
  border: 1px solid rgba(23, 107, 91, 0.14);
  border-top-left-radius: 6px;
  background: var(--assistant);
  white-space: normal;
}

.message-bubble p {
  margin: 0;
}

.message-bubble p + p,
.message-bubble p + ul,
.message-bubble p + ol,
.message-bubble p + .table-scroll,
.message-bubble ul + p,
.message-bubble ol + p,
.message-bubble .table-scroll + p {
  margin-top: 12px;
}

.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
  margin: 18px 0 8px;
  color: var(--brand-dark);
  line-height: 1.45;
}

.message-bubble h3:first-child,
.message-bubble h4:first-child,
.message-bubble h5:first-child,
.message-bubble h6:first-child {
  margin-top: 0;
}

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

.message-bubble li + li {
  margin-top: 6px;
}

.message-bubble strong {
  color: var(--brand-dark);
  font-weight: 800;
}

.table-scroll {
  width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid rgba(23, 107, 91, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.message-bubble table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.message-bubble th,
.message-bubble td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(22, 36, 45, 0.1);
  border-right: 1px solid rgba(22, 36, 45, 0.08);
  text-align: left;
  vertical-align: top;
}

.message-bubble th:last-child,
.message-bubble td:last-child {
  border-right: 0;
}

.message-bubble tr:last-child td {
  border-bottom: 0;
}

.message-bubble th {
  color: var(--brand-dark);
  background: rgba(231, 243, 239, 0.92);
  font-weight: 800;
  white-space: nowrap;
}

.composer {
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

textarea {
  width: 100%;
  min-height: 96px;
  max-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 16px;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.7;
  outline: none;
  transition: 0.18s ease;
}

textarea::placeholder {
  color: #99a2a9;
}

textarea:focus {
  border-color: rgba(23, 107, 91, 0.56);
  box-shadow: 0 0 0 4px rgba(23, 107, 91, 0.1);
}

.composer-footer {
  min-height: 46px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.send-button {
  min-width: 118px;
  border: 0;
  border-radius: 15px;
  padding: 12px 20px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(23, 107, 91, 0.22);
  transition: 0.18s ease;
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(23, 107, 91, 0.27);
}

.send-button:disabled,
.icon-button:disabled,
.quick-prompts button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .record-panel {
    grid-column: 1 / -1;
  }

  .chat-panel {
    min-height: 76vh;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 16px, 1320px);
    padding: 8px 0;
    gap: 10px;
  }

  .sidebar,
  .chat-header,
  .record-header,
  .record-body,
  .messages,
  .composer {
    padding: 16px;
  }

  .record-toolbar,
  .record-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .record-controls,
  .record-search,
  .record-model-select {
    width: 100%;
  }

  .record-table-scroll {
    max-height: 520px;
  }

  .brand-card {
    margin: -2px -2px 0;
    padding: 20px;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .chat-header {
    align-items: flex-start;
  }

  .quick-prompts-wrap {
    padding: 14px;
  }

  .quick-prompts-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .quick-prompts button {
    max-width: 292px;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .send-button {
    width: 100%;
  }
}
