/* ===================================
   智社台账 - 全局样式
   =================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --primary-light: #e6f7ff;
  --success: #52c41a;
  --success-light: #f6ffed;
  --warning: #fa8c16;
  --warning-light: #fff7e6;
  --danger: #f5222d;
  --danger-light: #fff1f0;
  --purple: #722ed1;
  --purple-light: #f9f0ff;
  --bg: #f0f2f5;
  --bg-dark: #001529;
  --white: #ffffff;
  --text: #262626;
  --text-2: #595959;
  --text-3: #8c8c8c;
  --text-4: #bfbfbf;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-sm: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a365d 0%, #2563eb 50%, #7c3aed 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  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.05'%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");
}
.login-card {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  margin-bottom: 16px;
}
.login-logo h1 { font-size: 26px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 14px; color: var(--text-3); margin-top: 4px; }

.form-item { margin-bottom: 20px; }
.form-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: all 0.2s;
  font-family: inherit;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24,144,255,0.1);
}
.form-item select { cursor: pointer; appearance: auto; }
.form-item textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
  color: var(--text);
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-success { background: var(--success); border-color: var(--success); color: white; }
.btn-success:hover { background: #45a614; border-color: #45a614; color: white; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-light); border-color: var(--danger); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-block { width: 100%; justify-content: center; }
.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #1890ff, #722ed1);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 4px;
  font-family: inherit;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(24,144,255,0.4); }

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

/* Sidebar */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #001529 0%, #002140 100%);
  color: white;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sidebar-brand h2 { font-size: 18px; font-weight: 600; white-space: nowrap; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav .nav-group { margin-bottom: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  color: rgba(255,255,255,0.65);
  transition: all 0.2s;
  font-size: 14px;
  margin: 2px 8px;
  border-radius: 6px;
  text-decoration: none;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-item.active { color: white; background: var(--primary); font-weight: 500; }
.nav-item .fa, .nav-item .nav-icon { width: 18px; text-align: center; font-size: 14px; }
.nav-divider { padding: 16px 20px 8px; font-size: 11px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 1px; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

/* Main content */
.main-area { flex: 1; margin-left: 240px; min-width: 0; }

/* Topbar */
.topbar {
  background: var(--white);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h3 { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.topbar-logout {
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.topbar-logout:hover { color: var(--danger); border-color: var(--danger); }
.topbar-mobile { display: none; }

/* Page Content */
.page-body { padding: 24px; }
@media (max-width: 768px) { .page-body { padding: 12px; } }

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
  cursor: default;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-card .icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-card .value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .label { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.stat-card .extra { font-size: 12px; color: var(--text-4); margin-top: 2px; }

/* Panels */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h3 { font-size: 16px; font-weight: 600; }
.panel-body { padding: 20px; }
.panel-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #fafafa; padding: 12px 16px; text-align: left; font-weight: 600; color: var(--text-2); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
tr:hover td { background: var(--primary-light); }
td.actions { white-space: nowrap; display: flex; gap: 6px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-published { background: var(--success-light); color: var(--success); border: 1px solid #b7eb8f; }
.badge-draft { background: var(--warning-light); color: var(--warning); border: 1px solid #ffd591; }
.badge-admin { background: var(--purple-light); color: var(--purple); }
.badge-worker { background: var(--primary-light); color: var(--primary); }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s;
}
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 90%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s;
}
.modal-sm { max-width: 480px; }
.modal-lg { max-width: 900px; }
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  color: var(--text-3);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Upload Area */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafafa;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone .icon { font-size: 40px; color: var(--primary); margin-bottom: 12px; }
.upload-zone p { color: var(--text-3); font-size: 14px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.photo-thumb {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  border: 2px solid var(--border-light);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .remove {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.6); color: white;
  border: none; border-radius: 50%;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* AI Result */
.ai-result {
  margin-top: 20px;
  background: var(--success-light);
  border: 1px solid #b7eb8f;
  border-radius: var(--radius);
  padding: 20px;
}
.ai-result h4 { margin-bottom: 12px; color: var(--success); }
.ai-result .info-row {
  display: flex; gap: 24px;
  margin-bottom: 8px; font-size: 14px;
}
.ai-result .info-row .label { color: var(--text-3); min-width: 60px; }

/* Search & Filter Bar */
.toolbar {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type="text"] {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 220px;
  font-family: inherit;
}
.toolbar select { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* Category Grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.cat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.cat-card:hover { box-shadow: var(--shadow-lg); }
.cat-card h4 { font-size: 16px; margin: 8px 0 4px; }
.cat-card p { font-size: 13px; color: var(--text-3); }
.cat-card .cat-icon { font-size: 32px; }

/* Storage Bar */
.storage-bar { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.storage-bar .fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s; }
.storage-bar .fill.warning { background: var(--warning); }
.storage-bar .fill.danger { background: var(--danger); }

/* Template Cards */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* Pagination */
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 16px; }
.pager button { padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; cursor: pointer; font-size: 13px; }
.pager button:hover { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Ledger Detail View */
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 15px; color: var(--text-2); margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }

/* Toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  z-index: 9999;
  animation: slideDown 0.3s;
  box-shadow: var(--shadow-lg);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Loading Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main-area { margin-left: 200px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; display: none; }
  .sidebar.open { display: block; }
  .main-area { margin-left: 0; }
  .topbar-mobile { display: flex; align-items: center; gap: 12px; }
  .stats-row { grid-template-columns: 1fr; }
  .modal { width: 95%; max-width: 100%; }
  .page-body { padding: 12px; }
  .toolbar { flex-direction: column; }
  .toolbar input[type="text"] { width: 100%; }
  .login-card { width: 90%; padding: 32px 24px; }
}

/* Print styles for report export */
@media print {
  .sidebar, .topbar, .btn, .modal-overlay { display: none !important; }
  .main-area { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
}

/* ===== Mobile responsive fixes ===== */
@media (max-width: 768px) {
  .category-chips { gap: 8px; }
  .category-chip { padding: 6px 10px; font-size: 13px; }
  .report-filters { grid-template-columns: 1fr; }
  .storage-card { grid-column: 1 / -1; }
  .ai-result-form { grid-template-columns: 1fr; }
  .modal-lg { max-width: 95%; }
  .ledger-checkbox { padding: 8px; }
}

/* ===== Extra visual polish ===== */
/* Smooth page transitions */
.page-body > template, .page-body > * { animation: fadeIn 0.25s ease; }

/* Enhanced stat cards with gradient icons */
.stat-card {
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(24,144,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

/* Better buttons */
.btn {
  border-radius: 6px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #36a3ff);
  box-shadow: 0 2px 6px rgba(24,144,255,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 4px 10px rgba(24,144,255,0.35);
}
.btn-success {
  background: linear-gradient(135deg, var(--success), #73d13d);
  box-shadow: 0 2px 6px rgba(82,196,26,0.25);
}
.btn-danger:hover { color: white; background: var(--danger); }

/* Enhanced panels */
.panel {
  border: 1px solid var(--border-light);
  transition: all 0.2s;
}
.panel:hover { box-shadow: var(--shadow-lg); }
.panel-header { background: linear-gradient(to right, #fff, #fafafa); }

/* Better table */
tr { transition: background 0.15s; }
tr:hover td { background: var(--primary-light); }

/* Enhanced empty state */
.empty-state { background: var(--white); border-radius: var(--radius); border: 1px dashed var(--border); }
.empty-state .icon { font-size: 56px; }
.empty-state p { font-size: 15px; }

/* Better badges */
.badge { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03); }

/* Enhanced category cards */
.cat-card {
  border: 1px solid var(--border-light);
  background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
}
.cat-card:hover { transform: translateY(-2px); border-color: var(--primary); }

/* Upload zone enhancement */
.upload-zone {
  background: linear-gradient(135deg, #fafafa 0%, #f0f5ff 100%);
  border-color: #d6e4ff;
}
.upload-zone:hover { background: linear-gradient(135deg, #e6f7ff 0%, #d6e4ff 100%); }

/* Report groups polish */
.report-group { background: var(--white); }
.report-group .group-header { background: linear-gradient(to right, #fafafa, #f0f5ff); }

/* Ledger detail polish */
.detail-section {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.detail-section h4 { border-bottom: none; padding-bottom: 0; margin-bottom: 12px; }

/* Toast improvement */
.toast { border-radius: 100px; padding: 12px 28px; }

/* Sidebar polish */
.sidebar-brand { background: rgba(255,255,255,0.03); }
.sidebar-nav .nav-item { margin: 2px 10px; border-radius: 6px; }
.nav-divider { font-size: 10px; font-weight: 600; }

/* ===== Dashboard Layout ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.storage-card {
  min-width: 220px;
}
.storage-card .value.small { font-size: 22px; }
.storage-mini {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  margin-bottom: 4px;
}
.storage-mini .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.5s;
}
.storage-mini .fill.warning { background: var(--warning); }
.storage-mini .fill.danger { background: var(--danger); }

/* ===== AI Category Selection ===== */
.ai-category-select { margin-bottom: 24px; }
.ai-category-select .required { color: var(--danger); margin-left: 4px; }
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.category-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  user-select: none;
}
.category-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.category-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(24,144,255,0.15);
}
.category-chip .icon { font-size: 16px; }
.category-chip .name { font-size: 14px; }
.template-tip {
  margin-top: 10px;
  font-size: 13px;
  color: var(--success);
  padding: 8px 12px;
  background: var(--success-light);
  border-radius: var(--radius-sm);
  display: inline-block;
}
.template-tip.text-muted { color: var(--text-3); background: var(--bg); }

.ai-result-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ai-result-form .form-item { margin-bottom: 12px; }
.ai-result-form .form-item:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ===== Report Filters & Groups ===== */
.report-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  padding: 16px;
  background: #fafafa;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.report-ledger-groups {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--white);
}
.report-group {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.report-group .group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #fafafa;
  font-weight: 500;
  font-size: 14px;
}
.report-group .group-header a {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
}
.report-group .group-header a:hover { text-decoration: underline; }
.report-group .group-items {
  padding: 8px;
}
.ledger-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.15s;
}
.ledger-checkbox:hover { background: var(--primary-light); }
.ledger-checkbox input { margin-top: 2px; cursor: pointer; }
.ledger-checkbox span { flex: 1; line-height: 1.4; }

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-2);
}
.report-content-box {
  background: #fafafa;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}
.report-content-box pre {
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

/* ===== Help & Guide Bars ===== */
.help-bar {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  background: linear-gradient(135deg, #e6f7ff 0%, #f0f5ff 100%);
  border: 1px solid #91d5ff;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  color: #0958d9;
  line-height: 1.6;
}
.help-bar i { margin-top: 2px; font-size: 16px; }
.help-bar span { flex: 1; }

/* ===== Template Enhancements ===== */
.template-card { transition: all 0.2s; }
.template-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.template-fields-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.field-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f5ff;
  border: 1px solid #d6e4ff;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.template-field-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fafafa;
}
.template-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 90px 70px auto auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-light);
}
.template-field-row:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.template-field-row input,
.template-field-row select { padding: 6px 8px; font-size: 13px; }
.template-field-row .btn-sm { padding: 4px 8px; font-size: 12px; }
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.checkbox-inline input { width: auto; cursor: pointer; }
.template-font-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 12px;
  background: #fafafa;
  border-radius: 6px;
}

/* ===== Storage Info Box ===== */
.storage-info-box {
  margin-top: 16px;
  padding: 16px;
  background: #fafafa;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}
.storage-info-box.warning { background: #fff7e6; border-color: #ffd591; }
.storage-info-box.danger { background: #fff1f0; border-color: #ffa39e; }
.storage-title { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.storage-warning {
  margin-top: 10px;
  font-size: 13px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== Upgrade Modal ===== */
.upgrade-intro {
  padding: 14px;
  background: #f0f5ff;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
}
.upgrade-intro p { margin-bottom: 6px; }
.upgrade-intro p:last-child { margin-bottom: 0; }
.upgrade-intro strong { color: var(--primary); }
.upgrade-contact {
  padding: 12px;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 14px;
  color: #389e0d;
}
.upgrade-contact i { margin-right: 6px; }

/* ===== Mobile fixes for new elements ===== */
@media (max-width: 768px) {
  .template-field-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .template-field-row .checkbox-inline,
  .template-field-row .btn-sm { grid-column: span 1; }
  .help-bar { font-size: 13px; padding: 12px; }
  .upgrade-intro { font-size: 13px; }
}


