/* ========================================
   速哒哒OA一体化 设计系统 - shared.css
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root{
  --primary:#2563EB;
  --primary-dark:#1d3a8a;
  --primary-light:#EFF6FF;
  --secondary:#F97316;
  --success:#16a34a;
  --danger:#dc2626;
  --warning:#d97706;
  --text-primary:#0f172a;
  --text-secondary:#475569;
  --text-muted:#94a3b8;
  --bg:#f1f5f9;
  --bg-card:#ffffff;
  --border:#e2e8f0;
  --sidebar-w:220px;
  --header-h:56px;
  --nav-h:60px;
  --radius-sm:8px;
  --radius:12px;
  --radius-lg:16px;
  --shadow-sm:0 1px 3px rgba(0,0,0,0.06),0 1px 2px rgba(0,0,0,0.04);
  --shadow:0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:0 10px 32px rgba(0,0,0,0.12);
  --transition:0.2s ease;
}

*{margin:0;padding:0;box-sizing:border-box}
body{
  font-family:'Inter',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  background:var(--bg);color:var(--text-primary);font-size:14px;line-height:1.5;
  -webkit-font-smoothing:antialiased;
}

/* ========== 顶部 Header ========== */
.g-header{
  position:fixed;top:0;left:0;right:0;height:var(--header-h);
  background:linear-gradient(135deg,var(--primary-dark) 0%,var(--primary) 100%);
  color:#fff;display:flex;align-items:center;justify-content:space-between;
  padding:0 16px 0 52px;z-index:200;
  box-shadow:0 2px 12px rgba(37,99,235,0.35);
}
@media(min-width:768px){.g-header{padding-left:calc(var(--sidebar-w) + 24px)}}
.g-header-title{font-size:16px;font-weight:600;letter-spacing:0.3px}
.g-header-actions{display:flex;align-items:center;gap:8px}

/* ========== 侧边导航 ========== */
.g-sidebar{
  position:fixed;left:0;top:0;bottom:0;width:var(--sidebar-w);
  background:linear-gradient(180deg,#0f1b4c 0%,#1a2f7a 60%,#1e3a8a 100%);
  z-index:300;display:flex;flex-direction:column;
  transform:translateX(-100%);transition:transform 0.3s ease;
  box-shadow:4px 0 20px rgba(0,0,0,0.2);
}
.g-sidebar.open{transform:translateX(0)}
@media(min-width:768px){
  .g-sidebar{transform:translateX(0)}
  .g-header{padding-left:calc(var(--sidebar-w) + 24px)}
  .g-layout{margin-left:var(--sidebar-w)}
}
.g-sidebar-logo{
  padding:22px 20px 18px;border-bottom:1px solid rgba(255,255,255,0.08);
  display:flex;align-items:center;gap:12px;
}
.g-sidebar-logo-icon{
  width:38px;height:38px;border-radius:10px;
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  box-shadow:0 4px 12px rgba(37,99,235,0.4);
}
.g-sidebar-logo-icon svg{width:20px;height:20px;fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.g-sidebar-logo-text{color:#fff;font-size:15px;font-weight:700;letter-spacing:0.3px}
.g-sidebar-logo-sub{color:rgba(255,255,255,0.45);font-size:11px;margin-top:1px}

.g-sidebar-nav{flex:1;padding:12px 10px;overflow-y:auto}
.g-sidebar-nav::-webkit-scrollbar{width:4px}
.g-sidebar-nav::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.1);border-radius:2px}
.g-nav-section{font-size:11px;color:rgba(255,255,255,0.35);letter-spacing:1px;text-transform:uppercase;padding:12px 10px 6px;font-weight:600}
.g-nav-item{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:var(--radius-sm);
  color:rgba(255,255,255,0.65);text-decoration:none;
  font-size:13.5px;font-weight:500;cursor:pointer;
  transition:all var(--transition);margin-bottom:2px;
}
.g-nav-item:hover{background:rgba(255,255,255,0.08);color:#fff}
.g-nav-item.active{
  background:linear-gradient(135deg,rgba(59,130,246,0.5),rgba(37,99,235,0.3));
  color:#fff;box-shadow:0 2px 8px rgba(37,99,235,0.2);
  border:1px solid rgba(99,155,255,0.2);
}
.g-nav-item svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}

.g-sidebar-footer{padding:14px 12px;border-top:1px solid rgba(255,255,255,0.08)}
.g-logout-btn{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:10px 12px;border-radius:var(--radius-sm);
  color:rgba(255,255,255,0.55);background:none;border:none;cursor:pointer;
  font-size:13.5px;font-family:inherit;transition:all var(--transition);
}
.g-logout-btn:hover{background:rgba(220,38,38,0.15);color:#fca5a5}
.g-logout-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* ========== 遮罩 ========== */
.g-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:299;
  display:none;backdrop-filter:blur(2px);
}
.g-overlay.show{display:block}

/* ========== 菜单按钮 ========== */
.g-menu-btn{
  position:fixed;left:14px;top:14px;
  width:28px;height:28px;
  background:rgba(255,255,255,0.2);border:none;border-radius:6px;
  color:#fff;cursor:pointer;z-index:201;
  display:flex;align-items:center;justify-content:center;
  transition:all var(--transition);
}
.g-menu-btn:hover{background:rgba(255,255,255,0.3)}
.g-menu-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
@media(min-width:768px){.g-menu-btn{display:none}}

/* ========== 主内容区 ========== */
.g-layout{padding-top:var(--header-h);min-height:100vh}
@media(max-width:767px){.g-layout{padding-bottom:var(--nav-h)}}

.g-content{padding:16px;max-width:1400px;margin:0 auto}

/* ========== 底部 Tab 导航（移动端）========== */
.g-tabbar{
  position:fixed;bottom:0;left:0;right:0;height:var(--nav-h);
  background:#fff;border-top:1px solid var(--border);
  display:flex;z-index:200;
  box-shadow:0 -4px 16px rgba(0,0,0,0.06);
}
@media(min-width:768px){.g-tabbar{display:none}}
.g-tab-item{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;cursor:pointer;transition:all var(--transition);text-decoration:none;
  color:var(--text-muted);
}
.g-tab-item.active{color:var(--primary)}
.g-tab-item svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.g-tab-label{font-size:11px;font-weight:500}

/* ========== 卡片 ========== */
.g-card{background:var(--bg-card);border-radius:var(--radius);box-shadow:var(--shadow-sm);margin-bottom:16px;overflow:hidden;border:1px solid var(--border)}
.g-card-head{
  padding:16px 20px;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;
}
.g-card-title{font-size:15px;font-weight:600;color:var(--text-primary)}
.g-card-body{padding:20px}

/* ========== 按钮 ========== */
.g-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:9px 18px;border-radius:var(--radius-sm);border:none;cursor:pointer;
  font-size:13.5px;font-weight:500;transition:all var(--transition);font-family:inherit;
}
.g-btn-primary{background:linear-gradient(135deg,var(--primary-dark),var(--primary));color:#fff;box-shadow:0 2px 8px rgba(37,99,235,0.3)}
.g-btn-primary:hover{transform:translateY(-1px);box-shadow:0 4px 14px rgba(37,99,235,0.4)}
.g-btn-success{background:linear-gradient(135deg,#15803d,#16a34a);color:#fff;box-shadow:0 2px 8px rgba(22,163,74,0.3)}
.g-btn-success:hover{transform:translateY(-1px)}
.g-btn-danger{background:linear-gradient(135deg,#b91c1c,#dc2626);color:#fff;box-shadow:0 2px 8px rgba(220,38,38,0.3)}
.g-btn-danger:hover{transform:translateY(-1px)}
.g-btn-ghost{background:transparent;color:var(--text-secondary);border:1.5px solid var(--border)}
.g-btn-ghost:hover{background:var(--bg);color:var(--text-primary)}
.g-btn svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ========== 表单控件 ========== */
.g-input,.g-select{
  width:100%;padding:10px 14px;
  border:1.5px solid var(--border);border-radius:var(--radius-sm);
  font-size:13.5px;color:var(--text-primary);background:#fff;outline:none;
  transition:all var(--transition);font-family:inherit;
}
.g-input:focus,.g-select:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,0.1)}
.g-select{appearance:none;cursor:pointer}

/* ========== Badge / Tag ========== */
.g-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:20px;font-size:12px;font-weight:500;gap:4px}
.g-badge-primary{background:#dbeafe;color:#1d4ed8}
.g-badge-success{background:#dcfce7;color:#15803d}
.g-badge-danger{background:#fee2e2;color:#b91c1c}
.g-badge-warning{background:#fef3c7;color:#b45309}
.g-badge-gray{background:#f1f5f9;color:#475569}

/* ========== 统计卡片 ========== */
.g-stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px}
.g-stat-card{
  background:#fff;border-radius:var(--radius);padding:16px;
  border:1px solid var(--border);box-shadow:var(--shadow-sm);
  transition:all var(--transition);cursor:default;
}
.g-stat-card:hover{box-shadow:var(--shadow);transform:translateY(-2px)}
.g-stat-icon{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;margin-bottom:10px}
.g-stat-icon svg{width:20px;height:20px;fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.g-stat-num{font-size:24px;font-weight:700;color:var(--text-primary);line-height:1}
.g-stat-label{font-size:12px;color:var(--text-muted);margin-top:4px}

/* ========== 分页 ========== */
.g-pagination{display:flex;align-items:center;justify-content:center;gap:6px;padding:16px 0}
.g-page-btn{
  min-width:34px;height:34px;padding:0 8px;border-radius:var(--radius-sm);
  border:1.5px solid var(--border);background:#fff;color:var(--text-secondary);
  font-size:13px;cursor:pointer;transition:all var(--transition);display:inline-flex;align-items:center;justify-content:center;
}
.g-page-btn:hover{border-color:var(--primary);color:var(--primary)}
.g-page-btn.active{background:var(--primary);border-color:var(--primary);color:#fff}
.g-page-btn:disabled{opacity:0.4;cursor:not-allowed}

/* ========== 搜索栏 ========== */
.g-search-bar{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.g-search-bar .g-input{flex:2;min-width:160px}
.g-search-bar .g-select{flex:1;min-width:120px}
.g-search-bar .g-btn{flex-shrink:0}

/* ========== 表格 ========== */
.g-table-wrap{overflow-x:auto}
.g-table{width:100%;border-collapse:collapse}
.g-table th{
  padding:11px 14px;text-align:left;font-size:12.5px;font-weight:600;
  color:var(--text-secondary);background:#f8fafc;
  border-bottom:1px solid var(--border);white-space:nowrap;
}
.g-table td{
  padding:12px 14px;font-size:13.5px;color:var(--text-primary);
  border-bottom:1px solid #f1f5f9;vertical-align:middle;
}
.g-table tr:last-child td{border-bottom:none}
.g-table tr:hover td{background:#fafbff}

/* ========== 状态 Tab ========== */
.g-tabs{display:flex;border-bottom:2px solid var(--border);gap:0;overflow-x:auto;padding-bottom:0}
.g-tabs::-webkit-scrollbar{height:0}
.g-tab-btn{
  padding:10px 18px;font-size:13.5px;font-weight:500;color:var(--text-muted);
  white-space:nowrap;cursor:pointer;border:none;background:none;
  border-bottom:2px solid transparent;margin-bottom:-2px;
  transition:all var(--transition);position:relative;font-family:inherit;
}
.g-tab-btn:hover{color:var(--text-primary)}
.g-tab-btn.active{color:var(--primary);border-bottom-color:var(--primary)}
.g-tab-count{
  display:inline-block;background:var(--danger);color:#fff;
  font-size:11px;padding:1px 5px;border-radius:10px;margin-left:5px;min-width:18px;text-align:center;
}

/* ========== loading skeleton ========== */
.g-skeleton{
  background:linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 50%,#f1f5f9 75%);
  background-size:200% 100%;animation:g-loading 1.4s infinite;border-radius:6px;
}
@keyframes g-loading{0%{background-position:200% 0}100%{background-position:-200% 0}}

/* ========== 空状态 ========== */
.g-empty{text-align:center;padding:40px 20px;color:var(--text-muted)}
.g-empty svg{width:48px;height:48px;stroke:var(--border);fill:none;stroke-width:1.5;margin-bottom:12px}
.g-empty p{font-size:14px}

/* ========== 动画 ========== */
@keyframes fadeInUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
.g-fade-in{animation:fadeInUp 0.3s ease forwards}

/* ========== 刷新按钮旋转 ========== */
@keyframes g-spin{to{transform:rotate(360deg)}}
.g-spin{animation:g-spin 1s linear infinite}

/* ========== 弹窗 Modal ========== */
.g-modal-backdrop{
  position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:500;
  display:none;align-items:center;justify-content:center;padding:20px;
  backdrop-filter:blur(4px);
}
.g-modal-backdrop.show{display:flex}
.g-modal{
  background:#fff;border-radius:var(--radius-lg);width:100%;max-width:520px;
  box-shadow:var(--shadow-lg);animation:fadeInUp 0.25s ease;max-height:90vh;display:flex;flex-direction:column;
}
.g-modal-head{padding:20px 24px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.g-modal-title{font-size:16px;font-weight:600}
.g-modal-close{width:30px;height:30px;border:none;background:var(--bg);border-radius:6px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text-muted);transition:all var(--transition)}
.g-modal-close:hover{background:var(--border);color:var(--text-primary)}
.g-modal-close svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.5}
.g-modal-body{padding:20px 24px;overflow-y:auto}
.g-modal-foot{padding:16px 24px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px;flex-shrink:0}

/* ========== 全局移动端优化 ========== */
html { overflow-x: hidden; }
body { min-width: 320px; }

/* ========== 响应式容器 ========== */
@media (max-width: 480px) {
  .g-content { padding: 12px; }
  .g-card-head { padding: 12px 14px; }
  .g-card-body { padding: 14px; }
}

/* ========== 统计卡片响应式 ========== */
.g-stat-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) {
  .g-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .g-stat-card { padding: 12px; }
  .g-stat-icon { width: 34px; height: 34px; margin-bottom: 8px; }
  .g-stat-icon svg { width: 16px; height: 16px; }
  .g-stat-num { font-size: 20px; }
  .g-stat-label { font-size: 11px; }
}

/* ========== 搜索栏响应式 ========== */
@media (max-width: 600px) {
  .g-search-bar { flex-direction: column; }
  .g-search-bar .g-input,
  .g-search-bar .g-select { width: 100%; flex: unset; min-width: unset; }
  .g-search-bar .g-btn { width: 100%; }
  .g-search-bar > * { width: 100%; flex: unset; }
}

/* ========== 表格响应式 ========== */
.g-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.g-table { min-width: 520px; }
@media (max-width: 600px) {
  .g-table th, .g-table td { padding: 9px 10px; font-size: 12px; }
}

/* ========== Modal 响应式 ========== */
.g-modal-backdrop { padding: 12px; align-items: flex-end; justify-content: center; }
@media (min-width: 480px) { .g-modal-backdrop { align-items: center; } }
.g-modal { max-width: 100%; width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
@media (min-width: 480px) {
  .g-modal { border-radius: var(--radius-lg); }
  .g-modal.modal-sm { max-width: 380px; }
  .g-modal.modal-md { max-width: 480px; }
}
.g-modal-head { padding: 16px 16px 14px; }
.g-modal-body { padding: 16px; max-height: 60vh; }
.g-modal-foot { padding: 14px 16px; flex-wrap: wrap; }
.g-modal-foot .g-btn { flex: 1; min-width: 80px; }

/* ========== 按钮响应式 ========== */
@media (max-width: 480px) {
  .g-btn { padding: 10px 14px; font-size: 13px; }
}

/* ========== 表单响应式 ========== */
@media (max-width: 480px) {
  .g-input, .g-select { padding: 11px 12px; font-size: 14px; }
}

/* ========== 分页响应式 ========== */
@media (max-width: 480px) {
  .g-pagination { gap: 4px; }
  .g-page-btn { min-width: 30px; height: 30px; font-size: 12px; padding: 0 6px; }
}

/* ========== Tab 响应式 ========== */
@media (max-width: 480px) {
  .g-tab-btn { padding: 9px 12px; font-size: 12.5px; }
}

/* ========== Toast ========== */
.g-toast{
  position:fixed;top:70px;left:50%;transform:translateX(-50%);
  background:#1e293b;color:#fff;padding:10px 18px;border-radius:var(--radius);
  font-size:13.5px;font-weight:500;z-index:600;
  animation:fadeInUp 0.3s ease;box-shadow:var(--shadow-lg);
  display:flex;align-items:center;gap:8px;max-width:calc(100vw - 32px);text-align:center;
  width:max-content;
}

/* ========== 明细列表 ========== */
.detail-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.detail-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}
.detail-item-head span:first-child {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
}
.detail-item-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.amount-add { color: var(--success); font-weight: 600; }
.amount-sub { color: var(--danger); font-weight: 600; }
.amount-set { color: var(--warning); font-weight: 600; }

/* ========== 按钮小尺寸 ========== */
.g-btn-sm {
  padding: 6px 12px !important;
  font-size: 12px !important;
}
