/* === 慧发布 - 全局样式 === */
*{box-sizing:border-box;margin:0;padding:0}

:root{
  --bg:#f5f5f3;
  --card-bg:#fff;
  --border:#e0e0db;
  --primary:#6C5FE8;
  --primary-light:#f0eeff;
  --text:#1a1a1a;
  --text-secondary:#666;
  --text-muted:#999;
  --green:#16a34a;
  --green-bg:#f0fdf4;
  --amber:#d97706;
  --amber-bg:#fffbeb;
  --red:#e11d48;
  --red-bg:#fff1f2;
  --radius:12px;
  --radius-sm:8px;
}

body{
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.app{
  display: flex;
  min-height: 100vh;
}

.sidebar{
  width: 200px;
  background: var(--card-bg);
  border-right: 0.5px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.logo{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 10px;
}

.logo-icon{
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg{ width: 20px; height: 20px; fill: #fff; }

.logo-text{ font-size: 15px; font-weight: 600; color: var(--text); }
.logo-sub{ font-size: 11px; color: var(--text-secondary); }

.nav-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
}

.nav-item:hover{ background: #f5f5f3; }
.nav-item.active{
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}

.nav-item svg{ width: 16px; height: 16px; opacity: .7; }

/* Content */
.content{ flex: 1; padding: 24px 32px; overflow-y: auto; }
.page-title{ font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.page-sub{ font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }

/* Cards */
.card{
  background: var(--card-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 0.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  transition: all .15s;
  font-family: inherit;
}

.btn:hover{ border-color: #aaa; }
.btn-primary{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover{ opacity: .9; }
.btn-sm{ padding: 5px 12px; font-size: 12px; }
.btn-danger{ color: var(--red); border-color: #fca5a5; }
.btn-danger:hover{ background: var(--red-bg); }
.btn:disabled{ opacity: .5; cursor: not-allowed; }

/* Platform Grid */
.platform-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.platform-card{
  background: var(--card-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.platform-card:hover{ border-color: #aaa; transform: translateY(-1px); }
.platform-card.connected{ border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-light); }
.platform-card.unavailable{ opacity: .5; cursor: not-allowed; }

.platform-icon{
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  position: relative;
}

.platform-name{ font-size: 13px; color: var(--text-secondary); text-align: center; }
.platform-desc{ font-size: 11px; color: var(--text-muted); text-align: center; }

.badge{
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge svg{ width: 9px; height: 9px; fill: #fff; }

.tag{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.tag.api{ background: var(--green-bg); color: var(--green); }
.tag.rpa{ background: var(--amber-bg); color: var(--amber); }
.tag.unsupported{ background: #f1f5f9; color: #94a3b8; }

/* Metrics */
.metrics{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card{
  background: var(--card-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.metric-val{ font-size: 24px; font-weight: 600; color: var(--text); }
.metric-lbl{ font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Filter */
.filter-bar{
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar input, .filter-bar select{
  padding: 8px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
}

.filter-bar input{ flex: 1; min-width: 180px; }
.filter-bar input:focus, .filter-bar select:focus{ outline: none; border-color: var(--primary); }

/* Table */
.table-wrap{
  background: var(--card-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

th{
  background: #f9f9f7;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
}

td{
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}

tr:last-child td{ border-bottom: none; }
tr:hover td{ background: #f9f9f7; }
tr.selected td{ background: var(--primary-light); }

.status-tag{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.status-tag.published{ background: var(--green-bg); color: var(--green); }
.status-tag.pending{ background: var(--amber-bg); color: var(--amber); }
.status-tag.failed{ background: var(--red-bg); color: var(--red); }
.status-tag.publishing{ background: #e0f2fe; color: #0284c7; }
.status-tag.partial_published{ background: var(--amber-bg); color: var(--amber); }
.status-tag.scheduled{ background: #e8f5e9; color: #2e7d32; }

.status-dot{
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}

.status-dot.published{ background: var(--green); }
.status-dot.pending{ background: var(--amber); }
.status-dot.failed{ background: var(--red); }

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

.section-header h3{ font-size: 16px; font-weight: 600; }

/* Detail Panel */
.detail-panel{
  background: var(--card-bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

.detail-panel h4{ font-size: 15px; margin-bottom: 14px; }

.platform-stats{ display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

.ps-card{
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.ps-name{ font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.ps-row{ display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.ps-row span:last-child{ color: var(--text); font-weight: 500; }

/* Publish area */
.publish-area{ background: var(--card-bg); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 20px; }

.publish-textarea{
  width: 100%;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 14px;
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  line-height: 1.8;
}

.publish-textarea:focus{ outline: none; border-color: var(--primary); }

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

.target-chips{ display: flex; gap: 6px; flex-wrap: wrap; }

.chip{
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  border-radius: 20px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
}

.chip:hover{ border-color: var(--primary); }
.chip .dot{ width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.toast{
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn .3s ease;
}

.toast.success{ background: var(--green-bg); color: var(--green); border: 0.5px solid #bbf7d0; }
.toast.error{ background: var(--red-bg); color: var(--red); border: 0.5px solid #fecdd3; }

@keyframes slideIn{ from{ opacity: 0; transform: translateX(20px); } to{ opacity: 1; transform: translateX(0); } }

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

.empty-state p{ font-size: 13px; margin-top: 8px; }

.loading{ text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }

.account-badge{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
}
