:root {
    --blue-900: #0e4fb0;
    --blue-700: #1765d8;
    --blue-500: #1d7fee;
    --blue-100: #eaf4ff;
    --blue-50: #f6faff;
    --ink: #16334f;
    --muted: #5c7894;
    --line: #d5e7f7;
    --white: #ffffff;
    --amber: #fff3bf;
    --amber-deep: #b7791f;
    --green: #179a67;
    --red: #d64545;
    --shadow: 0 8px 24px rgba(21, 91, 190, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(128, 201, 255, 0.28), transparent 32%),
        radial-gradient(circle at 88% 18%, rgba(84, 155, 255, 0.20), transparent 30%),
        linear-gradient(180deg, #fbfdff 0%, #eef7ff 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
        radial-gradient(circle, rgba(190, 222, 255, 0.35) 1px, transparent 1px);
    background-size: auto, 26px 26px;
    pointer-events: none;
    z-index: 0;
}

#particleCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

.landing-body,
.landing-body::before,
.landing-body #particleCanvas {
    min-height: 100vh;
}

.landing-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.landing-box {
    width: 100%;
    max-width: 620px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 42px 34px;
    text-align: center;
}

.landing-box h1 {
    margin: 0 0 14px;
    font-size: clamp(24px, 4vw, 32px);
    color: var(--blue-900);
    letter-spacing: 0;
}

.clock {
    margin: 0;
    font-size: 17px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.landing-tip {
    margin: 26px 0 16px;
    font-size: 15px;
    color: var(--muted);
}

.shift-choose {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.shift-choose form {
    margin: 0;
}

.topbar {
    position: relative;
    z-index: 1;
    background: linear-gradient(100deg, var(--blue-900) 0%, var(--blue-500) 100%);
    box-shadow: 0 5px 18px rgba(14, 79, 176, 0.22);
}

.topbar-inner {
    position: relative;
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar-title {
    text-align: center;
}

.topbar-title h1 {
    margin: 0 0 6px;
    font-size: clamp(21px, 3vw, 28px);
    color: #fff;
    letter-spacing: 0;
}

.topbar-title .clock {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.shift-badge {
    flex: 0 0 auto;
    background: #fff;
    color: var(--blue-700);
    font-size: 16px;
    font-weight: 800;
    padding: 10px 18px;
    border-radius: 8px;
    border: 0;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 40, 100, 0.18);
    white-space: nowrap;
    font-family: inherit;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    margin: 0 auto;
    padding: 22px 20px 60px;
}

.panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.panel-head h2 {
    margin: 0;
    font-size: 19px;
    color: var(--blue-900);
}

.panel-actions {
    display: flex;
    gap: 10px;
}

.notice {
    background: var(--blue-100);
    border: 1px solid #b8dcff;
    border-radius: 8px;
    color: var(--blue-900);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 15px;
}

.notice b {
    margin: 0 2px;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 14px;
    background: var(--blue-50);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.range-label {
    font-weight: 700;
    color: var(--blue-900);
    white-space: nowrap;
}

.range-sep {
    color: var(--muted);
    font-weight: 700;
    font-size: 18px;
}

.time-select {
    min-height: 44px;
    min-width: 132px;
    padding: 0 10px;
    border: 1px solid #bcd9f5;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.time-select:focus,
.data-grid input:focus,
.manual-reason input:focus {
    outline: 2px solid rgba(29, 127, 238, 0.35);
    outline-offset: 1px;
    border-color: var(--blue-500);
}

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

.field label,
.reason-block > label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 7px;
}

.data-grid input,
.manual-reason input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #c7def5;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.data-grid input[readonly] {
    background: var(--blue-50);
    color: var(--blue-900);
    font-weight: 700;
}

.data-grid input.skid-ok {
    background: #e9f9f1;
    border-color: #7fd3ac;
    color: #127a50;
}

.data-grid input.skid-error {
    background: #fff0f0;
    border-color: #f2a0a0;
    color: #b42323;
}

.data-grid input.skid-over {
    background: #fff0f0;
    border-color: #f24444;
    color: #d92626;
    font-weight: 700;
}

.data-grid input.auto-fill {
    background: var(--amber);
    border-color: #f0d477;
    color: var(--amber-deep);
    font-weight: 700;
}

.data-grid input:disabled {
    background: #f1f4f7;
    color: #8da3b8;
}

.reason-block {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--line);
}

.reason-block .btn {
    margin-top: 4px;
}

.reason-preview {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--blue-50);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 44px;
    white-space: pre-wrap;
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink);
}

.reason-preview:empty::before {
    content: "无";
    color: #a7b9ca;
}

.manual-reason {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.manual-reason input {
    flex: 1 1 260px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    color: #fff;
    box-shadow: 0 6px 16px rgba(23, 101, 216, 0.24);
}

.btn-outline {
    border-color: #bcd9f5;
    background: #fff;
    color: var(--blue-700);
}

.btn-secondary {
    border-color: #cfe4f8;
    background: var(--blue-100);
    color: var(--blue-900);
}

.btn-danger {
    border-color: #f3c5c5;
    background: #fff5f5;
    color: var(--red);
}

.btn-lg {
    min-height: 50px;
    min-width: 160px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 12px;
}

.total-item {
    background: var(--blue-50);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
}

.total-item span {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.total-item b {
    font-size: 24px;
    color: var(--blue-900);
    font-variant-numeric: tabular-nums;
}

.records-list:empty::before {
    content: "暂无产量数据";
    display: block;
    text-align: center;
    color: #a7b9ca;
    padding: 30px 0;
}

.record-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.record-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.record-head strong {
    font-size: 17px;
    color: var(--blue-900);
    font-variant-numeric: tabular-nums;
}

.record-head span {
    font-size: 13px;
    color: var(--muted);
}

.record-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px 14px;
    font-size: 14px;
    color: var(--ink);
}

.record-grid span {
    padding: 6px 0;
    border-bottom: 1px dashed #e3eef8;
}

.record-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.record-actions .btn {
    min-height: 38px;
    padding: 0 14px;
    font-size: 14px;
}

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(12, 38, 68, 0.46);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal {
    position: relative;
    width: 100%;
    max-width: 580px;
    max-height: 86vh;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(12, 38, 68, 0.28);
    padding: 22px;
}

.modal h3 {
    margin: 0 0 16px;
    color: var(--blue-900);
    font-size: 19px;
}

.reason-options {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.reason-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--blue-50);
    font-size: 15px;
    cursor: pointer;
}

.reason-options input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue-500);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 18px;
    flex-wrap: wrap;
}

.shift-modal .shift-choose {
    margin-top: 8px;
}

.report-modal {
    max-width: 640px;
}

.report-modal pre {
    margin: 0;
    padding: 16px;
    background: var(--blue-50);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: "SFMono-Regular", Consolas, "Microsoft YaHei", monospace;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ink);
    max-height: 52vh;
    overflow: auto;
}

.burst {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: 8px;
}

.burst-piece {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    animation: burst 0.9s ease-out forwards;
}

@keyframes burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0.2);
        opacity: 0;
    }
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 40;
    background: #123c6b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(12, 38, 68, 0.3);
    font-size: 15px;
    max-width: calc(100% - 32px);
    text-align: center;
}

.hidden {
    display: none !important;
}

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

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        padding: 14px 14px 16px;
    }

    .shift-badge {
        font-size: 15px;
        padding: 8px 14px;
    }

    .container {
        padding: 14px 12px 50px;
    }

    .panel {
        padding: 14px;
    }

    .data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .range-row {
        gap: 8px;
    }

    .time-select {
        min-width: 0;
        flex: 1 1 0;
    }

    .landing-box {
        padding: 32px 20px;
    }

    .shift-choose .btn-lg {
        min-width: 136px;
    }

    .modal-actions {
        justify-content: stretch;
    }

    .modal-actions .btn {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }
}
