/* 试用申请后台 · 独立样式（不依赖构建产物） */
:root {
  --brand: #1a5c9e;
  --brand-dark: #0b2d4d;
  --brand-deep: #082340;
  --line: #e2e8f0;
  --muted: #64748b;
  --text: #0f172a;
  --bg: #f4f7fb;
  --danger: #dc2626;
  --ok: #0f766e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.btn-primary {
  background: var(--brand);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #14507f;
}

.btn-ghost {
  border-color: var(--line);
  background: #ffffff;
  color: #334155;
}

.btn-ghost:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.btn-ghost-light {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.btn-ghost-light:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.btn-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
}

.btn-block {
  width: 100%;
  min-height: 2.75rem;
  font-size: 0.9375rem;
}

/* 登录 */
.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 82% 12%, rgba(56, 189, 248, 0.16), transparent 42%),
    linear-gradient(150deg, var(--brand-deep), var(--brand-dark) 55%, #124571);
}

.login-card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem 1.75rem;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 30px 70px -30px rgba(2, 12, 27, 0.8);
}

.login-logo {
  height: 2.1rem;
  width: auto;
}

.login-card h1 {
  margin: 1.4rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.login-sub {
  margin: 0.4rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.login-card label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
}

.login-card input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  font: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 92, 158, 0.16);
}

.login-card .btn-block {
  margin-top: 1rem;
}

.field + .field {
  margin-top: 0.85rem;
}

.login-links {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.7;
  text-align: center;
}

.login-links a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-links span {
  margin: 0 0.4rem;
}

.form-error {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* 顶栏 */
.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(120deg, var(--brand-deep), var(--brand-dark));
  color: #ffffff;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topbar-brand img {
  height: 1.5rem;
  width: auto;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topbar-user {
  align-self: center;
  color: #cbd5e1;
  font-size: 0.75rem;
}

/* 内部入口 */
.portal {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.portal-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.portal-card--button {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.portal-card:hover {
  border-color: #b7cee6;
  box-shadow: 0 16px 38px -28px rgba(11, 45, 77, 0.55);
  transform: translateY(-1px);
}

.portal-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: #e8f2fc;
  color: var(--brand);
}

.portal-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.portal-icon--data {
  background: #e7f7f1;
  color: var(--ok);
}

.portal-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.portal-title {
  font-size: 0.9375rem;
  font-weight: 700;
}

.portal-desc {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.6;
}

.portal-arrow {
  margin-left: auto;
  color: var(--brand);
  font-weight: 700;
}

.panel {
  margin-top: 1.25rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.panel-head__left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

.dataset-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.dataset-tab {
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #ffffff;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.dataset-tab:hover {
  border-color: #b7cee6;
  color: var(--brand);
}

.dataset-tab.is-active {
  border-color: var(--brand);
  background: #e8f2fc;
  color: var(--brand);
}

/* 主体 */
.main {
  max-width: 82rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.stat-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #ffffff;
}

.stat-card--alert {
  border-color: #fde68a;
  background: #fffbeb;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.stat-value {
  margin: 0.3rem 0 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #ffffff;
}

.filters input[type="search"],
.filters select,
.filters input[type="date"] {
  min-height: 2.25rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #ffffff;
  font: inherit;
  color: var(--text);
  outline: none;
}

.filters input[type="search"] {
  flex: 1 1 15rem;
  min-width: 11rem;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 92, 158, 0.14);
}

.date-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
}

/* 表格 */
.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.data-table td {
  font-size: 0.8125rem;
  line-height: 1.55;
}

.data-table tbody tr:hover {
  background: #f8fbff;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table td.num {
  text-align: right;
}

.note-col {
  max-width: 14rem;
}

.cell-note {
  display: block;
  max-width: 14rem;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-muted {
  color: #94a3b8;
}

.cell-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-weight: 400;
  color: #64748b;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge--new {
  background: #fef3c7;
  color: #92400e;
}

.badge--contacted {
  background: #dbeafe;
  color: #1e40af;
}

.badge--trial {
  background: #e0f2fe;
  color: #075985;
}

.badge--won {
  background: #dcfce7;
  color: #166534;
}

.badge--invalid {
  background: #f1f5f9;
  color: #64748b;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.empty {
  margin: 0;
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-top: 1px solid #eef2f7;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 36, 0.55);
}

.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 34rem;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  border-radius: 0.9rem;
  background: #ffffff;
  box-shadow: 0 34px 80px -30px rgba(2, 12, 27, 0.75);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 1rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: #e2e8f0;
}

.modal-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.detail-grid__full {
  grid-column: 1 / -1;
}

.detail-grid dt {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
}

.detail-grid dd {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  word-break: break-word;
}

.field-row {
  margin-top: 0.8rem;
}

.field-row label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
}

.field-row select,
.field-row textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font: inherit;
  color: var(--text);
  outline: none;
  resize: vertical;
}

.field-row select:focus,
.field-row textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 92, 158, 0.14);
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.modal-foot__right {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* 提示 */
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 70;
  max-width: min(22rem, calc(100vw - 2.5rem));
  padding: 0.65rem 0.9rem;
  border-radius: 0.6rem;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  font-size: 0.8125rem;
  line-height: 1.6;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
}

@media (max-width: 720px) {
  .main {
    padding: 0.9rem 0.75rem 2rem;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .data-table {
    min-width: 46rem;
  }

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

  .modal-foot__right {
    width: 100%;
    justify-content: flex-end;
  }
}

@media print {
  .topbar-actions,
  .filters,
  .pager,
  .modal,
  .toast {
    display: none !important;
  }
}
