:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0; }

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

/* Sidebar */
.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, #3b82f6, #6d28d9);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; }
.brand-text small { color: var(--muted); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: #374151; font-size: 13.5px;
}
.nav-item:hover { background: #f3f4f6; text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: .85; }
.sidebar-foot {
  margin-top: auto; padding: 12px 10px 2px;
  color: var(--muted); font-size: 11.5px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 7px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px #d1fae5; }

/* Main */
.main { flex: 1; min-width: 0; padding: 26px 34px 70px; max-width: 1240px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar h1 { font-size: 22px; letter-spacing: -0.3px; }
.subtitle { color: var(--muted); margin-top: 4px; font-size: 13px; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: #1f2937;
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: #fecaca; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.link { font-size: 12.5px; color: var(--accent); }
.cell-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 15.5px; }
.muted { color: var(--muted); font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 24px; letter-spacing: -0.5px; }

/* App grid */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.section-head h2 { font-size: 16px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.app-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 12px;
}
.app-card-head { display: flex; align-items: center; gap: 12px; }
.app-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-card-title a { color: var(--text); font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card-title a:hover { color: var(--accent); text-decoration: none; }
.app-card-title .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.app-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid #f3f4f6; }
.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.app-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  color: #fff; font-weight: 700; font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-icon.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 26px; }

.version-chip {
  font-family: var(--mono); font-size: 11.5px;
  background: #f3f4f6; color: #374151;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.tag {
  font-size: 11.5px; color: #4b5563;
  background: #f9fafb; border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500;
  padding: 2px 9px; border-radius: 999px;
  background: #f3f4f6; color: #4b5563; white-space: nowrap;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--green-soft); color: var(--green); }
.badge.failed { background: var(--red-soft); color: var(--red); }
.badge.running { background: var(--accent-soft); color: var(--accent); }
.badge.running i { animation: pulse 1.1s infinite; }
.badge.queued { background: #f9fafb; color: #6b7280; }
.badge.plat.android { background: #ecfdf5; color: #047857; }
.badge.plat.ios { background: #eff6ff; color: #1d4ed8; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Empty */
.empty { text-align: center; padding: 58px 24px; }
.empty-art { font-size: 40px; color: #c7d2fe; margin-bottom: 8px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 18px; max-width: 520px; margin-left: auto; margin-right: auto; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: #374151; }
.field .req { color: var(--red); font-weight: 600; }
.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field input:not([type]),
.field select {
  height: 38px; padding: 0 11px;
  border: 1px solid #d1d5db; border-radius: 9px;
  font-family: inherit; font-size: 13.5px; color: var(--text);
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input[type="color"] {
  width: 100%; height: 38px; padding: 3px;
  border: 1px solid #d1d5db; border-radius: 9px; background: #fff;
}
.field input[type="file"] { font-size: 12.5px; color: var(--muted); }
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.field em, .check em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check em { display: block; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #f3f4f6; border-radius: 10px; margin-bottom: 16px;
}
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 6px 16px; border-radius: 8px; font-size: 13px; color: #4b5563; }
.segmented input:checked + span { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.hidden { display: none !important; }

.config-block { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.config-block h3 { font-size: 13.5px; margin-bottom: 12px; color: #374151; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.file-name { font-size: 11.5px; color: var(--accent); }

/* App detail */
.app-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.app-hero-main { display: flex; gap: 16px; align-items: center; }
.app-hero-main h2 { font-size: 20px; }
.app-hero-main .mono { margin: 2px 0 8px; }
.app-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.info-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: #fafbfc; border-radius: 9px; }
.info-item span { color: var(--muted); font-size: 11.5px; }
.info-item strong { font-weight: 500; font-size: 13px; word-break: break-all; }

/* Table */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 11.5px; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.cell-error { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.small { font-size: 11.5px; }

/* Notices */
.notice { border-radius: 12px; padding: 13px 16px; margin-bottom: 18px; font-size: 13px; border: 1px solid; }
.notice strong { display: block; margin-bottom: 2px; }
.notice.warn { background: var(--amber-soft); border-color: #fde68a; color: #92400e; }
.notice.ok { background: var(--green-soft); border-color: #a7f3d0; color: #065f46; }
.notice.info { background: #f8fafc; border-color: var(--line); color: #374151; margin-top: 0; }
.notice a { color: inherit; text-decoration: underline; }
.notice .muted { margin-left: 8px; }

/* Build */
.build-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.build-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 16px; font-weight: 600; }
.error-card { border-color: #fecaca; }
.error-text {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 12px 14px; margin: 0;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow: auto;
}
.log {
  background: #0b1220; color: #d1d5db;
  border-radius: 10px; padding: 14px 16px; margin: 0;
  font-family: var(--mono); font-size: 12px; line-height: 1.65;
  height: 440px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

/* Env */
.env-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.env-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.env-card.ok { border-left: 3px solid #10b981; }
.env-card.fail { border-left: 3px solid #ef4444; }
.env-head { display: flex; gap: 11px; align-items: flex-start; }
.env-icon {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
}
.env-card.ok .env-icon { background: #10b981; }
.env-card.fail .env-icon { background: #ef4444; }
.env-head h3 { font-size: 14px; }
.env-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.env-details { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.env-details li { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; border-top: 1px dashed #f1f5f9; padding-top: 6px; }
.env-details span { color: var(--muted); flex-shrink: 0; }
.env-details code { font-family: var(--mono); font-size: 11.5px; color: #334155; word-break: break-all; text-align: right; }
.env-fix { margin-top: 12px; background: #fafafa; border: 1px dashed var(--line); border-radius: 9px; padding: 10px 12px; font-size: 12px; }
.env-fix p { color: var(--muted); margin-bottom: 6px; }
.env-fix pre, code { font-family: var(--mono); }
.env-fix pre { background: #0b1220; color: #d1d5db; padding: 8px 10px; border-radius: 7px; margin: 6px 0; font-size: 11.5px; white-space: pre-wrap; overflow-x: auto; }
.env-fix code, .notice code, .card p code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }
.code-block { background: #0b1220; color: #d1d5db; padding: 12px 14px; border-radius: 9px; font-family: var(--mono); font-size: 12px; overflow-x: auto; }
.warn-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }

/* WebClip */
.badge.plat.webclip { background: #fefce8; color: #a16207; }
.qr-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.qr-wrap img { width: 188px; height: 188px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.steps { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 7px; font-size: 13px; color: #374151; }
.steps a { word-break: break-all; }

@media (max-width: 1000px) {
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .env-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: auto; flex: none; height: auto; position: static;
    padding: 12px 14px; border-right: none; border-bottom: 1px solid var(--line);
    flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap;
  }
  .brand { padding: 0; flex: 1; }
  .nav { flex-direction: row; margin: 0; }
  .nav-item { padding: 7px 10px; }
  .nav-ico { display: none; }
  .sidebar-foot { display: none; }
  .main { padding: 18px 16px 50px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .info-grid { grid-template-columns: 1fr; }
  .app-hero { align-items: flex-start; }
  .topbar h1 { font-size: 19px; }
  .log { height: 360px; }
}
