/* 千旺外贸管理系统 - 共用样式 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: #f1f5f9; color: #334155; font-size: 14px; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #0d9488; }
textarea { width: 100%; resize: vertical; }

.btn { padding: 8px 14px; border: 1px solid #d1d5db; background: #fff; border-radius: 8px; cursor: pointer; color: #475569; font-size: 13px; white-space: nowrap; }
.btn:hover { background: #f8fafc; }
.btn-primary { background: #0d9488; border-color: #0d9488; color: #fff; }
.btn-primary:hover { background: #0f766e; }
.btn-danger { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.muted { color: #94a3b8; }
.green { color: #16a34a; }
.red { color: #dc2626; }
.req { color: #dc2626; margin-left: 2px; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.b-green { background: #dcfce7; color: #15803d; }
.b-blue { background: #dbeafe; color: #1d4ed8; }
.b-gray { background: #f1f5f9; color: #64748b; }
.b-red { background: #fee2e2; color: #b91c1c; }
.b-orange { background: #ffedd5; color: #c2410c; }
.b-teal { background: #ccfbf1; color: #0f766e; }
.b-darkred { background: #7f1d1d; color: #fff; }
.b-cyan { background: #cffafe; color: #0e7490; }
.b-dark { background: #374151; color: #fff; }
tr.sum-row td { background: #f8fafc; border-top: 2px solid #e2e8f0; }

/* ---------- 客户管理 ---------- */
.cust-layout { display: flex; gap: 14px; align-items: flex-start; }
.cust-tree { width: 170px; flex-shrink: 0; background: #fff; border-radius: 12px; padding: 12px 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.tree-head { font-weight: bold; font-size: 14px; padding: 4px 10px 12px; display: flex; justify-content: space-between; align-items: center; }
.tree-gear { color: #94a3b8; cursor: pointer; font-size: 13px; }
.tree-item { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: #475569; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tree-item:hover { background: #f0fdfa; }
.tree-item.active { background: #0d9488; color: #fff; }
.tree-item.active .tree-count { background: rgba(255,255,255,.25); color: #fff; }
.tree-count { margin-left: auto; background: #f1f5f9; color: #64748b; border-radius: 999px; font-size: 11px; padding: 1px 8px; }
.tree-child { padding-left: 30px; font-size: 12px; }
.tree-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.modal-wide { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.q-items { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.q-items th { background: #f8fafc; padding: 8px; font-size: 12px; color: #64748b; text-align: left; }
.q-items td { padding: 6px; border-top: 1px solid #f1f5f9; }
.q-items select, .q-items input { width: 100%; padding: 7px 8px; }
.q-amt { font-weight: 600; color: #0f766e; white-space: nowrap; }
.q-total { text-align: right; padding: 10px 4px; color: #475569; font-size: 14px; }
.q-total b { color: #dc2626; font-size: 16px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.prod-img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e8f0; }
.prod-emoji { font-size: 28px; }
.cust-main { flex: 1; min-width: 0; }
.cust-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cust-count { color: #475569; font-size: 14px; margin-right: 6px; }
.cust-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; background: #fff; padding: 10px 12px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.cust-filter input { width: 190px; }
.cust-chips { display: flex; gap: 6px; margin-left: auto; }
.chip { padding: 4px 12px; border-radius: 6px; background: #f1f5f9; color: #64748b; font-size: 12px; cursor: pointer; }
.chip:hover { background: #e2e8f0; }
.chip.active { background: #f87171; color: #fff; }
.cust-table th { white-space: nowrap; }
.cust-table td { white-space: nowrap; }
.cust-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: #0f172a; }
.cust-email { max-width: 140px; overflow: hidden; text-overflow: ellipsis; color: #2563eb; }
.cust-track { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.c-no { width: 44px; color: #94a3b8; }
.c-check { width: 30px; text-align: center; }
.hint-red { color: #dc2626; font-size: 12px; }
.hint-green { color: #16a34a; font-size: 12px; }
.hint-gray { color: #94a3b8; font-size: 12px; }
.cust-pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; background: #fff; padding: 10px 12px; border-radius: 12px; font-size: 13px; color: #64748b; flex-wrap: wrap; }
.pager-num.active { background: #0d9488; color: #fff; border-color: #0d9488; }
.pager-input { width: 46px; padding: 5px 8px; text-align: center; }
.pager-dots { color: #94a3b8; }

@media (max-width: 768px) {
  .cust-layout { flex-direction: column; }
  .cust-tree { width: 100%; display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
  .tree-head { display: none; }
  .tree-item { flex-shrink: 0; }
  .cust-filter input { width: 100%; }
  .cust-chips { margin-left: 0; }
}

/* ---------- 布局（电脑版） ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: linear-gradient(180deg, #0f766e, #115e59); color: #fff; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 16px; font-size: 17px; font-weight: bold; letter-spacing: 1px; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; align-items: center; gap: 8px; }
.brand .logo { background: #fff; color: #0f766e; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
#nav { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 18px; cursor: pointer; color: rgba(255,255,255,.85); font-size: 14px; transition: background .15s; }
.nav-item:hover { background: rgba(255,255,255,.1); }
.nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: bold; border-right: 3px solid #5eead4; }
.nav-item.active-parent { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.nav-child { padding-left: 46px; font-size: 13px; }
.nav-item.nav-child .nav-icon { width: 16px; font-size: 12px; }
.nav-arrow { margin-left: auto; font-size: 11px; opacity: .7; }
.nav-icon { width: 20px; text-align: center; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.15); font-size: 12px; color: rgba(255,255,255,.6); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 1px 3px rgba(0,0,0,.06); z-index: 5; }
.topbar h1 { font-size: 17px; margin: 0; color: #0f172a; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: #64748b; font-size: 13px; }
#content { padding: 22px 24px; flex: 1; }
.loading { text-align: center; color: #94a3b8; padding: 60px 0; }

/* ---------- 工具栏 / 表格 ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; align-items: center; }
.toolbar .search { flex: 1; max-width: 340px; }
.table-wrap { background: #fff; border-radius: 12px; overflow-x: auto; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 14px; background: #f8fafc; color: #64748b; font-weight: 600; font-size: 13px; white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid #f1f5f9; font-size: 13px; }
tr:hover td { background: #f8fffd; }
.op-col { white-space: nowrap; text-align: right; }
.count-info { color: #94a3b8; font-size: 12px; margin-top: 10px; }

.empty { text-align: center; padding: 50px 0; color: #94a3b8; background: #fff; border-radius: 12px; margin-top: 12px; }
.empty.small { padding: 18px 0; margin: 0; }
.empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal-mask.show { display: flex; }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; font-weight: bold; font-size: 15px; }
.modal-close { cursor: pointer; color: #94a3b8; font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body label { display: block; font-size: 13px; color: #64748b; margin: 12px 0 4px; }
.modal-body input, .modal-body select { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- 控制台 ---------- */
.dash-hello { background: linear-gradient(90deg, #0d9488, #0ea5e9); color: #fff; border-radius: 12px; padding: 18px 22px; font-size: 15px; margin-bottom: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: transform .15s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-icon { font-size: 26px; }
.stat-num { font-size: 26px; font-weight: bold; color: #0f766e; margin-top: 6px; }
.stat-name { color: #94a3b8; font-size: 13px; margin-top: 2px; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { background: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.panel-head { font-weight: bold; font-size: 14px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #f8fafc; cursor: pointer; font-size: 13px; }
.todo-row:hover { background: #f8fffd; }
.todo-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-date { color: #94a3b8; font-size: 12px; }
.fin-row { display: flex; justify-content: space-between; padding: 8px 2px; font-size: 13px; border-bottom: 1px solid #f8fafc; }

/* ---------- 基础数据 / 统计 ---------- */
.base-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #f0fdfa; color: #0f766e; border: 1px solid #99f6e4; padding: 3px 12px; border-radius: 999px; font-size: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.bar-row span:first-child { width: 56px; color: #64748b; }
.bar { flex: 1; height: 12px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-in { height: 100%; background: linear-gradient(90deg, #14b8a6, #0d9488); border-radius: 999px; }
.bar-in.blue { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.bar-row b { width: 30px; text-align: right; }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 手机版 ---------- */
.m-header { position: sticky; top: 0; z-index: 50; background: #0f766e; color: #fff; display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.m-header .menu-btn { font-size: 20px; cursor: pointer; }
.m-header h1 { font-size: 16px; margin: 0; flex: 1; }
.m-header .out { font-size: 13px; opacity: .85; cursor: pointer; }
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: none; }
.drawer-mask.show { display: block; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 240px; background: linear-gradient(180deg, #0f766e, #115e59); color: #fff; z-index: 100; transform: translateX(-100%); transition: transform .25s; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer .brand { border-bottom: 1px solid rgba(255,255,255,.15); }
.drawer #nav { flex: 1; overflow-y: auto; }
.m-content { padding: 14px; }
.card-list { display: flex; flex-direction: column; gap: 12px; }
.m-card { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.m-card-title { font-weight: bold; font-size: 15px; margin-bottom: 6px; }
.m-card-sub { color: #64748b; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.m-card-sub .dot { color: #cbd5e1; }
.m-card-op { display: flex; gap: 10px; margin-top: 10px; }
.m-card-op .btn { flex: 1; }
.m-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.m-toolbar .search { flex: 1; }
.m-toolbar .btn-primary { padding: 8px 16px; }

@media (max-width: 768px) {
  .dash-cols { grid-template-columns: 1fr; }
  .toolbar .search { max-width: none; }
}
