:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #eef3f9;
  --text: #102033;
  --muted: #5f6f85;
  --primary: #1e3a5f;
  --primary-2: #2c5282;
  --line: #d7e0eb;
  --success: #1f8b4c;
  --warning: #b9770e;
  --danger: #b42318;
  --info: #2563eb;
  --shadow: 0 12px 32px rgba(16, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #eff4fb 0%, #f7faff 100%);
}

body {
  min-height: 100vh;
}

button, input, select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr;
}

.topbar {
  height: 64px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.16);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  border: 1px solid rgba(255,255,255,0.22);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 13px;
  max-width: 100%;
  word-break: break-word;
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: calc(100vh - 64px);
}

.sidebar {
  background: rgba(255,255,255,0.96);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
}

.sidebar h2 {
  font-size: 14px;
  margin: 0 12px 14px;
  color: var(--muted);
  font-weight: 600;
}

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: 0.15s ease;
  text-align: left;
}

.nav-item:hover {
  background: #f3f7fc;
}

.nav-item.active {
  background: #e8f0fb;
  border-color: #c6d8ee;
  color: var(--primary);
  font-weight: 700;
}

.content {
  padding: 20px;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 12px;
  margin-top: 3px;
  opacity: 0.84;
}

.identity-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--primary);
  font-weight: 700;
}

.identity-strip span {
  color: var(--muted);
  font-weight: 500;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

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

.page-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn.ghost {
  background: #fff;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid.two {
  grid-template-columns: 1.25fr 0.95fr;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 16px;
}

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

.kpi-card {
  padding: 16px;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
}

.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.section {
  margin-top: 16px;
}

.project-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  padding: 16px;
}

.project-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.project-meta,
.small-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.succeeded { background: #e6f7ec; color: var(--success); }
.status.ready { background: #e8f6fb; color: #0f7490; }
.status.uploaded { background: #e9f1ff; color: var(--info); }
.status.failed { background: #fde8e8; color: var(--danger); }

.mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mini-chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #f8fbff;
  position: sticky;
  top: 0;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.blue { background: #e8f0fb; color: var(--info); }
.badge.green { background: #e6f7ec; color: var(--success); }
.badge.yellow { background: #fff4d6; color: var(--warning); }
.badge.red { background: #fde8e8; color: var(--danger); }

.chart-box {
  min-height: 250px;
  border: 1px dashed #cbd7e5;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #f4f8fd);
  padding: 16px;
}

.bar {
  height: 12px;
  border-radius: 999px;
  background: #e7eef7;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2c5282, #4f7bbb);
}

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

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.loading-card {
  max-width: 420px;
  margin: 12vh auto;
  background: rgba(255,255,255,0.92);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.loading-title {
  font-size: 20px;
  font-weight: 700;
}

.loading-text {
  margin-top: 8px;
  color: var(--muted);
}

.app-loading {
  min-height: 100vh;
}

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

.toolbar .left,
.toolbar .right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

input, select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  min-width: 180px;
}

.two-col-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
}

.info-row:last-child {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .grid.kpi,
  .grid.two,
  .grid.three,
  .project-list,
  .two-col-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar {
    height: auto;
    padding: 12px 16px;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
  }

  .brand {
    width: 100%;
  }

  .brand-title {
    white-space: normal;
  }

  .content {
    padding: 14px;
  }

  .page-head {
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  input, select {
    min-width: 0;
    width: 100%;
  }
}
