/* ============================================================
   焱坤云订单系统 · 基础样式（自研，无任何第三方 UI 框架）
   ============================================================ */

:root {
  --brand: #e8562a;
  --brand-strong: #cf461c;
  --brand-soft: #fdf1ec;
  --brand-line: #f6d3c6;
  --navy: #101a2e;
  --navy-2: #18263f;
  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --ink: #131c2e;
  --text: #263042;
  --muted: #6c7789;
  --line: #e4e9f2;
  --line-strong: #d3dae7;
  --success: #0f996e;
  --success-soft: #e7f7f1;
  --warn: #c47a10;
  --warn-soft: #fdf4e3;
  --danger: #d33636;
  --danger-soft: #fdecec;
  --info: #2b62d9;
  --info-soft: #eaf0fd;
  --violet: #7048c6;
  --violet-soft: #f1ecfc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 26, 46, 0.06);
  --shadow: 0 2px 4px rgba(16, 26, 46, 0.04), 0 18px 40px -28px rgba(16, 26, 46, 0.4);
  /* 全部为系统预置字体，仅按名称引用，不内嵌任何字体文件，无授权与体积风险。 */
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Courier New", monospace;
}

[data-theme="dark"] {
  --brand: #ff7a45;
  --brand-strong: #ff8f62;
  --brand-soft: rgba(255, 122, 69, 0.14);
  --brand-line: rgba(255, 122, 69, 0.32);
  --navy: #0a1220;
  --navy-2: #101c30;
  --bg: #0a1220;
  --surface: #111c2e;
  --surface-2: #0e1828;
  --surface-3: #17233a;
  --ink: #eef2f9;
  --text: #cdd6e4;
  --muted: #8b98ac;
  --line: #1f2c43;
  --line-strong: #2b3b57;
  --success: #34c795;
  --success-soft: rgba(52, 199, 149, 0.13);
  --warn: #f0b355;
  --warn-soft: rgba(240, 179, 85, 0.13);
  --danger: #f27272;
  --danger-soft: rgba(242, 114, 114, 0.13);
  --info: #6d9bff;
  --info-soft: rgba(109, 155, 255, 0.14);
  --violet: #a98bf0;
  --violet-soft: rgba(169, 139, 240, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 24px 50px -30px rgba(0, 0, 0, 0.9);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3,
h4,
h5,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

::selection {
  background: var(--brand);
  color: #fff;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------ 通用 ------------------------------ */

.muted {
  color: var(--muted);
}
.strong {
  color: var(--ink);
  font-weight: 600;
}
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}
.mono {
  font-family: var(--mono);
}
.center {
  text-align: center;
}
.right {
  text-align: right;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flex {
  display: flex;
  align-items: center;
  gap: 10px;
}
.flex-1 {
  flex: 1;
  min-width: 0;
}
.wrap {
  flex-wrap: wrap;
}
.gap-8 {
  gap: 8px;
}
.hide {
  display: none !important;
}
.small {
  font-size: 12px;
}
.money {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}
.money.plus {
  color: var(--success);
}

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn.primary {
  background: linear-gradient(135deg, var(--brand), #f07a3c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(232, 86, 42, 0.8);
}
.btn.primary:hover {
  color: #fff;
  filter: brightness(1.04);
  box-shadow: 0 10px 22px -10px rgba(232, 86, 42, 0.9);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.btn.ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: transparent;
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(211, 54, 54, 0.3);
  background: var(--danger-soft);
}
.btn.danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}
.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 7px;
}
.btn.lg {
  height: 44px;
  padding: 0 22px;
  font-size: 15px;
}
.btn.block {
  width: 100%;
}
.btn.link {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 500;
}
.btn.link:hover {
  background: none;
  text-decoration: underline;
}
.btn.icon {
  width: 36px;
  padding: 0;
}

/* ------------------------------ 表单 ------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.field > label .req,
.req {
  color: var(--danger);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232, 86, 42, 0.12);
}
.input:disabled,
.select:disabled {
  background: var(--surface-2);
  color: var(--muted);
}
.textarea {
  height: auto;
  min-height: 88px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.6;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.input-group {
  display: flex;
  align-items: center;
  position: relative;
}
.input-group .input {
  padding-left: 34px;
}
.input-group .input-icon {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.checkbox input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .span-2 {
  grid-column: span 2;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
}

/* ------------------------------ 卡片 ------------------------------ */

.card {
  background: var(--surface);
  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 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-head .sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.card-body {
  padding: 18px;
}
.card-body.tight {
  padding: 0;
}

/* ------------------------------ 徽标 ------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--muted);
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge.success {
  background: var(--success-soft);
  color: var(--success);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge.info {
  background: var(--info-soft);
  color: var(--info);
}
.badge.primary {
  background: var(--brand-soft);
  color: var(--brand);
}
.badge.violet {
  background: var(--violet-soft);
  color: var(--violet);
}
.badge.muted {
  background: var(--surface-3);
  color: var(--muted);
}
.badge.plain::before {
  display: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.tag.brand {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: var(--brand);
}

/* ------------------------------ 表格 ------------------------------ */

.table-wrap {
  width: 100%;
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr {
  transition: background 0.14s ease;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table .t-right {
  text-align: right;
}
.table .t-center {
  text-align: center;
}
.table .col-check {
  width: 38px;
  text-align: center;
}
.table .actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}
.table .actions .btn.link {
  font-size: 12.5px;
  padding: 0 4px;
}
.table .row-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.table tr.is-selected {
  background: var(--brand-soft);
}

/* ------------------------------ 分页 ------------------------------ */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pager-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
}
.page-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.page-btn.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ------------------------------ 弹窗 ------------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 16, 28, 0.52);
  backdrop-filter: blur(2px);
  animation: fade-in 0.18s ease;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal.wide {
  width: min(860px, 100%);
}
.modal.xwide {
  width: min(1040px, 100%);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
}
.modal-head h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.modal-head p {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}
.modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.modal-close:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.modal-body {
  padding: 4px 20px 18px;
  overflow: auto;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}
.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 890;
  background: rgba(9, 16, 28, 0.45);
  animation: fade-in 0.18s ease;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 895;
  width: min(560px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px -30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  animation: slide-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-body {
  padding: 20px;
  overflow: auto;
  flex: 1;
}
.drawer-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}
@keyframes slide-in {
  from {
    transform: translateX(40px);
    opacity: 0.6;
  }
}

/* ------------------------------ Toast ------------------------------ */

.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease;
  max-width: min(520px, 90vw);
}
.toast.success {
  background: #0d7a58;
}
.toast.error {
  background: #b62b2b;
}
.toast.warn {
  background: #a3650a;
}
.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ------------------------------ 空态 / 骨架 ------------------------------ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 46px 20px;
  color: var(--muted);
  font-size: 13px;
}
.empty svg {
  width: 46px;
  height: 46px;
  opacity: 0.35;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
  min-height: 14px;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* ------------------------------ 标签页 ------------------------------ */

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 0 4px;
}
.tab {
  position: relative;
  padding: 10px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}
.tab:hover {
  color: var(--ink);
}
.tab.on {
  color: var(--brand);
}
.tab.on::after {
  background: var(--brand);
}
.tab .count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab.on .count {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ------------------------------ 提示条 ------------------------------ */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12.5px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.notice svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}
.notice.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.notice.brand {
  background: var(--brand-soft);
  color: var(--brand);
}
.notice.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ------------------------------ 打印 ------------------------------ */

@media print {
  body {
    background: #fff !important;
  }
  .sidebar,
  .topbar,
  .footer,
  .page-head,
  .no-print,
  .toast-wrap,
  .overlay,
  .drawer,
  .drawer-mask {
    display: none !important;
  }
  .app-main,
  .app-body,
  .view,
  main {
    margin: 0 !important;
    padding: 0 !important;
  }
  .card {
    border: 0;
    box-shadow: none;
  }
  .print-area {
    display: block !important;
    width: 100%;
  }
  .print-sheet {
    box-shadow: none !important;
    border: 0 !important;
    margin: 0 auto !important;
    page-break-inside: avoid;
  }
  @page {
    margin: 10mm;
  }
}
