/* AutoFlow数据化 - 主样式 */
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --sidebar-bg: #1e1e2e;
  --sidebar-item: #2d2d3d;
  --sidebar-item-hover: #3d3d4d;
  --main-bg: #f8fafc;
  --card-bg: #fff;
  --text: #334155;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: 100%;
}
body {
  font-family: 'Noto Sans SC', -apple-system, sans-serif;
  background: var(--main-bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

/* 工作台外层：主区 + 弹窗同组，备案 footer 紧随其后，避免 body 上其它 flex 子项打乱 margin-top:auto */
body.layout-app {
  min-height: 100vh;
  min-height: 100dvh;
}
.page-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.page-shell + footer.site-icp-global {
  margin-top: 0;
  flex-shrink: 0;
  align-self: stretch;
}

/* 工作台：侧栏 + 主区同一行，整体与底部备案上下排列 */
.dashboard-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  align-items: stretch;
}

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.sidebar-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}
.sidebar-logo.fallback.show {
  display: flex !important;
}
.sidebar-title { font-weight: 600; font-size: 15px; }
.sidebar-actions {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-secondary {
  background: var(--sidebar-item);
  color: #e2e8f0;
}
.btn-secondary:hover { background: var(--sidebar-item-hover); }

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  color: #94a3b8;
  text-decoration: none;
  transition: background 0.2s;
}
.nav-item:hover { background: var(--sidebar-item-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-item); color: #fff; }
.nav-badge { font-size: 12px; color: #64748b; }
.nav-item:hover .nav-badge { color: #94a3b8; }
.nav-badge-chevron {
  font-size: 18px;
  line-height: 1;
  font-weight: 300;
  color: #64748b;
  transform: translateY(-1px);
}
.nav-item:hover .nav-badge-chevron { color: #94a3b8; }

/* 主内容区 */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main-header {
  padding: 16px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.main-title { font-size: 18px; font-weight: 600; }
.search-box {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 220px;
  font-size: 14px;
}
.search-box:focus { outline: none; border-color: var(--primary); }
.main-content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}
.top-links {
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.top-links a,
.top-links .user-name {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}
.top-links a:hover { color: var(--primary); }
.top-links .user-name { margin-right: 4px; color: var(--text); }

/* 项目表格 */
.table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.table-header {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 88px minmax(0, 1fr) 120px;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.table-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 88px minmax(0, 1fr) 120px;
  gap: 12px;
  padding: 14px 16px;
  align-items: center;
  border-top: 1px solid var(--border);
  transition: background 0.2s;
}
.table-row:hover { background: #f8fafc; }
.table-row .actions { display: flex; gap: 8px; }
.table-row .actions a {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}
.table-row .actions a:hover { text-decoration: underline; }
.table-row .actions a.danger { color: #ef4444; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-illus {
  width: 180px;
  height: 140px;
  margin: 0 auto 20px;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.empty-state p { color: var(--text-muted); margin-bottom: 16px; }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.form-group select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background-color: var(--surface, #fff);
  color: var(--text);
  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='%2364748b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-group select:focus { outline: none; border-color: var(--primary); }
.form-group input:focus { outline: none; border-color: var(--primary); }
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* 全站底部备案（includes/site_icp_footer.php）：文档流底部水平居中，短页时贴视口底 */
.site-icp-global {
  position: static;
  width: 100%;
  max-width: 100%;
  margin-top: auto;
  flex-shrink: 0;
  align-self: stretch;
  z-index: 5;
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04);
}
.site-icp-global a {
  color: inherit;
  text-decoration: none;
}
.site-icp-global a:hover {
  color: var(--primary);
  text-decoration: underline;
}
.admin-layout .site-icp-global {
  background: #252631;
  color: #94a3b8;
  border-top-color: rgba(255, 255, 255, 0.08);
}
.admin-layout .site-icp-global a:hover {
  color: #e2e8f0;
}
.auth-body .site-icp-global {
  background: rgba(255, 255, 255, 0.96);
  border-top-color: #e2e8f0;
}
