:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbfc;
  --line: #dfe6ee;
  --line-strong: #c5d0db;
  --text: #17212b;
  --muted: #667383;
  --faint: #8a97a6;
  --teal: #087f7a;
  --teal-soft: #dff5f1;
  --amber: #b7791f;
  --amber-soft: #fff4d7;
  --red: #b42318;
  --red-soft: #ffe4e0;
  --blue: #2860b8;
  --shadow: 0 18px 48px rgba(27, 45, 70, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

[v-cloak] {
  display: none;
}

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

button,
a.secondary {
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(8, 127, 122, 0.18);
}

.secondary,
a.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.link-button {
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
}

.full {
  width: 100%;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.muted {
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(8, 127, 122, 0.08), transparent 38%),
    var(--bg);
}

.login-panel {
  width: 420px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-row.compact {
  margin: 0 0 28px;
}

.brand-row h1,
.brand-row p,
.brand-row strong,
.brand-row small {
  margin: 0;
  display: block;
}

.brand-row h1 {
  font-size: 24px;
  line-height: 1.15;
}

.brand-row p,
.brand-row small {
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #0d3f3d;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.12);
}

.error-line {
  margin: 12px 0 0;
  color: var(--red);
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav button {
  height: 42px;
  justify-content: flex-start;
  gap: 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.sidebar nav button.active {
  color: var(--text);
  background: var(--teal-soft);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--teal);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.logout {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 24px;
}

.content {
  padding: 24px;
}

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

.topbar h2,
.topbar p {
  margin: 0;
}

.topbar h2 {
  font-size: 26px;
  line-height: 1.2;
}

.topbar p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  width: 320px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.kpi-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.kpi-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi-panel {
  padding: 16px;
  min-height: 112px;
}

.kpi-panel span,
.kpi-panel small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi-panel strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 30px;
  line-height: 1;
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

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

.panel-head.stacked {
  align-items: flex-start;
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.trend {
  height: 210px;
  display: flex;
  align-items: end;
  gap: 7px;
  padding: 18px 4px 4px;
  border-top: 1px solid var(--line);
}

.trend-bar {
  flex: 1;
  min-width: 8px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #20a39e, #087f7a);
}

.metric-list {
  display: grid;
  gap: 13px;
}

.metric-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.metric-row div {
  height: 8px;
  border-radius: 999px;
  background: var(--teal-soft);
  overflow: hidden;
}

.metric-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.metric-row.platform div {
  background: #e8eef8;
}

.metric-row.platform i {
  background: var(--blue);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 600;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover,
.data-table tbody tr.selected {
  background: #eefaf8;
}

.data-table td span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.empty-cell,
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-list article {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 3px 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.event-list strong {
  font-size: 13px;
}

.event-list span,
.event-list small {
  color: var(--muted);
  font-size: 12px;
}

.event-list small {
  grid-column: 1 / -1;
}

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

.main-table {
  min-width: 0;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filters select {
  width: 150px;
  height: 36px;
}

.detail-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-soft);
}

.status-pill.medium,
.status-pill.risk {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.high {
  color: var(--red);
  background: var(--red-soft);
}

.detail-list {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 10px 12px;
  margin: 0;
  font-size: 13px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  word-break: break-all;
}

.products-grid,
.docs-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.product-row strong,
.product-row span,
.product-row small {
  display: block;
}

.product-row span {
  margin-top: 4px;
}

.product-row small {
  margin-top: 5px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 8px;
}

.manual-form {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 120px;
  gap: 10px;
}

.code-block {
  overflow: auto;
  max-height: 360px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #101820;
  color: #d9fbf5;
  line-height: 1.6;
  font-size: 12px;
}

.events-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

.events-head,
.events-row {
  display: grid;
  grid-template-columns: 170px 70px 100px 220px minmax(0, 1fr) minmax(160px, 0.6fr);
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.events-head {
  color: var(--muted);
  background: var(--panel-soft);
  font-weight: 600;
}

.events-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell,
  .page-grid,
  .two-column,
  .products-grid,
  .docs-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .top-actions,
  .manual-form {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .search {
    width: 100%;
  }
}

