/* 精工智造 管理后台样式 */
:root {
  --adm-navy: #0f172a;
  --adm-navy-2: #16213d;
  --adm-navy-3: #1e2b4a;
  --adm-orange: #f97316;
  --adm-orange-dark: #ea580c;
  --adm-bg: #f4f6fb;
  --adm-card: #ffffff;
  --adm-line: #e5eaf3;
  --adm-text: #1f2937;
  --adm-muted: #6b7280;
  --adm-green: #15803d;
  --adm-green-bg: #e8f7ee;
  --adm-red: #b91c1c;
  --adm-red-bg: #fdecec;
  --adm-blue: #1d4ed8;
  --adm-blue-bg: #e9f0ff;
  --adm-yellow: #a16207;
  --adm-yellow-bg: #fdf6e3;
  --adm-radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--adm-bg);
  color: var(--adm-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--adm-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
img { max-width: 100%; }

/* 布局 */
.adm-shell { display: flex; min-height: 100vh; }
.adm-side {
  width: 244px; flex: 0 0 244px;
  background: var(--adm-navy); color: #cbd5e1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 40;
}
.adm-brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.adm-brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--adm-orange), #e11d48);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 19px;
}
.adm-brand-text { display: flex; flex-direction: column; line-height: 1.3; overflow: hidden; }
.adm-brand-text strong { color: #fff; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-brand-text small { color: #94a3b8; font-size: 11px; }
.adm-nav { padding: 12px 10px 24px; flex: 1; }
.adm-nav-group { margin-bottom: 14px; }
.adm-nav-label { font-size: 11px; letter-spacing: .12em; color: #64748b; padding: 8px 12px 4px; }
.adm-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; margin: 1px 0; border-radius: 8px;
  color: #cbd5e1; font-size: 13.5px; text-decoration: none;
  transition: background .15s, color .15s;
}
.adm-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.adm-nav-item.active { background: linear-gradient(90deg, rgba(249,115,22,.22), rgba(249,115,22,.06)); color: #fff; font-weight: 600; }
.adm-nav-item.active .adm-nav-dot { background: var(--adm-orange); box-shadow: 0 0 0 3px rgba(249,115,22,.2); }
.adm-nav-dot { width: 6px; height: 6px; border-radius: 50%; background: #475569; flex: 0 0 6px; }
.adm-side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.07); color: #64748b; font-size: 11px; }
.adm-main { flex: 1; min-width: 0; }
.adm-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--adm-line);
  padding: 12px 24px; min-height: 64px;
}
.adm-top-title { flex: 1; min-width: 0; }
.adm-top-title h1 { font-size: 18px; line-height: 1.3; }
.adm-top-title span { font-size: 12px; color: var(--adm-muted); }
.adm-top-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.adm-top-actions a { color: #374151; }
.adm-user { color: var(--adm-muted); }
.adm-logout { color: var(--adm-red) !important; }
.adm-menu-btn { display: none; border: 1px solid var(--adm-line); background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 16px; cursor: pointer; }
.adm-content { padding: 24px; max-width: 1500px; }
.adm-overlay { display: none; }

/* 通用块 */
.adm-card { background: var(--adm-card); border: 1px solid var(--adm-line); border-radius: var(--adm-radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.adm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--adm-line); flex-wrap: wrap; }
.adm-card-head h2 { font-size: 15px; }
.adm-card-head .sub { color: var(--adm-muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.adm-card-body { padding: 18px; }
.adm-card-body.tight { padding: 0; }
.adm-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.adm-page-head h2 { font-size: 19px; }
.adm-page-head p { margin: 4px 0 0; color: var(--adm-muted); font-size: 13px; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.adm-grid { display: grid; gap: 16px; }
.adm-grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.adm-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.adm-grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.adm-grid.cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.adm-mt { margin-top: 18px; }
.adm-muted { color: var(--adm-muted); }
.adm-small { font-size: 12px; }
.adm-nowrap { white-space: nowrap; }
.adm-right { text-align: right; }

/* 按钮 */
.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--adm-line);
  background: #fff; color: #374151; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.4; white-space: nowrap;
}
.adm-btn:hover { background: #f8fafc; text-decoration: none; }
.adm-btn-primary { background: var(--adm-orange); border-color: var(--adm-orange); color: #fff; }
.adm-btn-primary:hover { background: var(--adm-orange-dark); border-color: var(--adm-orange-dark); }
.adm-btn-dark { background: var(--adm-navy); border-color: var(--adm-navy); color: #fff; }
.adm-btn-dark:hover { background: #1e293b; }
.adm-btn-danger { color: var(--adm-red); border-color: #f3c8c8; background: #fff; }
.adm-btn-danger:hover { background: var(--adm-red-bg); }
.adm-btn-sm { padding: 5px 10px; font-size: 12px; }
.adm-btn-block { width: 100%; }
.adm-btn[disabled] { opacity: .6; cursor: not-allowed; }

/* 表单 */
.adm-form label { display: block; font-size: 12.5px; color: #475569; font-weight: 600; margin: 0 0 5px; }
.adm-form .hint { font-size: 12px; color: var(--adm-muted); margin-top: 4px; }
.adm-form input[type=text], .adm-form input[type=password], .adm-form input[type=email],
.adm-form input[type=number], .adm-form input[type=date], .adm-form input[type=datetime-local],
.adm-form input[type=file], .adm-form select, .adm-form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d7dee8; border-radius: 8px;
  font-size: 13.5px; font-family: inherit; color: var(--adm-text); background: #fff;
}
.adm-form textarea { min-height: 110px; resize: vertical; line-height: 1.65; }
.adm-form input:focus, .adm-form select:focus, .adm-form textarea:focus {
  outline: none; border-color: var(--adm-orange); box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.adm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.adm-form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.adm-form-grid .full { grid-column: 1 / -1; }
.adm-form-row { margin-bottom: 16px; }
.adm-check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; font-size: 13px !important; color: var(--adm-text) !important; }
.adm-check input { width: auto !important; }
.adm-check-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px 16px; }
.adm-inline-fields { display: flex; gap: 8px; align-items: center; }
.adm-field-note { font-size: 12px; color: var(--adm-muted); margin: 6px 0 0; }

/* 表格 */
.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th, .adm-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.adm-table th { font-size: 12px; color: #64748b; font-weight: 700; background: #f8fafc; white-space: nowrap; }
.adm-table tbody tr:hover { background: #fbfcfe; }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table .ops { text-align: right; white-space: nowrap; }
.adm-table .ops a, .adm-table .ops button { margin-left: 8px; }
.adm-table .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--adm-line); background: #f1f5f9; }
.adm-empty { padding: 42px 16px; text-align: center; color: var(--adm-muted); }
.adm-empty strong { display: block; color: #94a3b8; font-size: 30px; margin-bottom: 6px; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 1.7; background: #eef2f7; color: #475569; white-space: nowrap; }
.badge-1, .badge-paid, .badge-done, .badge-delivered, .badge-issued, .badge-in_use { background: var(--adm-green-bg); color: var(--adm-green); }
.badge-0, .badge-cancelled, .badge-void, .badge-scrapped, .badge-closed { background: #f1f5f9; color: #64748b; }
.badge-pending_payment, .badge-pending, .badge-planned, .badge-new { background: var(--adm-yellow-bg); color: var(--adm-yellow); }
.badge-pending_production, .badge-in_progress, .badge-processing, .badge-partial { background: var(--adm-blue-bg); color: var(--adm-blue); }
.badge-pending_shipment, .badge-shipped, .badge-after_sale { background: #fceef7; color: #9d174d; }
.badge-completed, .badge-unpaid { background: #eef2f7; color: #334155; }
.adm-progress { height: 5px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.adm-progress > span { display: block; height: 100%; background: var(--adm-orange); border-radius: 999px; }
.adm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; margin-right: 5px; vertical-align: middle; }
.adm-dot.on { background: #22c55e; }
.adm-dot.off { background: #cbd5e1; }

/* 提示 */
.adm-flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.adm-flash-success { background: var(--adm-green-bg); color: var(--adm-green); border-color: #bbf7d0; }
.adm-flash-error { background: var(--adm-red-bg); color: var(--adm-red); border-color: #fecaca; }
.adm-flash-info { background: var(--adm-blue-bg); color: var(--adm-blue); border-color: #bfdbfe; }
.adm-note { padding: 12px 14px; background: #f8fafc; border: 1px dashed #dbe3ee; border-radius: 9px; color: #475569; font-size: 12.5px; }
.adm-code { background: #f1f5f9; border-radius: 5px; padding: 1px 6px; font-size: 12px; }

/* 统计卡 */
.stat-card { background: #fff; border: 1px solid var(--adm-line); border-radius: var(--adm-radius); padding: 16px 18px; position: relative; overflow: hidden; }
.stat-card .label { font-size: 12px; color: var(--adm-muted); }
.stat-card .value { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat-card .foot { font-size: 11.5px; color: var(--adm-muted); margin-top: 4px; }
.stat-card::after { content: ""; position: absolute; right: -18px; top: -18px; width: 76px; height: 76px; border-radius: 50%; background: rgba(249,115,22,.07); }
.stat-card.blue::after { background: rgba(29,78,216,.07); }
.stat-card.green::after { background: rgba(21,128,61,.07); }
.stat-card.purple::after { background: rgba(126,34,206,.07); }

/* 筛选栏 */
.adm-filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--adm-line); }
.adm-filters .f { min-width: 150px; }
.adm-filters label { display: block; font-size: 11.5px; color: var(--adm-muted); margin-bottom: 4px; }
.adm-filters input, .adm-filters select { padding: 7px 10px; border: 1px solid #d7dee8; border-radius: 7px; font-size: 13px; }
.adm-filters input[type=text] { width: 220px; }

/* 分页 */
.adm-pager { display: flex; gap: 6px; padding: 14px 18px; flex-wrap: wrap; align-items: center; }
.adm-pager a, .adm-pager span { display: inline-block; min-width: 30px; text-align: center; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--adm-line); font-size: 12.5px; color: #374151; }
.adm-pager .current { background: var(--adm-navy); border-color: var(--adm-navy); color: #fff; }

/* 标签页 */
.adm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--adm-line); margin-bottom: 18px; flex-wrap: wrap; }
.adm-tabs a { padding: 9px 14px; font-size: 13px; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.adm-tabs a.active { color: var(--adm-orange-dark); border-color: var(--adm-orange); font-weight: 700; }
.adm-tabs a:hover { text-decoration: none; color: var(--adm-text); }

/* 图表 */
.trend-chart { display: flex; align-items: flex-end; gap: 5px; height: 150px; padding: 8px 4px 0; border-bottom: 1px solid var(--adm-line); }
.trend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 3px; position: relative; }
.trend-bar { background: linear-gradient(180deg, #f97316, #fb923c); border-radius: 3px 3px 0 0; min-height: 2px; }
.trend-bar.human { background: linear-gradient(180deg, #f97316, #fdba74); }
.trend-bar.ai { background: #7c3aed; }
.trend-bar.search { background: #2563eb; }
.trend-labels { display: flex; gap: 5px; margin-top: 6px; font-size: 10px; color: #94a3b8; }
.trend-labels span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--adm-muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 1.2fr) 2fr 52px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f97316, #fdba74); }
.bar-fill.blue { background: linear-gradient(90deg, #2563eb, #93c5fd); }
.bar-fill.purple { background: linear-gradient(90deg, #7c3aed, #c4b5fd); }
.bar-fill.green { background: linear-gradient(90deg, #15803d, #86efac); }
.bar-row .val { text-align: right; color: var(--adm-muted); font-variant-numeric: tabular-nums; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 内容编辑 */
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.editor-main, .editor-side { display: flex; flex-direction: column; gap: 16px; }
.editor-side { position: sticky; top: 80px; }
.image-preview { width: 100%; border-radius: 9px; border: 1px solid var(--adm-line); background: #f8fafc; aspect-ratio: 16/9; object-fit: cover; }
.seo-preview { background: #fff; border: 1px solid var(--adm-line); border-radius: 9px; padding: 12px 14px; }
.seo-preview .t { color: #1a0dab; font-size: 16px; line-height: 1.4; margin-bottom: 2px; }
.seo-preview .u { color: #15803d; font-size: 12px; margin-bottom: 3px; }
.seo-preview .d { color: #4b5563; font-size: 12.5px; line-height: 1.6; }

/* AI */
.ai-panel { background: linear-gradient(135deg, #0f172a, #1e2b4a); border-radius: 12px; color: #e2e8f0; padding: 18px; }
.ai-panel h3 { font-size: 15px; color: #fff; margin-bottom: 6px; }
.ai-panel p { margin: 0 0 12px; color: #94a3b8; font-size: 12.5px; }
.ai-result { display: none; }
.ai-result.show { display: block; }
.ai-log-item { border-bottom: 1px solid #eef2f7; padding: 10px 0; font-size: 12.5px; }
.ai-log-item:last-child { border-bottom: 0; }
.ai-log-item .meta { color: var(--adm-muted); font-size: 11.5px; }

/* 登录 */
.adm-login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 15% 15%, rgba(249,115,22,.16), transparent 40%),
              radial-gradient(circle at 85% 80%, rgba(37,99,235,.16), transparent 40%),
              #0b1220;
  padding: 24px;
}
.adm-login { width: 100%; max-width: 840px; display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.adm-login-brand { background: linear-gradient(150deg, #0f172a, #1e2b4a); padding: 44px 38px; color: #fff; display: flex; flex-direction: column; justify-content: center; }
.adm-login-brand .adm-brand-mark { width: 48px; height: 48px; font-size: 23px; margin-bottom: 18px; }
.adm-login-brand h1 { font-size: 23px; margin-bottom: 8px; }
.adm-login-brand p { color: #94a3b8; font-size: 13px; margin: 0; line-height: 1.7; }
.adm-login-card { background: #fff; padding: 38px 36px; display: flex; flex-direction: column; justify-content: center; }
.adm-login-card h2 { font-size: 19px; margin-bottom: 18px; }
.adm-login-card label { display: block; font-size: 12.5px; color: #475569; font-weight: 600; margin: 14px 0 6px; }
.adm-login-card input { width: 100%; padding: 11px 12px; border: 1px solid #d7dee8; border-radius: 9px; font-size: 14px; }
.adm-login-card input:focus { outline: none; border-color: var(--adm-orange); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }
.adm-login-card .adm-btn { margin-top: 20px; padding: 11px; font-size: 14px; }
.adm-login-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 11.5px; color: var(--adm-muted); }
.adm-denied { max-width: 520px; background: #fff; padding: 40px; border-radius: 16px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.15); }
.adm-denied strong { display: block; font-size: 52px; color: var(--adm-orange); letter-spacing: -.03em; }
.adm-denied h1 { font-size: 19px; margin: 10px 0; }
.adm-denied p { color: var(--adm-muted); margin-bottom: 20px; }

/* 订单详情 */
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv th { text-align: left; color: var(--adm-muted); font-weight: 500; padding: 7px 0; width: 92px; vertical-align: top; }
.kv td { padding: 7px 0; }
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: #e5eaf3; }
.timeline-item { position: relative; padding: 0 0 16px; font-size: 12.5px; }
.timeline-item::before { content: ""; position: absolute; left: -19px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--adm-orange); border: 2px solid #fff; box-shadow: 0 0 0 1px #f6c9a8; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .time { color: var(--adm-muted); font-size: 11.5px; }

/* 打印 */
.delivery-paper { background: #fff; max-width: 900px; margin: 20px auto; padding: 36px 40px; border: 1px solid #ddd; }
.delivery-paper h1 { font-size: 24px; text-align: center; letter-spacing: .2em; margin-bottom: 6px; }
.delivery-paper .dn-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: #555; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 16px; }
.delivery-paper table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.delivery-paper th, .delivery-paper td { border: 1px solid #999; padding: 7px 8px; }
.delivery-paper th { background: #f3f4f6; }
.delivery-paper .sign { display: flex; justify-content: space-between; margin-top: 34px; font-size: 12.5px; gap: 20px; }
.delivery-paper .sign div { flex: 1; border-top: 1px solid #999; padding-top: 8px; }
.print-bar { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
@media print {
  body { background: #fff; }
  .adm-side, .adm-top, .print-bar, .adm-flash { display: none !important; }
  .adm-main { margin: 0; }
  .adm-content { padding: 0; max-width: none; }
  .delivery-paper { border: 0; margin: 0; padding: 0; max-width: none; }
}

/* 响应式 */
@media (max-width: 1200px) {
  .adm-grid.cols-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .adm-grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .editor-split, .detail-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}
@media (max-width: 960px) {
  .adm-side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; }
  .adm-side.open { transform: translateX(0); }
  .adm-overlay.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .adm-menu-btn { display: inline-block; }
  .adm-content { padding: 16px; }
  .adm-top { padding: 10px 16px; }
  .adm-grid.cols-3, .adm-grid.cols-4, .adm-grid.cols-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .adm-login { grid-template-columns: 1fr; max-width: 440px; }
  .adm-login-brand { padding: 28px; }
}
@media (max-width: 640px) {
  .adm-grid.cols-2, .adm-grid.cols-3, .adm-grid.cols-4, .adm-grid.cols-5 { grid-template-columns: 1fr; }
  .adm-form-grid, .adm-form-grid.cols-3 { grid-template-columns: 1fr; }
  .adm-check-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .adm-top-actions .adm-user { display: none; }
  .stat-card .value { font-size: 22px; }
  .adm-content { padding: 12px; }
}