/* 仓库管理系统 - 移动端优先响应式样式（精致版） */
:root {
    --bg: #f4f6fa;
    --card: #ffffff;
    --text: #24303f;
    --text-2: #55637a;
    --muted: #8a97ab;
    --primary: #2f6bff;
    --primary-dark: #1e50d8;
    --primary-soft: #eef3ff;
    --danger: #e0343c;
    --danger-soft: #fdeeee;
    --ok: #18a058;
    --ok-soft: #e8f7ef;
    --warn: #d97a06;
    --warn-soft: #fdf3e2;
    --border: #e5eaf2;
    --border-strong: #d4dce8;
    --shadow-sm: 0 1px 2px rgba(30, 50, 90, .05);
    --shadow-md: 0 4px 16px rgba(30, 50, 90, .08);
    --radius: 12px;
    --radius-sm: 8px;
    --dark: #1c2b3f;
    --dark-2: #24364f;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(1200px 300px at 50% -80px, rgba(47, 107, 255, .06), transparent 70%),
        var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.6;
    letter-spacing: .2px;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
    background: linear-gradient(135deg, var(--dark) 0%, #24395c 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(16, 28, 48, .25);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    max-width: 1200px;
    margin: 0 auto;
}
.brand {
    font-size: 16.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 1px;
}
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    background: rgba(255,255,255,.12);
    border-radius: 9px;
    font-size: 16px;
}
.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13px; opacity: .85; }
a.user-name { color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,.45); padding-bottom: 1px; transition: opacity .15s, border-color .15s; }
a.user-name:hover { opacity: 1; border-bottom-color: #fff; }

/* ---------- 修改密码 ---------- */
.profile-wrap { max-width: 420px; margin: 32px auto; }
.profile-card { padding: 28px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.profile-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff; font-size: 22px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.profile-name { font-size: 17px; font-weight: 600; }
.profile-form .form-group { margin-bottom: 16px; }
.btn-block { width: 100%; margin-top: 6px; padding: 11px; font-size: 15px; }
.mainnav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4px 10px 10px;
    gap: 4px;
    scrollbar-width: none;
}
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
    color: rgba(255,255,255,.68);
    text-decoration: none;
    padding: 6px 14px;
    white-space: nowrap;
    font-size: 13.5px;
    border-radius: 18px;
    transition: all .18s ease;
    letter-spacing: .5px;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a.active {
    color: #fff;
    background: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(47, 107, 255, .45);
}

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 10px; }
.page-title {
    font-size: 20px;
    font-weight: 700;
    margin: 6px 0 18px;
    letter-spacing: .5px;
    position: relative;
    padding-left: 14px;
}
.page-title::before {
    content: "";
    position: absolute;
    left: 0; top: 5px; bottom: 5px;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), #6d9bff);
}
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head .page-title { margin-bottom: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0 34px; letter-spacing: 1px; }
.muted { color: var(--muted); font-size: 12.5px; margin: 10px 2px; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 16px 13px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #7ba4ff);
    opacity: .85;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-num {
    font-size: 25px;
    font-weight: 700;
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; letter-spacing: .5px; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h3, .card-title {
    margin: 0 0 12px;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: .5px;
}
.card-head h3 { margin: 0; }
.help-card { background: linear-gradient(180deg, #fbfcff, #f6f8fd); }
.help-card ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; }
.help-card li { margin-bottom: 5px; }
.help-card code { background: var(--primary-soft); color: var(--primary-dark); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12.5px;
    color: var(--text-2);
    margin-bottom: 5px;
    font-weight: 600;
    letter-spacing: .5px;
}
input[type=text], input[type=password], input[type=date], input[type=number], select, input[list] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    background: #fff;
    color: var(--text);
    min-height: 42px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .13);
}
.form-grid { display: grid; grid-template-columns: 1fr; gap: 2px; }
.form-actions { display: flex; gap: 10px; margin: 18px 0; }
.form-actions .btn { min-width: 104px; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; color: var(--text-2); }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.filter-bar input[type=text] { flex: 1 1 170px; min-width: 150px; }
.filter-bar input[type=date], .filter-bar select { flex: 0 1 150px; min-width: 132px; }
.filter-bar .btn { flex: 0 0 auto; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: .5px;
    cursor: pointer;
    text-decoration: none;
    min-height: 40px;
    transition: all .16s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(47, 107, 255, .3); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 3px 10px rgba(47, 107, 255, .4); }
.btn-success { background: var(--ok); color: #fff; box-shadow: 0 2px 6px rgba(24, 160, 88, .3); }
.btn-success:hover { background: #128349; }
.btn-secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn-secondary:hover { background: #dfe9ff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbdcdc; }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--primary-soft); border-color: var(--primary); }
.topbar .btn-ghost { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.28); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: 4px 11px; min-height: 30px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---------- 标签 ---------- */
.badge {
    display: inline-block;
    padding: 2.5px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #eef1f6;
    color: var(--text-2);
    letter-spacing: .5px;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-role { background: rgba(123, 164, 255, .2); color: #aecbff; }

/* ---------- 提示 ---------- */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13.5px;
    box-shadow: var(--shadow-sm);
}
.alert-success { background: var(--ok-soft); color: #0d6b3d; border: 1px solid #bfe8d2; }
.alert-error { background: var(--danger-soft); color: #a11d24; border: 1px solid #f5c8ca; }

/* ---------- 表格（参考ERP风格：大字号、宽松行高、灰表头） ---------- */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: 15.5px; min-width: 560px; }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #eef1f6; white-space: nowrap; }
.table th {
    background: #fbfcfe;
    color: #9aa4b2;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .5px;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border);
}
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f7faff; }
.table tbody tr:last-child td { border-bottom: none; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.neg, .table td .neg, .neg { color: var(--danger); }
.in-num { color: var(--ok); }
.table td.strong, .table tfoot td { font-weight: 700; }
.table td.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.table tfoot td { background: #f7f9fc; }
.td-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.td-detail { white-space: normal !important; max-width: 320px; word-break: break-all; }
.table a { color: var(--primary); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.ops { display: flex; gap: 6px; align-items: center; }
.inline-form { display: inline; }
.table-items input, .table-items select { min-width: 70px; min-height: 38px; padding: 6px 8px; font-size: 14.5px; }
.table-items .ipt-product { min-width: 170px; }
.table .badge { font-size: 12.5px; }
.table .btn-sm { font-size: 13px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 2px; }
.tab {
    padding: 7px 18px;
    border-radius: 20px;
    background: var(--card);
    color: var(--text-2);
    text-decoration: none;
    font-size: 13.5px;
    white-space: nowrap;
    border: 1px solid var(--border-strong);
    transition: all .16s;
    letter-spacing: .5px;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(47, 107, 255, .35);
}

/* ---------- 单据详情 ---------- */
.doc-meta { display: grid; grid-template-columns: 1fr; gap: 9px; margin-bottom: 12px; }
.doc-meta > div { font-size: 14px; }
.meta-label {
    color: var(--muted);
    font-size: 12.5px;
    margin-right: 10px;
    letter-spacing: .5px;
}
.meta-wide { grid-column: 1 / -1; }

/* ---------- 报表柱状分布 ---------- */
.bar-row { display: flex; flex-direction: column; gap: 3px; min-width: 120px; }
.bar { display: block; height: 7px; border-radius: 4px; }
.bar-in { background: linear-gradient(90deg, #18a058, #4cc987); }
.bar-out { background: linear-gradient(90deg, #e0343c, #f0777d); }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0; }

/* ---------- 登录 ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #16233a 0%, #24395c 55%, #2f5aa8 100%);
    padding: 16px;
}
.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 32px 28px;
    width: 100%;
    max-width: 370px;
    box-shadow: 0 20px 60px rgba(10, 20, 40, .45);
}
.login-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: 2px;
}
.login-hint {
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    line-height: 1.8;
}

/* ---------- 打印 ---------- */
@media print {
    .topbar, .footer, .page-actions, .form-actions, .btn, .inline-form { display: none !important; }
    body { background: #fff; }
    .card, .table-wrap { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- 平板/桌面 ---------- */
@media (min-width: 768px) {
    .container { padding: 26px 20px 12px; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); gap: 4px 24px; }
    .form-group-wide { grid-column: 1 / -1; }
    .doc-meta { grid-template-columns: repeat(3, 1fr); }
    .brand { font-size: 17.5px; }
    .mainnav a { padding: 7px 17px; }
}
@media (min-width: 1024px) {
    .form-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 导航下拉分组（系统） ---------- */
.nav-drop { position: relative; display: flex; flex: 0 0 auto; }
.nav-drop-toggle {
    color: rgba(255,255,255,.68); text-decoration: none;
    padding: 6px 14px; border-radius: 7px; cursor: pointer;
    display: flex; align-items: center; gap: 4px; white-space: nowrap;
    font-size: inherit; transition: background .15s, color .15s;
}
.nav-drop-toggle:hover,
.nav-drop.open .nav-drop-toggle { color: #fff; background: rgba(255,255,255,.08); }
.nav-drop.active .nav-drop-toggle { color: #fff; background: var(--primary); font-weight: 600; }
.nav-drop .caret { font-size: 10px; opacity: .85; }
.nav-drop-menu {
    display: none; position: fixed; z-index: 1000;
    flex-direction: column; min-width: 150px; padding: 6px;
    background: #fff; border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(20,40,80,.18);
}
.nav-drop.open .nav-drop-menu { display: flex; }
.nav-drop-menu a {
    color: #2b3445; text-decoration: none; padding: 9px 14px;
    border-radius: 8px; font-size: 14.5px; white-space: nowrap;
    font-weight: 400;
}
.nav-drop-menu a:hover { background: #f2f6fd; color: var(--primary); }
.nav-drop-menu a.active { background: var(--primary); color: #fff; font-weight: 600; }
@media (min-width: 768px) {
    .nav-drop-toggle { padding: 7px 17px; }
    .nav-drop-menu a { padding: 9px 14px; }
}

/* ---------- 商品搜索选择器 ---------- */
.pcell { display: flex; gap: 5px; align-items: center; }
.pcell input { flex: 1; min-width: 0; }
.pick-mask {
    position: fixed; inset: 0; background: rgba(15,25,40,.45);
    display: none; align-items: center; justify-content: center;
    padding: 16px; z-index: 60;
}
.pick-mask.show { display: flex; }
.pick-card {
    background: #fff; border-radius: 14px; width: 100%; max-width: 580px;
    max-height: 82vh; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 12px 40px rgba(20,40,80,.25);
}
.pick-head { padding: 14px 16px 10px; }
.pick-head h3 { font-size: 16px; margin-bottom: 10px; }
.pick-search { display: flex; gap: 8px; }
.pick-search input {
    flex: 1; min-width: 0; padding: 10px 12px; font-size: 14.5px;
    border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.pick-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.pick-count { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 16px; }
.pick-list { overflow-y: auto; border-top: 1px solid var(--border); flex: 1; }
.pick-item {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 11px 16px; cursor: pointer; border-bottom: 1px solid #f0f2f7;
}
.pick-item:last-child { border-bottom: none; }
.pick-item:hover { background: #f2f6fd; }
.pick-item .pi-name { font-weight: 500; font-size: 14.5px; }
.pick-item .pi-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pick-item .pi-unit { color: var(--muted); font-size: 13px; white-space: nowrap; }
.pick-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- 单据列表布局修正 ---------- */
/* 长单位名省略显示，防止表格被撑出横向滚动导致操作列截断 */
.table td.td-ellipsis {
    max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
/* 操作列按钮紧凑化，保证 查看/编辑/删除 完整显示 */
.table .ops .btn-sm { padding: 5px 11px; }
.table .ops .inline-form { display: inline-flex; }

/* ---------- 登录验证码 ---------- */
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-row img {
    height: 42px; border-radius: 8px; border: 1px solid var(--border);
    cursor: pointer; flex: 0 0 auto; background: #f0f4fa;
}
