:root {
            --bg: #f3f5f7;
            --panel: #ffffff;
            --ink: #17202a;
            --muted: #667085;
            --line: #d8dee6;
            --line-strong: #b7c0cc;
            --brand: #0f6f68;
            --brand-dark: #0a4f4b;
            --brand-soft: #e5f3f1;
            --gold: #c7952a;
            --steel: #657384;
            --danger: #b42318;
            --shadow: 0 18px 45px rgba(29, 41, 57, .10);
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            min-height: 100vh;
            background:
                linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(243, 245, 247, .94)),
                repeating-linear-gradient(90deg, rgba(23, 32, 42, .035) 0 1px, transparent 1px 84px);
            color: var(--ink);
            font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
            letter-spacing: 0;
        }

        button,
        input,
        select {
            font: inherit;
        }

        .app-shell {
            width: min(1440px, calc(100% - 32px));
            margin: 0 auto;
            padding: 22px 0 32px;
        }

        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            margin-bottom: 18px;
        }

        .brand-block {
            display: flex;
            align-items: center;
            gap: 14px;
            min-width: 0;
        }

        .brand-mark {
            width: 46px;
            height: 46px;
            border: 1px solid #0b5f5a;
            background: linear-gradient(145deg, var(--brand), #163646);
            color: #fff;
            display: grid;
            place-items: center;
            font-weight: 800;
            border-radius: 8px;
            box-shadow: 0 10px 25px rgba(15, 111, 104, .22);
            flex: 0 0 auto;
        }

        .brand-title {
            margin: 0;
            font-size: clamp(1.45rem, 3vw, 2.35rem);
            line-height: 1.05;
        }

        .brand-subtitle {
            margin: 5px 0 0;
            color: var(--muted);
            font-size: .94rem;
        }

        .top-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .btn {
            min-height: 40px;
            border: 1px solid var(--line-strong);
            border-radius: 8px;
            background: #fff;
            color: var(--ink);
            padding: 9px 14px;
            cursor: pointer;
            transition: border-color .18s, background .18s, color .18s, transform .18s;
        }

        .btn:hover {
            border-color: var(--brand);
            transform: translateY(-1px);
        }

        .btn-primary {
            border-color: var(--brand);
            background: var(--brand);
            color: #fff;
        }

        .btn-ghost {
            background: transparent;
        }

        .workflow {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
            margin-bottom: 16px;
        }

        .workflow-card {
            border: 1px solid var(--line);
            background: rgba(255, 255, 255, .82);
            border-radius: 8px;
            padding: 12px;
            display: grid;
            grid-template-columns: auto 1fr;
            gap: 11px;
            align-items: center;
        }

        .workflow-card.active {
            border-color: rgba(15, 111, 104, .55);
            background: var(--brand-soft);
        }

        .step-index {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: #17202a;
            color: #fff;
            display: grid;
            place-items: center;
            font-size: .82rem;
            font-weight: 700;
        }

        .workflow-card.active .step-index {
            background: var(--brand);
        }

        .step-label {
            margin: 0 0 2px;
            color: var(--muted);
            font-size: .74rem;
            text-transform: uppercase;
        }

        .step-value {
            margin: 0;
            font-weight: 700;
        }

        .main-grid {
            display: grid;
            grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
            gap: 16px;
            align-items: start;
        }

        .panel {
            background: var(--panel);
            border: 1px solid var(--line);
            border-radius: 8px;
            box-shadow: var(--shadow);
        }

        .panel-header {
            padding: 18px 20px 14px;
            border-bottom: 1px solid var(--line);
        }

        .panel-title {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            align-items: start;
            margin: 0;
            font-size: 1.05rem;
        }

        .panel-title span {
            color: var(--muted);
            font-size: .82rem;
            font-weight: 500;
        }

        .panel-body {
            padding: 18px 20px 20px;
        }

        .field-stack {
            display: grid;
            gap: 16px;
        }

        .field {
            display: grid;
            gap: 7px;
        }

        .field label {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            color: #344054;
            font-weight: 700;
            font-size: .9rem;
        }

        .code {
            color: var(--brand);
            font-family: Consolas, "Courier New", monospace;
            font-weight: 800;
        }

        .input-row {
            display: grid;
            grid-template-columns: 1fr auto;
            border: 1px solid var(--line-strong);
            border-radius: 8px;
            overflow: hidden;
            background: #fff;
        }

        .input-row input,
        .input-row select {
            width: 100%;
            border: 0;
            outline: 0;
            padding: 12px 12px;
            color: var(--ink);
            background: #fff;
        }

        .unit {
            display: grid;
            place-items: center;
            min-width: 58px;
            padding: 0 10px;
            color: var(--muted);
            background: #f7f9fb;
            border-left: 1px solid var(--line);
        }

        .segmented {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            border: 1px solid var(--line-strong);
            border-radius: 8px;
            overflow: hidden;
        }

        .segmented button {
            border: 0;
            border-right: 1px solid var(--line);
            background: #fff;
            min-height: 42px;
            cursor: pointer;
            color: var(--muted);
            font-weight: 700;
        }

        .segmented button:last-child {
            border-right: 0;
        }

        .segmented button.active {
            background: var(--brand);
            color: #fff;
        }

        .quick-filters {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
        }

        .chip {
            border: 1px solid var(--line-strong);
            border-radius: 999px;
            background: #fff;
            color: #344054;
            min-height: 38px;
            cursor: pointer;
            font-weight: 700;
        }

        .chip.active {
            border-color: var(--brand);
            background: var(--brand-soft);
            color: var(--brand-dark);
        }

        .diagram-panel {
            overflow: hidden;
        }

        .hero-strip {
            display: grid;
            grid-template-columns: 1fr auto;
            align-items: center;
            gap: 14px;
            padding: 18px 20px;
            border-bottom: 1px solid var(--line);
            background: linear-gradient(90deg, #ffffff, #eef3f5);
        }

        .hero-strip h2 {
            margin: 0;
            font-size: clamp(1.25rem, 2vw, 1.85rem);
        }

        .hero-strip p {
            margin: 6px 0 0;
            color: var(--muted);
        }

        .status-pill {
            border: 1px solid rgba(15, 111, 104, .35);
            background: var(--brand-soft);
            color: var(--brand-dark);
            border-radius: 999px;
            padding: 7px 11px;
            font-weight: 800;
            white-space: nowrap;
        }

        .diagram-wrap {
            display: grid;
            grid-template-columns: minmax(280px, .95fr) minmax(260px, 1fr);
            gap: 8px;
            align-items: center;
            padding: 18px 20px 20px;
        }

        .diagram-card {
            background: #f8fafc;
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 12px;
        }

        svg {
            display: block;
            width: 100%;
            height: auto;
        }

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

        .metric {
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 13px;
            background: #fff;
            min-height: 88px;
        }

        .metric-label {
            margin: 0 0 6px;
            color: var(--muted);
            font-size: .82rem;
        }

        .metric-value {
            margin: 0;
            font-size: 1.35rem;
            font-weight: 800;
        }

        .metric-value small {
            color: var(--muted);
            font-size: .82rem;
            font-weight: 600;
        }

        .results {
            margin-top: 16px;
        }

        .table-shell {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            min-width: 760px;
        }

        th,
        td {
            padding: 12px 14px;
            text-align: left;
            border-bottom: 1px solid var(--line);
            white-space: nowrap;
        }

        th {
            color: #475467;
            background: #f8fafc;
            font-size: .78rem;
            text-transform: uppercase;
            letter-spacing: .02em;
        }

        td {
            color: #1d2939;
            font-size: .92rem;
        }

        tbody tr:hover {
            background: #fbfcfe;
        }

        .empty {
            padding: 24px;
            color: var(--danger);
            font-weight: 700;
        }

        @media (max-width: 980px) {
            .topbar,
            .hero-strip,
            .diagram-wrap,
            .main-grid {
                grid-template-columns: 1fr;
            }

            .topbar {
                align-items: stretch;
            }

            .top-actions {
                justify-content: flex-start;
            }

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

        @media (max-width: 560px) {
            .app-shell {
                width: min(100% - 18px, 1440px);
                padding-top: 12px;
            }

            .brand-block {
                align-items: flex-start;
            }

            .brand-mark {
                width: 40px;
                height: 40px;
            }

            .top-actions,
            .quick-filters,
            .metric-grid {
                grid-template-columns: 1fr;
                display: grid;
            }

            .btn {
                width: 100%;
            }
        }
