:root {
  --bg: #f0f4ff;
  --bg2: #e8eeff;
  --surface: #ffffff;
  --line: #dbeafe;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent2: #7c3aed;
  --accent3: #06b6d4;
  --vip: #d97706;
  --success: #059669;
  --danger: #dc2626;
  --sidebar-w: 220px;
  --sidebar-collapsed: 68px;
  --header-h: 56px;
  --shadow: 0 8px 30px rgba(37, 99, 235, 0.12);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body.app-shell {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", system-ui, sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #fdf4ff 45%, #ecfeff 100%);
  color: var(--text);
  min-height: 100vh;
}
.app-frame {
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: width 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 16px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent);
}
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6);
}
.sidebar-nav { flex: 1; overflow-y: auto; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 4px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
}
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.15), rgba(124, 58, 237, 0.1));
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.sidebar-link.subtle { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.sidebar-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; flex-shrink: 0; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-foot { display: none; }
body.sidebar-collapsed .sidebar-link { justify-content: center; padding-inline: 8px; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-center { flex: 1; min-width: 0; }
.header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.icon-btn {
  border: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.miniapp-pill { font-size: 1rem; }
.badge-vip {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  color: var(--vip);
  font-size: 0.68rem;
  font-weight: 800;
  border: 1px solid #fcd34d;
}
.app-main { padding: 16px 16px 32px; flex: 1; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--accent);
}
.card p { color: var(--muted); font-size: 0.85rem; line-height: 1.55; }
label { display: block; font-size: 0.72rem; color: var(--muted); margin: 8px 0 4px; font-weight: 600; }
input, textarea, select, button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  padding: 11px 12px;
  font-size: 0.9rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
textarea { min-height: 100px; resize: vertical; }
.btn {
  margin-top: 10px;
  border: none;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.btn.ghost { background: #e2e8f0; color: var(--text); box-shadow: none; }
button.btn-compact,
.btn.btn-compact {
  width: auto;
  min-width: 0;
  display: inline-block;
  margin-top: 0;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.filter-tool-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 8px;
}
.filter-tool-row .filter-summary {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lock-tip {
  padding: 12px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.82rem;
  margin-bottom: 10px;
}
.log-box {
  max-height: 200px;
  overflow: auto;
  font-size: 0.72rem;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--line);
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.stat-card {
  background: linear-gradient(145deg, #fff 0%, #f0f9ff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card:nth-child(2) { background: linear-gradient(145deg, #fff, #faf5ff); }
.stat-card:nth-child(3) { background: linear-gradient(145deg, #fff, #ecfdf5); }
.stat-num {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 4px; font-weight: 600; }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.quick-links-full { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.check-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; font-size: .84rem; }
.check-row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-weight: 500; }
.field-hidden { display: none !important; }
.help-text { font-size: .78rem; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.quick-links a {
  text-decoration: none;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(124,58,237,0.08));
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 35;
}
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    height: 100%;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); transform: translateX(-100%); }
  body.sidebar-open.sidebar-collapsed .sidebar { transform: translateX(0); }
  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .sidebar-label { display: inline; }
}
/* legacy */
.panel { display: block; }
.nav { display: none; }
.top { display: none; }
footer { display: none; }
.btn-support {
  width: auto;
  margin: 0;
  padding: 10px 20px;
  text-decoration: none;
  display: inline-block;
  border-radius: 999px;
  background: linear-gradient(90deg, #facc15, #fbbf24);
  color: #422006;
  box-shadow: 0 4px 14px rgba(250, 204, 21, 0.45);
  font-weight: 800;
}
.btn-support:hover { filter: brightness(1.03); }
.check-row-one-line {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 8px;
}
.check-row-one-line label { flex: 1; justify-content: center; font-size: 0.82rem; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 280px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.modal-card h3 { margin: 0 0 10px; font-size: 0.92rem; color: var(--accent); }
.check-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.check-col label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 4px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text);
  font-weight: 500;
  width: 100%;
  box-sizing: border-box;
}
.modal-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  max-width: 18px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions .btn {
  flex: 1;
  width: auto;
  min-width: 0;
  margin-top: 0;
  padding: 9px 10px;
  font-size: 0.84rem;
}
.task-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.task-actions .btn {
  flex: 1;
  min-width: 120px;
  margin-top: 0;
}
.task-actions .btn:disabled {
  opacity: 0.5;
}
.check-col label span {
  flex: 1;
  min-width: 0;
}
