:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --line: #e3ebf6;
  --text: #102033;
  --muted: #6c7d92;
  --primary: #2f6bff;
  --primary-dark: #1f58df;
  --primary-soft: #edf4ff;
  --cyan: #18badf;
  --green: #16a36a;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(31, 65, 120, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef5ff 0, #f6f8fc 240px), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

p,
h1,
h2,
h3,
h4 {
  margin: 0;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  color: #ffffff;
  background: linear-gradient(160deg, #153f91 0%, #177ddb 48%, #31c7e8 100%);
}

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

.brand-avatar {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(9, 45, 106, 0.2);
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(18, 78, 173, 0.18);
}

.compliance-card {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.compliance-card strong {
  color: #ffffff;
  font-size: 14px;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 8px;
}

.legal-links a,
.page-footer a {
  color: inherit;
  font-size: 12px;
  text-decoration: none;
}

.legal-links a:hover,
.page-footer a:hover {
  text-decoration: underline;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.25;
}

.subtitle {
  margin-top: 8px;
  max-width: 760px;
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-panel span {
  min-width: 116px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--primary);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.status-strip span {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(31, 65, 120, 0.05);
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 12px rgba(31, 65, 120, 0.06);
  padding: 22px;
}

.login-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.inline-form,
.support-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 96px;
  gap: 10px;
}

input {
  height: 46px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.12);
}

.primary,
.ghost,
.inline-form button,
.support-form button,
.plan-card button,
.export-row button {
  height: 46px;
  border-radius: 14px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 900;
}

.primary,
.inline-form button,
.support-form button,
.plan-card button {
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #ffffff;
}

.ghost,
.export-row button {
  background: #ffffff;
  color: var(--primary);
  border-color: #d7e4ff;
}

.full {
  width: 100%;
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.badge {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.segment {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  border-color: #c8dcff;
  background: var(--primary-soft);
  color: var(--primary);
}

.upload-box {
  min-height: 178px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  border: 1.5px dashed #afc7f6;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fbff, #ffffff);
  color: var(--muted);
  text-align: center;
}

.upload-box input {
  display: none;
}

.upload-box strong {
  color: var(--text);
  font-size: 17px;
}

.file-list,
.result-area,
.history-list,
.plans-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.file-item,
.history-item,
.result-card,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 13px 14px;
}

.file-item,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-item span,
.history-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item button {
  border: 0;
  background: transparent;
  color: var(--danger);
}

.result-card h4,
.plan-card h4 {
  margin-bottom: 10px;
}

.result-card dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.result-card dt {
  color: var(--muted);
}

.result-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  border: 1px dashed #c9d7ea;
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 34px;
  text-align: center;
}

.export-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.plans-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-card {
  display: grid;
  gap: 10px;
}

.plan-price strong {
  color: var(--primary);
  font-size: 28px;
}

.plan-price span,
.plan-quota {
  color: var(--muted);
}

.notice {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #d5e7ff;
  border-radius: 16px;
  background: #eef6ff;
}

.buy-guide {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #d5e7ff;
  border-radius: 16px;
  background: linear-gradient(135deg, #eef6ff, #f0fdff);
}

.buy-guide strong {
  color: var(--primary-dark);
}

.buy-guide span {
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.support-card {
  max-width: 920px;
}

.chat-log {
  height: 360px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f7faff;
}

.chat {
  width: fit-content;
  max-width: 78%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  line-height: 1.7;
}

.chat.user {
  margin-left: auto;
  background: #eaf2ff;
  color: var(--primary-dark);
}

.support-form {
  margin-top: 12px;
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-top: 22px;
  padding-top: 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  z-index: 40;
  padding: 13px 16px;
  border-radius: 14px;
  background: #11233b;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.hidden,
.view {
  display: none !important;
}

.view.active {
  display: block !important;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: auto;
    padding: 14px 16px;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 8px 18px rgba(26, 93, 216, 0.14);
  }

  .brand-avatar {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 30;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 26px rgba(31, 65, 120, 0.16);
  }

  .nav-item {
    height: 42px;
    padding: 0 6px;
    background: transparent;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
  }

  .nav-item.active {
    background: var(--primary-soft);
    box-shadow: none;
  }

  .compliance-card {
    display: none;
  }

  .main {
    padding: 20px 16px 92px;
  }

  .topbar,
  .login-card,
  .section-head {
    flex-direction: column;
  }

  .user-panel,
  .user-panel span,
  .inline-form,
  .support-form {
    width: 100%;
  }

  .status-strip,
  .grid.two,
  .plans-list {
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar h2 {
    font-size: 24px;
  }

  .export-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-card dl {
    grid-template-columns: 1fr;
  }
}
