* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f7f9;
  color: #1f2933;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.layout {
  min-height: 100vh;
  display: flex;
}

.left-nav {
  width: 240px;
  flex: 0 0 240px;
  min-height: 100vh;
  overflow-y: auto;
  background: #101828;
  color: #e5e7eb;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.left-nav__brand {
  color: #f9fafb;
  font-size: 14px;
  letter-spacing: .3px;
  margin-bottom: 4px;
  padding: 0 10px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.2);
}

.left-nav a {
  display: block;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
  color: #cbd5e1;
  border-radius: 8px;
  white-space: nowrap;
}

.left-nav a:hover {
  color: #f8fafc;
  background: rgba(241, 245, 249, 0.08);
}

.left-nav a.active {
  color: #111827;
  background: #e2e8f0;
  font-weight: 700;
}

.content {
  flex: 1;
  max-width: none;
  margin: 0;
  padding: 18px 22px;
}

.inline-link {
  color: #1d4ed8;
}

.button-like {
  display: inline-block;
  background: #0f766e;
  color: #ffffff;
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 12px;
}

.cta {
  margin-top: 12px;
}

.legacy-image-center {
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
  padding: 18px;
}

.legacy-image-center h1 {
  margin-top: 0;
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

.toolbar {
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

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

.page-header h1 {
  margin: 0 0 6px;
}

.page-header p {
  margin: 0;
}

.toolbar form:not(.logout-form) {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 2fr) minmax(140px, 1fr) minmax(220px, 1.5fr) auto;
  gap: 10px;
  align-items: center;
}

.asset-dashboard {
  display: grid;
  gap: 14px;
}

.asset-dashboard__head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid #d7e3df;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, .10), transparent 46%),
    linear-gradient(90deg, #fbfdfb, #f2f6f3);
}

.asset-dashboard__head h1,
.panel-titlebar h2 {
  margin: 0;
  color: #12201d;
  letter-spacing: 0;
}

.asset-dashboard__head h1 {
  font-size: 26px;
  line-height: 1.15;
}

.dashboard-kicker {
  margin: 0 0 6px;
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ranking-panel,
.library-panel {
  overflow: hidden;
  border: 1px solid #dce1e7;
  border-radius: 8px;
  background: #ffffff;
}

.ranking-panel {
  border-color: #bcd5ce;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}

.panel-titlebar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid #e5ece9;
  background: #fbfdfc;
}

.panel-titlebar h2 {
  font-size: 18px;
}

.panel-titlebar--library {
  align-items: center;
  background: #ffffff;
}

.date-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: end;
}

.date-filter label {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.date-filter input {
  min-width: 150px;
  background: #ffffff;
}

.date-filter button {
  background: #0f766e;
  white-space: nowrap;
}

.ranking-summary {
  display: grid;
  grid-template-columns: 1.5fr repeat(2, minmax(120px, .5fr));
  gap: 1px;
  border-bottom: 1px solid #e5ece9;
  background: #e5ece9;
}

.ranking-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 16px;
  background: #f8fbf9;
}

.ranking-summary span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.ranking-summary strong {
  color: #12201d;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.ranking-card {
  display: grid;
  grid-template-columns: 40px minmax(160px, 1fr) minmax(82px, auto) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 12px 14px;
  color: #344054;
  text-decoration: none;
  border: 1px solid #e3ebe7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.ranking-card:hover {
  border-color: #9cc8bc;
  background: #f5fbf8;
  transform: translateY(-1px);
}

.ranking-card__main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ranking-card__main strong {
  font-size: 15px;
  min-width: 0;
  color: #101828;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-card__main small,
.ranking-card__metrics small {
  color: #667085;
  font-size: 12px;
}

.ranking-card__metrics {
  display: grid;
  justify-items: end;
  min-width: 68px;
}

.ranking-card__metrics b {
  color: #0f766e;
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ranking-chip {
  min-width: 64px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #eef6f3;
  color: #35635b;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.rank-number {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f4ef;
  color: #0f766e;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric {
  font-variant-numeric: tabular-nums;
}

.metric--total {
  color: #0f766e;
  font-weight: 800;
}

.ranking-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 12px 12px;
  border-top: 1px solid #e5ece9;
  background: #fbfcfb;
  color: #667085;
  font-size: 13px;
}

.ranking-pager a {
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid #c9d8d3;
  border-radius: 8px;
  color: #0f766e;
  background: #ffffff;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.ranking-pager a.disabled {
  color: #98a2b3;
  pointer-events: none;
  background: #f2f4f7;
}

.ranking-empty,
.library-empty {
  padding: 22px 18px;
}

.upload-strip {
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: #f8fafc;
}

.asset-grid {
  padding: 16px;
}

.owner-dialog {
  position: fixed;
  inset: 0;
  width: min(1120px, calc(100vw - 42px));
  max-height: min(820px, calc(100vh - 42px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.owner-dialog::backdrop {
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(5px);
}

.owner-dialog__panel {
  overflow: hidden;
  border: 1px solid #dce1e7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}

.owner-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5ece9;
  background: #f8fbf9;
}

.owner-dialog__head h2 {
  margin: 0;
  color: #12201d;
  font-size: 20px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #344054;
  background: #ffffff;
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
}

.dialog-grid {
  max-height: calc(100vh - 176px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  overflow: auto;
  padding: 14px;
  background: #f6f7f9;
}

.asset-card--compact span {
  font-size: 13px;
  line-height: 1.25;
}

.asset-card--compact small {
  font-size: 11px;
}

.asset-card span {
  font-weight: 700;
  line-height: 1.25;
}

input,
button {
  height: 38px;
  border-radius: 6px;
  font: inherit;
}

input {
  border: 1px solid #c8d0d9;
  padding: 0 10px;
  background: #ffffff;
}

input[type="file"] {
  padding: 7px 10px;
}

button {
  border: 0;
  padding: 0 16px;
  color: #ffffff;
  background: #0f766e;
  cursor: pointer;
}

.logout-form {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.logout-form button {
  background: #475467;
}

.login-panel {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.login-form {
  width: min(100%, 360px);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
}

.login-form h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form span {
  color: #475467;
  font-size: 14px;
}

.login-form button {
  width: 100%;
}

.error {
  margin: 0;
  color: #b42318;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.asset-card {
  display: block;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
}

.asset-card img,
.asset-card video,
.empty-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e9edf2;
}

.asset-card span,
.asset-card small {
  display: block;
  padding: 10px 12px 0;
}

.asset-card small {
  padding-top: 4px;
  padding-bottom: 12px;
  color: #667085;
}

.detail {
  display: grid;
  grid-template-columns: minmax(280px, 520px) 1fr;
  gap: 24px;
  align-items: start;
}

.preview img,
.preview video {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #dce1e7;
  background: #ffffff;
}

.preview video {
  width: 100%;
}

.asset-detail-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.detail-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
}

.detail-card h1,
.detail-card h2,
.detail-card h3 {
  margin: 0;
}

.detail-card h1 {
  font-size: 22px;
  line-height: 1.3;
}

.detail-card h2 {
  font-size: 16px;
}

.detail-card h3 {
  font-size: 14px;
}

.detail-card--summary {
  border-color: #b9d9d3;
  background: #f8fffd;
}

.detail-eyebrow {
  margin: 0;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px 14px;
  margin: 0;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
}

dt {
  color: #667085;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-kv {
  padding: 0;
  border: 0;
  background: transparent;
}

.hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.prompt-section {
  gap: 14px;
}

.prompt-details {
  display: grid;
  gap: 8px;
}

.prompt-details summary {
  cursor: pointer;
  color: #334155;
  font-weight: 700;
}

.prompt-block {
  overflow: hidden;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fbfcfd;
}

.prompt-block--primary {
  border-color: #add5cd;
  background: #f6fffc;
}

.prompt-block--technical {
  background: #f8fafc;
}

.prompt-block__meta {
  padding: 8px 12px;
  border-bottom: 1px solid #e4e7ec;
  color: #667085;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.prompt-block pre,
.technical-details pre {
  max-height: 420px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #182230;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.technical-details {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
}

.technical-details summary {
  cursor: pointer;
  color: #334155;
  font-weight: 700;
}

.technical-details h3 {
  margin: 8px 0 0;
  font-size: 14px;
}

.technical-details pre {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #f8fafc;
}

.external-url-tool {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #dce1e7;
  border-radius: 8px;
}

.external-url-tool h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.external-url-tool p {
  margin: 0;
}

.external-url-tool input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.muted {
  color: #667085;
}

.status-shell {
  display: grid;
  gap: 16px;
}

.server-trend-panel {
  overflow: hidden;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06);
}

.server-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
}

.server-trend-title {
  font-size: 15px;
  font-weight: 700;
}

.chart-legend {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.legend-dot.cpu { background: #f97316; }
.legend-dot.memory { background: #0f766e; }

.trend-chart {
  position: relative;
  min-height: 260px;
  padding: 16px 18px 10px;
}

.trend-svg {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
}

.chart-grid {
  stroke: #f3f4f6;
  stroke-width: 1;
}

.chart-axis-line {
  stroke: #cbd5e1;
  stroke-width: 1;
}

.chart-y-label {
  fill: #667085;
  font-size: 12px;
  text-anchor: end;
  font-variant-numeric: tabular-nums;
}

.cpu-line,
.memory-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.cpu-line { stroke: #f97316; }
.memory-line { stroke: #0f766e; }

.chart-marker {
  fill: #0f766e;
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chart-hit {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  min-width: 150px;
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06);
  color: #101828;
  font-size: 12px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #667085;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: #667085;
}

.trend-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid #f3f4f6;
  background: #f3f4f6;
}

.trend-summary > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 12px 16px;
  background: #fff;
}

.trend-summary .label {
  margin-top: 0;
}

.trend-summary strong {
  font-size: 18px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 820px) {
  .toolbar form:not(.logout-form),
  .detail {
    grid-template-columns: 1fr;
  }

  .asset-dashboard__head,
  .page-header,
  .server-trend-head,
  .panel-titlebar,
  .date-filter {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .asset-dashboard__head h1 {
    font-size: 24px;
  }

  .date-filter {
    width: 100%;
  }

  .date-filter input,
  .date-filter button {
    width: 100%;
  }

  .ranking-summary {
    grid-template-columns: 1fr;
  }

  .ranking-card {
    grid-template-columns: 38px 1fr minmax(58px, auto);
    gap: 8px;
    padding: 10px;
  }

  .ranking-chip {
    grid-column: 2 / span 2;
    width: fit-content;
  }

  .ranking-pager {
    justify-content: space-between;
  }

  .owner-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .owner-dialog__head {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .dialog-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    padding: 12px;
  }

  .chart-legend {
    justify-content: flex-start;
  }

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

  main {
    padding: 16px;
  }
}
