* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    background: #eef1f5;
    color: #1f2933;
    font-size: 14px;
}

a {
    color: #1d4f91;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 226px;
    height: 100vh;
    background: #1f2d3d;
    color: #fff;
    border-right: 1px solid #17212e;
    padding: 18px 0;
}

.side-title {
    font-size: 26px;
    font-weight: 700;
    padding: 0 22px;
    line-height: 34px;
}

.side-desc {
    font-size: 12px;
    color: #b8c2cc;
    padding: 4px 22px 18px;
    border-bottom: 1px solid #33465c;
}

.menu-group {
    color: #8fa3b8;
    font-size: 12px;
    padding: 16px 22px 6px;
}

.sidebar a {
    display: block;
    height: 38px;
    line-height: 38px;
    color: #d8e1ea;
    padding: 0 22px;
    border-left: 4px solid transparent;
}

.sidebar a:hover {
    background: #293b50;
    text-decoration: none;
}

.sidebar a.active {
    background: #30465f;
    border-left-color: #2f80ed;
    color: #fff;
    font-weight: 700;
}

.main {
    margin-left: 226px;
    padding: 22px 26px 40px;
}

.page-head {
    min-height: 68px;
    background: #fff;
    border: 1px solid #d9e0e8;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-head h1 {
    margin: 0;
    font-size: 22px;
    color: #1f2933;
}

.page-head p {
    margin: 6px 0 0;
    color: #68778a;
}

.head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.panel {
    background: #fff;
    border: 1px solid #d9e0e8;
    margin-bottom: 16px;
    padding: 16px;
}

.panel h2 {
    margin: 0 0 12px;
    font-size: 17px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.panel-title h2 {
    margin: 0;
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.summary-card {
    background: #fff;
    border: 1px solid #d9e0e8;
    padding: 16px;
    min-height: 90px;
}

.summary-label {
    color: #68778a;
    font-size: 13px;
}

.summary-num {
    margin-top: 8px;
    font-size: 30px;
    font-weight: 700;
    color: #1d4f91;
}

.summary-num.warn {
    color: #b45309;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    min-width: 74px;
    padding: 0 14px;
    border: 1px solid #b7c3d0;
    background: #f5f7fa;
    color: #1f2933;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    border-radius: 2px;
    text-decoration: none;
}

button {
    background: #1d4f91;
    border-color: #1d4f91;
    color: #fff;
}

.btn.primary {
    background: #1d4f91;
    border-color: #1d4f91;
    color: #fff;
}

button.danger,
.btn.danger {
    background: #b42318;
    border-color: #b42318;
    color: #fff;
}

.btn:hover,
button:hover {
    opacity: 0.92;
    text-decoration: none;
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr 180px 78px 78px;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

input,
select,
textarea {
    width: 100%;
    min-height: 34px;
    border: 1px solid #b7c3d0;
    background: #fff;
    padding: 6px 8px;
    font-size: 14px;
    border-radius: 2px;
    outline: none;
    font-family: inherit;
}

textarea {
    min-height: 78px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #1d4f91;
    box-shadow: 0 0 0 1px #1d4f91 inset;
}

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

.data-table th,
.data-table td {
    border: 1px solid #d9e0e8;
    padding: 8px 9px;
    text-align: left;
    vertical-align: middle;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th {
    background: #f3f6f9;
    color: #34465a;
    font-weight: 700;
}

.data-table tr:nth-child(even) td {
    background: #fbfcfd;
}

.main-name {
    font-size: 16px;
    font-weight: 700;
}

.w-order {
    width: 170px;
}

.w-size {
    width: 180px;
}

.w-num {
    width: 70px;
}

.w-money {
    width: 110px;
}

.w-status {
    width: 100px;
}

.w-time {
    width: 170px;
}

.w-action {
    width: 150px;
}

.status {
    display: inline-block;
    min-width: 66px;
    text-align: center;
    border: 1px solid #9fb4cc;
    background: #eef5ff;
    color: #1d4f91;
    padding: 2px 8px;
    font-size: 13px;
}

.sep {
    color: #b7c3d0;
    margin: 0 4px;
}

.empty {
    border: 1px dashed #b7c3d0;
    background: #f8fafc;
    padding: 28px;
    color: #68778a;
    text-align: center;
}

.warning {
    background: #fff8e6;
    border-color: #f0c36d;
}

.warning p {
    margin: 6px 0;
}

.form-panel {
    max-width: 760px;
}

.form-section-title {
    height: 34px;
    line-height: 34px;
    margin: 8px 0 12px;
    padding: 0 10px;
    background: #f3f6f9;
    border-left: 4px solid #1d4f91;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 18px;
    margin-bottom: 12px;
}

.form-grid.one {
    grid-template-columns: repeat(2, 1fr);
}

.form-line label {
    display: block;
    margin-bottom: 5px;
    color: #34465a;
    font-weight: 600;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    gap: 8px;
}

.more-box {
    margin-top: 12px;
    border: 1px solid #d9e0e8;
    background: #fbfcfd;
    padding: 10px 12px;
}

.more-box summary {
    cursor: pointer;
    font-weight: 700;
    color: #34465a;
}

.calc-box {
    border: 1px solid #c8d3df;
    background: #f8fafc;
    padding: 8px 10px;
    min-height: 118px;
}

.calc-box div {
    display: flex;
    justify-content: space-between;
    line-height: 24px;
}

.calc-box .final {
    border-top: 1px solid #d9e0e8;
    margin-top: 4px;
    padding-top: 6px;
    font-size: 16px;
}

.calc-box .final b {
    color: #b42318;
}

.detail-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.full-panel {
    grid-column: 1 / -1;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table th,
.info-table td {
    border: 1px solid #d9e0e8;
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
}

.info-table th {
    width: 130px;
    background: #f3f6f9;
    color: #34465a;
}

.total-line td {
    color: #b42318;
    font-size: 18px;
    font-weight: 700;
}

.audit-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff8e6;
    border-color: #f0c36d;
}

.audit-panel h2 {
    margin: 0 0 6px;
}

.audit-panel p {
    margin: 0;
}

.inline-form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.amount {
    color: #b42318;
    font-weight: 700;
}

/* 登录页 */
.login-body {
    min-height: 100vh;
    background: #eef1f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 380px;
    background: #fff;
    border: 1px solid #c8d3df;
    padding: 30px;
}

.brand {
    font-size: 30px;
    font-weight: 700;
    color: #1d4f91;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #68778a;
    margin: 8px 0 24px;
}

.error {
    background: #fff1f0;
    border: 1px solid #ffa39e;
    color: #a8071a;
    padding: 8px;
    margin-bottom: 12px;
}

.hint {
    margin-top: 16px;
    color: #8a99aa;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

/* 打印页保留清晰单据风格 */
.print-body {
    background: #e5e7eb;
    padding: 24px;
}

.print-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: #fff;
    padding: 18mm;
    color: #111827;
}

.print-head {
    text-align: center;
    border-bottom: 2px solid #111827;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.print-head h1 {
    margin: 0 0 8px;
    letter-spacing: 2px;
}

.print-head p {
    margin: 0;
    color: #374151;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.print-table th,
.print-table td {
    border: 1px solid #111827;
    padding: 10px;
    font-size: 15px;
}

.print-table th {
    width: 18%;
    background: #f3f4f6;
    color: #111827;
}

.print-table.big th,
.print-table.big td {
    font-size: 18px;
    padding: 14px 10px;
}

.print-total td {
    font-size: 24px;
    font-weight: 800;
    color: #b42318;
}

.print-note,
.production-box {
    border: 1px solid #111827;
    padding: 14px;
    margin-bottom: 16px;
    min-height: 70px;
    white-space: pre-wrap;
}

.production-box h2 {
    margin: 0 0 10px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    font-size: 18px;
}

.print-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    font-size: 16px;
}

.print-actions {
    margin-top: 28px;
    text-align: center;
}

@media print {
    body.print-body {
        background: white;
        padding: 0;
    }

    .print-sheet {
        width: auto;
        min-height: auto;
        margin: 0;
        padding: 0;
    }

    .print-actions {
        display: none;
    }
}

@media (max-width: 1100px) {
    .summary-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid,
    .form-grid.one,
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .toolbar {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 210px;
    }

    .main {
        margin-left: 210px;
    }
}

.issue-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.issue-card {
    background: #fff;
    border: 1px solid #cfd8e3;
    padding: 18px;
    color: #111827;
}

.issue-doc-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}

.issue-doc-sub {
    text-align: center;
    margin-bottom: 14px;
    color: #4b5563;
}

.issue-table {
    width: 100%;
    border-collapse: collapse;
}

.issue-table th,
.issue-table td {
    border: 1px solid #1f2937;
    padding: 8px 10px;
    font-size: 14px;
    vertical-align: middle;
}

.issue-table th {
    width: 18%;
    background: #f3f4f6;
}

.issue-total td {
    font-size: 22px;
    font-weight: 700;
    color: #b42318;
}

.issue-note,
.issue-check {
    border: 1px solid #1f2937;
    margin-top: 14px;
    padding: 12px;
    min-height: 60px;
}

.issue-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    font-size: 14px;
}

@media (max-width: 1100px) {
    .issue-layout {
        grid-template-columns: 1fr;
    }
}

.w-code {
    width: 110px;
}

.customer-picker {
    position: relative;
}

.suggestions {
    display: none;
    position: absolute;
    left: 0;
    top: 61px;
    width: 100%;
    background: #fff;
    border: 1px solid #b7c3d0;
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.suggestion {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eef1f5;
}

.suggestion:hover {
    background: #eef5ff;
}

.suggestion.muted {
    color: #68778a;
    cursor: default;
}

.issue-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.issue-card {
    background: #fff;
    border: 1px solid #cfd8e3;
    padding: 18px;
    color: #111827;
}

.issue-doc-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}

.issue-doc-sub {
    text-align: center;
    margin-bottom: 14px;
    color: #4b5563;
}

.issue-table {
    width: 100%;
    border-collapse: collapse;
}

.issue-table th,
.issue-table td {
    border: 1px solid #1f2937;
    padding: 8px 10px;
    font-size: 14px;
    vertical-align: middle;
}

.issue-table th {
    width: 18%;
    background: #f3f4f6;
}

.issue-table .money {
    font-size: 20px;
    font-weight: 700;
    color: #b42318;
}

.issue-note,
.issue-check {
    border: 1px solid #1f2937;
    margin-top: 14px;
    padding: 12px;
    min-height: 60px;
}

.issue-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    font-size: 14px;
}

@media (max-width: 1100px) {
    .issue-layout {
        grid-template-columns: 1fr;
    }
}

.summary-sub {
    margin-top: 6px;
    color: #68778a;
    font-size: 13px;
}

.money-num {
    font-size: 24px;
    color: #b42318;
}

.w-action-wide {
    width: 190px;
}

.delete-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.link-danger {
    display: inline;
    height: auto;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #b42318;
    font-weight: 400;
    cursor: pointer;
    font-size: 14px;
}

.link-danger:hover {
    text-decoration: underline;
    opacity: 1;
}

.ai-banner {
    background: #1f2d3d;
    color: #fff;
    border: 1px solid #17212e;
    padding: 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-title {
    font-size: 22px;
    font-weight: 700;
}

.ai-desc {
    margin-top: 6px;
    color: #c8d3df;
}

.ai-badge {
    background: #2f80ed;
    color: #fff;
    padding: 6px 12px;
    font-weight: 700;
}

.insight-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.insight-card {
    border: 1px solid #d9e0e8;
    padding: 14px;
    background: #f8fafc;
}

.insight-card.good {
    border-left: 4px solid #15803d;
}

.insight-card.warn {
    border-left: 4px solid #b45309;
    background: #fff8e6;
}

.insight-card.normal {
    border-left: 4px solid #1d4f91;
}

.insight-head {
    font-weight: 700;
    margin-bottom: 8px;
    color: #1f2933;
}

.insight-text {
    color: #34465a;
    line-height: 1.7;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 1100px) {
    .insight-list,
    .analysis-grid {
        grid-template-columns: 1fr;
    }
}
