/* 外贸 CRM · 移动优先样式（窄屏 <768px 表格转卡片） */
* { box-sizing: border-box; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px; color: #303133; background: #f5f7fa; line-height: 1.55;
}
a { color: #409eff; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: #909399; }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.danger { color: #f56c6c; }
.ok { color: #67c23a; }

/* ---- 登录 ---- */
.login-wrap {
  min-height: 100%; display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;
  background: linear-gradient(160deg, #1f2d3d 0%, #3a5169 100%); padding: 20px;
}
.login-card { background: #fff; border-radius: 10px; padding: 28px 22px; width: 100%; max-width: 360px; box-shadow: 0 12px 32px rgba(0,0,0,.28); }
.login-title { margin: 0 0 4px; font-size: 22px; }
.login-sub { margin: 0 0 20px; color: #909399; font-size: 13px; }
.login-tip { color: #a8abb2; font-size: 12px; margin: 14px 0 0; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: #606266; font-size: 13px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff; color: #303133;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #409eff; outline: none; }

/* ---- 按钮 ---- */
.btn {
  display: inline-block; padding: 9px 14px; border-radius: 6px; border: 1px solid #dcdfe6;
  background: #fff; color: #303133; cursor: pointer; font-size: 13px; line-height: 1.2;
  min-height: 36px; font-family: inherit;
}
.btn:active { opacity: .8; }
.btn-primary { background: #409eff; border-color: #409eff; color: #fff; }
.btn-danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }
.btn-ok { background: #67c23a; border-color: #67c23a; color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 5px 9px; min-height: 30px; font-size: 12px; }
.icon-btn { background: transparent; border: 0; font-size: 18px; cursor: pointer; color: inherit; padding: 4px 8px; }

/* ---- 顶栏 / 布局 ---- */
.topbar {
  height: 52px; background: #1f2d3d; color: #fff; display: -webkit-box; display: -ms-flexbox;
  display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; padding: 0 10px;
  position: -webkit-sticky; position: sticky; top: 0; z-index: 20;
}
.topbar-left, .topbar-right { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 8px; }
.brand { font-weight: 600; font-size: 15px; }
.whoami { color: #c0c4cc; font-size: 13px; }
.layout { display: block; }
.sidebar { display: none; }
.main { padding: 12px; padding-bottom: 72px; }
.badge-dot { background: #f56c6c; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; margin-right: 6px; }

/* ---- 底部 Tab（移动） ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid #e4e7ed;
  display: -webkit-box; display: -ms-flexbox; display: flex; z-index: 30;
}
.tabbar a {
  -webkit-box-flex: 1; -ms-flex: 1; flex: 1; text-align: center; padding: 8px 0 10px; color: #909399;
  font-size: 11px; min-height: 44px;
}
.tabbar a.active { color: #409eff; }
.tabbar .tab-icon { display: block; font-size: 18px; line-height: 1.1; }

/* ---- 侧栏（PC） ---- */
@media (min-width: 768px) {
  .layout { display: -webkit-box; display: -ms-flexbox; display: flex; }
  .sidebar { display: block; width: 190px; background: #fff; border-right: 1px solid #e4e7ed; min-height: calc(100vh - 52px); padding: 10px 0; }
  .sidebar a { display: block; padding: 10px 16px; color: #606266; font-size: 14px; }
  .sidebar a.active { color: #409eff; background: #ecf5ff; border-right: 3px solid #409eff; }
  .sidebar .nav-group { padding: 10px 16px 4px; color: #a8abb2; font-size: 12px; }
  .main { -webkit-box-flex: 1; -ms-flex: 1; flex: 1; padding: 18px; padding-bottom: 24px; }
  .tabbar { display: none; }
  #menu-btn { display: none; }
}

/* ---- 卡片 / KPI ---- */
.card { background: #fff; border-radius: 8px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; -webkit-box-align: center; -ms-flex-align: center; align-items: center; }
.kpi-grid { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; margin: -6px; }
.kpi { -webkit-box-flex: 1; -ms-flex: 1 1 45%; flex: 1 1 45%; margin: 6px; background: #fff; border-radius: 8px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); min-width: 130px; }
.kpi .num { font-size: 22px; font-weight: 600; color: #1f2d3d; }
.kpi .label { color: #909399; font-size: 12px; margin-top: 2px; }
.kpi .num.warn { color: #e6a23c; }
.kpi .num.danger { color: #f56c6c; }

/* ---- 工具条 / 过滤 ---- */
.toolbar { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; -webkit-box-align: center; -ms-flex-align: center; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 120px; padding: 8px 10px; }
.toolbar .spacer { -webkit-box-flex: 1; -ms-flex: 1; flex: 1; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #ebeef5; vertical-align: top; }
th { background: #fafafa; color: #606266; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #f7fbff; }
tr.overdue { background: #fef0f0; }
tr.overdue td:first-child { border-left: 3px solid #f56c6c; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: #ecf5ff; color: #409eff; font-size: 12px; }
.tag.gray { background: #f4f4f5; color: #909399; }
.tag.green { background: #f0f9eb; color: #67c23a; }
.tag.red { background: #fef0f0; color: #f56c6c; }
.tag.orange { background: #fdf6ec; color: #e6a23c; }
.masked { color: #c0c4cc; font-weight: 600; }
.pager { padding: 10px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; gap: 8px; }

/* ---- 卡片化表格（窄屏） ---- */
@media (max-width: 767px) {
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 6px solid #f5f7fa; padding: 6px 2px; }
  table.responsive td { display: block; border: 0; padding: 4px 10px; }
  table.responsive td:before { content: attr(data-label) "："; color: #909399; font-size: 12px; }
}

/* ---- 详情 / 时间线 ---- */
.kv { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; margin: -4px 0; }
.kv .item { -ms-flex: 0 0 50%; flex: 0 0 50%; padding: 4px 0; }
.kv .item.full { -ms-flex: 0 0 100%; flex: 0 0 100%; }
.kv .k { color: #909399; font-size: 12px; }
.kv .v { color: #303133; word-break: break-all; }
.tabs { display: -webkit-box; display: -ms-flexbox; display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid #e4e7ed; margin-bottom: 10px; }
.tabs button { border: 0; background: transparent; padding: 9px 12px; color: #606266; cursor: pointer; white-space: nowrap; font-size: 13px; font-family: inherit; }
.tabs button.active { color: #409eff; border-bottom: 2px solid #409eff; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid #e4e7ed; position: relative; }
.timeline li:before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #409eff; }
.timeline .t { color: #909399; font-size: 12px; }

/* ---- 模态 ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 8px; width: 100%; max-width: 720px; max-height: 88vh; overflow: auto; }
.modal-head { padding: 12px 14px; border-bottom: 1px solid #ebeef5; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; -webkit-box-align: center; -ms-flex-align: center; align-items: center; font-weight: 600; position: -webkit-sticky; position: sticky; top: 0; background: #fff; }
.modal-body { padding: 14px; }

/* ---- Toast ---- */
.toast { position: fixed; top: 16px; left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); background: #303133; color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 13px; z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; }
.toast.show { opacity: .95; }
.toast.err { background: #f56c6c; }
.toast.ok { background: #67c23a; }
.loading { text-align: center; color: #909399; padding: 30px; }
.empty { text-align: center; color: #909399; padding: 24px; }
.alert { background: #fdf6ec; color: #e6a23c; border: 1px solid #f5dab1; border-radius: 6px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; }
.alert.err { background: #fef0f0; color: #f56c6c; border-color: #fbc4c4; }
