/* ===== 全局变量 ===== */
:root {
    --primary: #1ab394;
    --primary-dark: #18a689;
    --header-bg: #1ab394;
    --sidebar-bg: #2f4050;
    --sidebar-hover: #293846;
    --sidebar-active: #19aa8d;
    --text-dark: #333;
    --text-muted: #888;
    --border: #e7eaec;
    --bg-light: #f3f3f4;
    --danger: #ed5565;
    --warning: #f8ac59;
    --info: #23c6c8;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--bg-light);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== 登录页 ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6f8;
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.login-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    padding: 0 24px;
    text-align: center;
}

.login-box h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #81c995;
    letter-spacing: 0.5px;
}

.login-box .subtitle {
    font-size: 14px;
    color: #9aa0a6;
    margin-bottom: 36px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    padding: 12px 16px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.login-form input:focus {
    border-color: #81c995;
    box-shadow: 0 0 0 2px rgba(129, 201, 149, 0.2);
}

.login-form input::placeholder { color: #bdc1c6; }

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #5f6368;
    cursor: pointer;
    margin: 8px 0 24px;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #81c995;
    cursor: pointer;
}

.btn-login {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    background: #81c995;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}

.btn-login:hover {
    background: #6ab87d;
}

.login-error {
    background: #fce8e6;
    border: 1px solid #f5c6c2;
    color: #c5221f;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 13px;
    text-align: left;
}

/* ===== 后台布局 ===== */
.admin-body { background: var(--bg-light); }

.admin-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--header-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.system-title {
    font-size: 18px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.35);
    flex-shrink: 0;
}

.logout-link {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    transition: all .2s;
}

.logout-link:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ===== 侧边栏 ===== */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 220px;
    height: calc(100vh - 56px);
    min-height: calc(100vh - 56px);
    background: var(--sidebar-bg);
    overflow-y: auto;
    transition: transform .3s;
    z-index: 900;
}

.sidebar-nav { padding: 12px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #a7b1c2;
    font-size: 14px;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.nav-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

/* ===== 主内容区 ===== */
.main-content {
    margin-left: 220px;
    margin-top: 56px;
    padding: 20px;
    min-height: calc(100vh - 56px);
}

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border-radius: 4px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 500;
}

.card-body { padding: 20px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    line-height: 1.4;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #da4453; }
.btn-default { background: #fff; color: var(--text-dark); border: 1px solid var(--border); }
.btn-default:hover { background: var(--bg-light); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th {
    background: #f5f5f6;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table .col-no { width: 115px; }
.data-table .col-check { width: 42px; }
.data-table .col-action { width: 100px; }
.data-table .col-action-wide { width: 130px; }
.data-table .col-money { width: 105px; }
.data-table .col-date { width: 95px; }
.data-table .col-name { width: 100px; }
.data-table .col-remark { white-space: normal; word-break: break-word; }

/* 仓库管理表格列宽 */
.data-table-warehouses {
    table-layout: fixed;
}

.data-table-warehouses col.col-check { width: 4%; }
.data-table-warehouses col.col-name { width: 24%; }
.data-table-warehouses col.col-qty { width: 11%; }
.data-table-warehouses col.col-warn { width: 12%; }
.data-table-warehouses col.col-action { width: 14%; }

.data-table-warehouses th,
.data-table-warehouses td {
    padding: 12px 18px;
}

.data-table-warehouses th.col-qty,
.data-table-warehouses td.col-qty-cell,
.data-table-warehouses td.text-right {
    padding-right: 24px;
}

.data-table-warehouses th.col-warn,
.data-table-warehouses td.col-warn-cell {
    padding-left: 20px;
    padding-right: 20px;
}

.data-table-warehouses th.col-action,
.data-table-warehouses td.actions {
    padding-left: 16px;
    padding-right: 16px;
}

.data-table-warehouses .warn-check-select {
    width: 80px;
    margin: 0 auto;
    display: block;
}

/* 库存列表：15 列等宽铺满，字段间距均匀 */
.data-table.data-table-inventory {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.data-table-inventory col.w-col {
    width: calc(100% / 15);
}

.data-table-inventory th,
.data-table-inventory td {
    width: calc(100% / 15);
    padding: 10px 6px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.data-table-inventory th.w-code,
.data-table-inventory td.w-code,
.data-table-inventory th.w-name,
.data-table-inventory td.w-name,
.data-table-inventory th.w-wh,
.data-table-inventory td.w-wh,
.data-table-inventory th.w-category,
.data-table-inventory td.w-category,
.data-table-inventory th.w-spec,
.data-table-inventory td.w-spec,
.data-table-inventory th.w-remark,
.data-table-inventory td.w-remark {
    text-align: left;
}

.data-table-inventory th.w-price,
.data-table-inventory td.w-price,
.data-table-inventory th.w-stock,
.data-table-inventory td.w-stock,
.data-table-inventory th.w-in-qty,
.data-table-inventory td.w-in-qty,
.data-table-inventory th.w-out-qty,
.data-table-inventory td.w-out-qty {
    text-align: right;
}

.data-table-inventory th.w-in-qty,
.data-table-inventory td.w-in-qty,
.data-table-inventory th.w-out-qty,
.data-table-inventory td.w-out-qty {
    padding-right: 12px;
}

.data-table-inventory th.w-out-qty,
.data-table-inventory td.w-out-qty {
    padding-right: 18px;
}

.data-table-inventory th.w-remark,
.data-table-inventory td.w-remark {
    padding-left: 18px;
}

.data-table-inventory .stock-qty-highlight {
    color: var(--danger);
    font-weight: 700;
    font-size: 14px;
}

.data-table-inventory .stock-qty-link.stock-qty-highlight {
    color: var(--danger);
    font-weight: 700;
    font-size: 14px;
}

.data-table-inventory .cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table-inventory td.actions,
.data-table-inventory th.w-action {
    overflow: visible;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center;
}

.data-table-inventory td.w-image,
.data-table-inventory th.w-image {
    text-align: center;
    vertical-align: middle;
    padding: 6px 4px;
}

.data-table-inventory td.w-image .product-thumb {
    display: block;
    margin: 0 auto;
}

/* 窄屏时横向滚动 */
@media (max-width: 1280px) {
    .table-wrap-inventory {
        overflow-x: auto;
    }
    .data-table.data-table-inventory {
        min-width: 1200px;
    }
}

/* 产品详情页 */
.page-breadcrumb {
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.page-breadcrumb a {
    color: var(--primary);
}

.page-breadcrumb .sep {
    margin: 0 8px;
}

.product-detail-header {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.product-detail-main {
    flex: 1;
    min-width: 0;
}

.product-detail-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.product-detail-noimg {
    width: 120px;
    height: 120px;
    background: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
}

.product-detail-title {
    margin: 0 0 10px;
    font-size: 22px;
    color: var(--text-dark);
}

.product-detail-code {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px 32px;
}

.product-detail-grid .label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.product-detail-grid .value {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.5;
}

.product-detail-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.filter-bar-inline {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-top: none;
    background: #fff;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.product-detail-filter-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

a.btn-action {
    text-decoration: none;
}

@media (max-width: 1200px) {
    .product-detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .product-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .product-detail-header {
        flex-direction: column;
    }
    .product-detail-grid {
        grid-template-columns: 1fr;
    }
}

.product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn .form-control {
    flex: 1;
}

.product-info-box {
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.product-info-inner {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.product-info-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.product-info-noimg {
    width: 72px;
    height: 72px;
    background: #e9ecef;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.product-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 20px;
    flex: 1;
}

.product-info-grid .label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.product-info-grid .value {
    font-size: 14px;
    color: var(--text);
}

.product-info-grid .stock-highlight {
    color: var(--primary);
    font-weight: 600;
}

.product-autocomplete {
    position: relative;
}

.product-ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    max-height: 280px;
    overflow-y: auto;
}

.product-ac-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.product-ac-item:last-child {
    border-bottom: none;
}

.product-ac-item:hover,
.product-ac-item.active {
    background: #f0f7ff;
}

.product-ac-code {
    font-weight: 600;
    color: var(--text);
}

.product-ac-name {
    color: var(--text);
}

.product-ac-meta {
    font-size: 12px;
    color: var(--text-muted);
    width: 100%;
}

.product-ac-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.stock-io-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stock-io-add-row {
    align-items: flex-end;
    margin-bottom: 16px;
}

.stock-io-add-row .form-group-btn {
    flex: 0 0 auto;
}

.stock-batch-empty {
    padding: 24px 0;
}

.stock-batch-table {
    margin-bottom: 16px;
}

.stock-batch-table-out {
    table-layout: fixed;
    width: 100%;
}

.stock-batch-table-out col.w-col {
    width: calc(100% / 11);
}

.stock-batch-table-in {
    table-layout: fixed;
    width: 100%;
}

.stock-batch-table-in col.w-col {
    width: calc(100% / 9);
}

.stock-batch-table .cell-editable {
    cursor: pointer;
}

.stock-batch-table .cell-editable:hover {
    background: #e8f5f1;
}

.stock-batch-table .cell-edit-input {
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: 13px;
}

.stock-batch-table .cell-edit-input.text-right {
    text-align: right;
}

.stock-batch-foot .stock-batch-summary td {
    background: #f5f5f6;
    font-weight: 600;
    border-top: 2px solid var(--border);
    padding: 12px 8px;
}

.stock-warn-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.stock-warn-tip {
    font-size: 13px;
    white-space: nowrap;
}

.stock-warn-filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.warn-check-select {
    width: 72px;
    min-height: 32px;
    padding: 4px 8px;
}

.form-control-inline {
    width: 96px;
    min-height: 32px;
    padding: 4px 8px;
}

.data-table-stock-history {
    table-layout: fixed;
}

.data-table-stock-history .cell-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-in {
    background: #e8f8ef;
    color: #27ae60;
}

.badge-out {
    background: #fdecea;
    color: #e74c3c;
}

@media (max-width: 768px) {
    .product-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 支出明细表（保留兼容） */
.data-table-expenses {
    table-layout: fixed;
}

.data-table-expenses .w-check { width: 42px; }
.data-table-expenses .w-no { width: 108px; }
.data-table-expenses .w-date { width: 88px; }
.data-table-expenses .w-summary { width: 16%; }
.data-table-expenses .w-type { width: 72px; }
.data-table-expenses .w-money { width: 96px; }
.data-table-expenses .w-dept { width: 72px; }
.data-table-expenses .w-budget-month { width: 80px; }
.data-table-expenses .w-account { width: 72px; }
.data-table-expenses .w-handler { width: 64px; }
.data-table-expenses .w-voucher { width: 72px; }
.data-table-expenses .w-remark { width: 12%; }
.data-table-expenses .w-action { width: 72px; }

.data-table-expenses th,
.data-table-expenses td {
    white-space: nowrap;
}

.data-table-expenses .cell-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

.data-table-expenses .expense-amount {
    color: #e74c3c;
    font-weight: 600;
    font-size: 14px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.data-table th.text-right,
.data-table td.text-right {
    text-align: right;
}

.data-table th.text-center,
.data-table td.text-center {
    text-align: center;
}

.data-table tbody tr:nth-child(even) { background: #fafafa; }
.data-table tbody tr:hover { background: #f0f9f7; }

/* 操作列勿对 td 使用 flex，否则会与行高错位出现多余横线 */
.data-table td.actions {
    display: table-cell;
    vertical-align: middle;
    text-align: center;
    white-space: nowrap;
    line-height: 1;
}

.data-table td.actions .btn-action {
    display: inline-flex;
    vertical-align: middle;
}

.data-table td.actions .btn-action + .btn-action {
    margin-left: 6px;
}

.btn-action {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color .2s;
}

.btn-action:hover {
    color: var(--primary);
}

.btn-action.btn-action-danger:hover {
    color: var(--danger);
}

.system-logo {
    height: 28px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h4 {
    font-size: 15px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    background: #fafafa;
}

.tab-nav-item {
    padding: 14px 24px;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all .2s;
}

.tab-nav-item:hover {
    color: var(--primary);
}

.tab-nav-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
    background: #fff;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.settings-block {
    margin-top: 8px;
    margin-bottom: 8px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.form-stack .form-group {
    max-width: 520px;
}

.settings-block-danger {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.settings-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.data-maint-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.data-maint-restore {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.data-maint-restore .form-control {
    width: 220px;
}

.settings-tips {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
}

.btn-warning {
    background: #f0ad4e;
    border-color: #eea236;
    color: #fff;
}

.btn-warning:hover {
    background: #ec971f;
    border-color: #d58512;
    color: #fff;
}

.settings-block-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.radio-group {
    display: flex;
    gap: 24px;
    margin-top: 6px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.logo-preview {
    margin-top: 10px;
}

.logo-preview img {
    max-height: 60px;
    max-width: 200px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px;
    background: #fff;
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--primary); }

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    color: var(--text-dark);
    background: #fff;
}

.pagination a:hover { background: var(--bg-light); border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* ===== 表单 ===== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 13px;
    transition: border-color .2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26,179,148,.15);
}

.form-control-readonly,
.form-control[readonly] {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 8px;
}

/* ===== 模态框 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    background: #fff;
    border-radius: 6px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}

.modal-wide {
    max-width: 720px;
}

.budget-adjust-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 16px;
}

@media (max-width: 640px) {
    .budget-adjust-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 500; }

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ===== 提示 ===== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: #dff0d8; color: #3c763d; border: 1px solid #d6e9c6; }
.alert-error { background: #f2dede; color: #a94442; border: 1px solid #ebccd1; }
.alert-warning { background: #fcf8e3; color: #8a6d3b; border: 1px solid #faebcc; }

/* ===== 首页/报表 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
}

.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.info .stat-value { color: var(--info); }

.stats-grid-home {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .stats-grid-home {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .stats-grid-home {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.chart-panel {
    padding: 16px 20px 8px;
    background: #fff;
    min-height: 220px;
}

.hbar-chart {
    display: block;
    width: 100%;
    min-height: 180px;
    background: #fff;
}

.chart-year-tag {
    font-size: 12px;
    font-weight: normal;
    color: var(--text-muted);
}

/* ===== 财务报表页 ===== */
.report-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
    background: #fff;
    padding: 14px 20px;
    border-radius: 4px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border-bottom: 3px solid #2c3e50;
    overflow-x: auto;
}

.report-top-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.report-top-title .report-icon {
    font-size: 24px;
    line-height: 1;
    color: #2c3e50;
}

.report-top-title h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.report-header {
    background: #fff;
    padding: 24px 30px;
    border-radius: 4px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border-bottom: 3px solid #2c3e50;
}

.report-header .report-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.report-header h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.report-header .report-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

.report-layout {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 20px;
}

.report-main { min-width: 0; }

.type-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.type-summary-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 8px;
    text-align: center;
}

.type-summary-item .type-name {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.type-summary-item .type-amount {
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.chart-box {
    background: #fff;
    border-radius: 4px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.chart-box h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-align: center;
}

.chart-canvas { width: 100%; height: 200px; }

.report-sidebar .sidebar-stat {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.sidebar-stat .stat-label-bar {
    background: #5b7a9d;
    color: #fff;
    padding: 8px 14px;
    font-size: 12px;
    text-align: center;
}

.sidebar-stat .stat-value-box {
    padding: 14px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #666;
}

.expense-detail-table .data-table th {
    background: #5b7a9d;
    color: #fff;
    border-bottom: none;
}

.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.filter-bar-report {
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    flex-shrink: 0;
}

.filter-bar-report label {
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0;
}

.filter-bar-report .form-control {
    width: auto;
    min-width: 118px;
    flex-shrink: 0;
}

.filter-bar-report .btn {
    flex-shrink: 0;
}

.period-filters {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}

.filter-bar label {
    font-size: 13px;
    color: var(--text-muted);
}

.filter-bar .form-control { width: auto; min-width: 140px; }

.voucher-link {
    color: var(--info);
    font-size: 12px;
}

.voucher-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    margin-top: 8px;
}

/* ===== 数据报表 ===== */
.data-report-card { margin-bottom: 20px; }

.data-report-card .tab-nav-item {
    display: inline-block;
    text-decoration: none;
}

.data-report-table th,
.data-report-table td {
    white-space: nowrap;
}

.data-report-total-row {
    background: #f8fafb;
}

.data-report-filter {
    padding: 16px 20px 0;
    margin-bottom: 0;
}

.data-report-product-filter .form-control[name="keyword"] {
    width: 160px;
    min-width: 140px;
}

.budget-section-head .data-report-product-filter {
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ===== 预算管理（遗留样式） ===== */
.budget-section { margin-bottom: 20px; }

.budget-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.budget-section-head h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.budget-section-head h3 small {
    font-weight: normal;
}

.budget-filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.budget-filter-form .form-control {
    width: auto;
    min-width: 120px;
}

.budget-filter-form .btn,
.budget-filter-form a.btn {
    white-space: nowrap;
}

.import-budget-tips {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.7;
}

.import-budget-tips p {
    margin: 0 0 6px;
}

.import-budget-tips code {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 11px;
}

.budget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: auto;
}

.budget-table th,
.budget-table td {
    border: 1px solid #e4e4e4;
    padding: 8px 6px;
    text-align: center;
    white-space: nowrap;
}

.budget-table thead th {
    background: #f7f7f7;
    font-weight: 600;
    color: #555;
}

.budget-row-label {
    background: #fafafa;
    font-weight: 600;
    text-align: left !important;
    padding-left: 12px !important;
    min-width: 64px;
}

.budget-num { font-weight: 500; }
.budget-expense { color: #e74c3c; }
.budget-income { color: #3498db; }
.budget-remain { color: #3498db; }
.budget-over { color: #e74c3c; font-weight: 600; }

.budget-input {
    width: 72px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 12px;
    text-align: center;
}

.budget-input:focus {
    outline: none;
    border-color: var(--primary);
}

.budget-footnote {
    font-size: 11px;
    color: var(--text-muted);
    padding: 10px 0 4px;
    line-height: 1.5;
}

.annual-budget-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.annual-input-row {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 480px;
}

.annual-input-row .form-control {
    flex: 1;
}

.budget-day-table th,
.budget-day-table td {
    min-width: 48px;
    font-size: 11px;
    padding: 6px 4px;
}

.budget-month-table .budget-input {
    width: 64px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .type-summary-grid { grid-template-columns: repeat(3, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .report-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .type-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}

/* ===== 出入库单据打印 ===== */
.stock-slip-body {
    background: #eef1f4;
    min-height: 100vh;
}

.stock-slip-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.stock-slip-sheet {
    position: relative;
    background: #fff;
    border: 1px solid #d9dee3;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 36px 40px 48px;
    overflow: hidden;
}

.stock-slip-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.04);
    transform: rotate(-24deg);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.stock-slip-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 18px;
    letter-spacing: 2px;
}

.stock-slip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    padding: 12px 0 18px;
    border-top: 1px solid #333;
    border-bottom: 1px solid #ddd;
    margin-bottom: 18px;
    font-size: 13px;
}

.stock-slip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 18px;
}

.stock-slip-table th,
.stock-slip-table td {
    border: 1px solid #bbb;
    padding: 8px 10px;
}

.stock-slip-table thead th {
    background: #f3f3f3;
    font-weight: 600;
}

.stock-slip-remark {
    font-size: 13px;
    margin-bottom: 36px;
    line-height: 1.6;
}

.stock-slip-signatures {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    font-size: 13px;
}

.stock-slip-sign-item {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.stock-slip-sign-line {
    flex: 1;
    border-bottom: 1px solid #333;
    min-width: 120px;
    height: 18px;
}

.stock-slip-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    body.stock-slip-body {
        background: #fff;
    }

    .stock-slip-page {
        max-width: none;
        padding: 0;
        margin: 0;
    }

    .stock-slip-sheet {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .no-print {
        display: none !important;
    }
}

/* ===== 用户管理权限 ===== */
.user-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    margin-bottom: 16px;
}

.permission-panel {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    max-height: 360px;
    overflow: auto;
}

.permission-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.permission-preset-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.permission-preset-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 4px;
}

.permission-group {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 4px;
}

.permission-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.permission-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px 12px;
    padding-left: 22px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: normal;
}

@media (max-width: 768px) {
    .user-form-grid {
        grid-template-columns: 1fr;
    }
}

.data-table-users {
    table-layout: fixed;
    width: 100%;
}

.data-table-users col.w-check { width: 42px; }
.data-table-users col.w-user { width: 14%; }
.data-table-users col.w-name { width: 12%; }
.data-table-users col.w-role { width: 12%; }
.data-table-users col.w-status { width: 8%; }
.data-table-users col.w-perm { width: 8%; }
.data-table-users col.w-date { width: 16%; }
.data-table-users col.w-action { width: 120px; }

.data-table-users th,
.data-table-users td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table-users td.actions {
    overflow: visible;
    white-space: nowrap;
}

.profile-card {
    margin-bottom: 20px;
}

.profile-section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.inv-qty-tip {
    font-size: 12px;
    margin: -4px 0 12px;
}

.profile-form-stack {
    max-width: 480px;
}

.stock-qty-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(181, 74, 69, 0.35);
    position: relative;
    z-index: 1;
}

.stock-qty-link:hover {
    opacity: 0.85;
}

.stock-breakdown-summary {
    margin: 0 0 12px;
    font-size: 13px;
}

.stock-breakdown-total td {
    background: #fafafa;
}

.stock-transfer-warehouses {
    align-items: flex-end;
    margin-bottom: 8px;
}

.stock-transfer-warehouses .form-group {
    flex: 1;
    min-width: 180px;
}

.stock-transfer-arrow {
    flex: 0 0 auto;
    width: auto;
}

.transfer-arrow-icon {
    height: 38px;
    line-height: 38px;
    font-size: 22px;
    color: var(--primary);
    text-align: center;
    padding: 0 8px;
}

.stock-transfer-tip {
    display: block;
    margin: 0 0 16px;
}

.slip-watermark-preview {
    margin-top: 12px;
    height: 120px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.slip-watermark-preview-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.06);
    transform: rotate(-24deg);
    white-space: nowrap;
    user-select: none;
}