/* ===== 临沂拓研ERP 桌面端 UI v2 ===== */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #f0f2f5;
}

/* ===== CSS Variables ===== */
:root {
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 64px;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-title: #64748b;
  --header-h: 56px;
  --header-bg: #fff;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Layout ===== */
.layui-layout-body { overflow: hidden; }
.layui-layout-admin { position: relative; height: 100vh; }

/* --- Header --- */
.layui-header {
  position: fixed; left: var(--sidebar-w); top: 0; right: 0; z-index: 100;
  height: var(--header-h); background: var(--header-bg);
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px; display: flex; justify-content: space-between; align-items: center;
  transition: left var(--transition);
}
.layui-header .header-left {
  font-size: 15px; font-weight: 600; color: #1e293b;
  display: flex; align-items: center; gap: 8px;
}
.layui-header .header-right {
  font-size: 13px; display: flex; align-items: center; gap: 16px;
}
.layui-header .header-right a {
  color: #64748b; text-decoration: none; cursor: pointer;
  font-size: 13px; padding: 4px 8px; border-radius: 6px; transition: all var(--transition);
}
.layui-header .header-right a:hover { color: var(--primary); background: #eff6ff; }
.layui-header .user-info { color: var(--primary); font-weight: 500; }

/* --- Body --- */
.layui-body {
  position: fixed; left: var(--sidebar-w); top: var(--header-h); right: 0; bottom: 0;
  overflow: hidden; background: #f0f2f5;
  display: flex; flex-direction: column;
  transition: left var(--transition);
}

/* ===== Sidebar ===== */
.layui-side {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow: hidden; transition: width var(--transition);
  box-shadow: 2px 0 8px rgba(0,0,0,.06);
}

/* Sidebar Logo */
.layui-side .side-logo {
  height: var(--header-h); line-height: 56px;
  padding: 0 20px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0; overflow: hidden;
}
.layui-side .side-logo .logo-icon {
  width: 32px; height: 32px; background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
}
.layui-side .side-logo .logo-text {
  color: #f1f5f9; font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden;
}
.layui-side .side-logo .logo-ver {
  font-size: 10px; color: #64748b; margin-left: 4px; white-space: nowrap;
}

/* Sidebar Toggle */
.sidebar-toggle {
  position: absolute; top: 16px; right: -12px; z-index: 300;
  width: 24px; height: 24px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; color: #64748b;
  transition: all var(--transition); box-shadow: var(--shadow-sm);
}
.sidebar-toggle:hover { color: var(--primary); border-color: var(--primary); box-shadow: var(--shadow); }

/* Sidebar Scroll */
.layui-side-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 0 16px;
}
.layui-side-scroll::-webkit-scrollbar { width: 3px; }
.layui-side-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

/* Sidebar Search */
.sidebar-search {
  margin: 0 12px 8px; position: relative;
}
.sidebar-search input {
  width: 100%; height: 34px; padding: 0 12px 0 34px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05);
  color: #e2e8f0; font-size: 13px; outline: none;
  transition: all var(--transition);
}
.sidebar-search input::placeholder { color: #64748b; }
.sidebar-search input:focus { border-color: var(--primary); background: rgba(255,255,255,.08); }
.sidebar-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #64748b; font-size: 14px; pointer-events: none;
}

/* Sidebar Nav */
.side-nav { list-style: none; }
.side-nav .nav-section { margin-bottom: 2px; }

/* Sidebar Section Header */
.side-nav .nav-group {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px 4px; margin-top: 6px;
  color: var(--sidebar-title); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  cursor: pointer; user-select: none; transition: color var(--transition);
}
.side-nav .nav-group:hover { color: #94a3b8; }
.side-nav .nav-group .group-arrow {
  margin-left: auto; font-size: 10px; transition: transform var(--transition);
}
.side-nav .nav-group.collapsed .group-arrow { transform: rotate(-90deg); }

/* Sidebar Menu Items */
.side-nav .nav-item { display: block; }
.side-nav .nav-item a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px 9px 24px; margin: 1px 8px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; border-radius: 6px;
  transition: all var(--transition); white-space: nowrap; overflow: hidden;
}
.side-nav .nav-item.sub-item a { padding-left: 36px; }
.side-nav .nav-item a:hover {
  background: var(--sidebar-hover); color: #e2e8f0;
}
.side-nav .nav-item.active a {
  background: var(--sidebar-active); color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.side-nav .nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* Collapsed Section */
.side-nav .nav-section.collapsed .nav-item { display: none; }

/* Separator */
.side-nav .nav-separator {
  height: 1px; background: rgba(255,255,255,.06);
  margin: 8px 16px;
}

/* ===== Collapsed Sidebar ===== */
.layui-layout-admin.sidebar-collapsed { --sidebar-w: var(--sidebar-collapsed-w); }
.layui-layout-admin.sidebar-collapsed .side-logo .logo-text,
.layui-layout-admin.sidebar-collapsed .side-logo .logo-ver,
.layui-layout-admin.sidebar-collapsed .sidebar-search,
.layui-layout-admin.sidebar-collapsed .nav-group .group-arrow,
.layui-layout-admin.sidebar-collapsed .nav-item a span { display: none; }
.layui-layout-admin.sidebar-collapsed .side-logo { justify-content: center; padding: 0; }
.layui-layout-admin.sidebar-collapsed .nav-group {
  justify-content: center; padding: 10px 0 4px; font-size: 0; overflow: hidden;
}
.layui-layout-admin.sidebar-collapsed .nav-item a {
  justify-content: center; padding: 10px 0; margin: 1px 12px;
}
.layui-layout-admin.sidebar-collapsed .nav-item .nav-icon {
  font-size: 18px; width: auto;
}
.layui-layout-admin.sidebar-collapsed .nav-item a {
  position: relative;
}
.layui-layout-admin.sidebar-collapsed .nav-item a:hover::after {
  content: attr(data-title);
  position: absolute; left: 68px; top: 50%; transform: translateY(-50%);
  background: #1e293b; color: #fff; padding: 5px 10px;
  border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 300;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.layui-layout-admin.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }

/* ===== Main Content Area ===== */
.screen { display: none; }
.screen.active { display: block; flex: 1; overflow-y: auto; padding: 16px 20px; }
.page { display: none; }
.page.active { display: block; }

/* ===== Tab Bar ===== */
.tab-bar {
  display: flex; align-items: center; background: #fff;
  border-bottom: 1px solid #e5e7eb; padding: 0;
  min-height: 38px; overflow-x: auto; flex-shrink: 0;
}
.tab-scroll { display: flex; align-items: stretch; height: 100%; margin: 0; padding: 0 8px; }
.tab-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 12px; cursor: pointer;
  color: #6b7280; background: transparent;
  border-bottom: 2px solid transparent; white-space: nowrap;
  user-select: none; transition: all var(--transition);
  border-radius: 6px 6px 0 0; margin: 6px 1px 0;
}
.tab-item:hover { background: #f3f4f6; color: #374151; }
.tab-item.active { background: #eff6ff; color: var(--primary); font-weight: 500; border-bottom-color: var(--primary); }
.tab-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 4px;
  font-size: 12px; color: #9ca3af; cursor: pointer;
  margin-left: 2px; transition: all var(--transition);
}
.tab-close:hover { background: #fee2e2; color: var(--danger); }

/* ===== Login Screen ===== */
.login-screen {
  display: flex; justify-content: center; align-items: center;
  height: 100vh; background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
}
.login-box {
  background: #fff; border-radius: 16px; padding: 48px 40px;
  width: 380px; max-width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center;
}
.login-box h1 { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 6px; }
.login-box .login-subtitle { font-size: 13px; color: #94a3b8; margin-bottom: 32px; }

/* ===== Cards ===== */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 16px; overflow: hidden;
  border: 1px solid #e5e7eb;
}
.card-header {
  position: relative; height: 44px; line-height: 44px;
  padding: 0 16px; border-bottom: 1px solid #f1f5f9;
  color: #1e293b; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
  background: #fafbfc;
}
.card-title { font-size: 14px; font-weight: 600; color: #1e293b; }
.card-body { padding: 16px; }
.card-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 34px; padding: 0 14px; font-size: 13px; font-weight: 500;
  border: none; border-radius: 6px; cursor: pointer;
  white-space: nowrap; color: #fff; background: var(--primary);
  transition: all var(--transition); vertical-align: middle;
  line-height: 1;
}
.btn:hover { background: var(--primary-dark); box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn + .btn { margin-left: 6px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-normal { background: #6366f1; }
.btn-normal:hover { background: #4f46e5; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #1e293b; }
.btn-warning:hover { background: #d97706; }
.btn-outline {
  background: #fff; color: #4b5563; border: 1px solid #d1d5db;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 5px; }
.btn-xs { height: 24px; padding: 0 7px; font-size: 11px; border-radius: 4px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 14px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid #e5e7eb; }
table {
  width: 100%; background: #fff; color: #374151;
  border-collapse: collapse; font-size: 13px;
}
table th {
  text-align: left; font-weight: 600; background: #f8fafc;
  color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
  border-right: 1px solid #f1f5f9;
}
table td, table th {
  padding: 10px 14px; line-height: 1.4;
  border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9;
}
table td:last-child, table th:last-child { border-right: none; }
table tbody tr:hover { background: #f8fafc; }
table tbody tr:nth-child(even) { background: #fafbfc; }
.table-wrap table { border: none; border-radius: 0; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 13px; color: #4b5563;
  margin-bottom: 5px; font-weight: 500;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select {
  height: 36px; line-height: 1.4;
  border: 1px solid #d1d5db; background: #fff;
  border-radius: 6px; padding: 0 12px; font-size: 13px;
  color: #1e293b; width: 100%;
  transition: all var(--transition);
}
textarea.form-input { height: auto; min-height: 60px; padding: 8px 12px; resize: vertical; }
.form-input:hover, .form-select:hover { border-color: #94a3b8; }
.form-input:focus, .form-select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
select.form-select {
  padding-right: 32px; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.form-input[readonly], .form-input[disabled] { background: #f9fafb; color: #9ca3af; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 0; }
.form-row-2 > * { flex: 0 0 calc(50% - 5px); }
.form-row-3 > * { flex: 0 0 calc(33.333% - 7px); }

/* ===== Stats / Dashboard ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 20px 18px;
  text-align: center; box-shadow: var(--shadow-sm); border: 1px solid #e5e7eb;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card .stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: #1e293b; }
.stat-card .stat-label { font-size: 13px; color: #94a3b8; margin-top: 4px; }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger { border-left: 3px solid var(--danger); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.info { border-left: 3px solid var(--primary); }
.stat-card.info .stat-value { color: var(--primary); }

/* ===== Dashboard (Mini-Cloud) ===== */
.mc-dashboard { padding: 0; }
.mc-quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mc-quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 22px 14px; background: #fff; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; transition: all var(--transition);
  box-shadow: var(--shadow-sm); border: 1px solid #e5e7eb;
}
.mc-quick-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mc-quick-btn .mc-qb-icon { font-size: 30px; margin-bottom: 8px; }
.mc-quick-btn .mc-qb-label { font-size: 13px; color: #4b5563; font-weight: 500; }
.mc-quick-btn.sale { border-left: 3px solid var(--success); }
.mc-quick-btn.purchase { border-left: 3px solid var(--primary); }
.mc-quick-btn.receipt { border-left: 3px solid var(--warning); }
.mc-quick-btn.pay { border-left: 3px solid var(--danger); }
.mc-quick-btn.stock { border-left: 3px solid #8b5cf6; }

.mc-summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mc-summary-card {
  background: #fff; border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); border: 1px solid #e5e7eb;
}
.mc-summary-card .mc-sc-title { font-size: 13px; color: #94a3b8; margin-bottom: 8px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.mc-summary-card .mc-sc-val { font-size: 24px; font-weight: 700; color: #1e293b; }
.mc-summary-card .mc-sc-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.mc-summary-card.green { border-left: 3px solid var(--success); }
.mc-summary-card.red { border-left: 3px solid var(--danger); }
.mc-summary-card.blue { border-left: 3px solid var(--primary); }
.mc-summary-card.amber { border-left: 3px solid var(--warning); }

.mc-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mc-chart-row { margin-top: 12px; }
.mc-chart-row .card-body { padding: 8px; }

/* ===== Search / Filter Bar ===== */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-bar label { font-size: 13px; color: #6b7280; display: flex; align-items: center; gap: 4px; font-weight: 500; }
.filter-bar input[type="date"], .filter-bar select {
  height: 32px; border: 1px solid #d1d5db; border-radius: 6px; padding: 0 8px; font-size: 13px;
  background: #fff; color: #1e293b; transition: border-color var(--transition);
}
.filter-bar input[type="date"]:focus, .filter-bar select:focus { border-color: var(--primary); outline: none; }
.search-box {
  height: 32px; border: 1px solid #d1d5db; border-radius: 6px;
  padding: 0 10px; font-size: 13px; width: 220px; background: #fff; color: #1e293b;
  transition: border-color var(--transition);
}
.search-box:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,.5); z-index: 2000;
  display: none; justify-content: center; align-items: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-width: 92%; animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  height: 52px; line-height: 52px; padding: 0 20px;
  border-bottom: 1px solid #f1f5f9; display: flex;
  justify-content: space-between; align-items: center;
  background: #fafbfc; border-radius: 12px 12px 0 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; color: #1e293b; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; color: #9ca3af; cursor: pointer; padding: 4px; line-height: 1; border-radius: 6px; transition: all var(--transition); }
.modal-close:hover { color: var(--danger); background: #fef2f2; }
.modal-body { padding: 20px; max-height: 72vh; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 8px; background: #fafbfc; border-radius: 0 0 12px 12px; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0; flex-wrap: wrap; }
.pagination a, .pagination button, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid #d1d5db; border-radius: 6px;
  cursor: pointer; color: #4b5563; text-decoration: none;
  font-size: 13px; background: #fff; transition: all var(--transition);
}
.pagination a:hover:not(.active), .pagination button:hover:not(:disabled) { background: #f0f4ff; border-color: var(--primary); color: var(--primary); }
.pagination a.active, .pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a[style*="pointer-events:none"], .pagination button:disabled { color: #d1d5db !important; background: #f9fafb !important; border-color: #e5e7eb !important; cursor: not-allowed !important; }
th[onclick*="togglePagination"] { cursor: pointer; user-select: none; }
th[onclick*="togglePagination"]:hover { background: #eef2ff; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  padding: 10px 24px; border-radius: 8px; z-index: 9999;
  font-size: 14px; font-weight: 500;
  display: none; pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { display: block; animation: toastIn .3s ease; }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: 12px; font-size: 12px; line-height: 20px;
  font-weight: 500;
}
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-partial { background: #dbeafe; color: #2563eb; }
.badge-paid { background: #dcfce7; color: #16a34a; }
.badge-completed { background: #dcfce7; color: #16a34a; }
.badge-cancelled { background: #fee2e2; color: #dc2626; }
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-ordered { background: #ddd6fe; color: #6d28d9; }
.badge-returned { background: #fee2e2; color: #dc2626; }

/* ===== Detail View ===== */
.detail-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: #f8fafc;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid #e5e7eb; border-bottom: none;
}
.detail-title { font-size: 16px; font-weight: 700; color: #1e293b; }
.detail-body {
  border: 1px solid #e5e7eb; border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 18px; background: #fff;
}
.detail-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.detail-table td { padding: 7px 12px; font-size: 13px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.detail-table .dl { width: 100px; color: #94a3b8; white-space: nowrap; font-weight: 500; }
.detail-table .dv { color: #1e293b; }
.detail-table .ds { background: #f8fafc; color: #64748b; font-size: 11px; font-weight: 600; text-transform: uppercase; padding: 8px 12px; letter-spacing: .5px; }
.detail-table .dr { text-align: right; }
.detail-table .db { font-weight: 700; }
.detail-table .dd { color: var(--danger); }
.detail-table .dg { color: var(--success); }

/* Detail info grid */
.detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.detail-info-item { font-size: 13px; color: #6b7280; padding: 4px 0; }
.detail-info-item strong { color: #1e293b; margin-right: 4px; }

/* ===== Search Select Dropdown ===== */
.search-select-wrap { position: relative; }
.search-select-wrap input {
  width: 100%; height: 36px; border: 1px solid #d1d5db;
  border-radius: 6px; padding: 0 12px; font-size: 13px; color: #1e293b; background: #fff;
  transition: border-color var(--transition);
}
.search-select-wrap input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.search-select-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 220px; overflow-y: auto; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 8px;
  z-index: 500; box-shadow: var(--shadow-lg); display: none;
}
.search-select-dropdown .ss-item {
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--transition);
}
.search-select-dropdown .ss-item:hover { background: #f1f5f9; }
.search-select-dropdown .ss-item.selected { background: var(--primary); color: #fff; }

/* ===== Reports ===== */
.rpt-sections { display: flex; flex-direction: column; gap: 4px; }
.rpt-section { background: #fff; border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-sm); border: 1px solid #e5e7eb; }
.rpt-sec-title { font-size: 13px; color: #64748b; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.rpt-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.rpt-tab {
  display: inline-block; padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: #6b7280;
  background: #f3f4f6; transition: all var(--transition); user-select: none;
}
.rpt-tab:hover { background: #e0e7ff; color: var(--primary); }
.rpt-tab.active { background: var(--primary); color: #fff; }
.rpt-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; padding: 8px 0; }
.rpt-toolbar > * { flex-shrink: 0; }
.rpt-summary { margin-left: auto; font-size: 13px; color: #64748b; font-weight: 500; white-space: nowrap; }
.rpt-loading { text-align: center; padding: 40px; color: #9ca3af; font-size: 14px; }

/* ===== Settings Tabs ===== */
.settings-tabs { display: flex; gap: 2px; border-bottom: 2px solid #e5e7eb; margin-bottom: 16px; }
.stab {
  padding: 9px 20px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; font-size: 13px; color: #6b7280;
  transition: all var(--transition); font-weight: 500;
  border-radius: 8px 8px 0 0;
}
.stab:hover { color: #1e293b; background: #f9fafb; }
.stab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; background: #eff6ff; }

/* ===== Statements ===== */
.stmt-group { background: #f8fafc; padding: 8px 14px !important; font-size: 13px; border-bottom: 1px solid #e5e7eb; font-weight: 600; }
.stmt-group-row:hover { background: #f8fafc !important; }
.stmt-header { text-align: center; margin-bottom: 14px; }
.stmt-header h2 { margin: 0 0 6px; font-size: 18px; }
.stmt-meta { font-size: 13px; color: #6b7280; display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.stmt-summary-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.stmt-sum-item { flex: 1; min-width: 110px; background: #f8fafc; padding: 12px; border-radius: var(--radius); text-align: center; border: 1px solid #e5e7eb; }
.stmt-sum-item span { display: block; font-size: 11px; color: #94a3b8; font-weight: 500; }
.stmt-sum-item strong { font-size: 18px; }
.stmt-sum-item.up { border-top: 2px solid var(--success); }
.stmt-sum-item.up strong { color: var(--success); }
.stmt-sum-item.down { border-top: 2px solid var(--danger); }
.stmt-sum-item.down strong { color: var(--danger); }
.stmt-sum-item.end { border-top: 2px solid var(--primary); }
.stmt-sum-item.end strong { color: var(--primary); }
.stmt-table { width: 100%; border-collapse: collapse; }
.stmt-table th { background: #f8fafc; font-size: 12px; padding: 7px 10px; border: 1px solid #d1d5db; }
.stmt-table td { font-size: 13px; padding: 6px 10px; border: 1px solid #d1d5db; }
.stmt-table .stmt-opening td { background: #fafbfc; font-weight: 600; font-size: 13px; }
.stmt-table .stmt-total-row td { background: #eff6ff; font-weight: 700; border-top: 2px solid var(--primary); font-size: 13px; }
.stmt-footer { margin-top: 14px; font-size: 12px; color: #9ca3af; display: flex; justify-content: space-between; }

/* ===== Statement Product Blocks ===== */
.sp-blk { margin-bottom: 8px; border: 1px solid #e5e7eb; border-radius: var(--radius); overflow: hidden; }
.sp-blk-hd { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f8fafc; font-size: 13px; flex-wrap: wrap; }
.sp-blk-hd strong { color: var(--primary); }
.sp-blk-err { border-color: #fde2e2; }
.sp-blk-err .sp-blk-hd { background: #fef2f2; }
.sp-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.sp-tbl th { background: #fafbfc; padding: 6px 10px; text-align: left; font-size: 12px; color: #94a3b8; font-weight: 500; border-bottom: 1px solid #f1f5f9; }
.sp-tbl td { padding: 6px 10px; border-bottom: 1px solid #f8fafc; }
.sp-tbl .tr { text-align: right; }
.sp-sub td { background: #fafbfc; font-size: 12px; color: #94a3b8; border-bottom: none; }
.sp-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.sp-row-fin { background: #fafbfc; }
.sp-empty { padding: 14px; text-align: center; color: #d1d5db; font-size: 12px; }

/* ===== Toggle Switch ===== */
.toggle-group { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.toggle-group label:first-child { font-weight: 500; font-size: 13px; color: #1e293b; }
.switch { position: relative; display: inline-block; width: 46px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #d1d5db; border-radius: 24px; transition: .3s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* ===== Utility Classes ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-muted { color: #9ca3af; }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.font-bold, .fw6 { font-weight: 600; }
.fs16 { font-size: 16px; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.ml-8 { margin-left: 8px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-8 { gap: 8px; }
.empty-state { text-align: center; color: #9ca3af; padding: 40px !important; font-size: 14px; }
.tgreen { color: var(--success); font-weight: 600; }
.tred { color: var(--danger); font-weight: 600; }
.tmuted { color: #9ca3af; font-size: 12px; }

/* ===== Settings Tab Content ===== */
.settings-tab-content .card { margin-bottom: 0; }
.settings-tab-content .form-row { margin-bottom: 8px; }
.settings-tab-content label.form-label { font-size: 12px; color: #6b7280; margin-bottom: 4px; display: block; }
.settings-tab-content textarea { border: 1px solid #d1d5db; border-radius: 6px; padding: 8px 10px; font-size: 13px; resize: vertical; width: 100%; }
.settings-tab-content hr { border: none; border-top: 1px solid #e5e7eb; }

/* ===== Chart Grid ===== */
.mc-chart-grid .card .card-body { padding: 12px; }

/* ===== Offline Banner ===== */
#offline-banner {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  background: var(--danger); color: #fff; text-align: center;
  padding: 8px; z-index: 9999; font-size: 14px; font-weight: 500;
}

/* ===== Print ===== */
@media print {
  .layui-side, .layui-header, .tab-bar, .rpt-toolbar, #stmt-sum, .sidebar-toggle { display: none !important; }
  .layui-body { left: 0 !important; top: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
