:root {
  --brand: #4f46e5;
  --brand-light: #6366f1;
  --brand-bg: #eef2ff;
  --sidebar-bg: #0f172a;
  --sidebar-w: 220px;
  --header-h: 56px;
  --page-bg: #f1f5f9;
  --card-radius: 10px;
  --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: var(--page-bg); color: #1e293b; font-size: 14px; }
[v-cloak] { display: none; }

/* ===== Element Plus overrides ===== */
.el-card { border: none; border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
.el-card__header { padding: 16px 20px; font-weight: 600; font-size: 15px; border-bottom: 1px solid #f1f5f9; }
.el-table th.el-table__cell { background: #f8fafc !important; color: #475569; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.el-table td.el-table__cell { color: #334155; }
.el-table--small .el-table__cell { padding: 8px 0; }
.el-tag { border-radius: 4px; }
.el-dialog__header { padding: 16px 20px 12px; }
.el-dialog__body { padding: 12px 20px 20px; }
.el-dialog__footer { padding: 12px 20px 16px; }
.el-menu-item.is-active { background: rgba(99,102,241,.15) !important; }

/* ===== LOGIN ===== */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  position: relative;
}
.login-wrapper::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.15) 0%, transparent 70%);
  top: -200px; right: -200px; border-radius: 50%;
}
.login-wrapper::after {
  content: ''; position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,.1) 0%, transparent 70%);
  bottom: -100px; left: -100px; border-radius: 50%;
}

/* ===== LAYOUT ===== */
.app-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar-bg); z-index: 100; display: flex; flex-direction: column;
  box-shadow: 2px 0 8px rgba(0,0,0,.1);
}
.sidebar-brand {
  padding: 18px 20px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.sidebar-brand-text { color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .5px; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar-nav .el-menu { border-right: none; background: transparent; }
.sidebar-nav .el-menu-item {
  height: 44px; line-height: 44px; margin: 2px 8px; border-radius: 8px;
  color: rgba(255,255,255,.6); font-size: 14px;
}
.sidebar-nav .el-menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .el-menu-item.is-active { background: rgba(99,102,241,.2) !important; color: #fff !important; }
.sidebar-nav .el-menu-item .el-icon { font-size: 18px; margin-right: 8px; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  color: rgba(255,255,255,.7); font-size: 13px; cursor: pointer; transition: background .2s;
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 8px; background: rgba(99,102,241,.3);
  display: flex; align-items: center; justify-content: center; color: #c7d2fe;
  font-size: 14px; flex-shrink: 0;
}

.app-body { margin-left: var(--sidebar-w); min-height: 100vh; }

.page-header {
  height: var(--header-h); padding: 0 28px; background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 50;
}
.page-header h2 { font-size: 16px; font-weight: 600; color: #0f172a; }
.page-content { padding: 24px 28px; }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-item {
  background: #fff; border-radius: var(--card-radius); padding: 20px;
  box-shadow: var(--card-shadow); display: flex; align-items: center; gap: 16px;
  transition: transform .15s, box-shadow .15s; cursor: default;
}
.stat-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.amber { background: #fffbeb; color: #f59e0b; }
.stat-icon.rose { background: #fff1f2; color: #f43f5e; }
.stat-info {}
.stat-val { font-size: 24px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.stat-label { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ===== CARD HEADERS ===== */
.card-hdr { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.card-hdr-title { font-weight: 600; font-size: 15px; color: #0f172a; }

/* ===== DISTRIBUTION ===== */
.section-gap { margin-bottom: 20px; }
.mono { font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace; font-size: 12px; color: var(--brand); }

.link-card {
  border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px;
  transition: box-shadow .2s, border-color .2s; overflow: hidden;
}
.link-card:hover { border-color: #c7d2fe; }
.link-card.expanded { border-color: #a5b4fc; box-shadow: 0 2px 12px rgba(79,70,229,.08); }

.link-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; cursor: pointer; gap: 12px;
}
.link-card-header:hover { background: #fafbff; }

.link-url-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 12px; border-bottom: 1px solid #f1f5f9;
}
.link-url {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px; color: var(--brand); background: #f8fafc; padding: 4px 10px; border-radius: 4px;
}

.link-stat { text-align: center; }
.link-stat-val { font-size: 14px; font-weight: 600; color: #1e293b; display: block; line-height: 1.2; }
.link-stat-lbl { font-size: 10px; color: #94a3b8; }

.link-card-body { padding: 16px 18px; background: #f8fafc; }

.upload-zone .el-upload { width: 100%; }
.upload-zone .el-upload-dragger {
  border: 2px dashed #ddd; border-radius: 10px; background: #fff; padding: 8px;
  transition: border-color .2s;
}
.upload-zone .el-upload-dragger:hover { border-color: var(--brand); }

/* ===== SETTINGS ===== */
.settings-section { margin-bottom: 28px; }
.settings-section:last-child { margin-bottom: 0; }
.form-help { font-size: 11px; color: #94a3b8; line-height: 1.5; margin-top: 3px; }
.form-help b { color: #64748b; }

.srv-info-box {
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px;
  padding: 16px 18px; margin-bottom: 20px; font-size: 13px; line-height: 1.8; color: #0c4a6e;
}
.srv-info-box b { color: #0369a1; }
.srv-info-box ol { padding-left: 18px; margin-top: 4px; }
.srv-type-tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; margin-right: 4px; }
.srv-type-tag.dl { background: #dbeafe; color: #1d4ed8; }
.srv-type-tag.st { background: #dcfce7; color: #15803d; }
.srv-type-tag.cdn { background: #fef3c7; color: #b45309; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .app-sidebar { display: none; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
}
