/* ==========================================================================
   焱坤云商城 · 数字化营销魔方供应链系统
   基础样式：设计变量、通用组件、表单、表格、弹窗、提示
   全部手写，无任何第三方框架或图标库
   ========================================================================== */
:root {
  --brand: #0e7490;
  --brand-strong: #0b5d75;
  --brand-soft: #e3f4f8;
  --accent: #f59e0b;
  --ink: #0f2740;
  --ink-2: #334e68;
  --ink-3: #627d98;
  --ink-4: #94a9bd;
  --line: #e3eaf2;
  --line-strong: #d3deea;
  --bg: #f2f6fa;
  --card: #ffffff;
  --green: #0f9f6e;
  --green-soft: #e4f8f0;
  --red: #dc3d43;
  --red-soft: #fdecec;
  --amber: #b7791f;
  --amber-soft: #fdf3df;
  --blue: #2b6cb0;
  --blue-soft: #e8f1fb;
  --purple: #6b46c1;
  --purple-soft: #f0ebfb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 39, 64, .06);
  --shadow: 0 10px 30px rgba(15, 39, 64, .08);
  --shadow-lg: 0 24px 70px rgba(8, 24, 42, .22);
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; border-spacing: 0; width: 100%; }
[hidden] { display: none !important; }

::selection { background: #bfe6ef; color: var(--ink); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c6d4e2; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a9bccf; background-clip: content-box; }

:focus-visible { outline: 2px solid rgba(14, 116, 144, .55); outline-offset: 2px; }

/* ---------------- 图标 ---------------- */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #0e7490, #0a617b); color: #fff; box-shadow: 0 6px 16px rgba(14, 116, 144, .24); }
.btn-primary:hover { background: linear-gradient(135deg, #0b6a84, #085a72); color: #fff; }
.btn-accent { background: linear-gradient(135deg, #f59e0b, #dd8a05); color: #fff; box-shadow: 0 6px 16px rgba(221, 138, 5, .22); }
.btn-accent:hover { color: #fff; filter: brightness(.97); }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { border-color: #b9cbdc; color: var(--ink); background: #f7fafd; }
.btn-danger { background: #fff; border-color: #f1c2c4; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-danger-solid { background: linear-gradient(135deg, #e14b50, #c83238); color: #fff; }
.btn-text { color: var(--brand); height: 30px; padding: 0 6px; font-weight: 600; }
.btn-text:hover { background: var(--brand-soft); border-radius: 7px; }
.btn-text.danger { color: var(--red); }
.btn-text.danger:hover { background: var(--red-soft); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--red); margin-left: 2px; }
.input, .select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
  outline: none;
}
.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23627d98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.input:hover, .select:hover { border-color: #b8cbdd; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 116, 144, .13); }
.input::placeholder { color: #a4b6c7; }
.input[readonly], .input:disabled, .select:disabled { background: #f5f8fb; color: var(--ink-3); cursor: not-allowed; }
.field-hint { font-size: 11.5px; color: var(--ink-4); }
.field-error { font-size: 12px; color: var(--red); min-height: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.input-group { position: relative; }
.input-group .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-4); }
.input-group .input { padding-left: 38px; }
.input-group .toggle-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink-4); border-radius: 7px; }
.input-group .toggle-eye:hover { background: #f0f5fa; color: var(--ink-2); }

/* ---------------- 徽标 / 状态 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-green { color: #087a55; background: var(--green-soft); }
.badge-amber { color: #9a6208; background: var(--amber-soft); }
.badge-red { color: #bd2d33; background: var(--red-soft); }
.badge-blue { color: #245e9c; background: var(--blue-soft); }
.badge-purple { color: #5b3aa8; background: var(--purple-soft); }
.badge-gray { color: #5e7386; background: #eef3f8; }
.badge-teal { color: #0b6a84; background: var(--brand-soft); }

/* ---------------- 数据表格 ---------------- */
.table-wrap { width: 100%; overflow: auto; border-radius: 12px; }
table.data { min-width: 100%; font-size: 13px; }
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 13px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--ink-3);
  background: #f6f9fc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data tbody td {
  padding: 12px 13px;
  border-bottom: 1px solid #edf2f7;
  color: var(--ink-2);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: #f8fbfd; }
table.data .cell-strong { color: var(--ink); font-weight: 600; }
table.data .cell-main { color: var(--ink); font-weight: 600; }
table.data .cell-sub { display: block; font-size: 11.5px; color: var(--ink-4); margin-top: 1px; }
table.data .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.actions .btn-text { margin-left: 2px; }
table.data.compact tbody td { padding: 9px 12px; }
table.data.compact thead th { padding: 9px 12px; }
.table-link { color: var(--brand); font-weight: 600; cursor: pointer; }
.table-link:hover { text-decoration: underline; }
.row-warn td { background: #fffaf0; }
.row-warn:hover td { background: #fff6e6 !important; }

/* ---------------- 卡片 / 空态 / 加载 ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #eef3f8; }
.card-head h3 { font-size: 14.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12px; color: var(--ink-4); font-weight: 400; }
.card-body { padding: 18px 20px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 46px 20px; color: var(--ink-4); font-size: 13px; text-align: center; }
.empty .icon { width: 34px; height: 34px; color: #c3d2e0; stroke-width: 1.3; }
.empty strong { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 80px 20px; color: var(--ink-4); font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid #d8e4ee; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #eef3f8 25%, #f7fafc 37%, #eef3f8 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------------- 弹窗 ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-mask { position: absolute; inset: 0; background: rgba(8, 22, 38, .48); backdrop-filter: blur(3px); animation: fadeIn .18s ease; }
.modal {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modalUp .22s cubic-bezier(.2, .8, .3, 1);
  overflow: hidden;
}
.modal.modal-sm { width: min(460px, 100%); }
.modal.modal-lg { width: min(860px, 100%); }
.modal.modal-xl { width: min(1080px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 19px 22px 15px; border-bottom: 1px solid #eef3f8; }
.modal-head h3 { font-size: 16px; font-weight: 700; color: var(--ink); }
.modal-head .sub { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.modal-close { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-4); }
.modal-close:hover { background: #f1f5f9; color: var(--ink); }
.modal-body { padding: 20px 22px; overflow: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid #eef3f8; background: #fbfdff; }
.modal-foot .left { margin-right: auto; font-size: 12px; color: var(--ink-4); }
.modal.is-drawer {
  margin-left: auto;
  width: min(760px, 100%);
  height: 100%;
  max-height: 100vh;
  border-radius: 16px 0 0 16px;
  animation: drawerIn .26s cubic-bezier(.2, .8, .3, 1);
}
.modal-root.is-drawer-root { padding: 0; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalUp { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes drawerIn { from { transform: translateX(40px); opacity: .4; } }
@media (max-width: 640px) {
  .modal-root { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal.is-drawer { border-radius: 16px 16px 0 0; width: 100%; }
}

/* ---------------- 轻提示 ---------------- */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  max-width: 560px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(8, 24, 42, .18);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  animation: toastIn .2s ease;
  pointer-events: auto;
}
.toast .icon { width: 17px; height: 17px; }
.toast-success .icon { color: var(--green); }
.toast-error .icon { color: var(--red); }
.toast-warn .icon { color: var(--accent); }
.toast-info .icon { color: var(--blue); }
.toast.leaving { animation: toastOut .18s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------------- 描述列表 / 进度 / 时间线 ---------------- */
.desc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.desc-item { background: #fff; padding: 11px 14px; min-width: 0; }
.desc-item .k { font-size: 11.5px; color: var(--ink-4); margin-bottom: 2px; }
.desc-item .v { font-size: 13px; color: var(--ink); font-weight: 600; word-break: break-all; }
@media (max-width: 560px) { .desc-grid { grid-template-columns: 1fr; } }
.progress { height: 7px; border-radius: 99px; background: #edf2f7; overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #12a4b8, #0e7490); }
.progress.warn > i { background: linear-gradient(90deg, #f6b73c, #e08a00); }
.progress.danger > i { background: linear-gradient(90deg, #ef6b70, #d02f36); }

/* ---------------- 工具类 ---------------- */
.muted { color: var(--ink-4); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-brand { color: var(--brand); }
.small { font-size: 12px; }

/* ---------------- 打印 ---------------- */
@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .no-print { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
}
