/* 黔食民电商内账系统 */
:root {
    --qsm-primary: #2c6e49;
    --qsm-accent: #f4a261;
}

body {
    background-color: #f8f9fa;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.navbar-brand {
    font-weight: 700;
}

.sidebar {
    min-height: calc(100vh - 56px);
    background: #fff;
    border-right: 1px solid #dee2e6;
    padding-top: 0.75rem;
    padding-bottom: 1rem;
}

.sidebar-nav > .nav-item > .nav-link {
    font-weight: 600;
}

.nav-section {
    margin-top: 0.35rem;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--qsm-primary);
    color: #fff !important;
    padding: 0.55rem 0.85rem;
    margin: 0.15rem 0.5rem;
    border-radius: 0.3rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.nav-section-header:hover {
    background-color: #245a3c;
    color: #fff !important;
}

.nav-section-header .section-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.nav-section-header:not(.collapsed) .section-arrow {
    transform: rotate(0deg);
}

.nav-section-header.collapsed .section-arrow {
    transform: rotate(-90deg);
}

.nav-section-sub {
    padding: 0.15rem 0 0.25rem;
}

.nav-section-sub .nav-link {
    padding-left: 1.75rem;
    font-size: 0.9rem;
}

.sidebar .nav-link {
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    margin: 0.1rem 0.5rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: var(--qsm-primary);
    color: #fff;
}

.stat-card {
    border-left: 4px solid var(--qsm-primary);
}

.stat-card.profit-positive {
    border-left-color: #28a745;
}

.stat-card.profit-negative {
    border-left-color: #dc3545;
}

.pl-positive {
    color: #28a745;
    font-weight: 600;
}

.pl-negative {
    color: #dc3545;
    font-weight: 600;
}

.help-icon {
    cursor: help;
    color: #6c757d;
    font-size: 0.85rem;
}

.table-compact td, .table-compact th {
    padding: 0.4rem 0.5rem;
    vertical-align: middle;
}

.month-filter {
    max-width: 180px;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c6e49 0%, #4c956c 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.badge-draft { background-color: #ffc107; color: #000; }
.badge-confirmed { background-color: #28a745; }

.paid-status-cell { min-width: 88px; }
.paid-switch-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-left: 2.25rem;
}
.paid-switch-wrap .form-check-input {
    cursor: pointer;
    width: 2.2em;
    height: 1.15em;
}
.paid-switch-label { color: #495057; }

/* 商品三级分组表（对齐 Excel 合并单元格效果） */
.product-group-table {
    border-collapse: collapse;
}

.product-group-table th {
    text-align: center;
    font-size: 0.85rem;
}

.product-group-table .cell-name {
    background: #e8f3ed;
    font-weight: 600;
    vertical-align: middle;
    text-align: center;
    min-width: 110px;
    border-right: 1px solid #c5d9ce;
}

.product-group-table .cell-spec {
    background: #f4faf7;
    font-weight: 500;
    vertical-align: middle;
    text-align: center;
    min-width: 72px;
    border-right: 1px solid #dee2e6;
}

.product-group-table .cell-alias {
    text-align: center;
    min-width: 72px;
}

.product-group-table .cell-qty {
    color: #c0392b;
    font-weight: 600;
    text-align: right;
}

.product-group-table .cell-money {
    text-align: right;
}

.product-group-table tr.group-start > td {
    border-top: 2px solid #adb5bd;
}

.product-group-table tr:hover .cell-alias,
.product-group-table tr:hover .cell-qty,
.product-group-table tr:hover .cell-money {
    background-color: #fffde7;
}

.product-summary-badge {
    font-size: 0.78rem;
}

/* 库存盘点：对比上月盈亏提示 */
.mom-banner {
    padding: 0.55rem 1rem;
    border-radius: 0.35rem;
    font-size: 0.92rem;
    border: 2px solid;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.mom-banner .mom-amount {
    font-size: 1.15rem;
    font-weight: 800;
}

.mom-loss {
    background: #fff5f5;
    border-color: #dc3545;
    color: #b02a37;
}

.mom-loss .mom-amount {
    color: #dc3545;
}

.mom-profit {
    background: #f0fff4;
    border-color: #28a745;
    color: #1e7e34;
}

.mom-profit .mom-amount {
    color: #28a745;
}

.mom-neutral {
    background: #fff8e6;
    border-color: #ffc107;
    color: #856404;
}

.product-group-table .unit-price-input {
    color: #2c6e49;
    font-weight: 600;
}

.product-group-table .qty-input {
    color: #c0392b;
    font-weight: 600;
}

/* 全站账期提醒 */
.navbar-accounting-hint {
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 193, 7, 0.55);
    background: rgba(255, 193, 7, 0.15);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}

.accounting-month-banner {
    background: linear-gradient(90deg, #fff3cd 0%, #fff9e6 100%);
    border: 2px solid #ffc107;
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.25);
}

.accounting-month-banner-icon {
    font-size: 1.75rem;
    color: #e67e22;
    line-height: 1;
    margin-top: 0.1rem;
}

.accounting-month-banner-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #7a4f01;
}

.accounting-month-banner-text {
    font-size: 0.9rem;
    color: #5c4a1f;
    line-height: 1.5;
}

.accounting-month-badge-current {
    background: #2c6e49;
    color: #fff;
    font-size: 0.8rem;
}

.accounting-month-badge-prev {
    background: #fff;
    color: #856404;
    border: 1px solid #ffc107;
    font-size: 0.8rem;
}

.month-filter-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.accounting-month-badge-work {
    background: #c0392b;
    color: #fff;
    font-size: 0.8rem;
}

.accounting-month-badge-calendar {
    background: #6c757d;
    color: #fff;
    font-size: 0.8rem;
}

.accounting-month-mismatch {
    background: #fff;
    border: 2px solid #dc3545;
    color: #842029;
    padding: 0.45rem 0.65rem;
    border-radius: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.month-filter-hint-work {
    font-size: 0.75rem;
    font-weight: 700;
    color: #c0392b;
    white-space: nowrap;
}

.expense-date-hint {
    background: #fff8e1;
    border-width: 2px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #7a4f01;
}

.inventory-observe-card {
    background: #f8f9fa;
    border: 1px dashed #ced4da;
}

.inventory-observe-card .card-body small {
    color: #6c757d;
}

/* 操作结果浮动提示（不顶到页面顶部） */
.qsm-toast-container {
    position: fixed;
    top: 4.25rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.qsm-toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: 0.45rem;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateX(1rem);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.qsm-toast-show {
    opacity: 1;
    transform: translateX(0);
}

.qsm-toast-hide {
    opacity: 0;
    transform: translateY(-0.35rem);
}

.qsm-toast-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
}

.qsm-toast-text {
    flex: 1;
}

.qsm-toast-success {
    background: linear-gradient(135deg, #198754, #157347);
}

.qsm-toast-danger {
    background: linear-gradient(135deg, #dc3545, #b02a37);
}

.qsm-toast-warning {
    background: linear-gradient(135deg, #fd7e14, #e8590c);
}

.qsm-toast-info {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
}

/* 长表单弹窗：form 包裹 header/body/footer 时，中间区域可滚动、底部按钮固定可见 */
.qsm-modal-scroll.modal-dialog {
    max-height: calc(100vh - 1rem);
    margin: 0.5rem auto;
}

.qsm-modal-scroll .modal-content,
.qsm-modal-scroll .modal-content > form {
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.qsm-modal-scroll .modal-body {
    overflow-y: auto !important;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.qsm-modal-scroll .modal-header,
.qsm-modal-scroll .modal-footer {
    flex-shrink: 0;
}

@media print {
    .sidebar, .navbar, .no-print { display: none !important; }
    .col-md-10 { width: 100% !important; }
}
