@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  --sidebar-width: 240px;
  --bg: #f0f4f8;
  --bg-pattern: radial-gradient(ellipse at 20% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 100%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  background-image: var(--bg-pattern);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
}

.sidebar .brand {
  padding: 22px 22px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  letter-spacing: -0.02em;
  border-bottom: none;
}

.sidebar-user {
  padding: 0 22px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.sidebar-username {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  word-break: break-all;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 4px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.sidebar a.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(37, 99, 235, 0.2) 100%);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.3);
}

.sidebar a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  opacity: 0.9;
}

.sidebar a.nav-logout {
  color: #fca5a5;
  margin-top: 10px;
  margin-bottom: 0;
}

.sidebar a.nav-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fecaca;
}

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.content { padding: 28px; flex: 1; }

.readonly-banner {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
}

/* ── Stat cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  opacity: 0;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card:hover::before { opacity: 1; }

.card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 8px;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.card .value.text-sm { font-size: 15px; font-weight: 600; color: var(--text); }

.card .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.card-accent-green::before { background: linear-gradient(90deg, #10b981, #34d399); opacity: 1; }
.card-accent-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); opacity: 1; }
.card-accent-violet::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); opacity: 1; }

.card-clickable {
  cursor: pointer;
  user-select: none;
}

.card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.card-hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.modal-wide { max-width: 820px; }

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 12px 0 16px;
  line-height: 1.5;
}

.growth-modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.growth-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.growth-tab:hover {
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

.growth-tab.active {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.growth-tab-panel { display: none; }
.growth-tab-panel.active { display: block; }

.table-wrap-sm { max-height: 360px; overflow: auto; }

.delta-up { color: var(--danger); font-weight: 600; }
.delta-down { color: var(--success); font-weight: 600; }

/* ── Panels ── */
.panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.panel h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3::before {
  content: '';
  width: 4px;
  height: 16px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-box { height: 300px; width: 100%; min-height: 200px; }

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Filters ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--border-light);
  border-radius: var(--radius);
}

form.filters {
  border: none;
  margin: 0 0 20px;
}

.filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
}

.filter-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.filter-summary-item.highlight .filter-summary-value {
  color: var(--primary-dark);
  font-size: 22px;
}

.filter-summary-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

input, select, textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder { color: #94a3b8; }

textarea { width: 100%; min-height: 72px; resize: vertical; }

/* ── Buttons ── */
.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  border-color: var(--primary-light);
  color: var(--primary-dark);
  background: #f8fafc;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

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

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  text-transform: none;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--text-secondary);
}

th.sortable:hover { color: var(--primary); background: #eff6ff; }
th.sortable.active { color: var(--primary-dark); background: #eff6ff; }

.sort-icon { font-size: 10px; margin-left: 4px; color: var(--muted); }
th.sortable.active .sort-icon { color: var(--primary); }

tbody tr { transition: var(--transition); }
tbody tr:hover td { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: #eff6ff;
  color: var(--primary-dark);
}

.tag.expense { background: #fee2e2; color: #b91c1c; }
.tag.income { background: #d1fae5; color: #047857; }

.tag.change-续费 { background: #e0e7ff; color: #3730a3; }
.tag.change-替换 { background: #fef3c7; color: #b45309; }
.tag.change-新增 { background: #d1fae5; color: #047857; }
.tag.change-停用 { background: #f1f5f9; color: #64748b; }

.tag.tag-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 4px 2px 0;
  background: #e0f2fe;
  color: #0369a1;
}

.tags-cell { max-width: 200px; line-height: 1.8; }

.tag-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin-bottom: 8px;
}

.tag-empty {
  font-size: 13px;
  color: var(--muted);
}

.tag-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}

.tag-remove:hover { opacity: 1; }

.tag-editor-row input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.tag-suggestions-label {
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-editor .tag-preset {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.tag-editor .tag-preset::before {
  content: '+';
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}

.tag-editor .tag-preset:hover:not(:disabled) {
  border-color: var(--primary-light);
  color: var(--primary-dark);
  background: #eff6ff;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.tag-editor .tag-preset:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.tag-editor .tag-preset.is-added,
.tag-editor .tag-preset:disabled {
  cursor: default;
  border-color: #bae6fd;
  background: #e0f2fe;
  color: #0369a1;
  opacity: 1;
  box-shadow: none;
  transform: none;
}

.tag-editor .tag-preset.is-added::before,
.tag-editor .tag-preset:disabled::before {
  content: '✓';
  color: #0284c7;
  font-size: 11px;
}

/* ── Pagination ── */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.page-size-label {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.page-size-label select {
  padding: 8px 12px;
  min-width: 80px;
  border-radius: 8px;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.pagination button { min-width: 40px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea { width: 100%; }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ── Suggestions ── */
.suggestion {
  border-left: 4px solid var(--success);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--success-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: var(--transition);
}

.suggestion:hover { box-shadow: var(--shadow-sm); }

.suggestion.high { border-color: var(--danger); background: var(--danger-bg); }
.suggestion.medium { border-color: var(--warning); background: var(--warning-bg); }
.suggestion.low { border-color: var(--success); background: var(--success-bg); }

.suggestion h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.suggestion p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.panel-desc {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 20px;
  line-height: 1.5;
}

.advice-panel { margin-top: 8px; }

.advice-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.advice-chart-item {
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border-light);
}

.advice-chart-item h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-align: center;
}

.advice-chart-full { grid-column: 1 / -1; }

.chart-box-sm { height: 280px; }

.module-block {
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.module-block-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border-light);
}

.module-block-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

.module-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.module-stats strong {
  color: var(--text);
  font-weight: 600;
}

.module-block-body {
  padding: 16px 20px;
  background: #fff;
}

.module-no-suggestions {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.suggestion-action {
  margin-top: 6px;
  font-size: 13px;
}

.suggestion-tabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestion-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}

.suggestion-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  max-width: 100%;
}

.suggestion-tab:hover {
  border-color: var(--primary-light);
  color: var(--primary-dark);
  background: #eff6ff;
}

.suggestion-tab.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15);
}

.suggestion-tab-level {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.2;
}

.suggestion-tab-level.high { background: #fee2e2; color: #b91c1c; }
.suggestion-tab-level.medium { background: #fef3c7; color: #b45309; }
.suggestion-tab-level.low { background: #d1fae5; color: #047857; }

.suggestion-tab-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-tab-panels {
  min-height: 0;
}

.suggestion-tab-panel {
  display: none;
}

.suggestion-tab-panel.active {
  display: block;
}

.suggestion-tab-panel .suggestion {
  margin-bottom: 0;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.highlight-row td { background: #eff6ff !important; }

.amount {
  font-weight: 700;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.growth-up { color: var(--danger); font-weight: 600; }
.growth-down { color: var(--success); font-weight: 600; }
.growth-new { color: var(--primary); font-weight: 600; }

.empty-cell { color: var(--muted); }

/* ── Login page ── */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 40%, #3b82f6 100%);
  background-attachment: fixed;
}

body.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-card .login-logo {
  font-size: 40px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.4));
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-card p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.login-card input {
  width: 100%;
  margin-bottom: 8px;
}

.login-card button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
}

.login-error { color: var(--danger); font-size: 13px; min-height: 22px; margin-bottom: 4px; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .advice-charts { grid-template-columns: 1fr; }
  .advice-chart-full { grid-column: 1; }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  }
  .sidebar .brand {
    width: 100%;
    padding: 16px 20px 8px;
  }
  .sidebar-user {
    width: 100%;
    padding: 0 20px 12px;
    border-bottom: none;
  }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px 12px 12px;
    flex: 1;
  }
  .sidebar a.nav-logout {
    margin-top: 0;
  }
  .sidebar a { margin-bottom: 0; margin-right: 4px; white-space: nowrap; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
}
