:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: #eef2ff;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

html, body {
  background: linear-gradient(180deg, #f9fafb 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body { overflow-x: hidden; }

.top-navbar {
  height: 64px;
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(229,231,235,.9);
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
}

.navbar-brand {
  color: var(--text) !important;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.1rem;
}

.menu-toggle { color: var(--text-muted) !important; }

.shell-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.8);
  color: var(--text-muted);
  font-size: .875rem;
}

.shell-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}

.sidebar {
  top: 64px;
  left: 0;
  width: 272px;
  height: calc(100vh - 64px);
  background: rgba(255,255,255,0.84);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(229,231,235,.9);
  box-shadow: none;
  transform: translateX(-100%);
  transition: transform .28s ease;
}
.sidebar.show { transform: translateX(0); }
.sidebar-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 20px 18px 16px;
}
.sidebar-header h5 { font-weight: 700; }
.sidebar-menu { padding: 12px; }
.menu-item {
  margin: 4px 0;
  border-radius: 12px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 11px 14px;
}
.menu-item:hover {
  background: #f3f4f6;
  color: var(--text);
}
.menu-item.active {
  background: var(--primary-soft);
  color: var(--primary) !important;
}

.main-content {
  padding: 88px 24px 24px;
  min-height: 100vh;
  transition: margin-left .28s ease;
}
.main-content.expanded { margin-left: 272px; }

@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
  .main-content { margin-left: 272px; }
  .menu-toggle { display: none; }
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.page-title {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.page-subtitle {
  margin-top: 8px;
  color: var(--text-muted);
  max-width: 720px;
}

.surface-card,
.card,
.module-card {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
}
.card, .module-card { overflow: hidden; }
.module-card { margin-bottom: 24px; }
.module-card:hover { transform: none; }
.module-header,
.card-header-soft,
.surface-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(249,250,251,.96));
}
.module-body,
.surface-body { padding: 22px; }

.hero-panel {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(79,70,229,.08), rgba(255,255,255,.92));
}
.hero-panel strong { color: var(--text); }

.stat-card,
.stat-card-box,
.task-stat-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: var(--shadow-sm);
}
.stat-card-box,
.task-stat-card { min-height: 110px !important; }
.stat-value, .task-stat-value { font-size: 1.9rem !important; font-weight: 800 !important; letter-spacing: -0.04em; }
.stat-subvalue { font-size: 1.15rem; font-weight: 700; }
.stat-icon-muted, .task-card-icon { opacity: .95; }
.stat-kicker {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .78rem;
  font-weight: 700;
}

.task-item {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.task-item:hover {
  border-color: #c7d2fe;
  box-shadow: 0 10px 24px rgba(79,70,229,.08);
}
.task-title { font-weight: 700; letter-spacing: -.01em; }
.task-details { color: var(--text-muted); }
.task-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.status-success { background: var(--success-soft); color: var(--success); border-color: rgba(21,128,61,.14); }
.status-pending { background: var(--warning-soft); color: var(--warning); border-color: rgba(180,83,9,.14); }
.status-failed { background: var(--danger-soft); color: var(--danger); border-color: rgba(220,38,38,.12); }

.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border);
  margin-bottom: 0;
}
.table thead th {
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
  border-bottom-width: 1px;
  background: #fbfbfc;
}
.table tbody td {
  padding-top: 14px;
  padding-bottom: 14px;
}
.table tbody tr:hover td { background: rgba(99,102,241,.03); }

.btn {
  border-radius: 12px;
  font-weight: 600;
  box-shadow: none !important;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}
.btn-outline-secondary {
  border-color: var(--border-strong);
  color: #374151;
}
.btn-outline-secondary:hover {
  background: #f3f4f6;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-light {
  background: #fff;
  border: 1px solid var(--border);
}

.form-control,
.form-select,
.input-group-text,
textarea {
  border-radius: 12px !important;
  border-color: var(--border);
  background: #fff;
  min-height: 44px;
}
.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 .2rem rgba(79,70,229,.12);
}
.input-group-text { background: #f9fafb; color: var(--text-muted); }

.offcanvas {
  --bs-offcanvas-width: min(560px, 94vw);
  border-left: 1px solid var(--border);
}
.offcanvas-header {
  padding: 20px 22px;
  background: #fbfbfc;
}
.offcanvas-body { padding: 22px; }

.alert {
  border-radius: 14px;
  border: 1px solid var(--border);
}
.alert-info { background: #f8fbff; border-color: #dbeafe; color: #1d4ed8; }
.alert-secondary { background: #f9fafb; color: #4b5563; }

.toast-stack {
  position: fixed;
  top: 84px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast-pill {
  min-width: 260px;
  max-width: 380px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
}
.toast-pill.success { border-color: rgba(21,128,61,.16); }
.toast-pill.error { border-color: rgba(220,38,38,.16); }
.toast-pill.info { border-color: rgba(37,99,235,.14); }
.loading-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  padding: 28px 16px;
}
.loading-shell .spinner-border { width: 1rem; height: 1rem; }
.module.d-none { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

@media (max-width: 991px) {
  .main-content { padding: 82px 16px 20px; }
  .page-hero { flex-direction: column; }
}
