:root {
  --bg: #f5f7fb;
  --panel: #fff;
  --line: #d9e1ea;
  --text: #17202a;
  --muted: #667085;
  --primary: #1f6feb;
  --primary-dark: #195cc4;
  --green: #138a52;
  --orange: #b75e00;
  --red: #c83349;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  background: #192231;
  color: #fff;
  padding: 18px 14px;
  flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 20px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 6px;
  display: grid; place-items: center;
  background: #2f80ed; font-weight: 800;
}
.brand span { display: block; color: #aab4c2; font-size: 12px; margin-top: 2px; }
nav { display: grid; gap: 6px; }
nav button {
  width: 100%; text-align: left; border: 0; border-radius: 6px;
  padding: 11px 12px; color: #cbd5e1; background: transparent; cursor: pointer;
}
nav button.active, nav button:hover { background: #263245; color: #fff; }

main { flex: 1; min-width: 0; padding: 22px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
h1 { margin: 0; font-size: 22px; }
h2 { margin: 0; font-size: 16px; }
p { margin: 6px 0 0; color: var(--muted); }
.actions, .filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-badge { color: var(--muted); font-size: 13px; }

button, input, select, textarea {
  font: inherit;
}
button {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 6px; padding: 8px 12px; cursor: pointer;
}
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.icon { border: 0; font-size: 24px; line-height: 1; background: transparent; padding: 4px 8px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; background: #fff;
}
#keyword { width: 320px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px;
}
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 22px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 14px; overflow: hidden;
}
.panel-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1120px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #edf1f5; text-align: left; font-size: 14px; }
th { color: #475467; background: #f8fafc; font-weight: 600; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fbff; }
.status, .tag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 54px; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 600;
}
.status.ACTIVE { color: var(--green); background: #e7f6ee; }
.status.PLANNING { color: #2f5fb3; background: #e9f0ff; }
.status.PAUSED { color: var(--orange); background: #fff2df; }
.status.CLOSED { color: #667085; background: #eef1f4; }
.tag { background: #eef4ff; color: #2456a6; }
.progress {
  height: 8px; width: 110px; background: #edf1f5; border-radius: 999px; overflow: hidden;
}
.progress b { display: block; height: 100%; background: var(--primary); }
.grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.list { padding: 8px 14px 14px; }
.list-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.list-item:last-child { border-bottom: 0; }
.list-item small { color: var(--muted); }

dialog { border: 0; border-radius: 10px; padding: 0; width: min(860px, calc(100vw - 32px)); box-shadow: 0 24px 80px #10182840; }
dialog::backdrop { background: #10182866; }
.dialog-card { padding: 18px; }
.detail-card { max-height: 86vh; overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.dialog-head-actions { display: flex; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; color: #344054; font-size: 13px; }
label.full { margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.detail-section { margin-top: 16px; }
.detail-tools { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; margin: 10px 0; }

@media (max-width: 900px) {
  #app { display: block; }
  .sidebar { width: 100%; }
  .metrics, .grid, .form-grid { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
  #keyword { width: 100%; }
}
