/* ==========================================================================
   38. 出入库单生成 · stock-in-out-form
   风格：牛皮纸单据 + 砖橙印章 / 仓储台账
   ========================================================================== */

.tsk.sio {
    --sio-paper: #f6f1e6;
    --sio-paper-2: #eee8da;
    --sio-card: #fffdf7;
    --sio-ink: #241f1a;
    --sio-ink-2: #5b5348;
    --sio-mute: #8d8475;
    --sio-line: #ddd3c0;
    --sio-accent: #b4611f;
    --sio-accent-soft: #f6e6d5;
    --sio-shadow: 0 18px 40px rgba(70, 50, 25, .12);
    --tsk-brand: #b4611f;
    color: var(--sio-ink);
}

.sio .tsk-h1 b { color: var(--sio-accent); }
.sio .tsk-kicker i { background: var(--sio-accent); }

/* ---------- 首屏 ---------- */
.sio-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
    gap: 34px;
    align-items: stretch;
    padding: 30px 0 10px;
}

.sio-hero-l {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.sio-hero-l .tsk-lead { max-width: 640px; }
.sio-hero-r { display: flex; min-width: 0; }

/* ---------- 单据头表单 ---------- */
.sio-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--sio-line);
    border-radius: 18px;
    background: var(--sio-card);
    box-shadow: var(--sio-shadow);
    overflow: hidden;
}

.sio-form-hd {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--sio-line);
    background:
        repeating-linear-gradient(90deg, transparent 0 19px, rgba(180, 97, 31, .08) 19px 20px),
        var(--sio-paper-2);
}

.sio-form-hd b { font-size: 14.5px; }
.sio-form-hd small { font-size: 12px; color: var(--sio-mute); }

.sio-form-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 18px 20px 20px;
}

.sio-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sio-acts { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 4px; }

.sio-tip {
    margin: 0;
    padding-top: 8px;
    border-top: 1px dashed var(--sio-line);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--sio-mute);
}

/* ---------- 明细区 ---------- */
.sio-rows-sec { margin-top: 26px; }

.sio-sec-hd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.sio-sec-sub, .sio-sec-sub2 { margin: 4px 0 0; font-size: 12px; color: var(--sio-mute); }
.sio-sec-sub b { color: var(--sio-accent); }
.sio-sec-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.sio-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--sio-line);
    border-radius: 14px;
    background: var(--sio-card);
    box-shadow: 0 8px 20px rgba(70, 50, 25, .06);
}

.sio-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

.sio-table thead th {
    padding: 10px 8px;
    font-size: 11.5px;
    font-weight: 700;
    text-align: left;
    color: var(--sio-ink-2);
    background: var(--sio-paper-2);
    border-bottom: 1px solid var(--sio-line);
    white-space: nowrap;
}

.sio-table thead th em { color: #c0261b; font-style: normal; }

.sio-table tbody td {
    padding: 4px 6px;
    border-bottom: 1px dashed var(--sio-line);
    vertical-align: middle;
}

.sio-table tbody tr:last-child td { border-bottom: 0; }

.sio-table tfoot td {
    padding: 11px 8px;
    font-size: 12.5px;
    background: var(--sio-paper);
    border-top: 2px solid var(--sio-line);
}

.sio-foot-label {
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--sio-ink-2);
}

.sio-foot-num {
    font-weight: 700;
    color: var(--sio-accent);
    font-variant-numeric: tabular-nums;
}

.sio-foot-mute { color: var(--sio-mute); font-size: 11.5px; }

/* 行内输入 */
.sio-input {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--sio-ink);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .14s, background .14s, box-shadow .14s;
}

.sio-input::placeholder { color: #b0a796; }
.sio-input:hover { border-color: var(--sio-line); background: #fff; }
.sio-input:focus { border-color: var(--sio-accent); background: #fff; box-shadow: 0 0 0 3px rgba(180, 97, 31, .12); }
.sio-input.is-error { border-color: #c0261b; background: #fdf1f0; box-shadow: 0 0 0 3px rgba(192, 38, 27, .12); }

.sio-input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }

.sio-drag {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: grab;
    user-select: none;
}

.sio-drag:active { cursor: grabbing; }

.sio-grip {
    color: #b9ae9a;
    font-size: 12px;
    letter-spacing: -1px;
}

.sio-drag b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--sio-paper-2);
    color: var(--sio-ink-2);
    font-size: 10.5px;
}

.sio-cell-amt {
    text-align: right;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    color: var(--sio-ink-2);
}

.sio-del {
    width: 26px;
    height: 26px;
    border: 1px solid var(--sio-line);
    border-radius: 6px;
    background: #fff;
    color: var(--sio-mute);
    font-size: 11px;
    cursor: pointer;
    transition: border-color .14s, color .14s, background .14s;
}

.sio-del:hover { border-color: #d9a3a0; background: #fdf1f0; color: #c0261b; }

.sio-row.is-dragging { opacity: .45; }
.sio-row.is-over td { box-shadow: inset 0 2px 0 var(--sio-accent); }

.sio-err {
    min-height: 20px;
    margin: 8px 2px 0;
    font-size: 12px;
    color: #c0261b;
}

/* ---------- 预览 ---------- */
.sio-stage {
    margin-top: 26px;
    border: 1px solid var(--sio-line);
    border-radius: 20px;
    background: var(--sio-paper);
    box-shadow: var(--sio-shadow);
    overflow: hidden;
}

.sio-stage-hd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--sio-line);
    background: var(--sio-paper-2);
}

.sio-stage-sub { margin: 4px 0 0; font-size: 12px; color: var(--sio-mute); }
.sio-tools { display: flex; flex-wrap: wrap; gap: 8px; }

.sio-doc {
    width: min(820px, calc(100% - 48px));
    margin: 26px auto 34px;
    padding: 34px 38px 28px;
    border: 1px solid #d9d2c2;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(60, 45, 25, .12);
    color: #1f1c18;
}

.sio-doc-hd {
    position: relative;
    padding-bottom: 14px;
    border-bottom: 3px double #33302b;
    text-align: center;
}

.sio-doc-brand {
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 10px;
    letter-spacing: .22em;
    color: #a19685;
}

.sio-doc-hd h3 {
    margin: 4px 0 6px;
    font-size: 26px;
    letter-spacing: .16em;
}

.sio-doc-hd p { margin: 0; font-size: 12px; color: #6b6357; }

.sio-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 26px;
    padding: 14px 2px;
    font-size: 12.5px;
    color: #5d5548;
}

.sio-doc-meta b { color: #1f1c18; font-weight: 600; }

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

.sio-doc-table th,
.sio-doc-table td {
    padding: 8px 8px;
    border: 1px solid #b9b09e;
    font-size: 12px;
    text-align: left;
    vertical-align: middle;
}

.sio-doc-table th {
    background: #f1ece1;
    font-weight: 700;
    letter-spacing: .04em;
}

.sio-doc-table td:nth-child(5),
.sio-doc-table td:nth-child(6),
.sio-doc-table td:nth-child(7),
.sio-doc-table th:nth-child(5),
.sio-doc-table th:nth-child(6),
.sio-doc-table th:nth-child(7) { text-align: right; }

.sio-doc-table tfoot td { background: #f7f3ea; font-weight: 700; }
.sio-doc-empty { text-align: center !important; color: #a19685; padding: 26px 8px !important; }

.sio-doc-upper {
    margin: 12px 0 0;
    padding: 9px 10px;
    border: 1px dashed #b9b09e;
    font-size: 12.5px;
    color: #5d5548;
}

.sio-doc-upper b { color: #1f1c18; letter-spacing: .06em; }

.sio-doc-remark {
    margin: 10px 0 0;
    font-size: 11.5px;
    line-height: 1.7;
    color: #6b6357;
}

.sio-doc-sign {
    display: flex;
    gap: 40px;
    margin-top: 30px;
    padding-top: 8px;
}

.sio-doc-sign > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 12px;
    color: #6b6357;
}

.sio-doc-sign i { display: block; border-bottom: 1px solid #b9b09e; }

/* ---------- 规则 / 自查 ---------- */
.sio-rules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.sio-rule {
    padding: 19px 17px;
    border: 1px solid var(--sio-line);
    border-radius: 14px;
    background: var(--sio-card);
}

.sio-rule > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: var(--sio-accent-soft);
    color: var(--sio-accent);
    font-size: 12px;
    font-weight: 700;
}

.sio-rule b { display: block; font-size: 14px; margin-bottom: 7px; }
.sio-rule p { margin: 0; font-size: 12.5px; line-height: 1.75; color: var(--sio-ink-2); }

.sio-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.sio-check {
    display: flex;
    gap: 14px;
    padding: 17px 18px;
    border: 1px solid var(--sio-line);
    border-radius: 14px;
    background: var(--sio-card);
}

.sio-check > span {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--sio-accent-soft);
    color: var(--sio-accent);
    font-size: 12px;
    font-weight: 700;
}

.sio-check b { display: block; font-size: 13.5px; margin-bottom: 5px; }
.sio-check p { margin: 0; font-size: 12.5px; line-height: 1.75; color: var(--sio-ink-2); }

/* ---------- Toast ---------- */
.sio-toast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    z-index: 999;
    padding: 11px 18px;
    border-radius: 99px;
    background: rgba(40, 32, 24, .93);
    color: #fff;
    font-size: 13px;
    opacity: 0;
    transform: translate(-50%, 14px);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}

.sio-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .sio-hero { grid-template-columns: minmax(0, 1fr); }
    .sio-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .sio-doc { width: calc(100% - 24px); padding: 22px 18px; }
    .sio-doc-hd h3 { font-size: 20px; }
    .sio-doc-sign { gap: 18px; }
}

@media (max-width: 640px) {
    .sio-row2 { grid-template-columns: 1fr; }
    .sio-rules, .sio-checks { grid-template-columns: minmax(0, 1fr); }
    .sio-form-body { padding: 16px; }
    .sio-stage-hd { padding: 14px 16px; }
    .sio-tools { width: 100%; }
    .sio-tools .tsk-btn { flex: 1 1 calc(50% - 8px); }
}

/* ---------- 深色模式（仅变量覆盖） ---------- */
:root[data-theme="dark"] .tsk.sio {
    --sio-paper: #1a1713;
    --sio-paper-2: #23201b;
    --sio-card: #1f1c17;
    --sio-ink: #f2ece0;
    --sio-ink-2: #c6bcaa;
    --sio-mute: #928778;
    --sio-line: #3a342b;
    --sio-accent: #e0913f;
    --sio-accent-soft: #3a2918;
    --sio-shadow: 0 18px 40px rgba(0, 0, 0, .5);
}

:root[data-theme="dark"] .tsk.sio .sio-input:hover,
:root[data-theme="dark"] .tsk.sio .sio-input:focus { background: #2a251e; }
:root[data-theme="dark"] .tsk.sio .sio-del { background: #26221c; }
:root[data-theme="dark"] .tsk.sio .sio-doc {
    background: #fbf8f1;
    color: #1f1c18;
    border-color: #423a2c;
}
:root[data-theme="dark"] .tsk.sio .sio-toast { background: rgba(255, 255, 255, .94); color: #1f1a14; }
