* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fb;
    color: #172033;
    font-family: "SiteSans", "SiteSansCJK", sans-serif;
    letter-spacing: 0;
}

.tool-shell {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 84px 20px 44px;
}

.tool-board {
    display: grid;
    grid-template-columns: minmax(180px, 270px) minmax(0, 1fr);
    gap: 10px 20px;
    align-items: start;
    margin-bottom: 14px;
}

.tool-board-head {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    min-width: 0;
}

.tool-board h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    color: #111827;
}

.tool-board p {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: #667085;
}

.tool-title {
    min-width: 0;
}

.tool-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tool-login-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    color: #1f8a4c;
    font-size: 12px;
    line-height: 1;
}

.tool-login-state i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.tool-filter-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
}

.tool-search {
    position: relative;
    flex: 1 1 320px;
    max-width: 480px;
    min-width: 260px;
}

.tool-search > i {
    position: absolute;
    left: 13px;
    top: 50%;
    margin-top: -8px;
    color: #7b8798;
    font-size: 16px;
}

.tool-search input {
    width: 100%;
    height: 36px;
    padding: 0 44px 0 38px;
    border: 1px solid #d6dce8;
    border-radius: 6px;
    background: #ffffff;
    color: #172033;
    font-size: 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.tool-search input:focus {
    border-color: #2f66d0;
    box-shadow: 0 0 0 3px rgba(47, 102, 208, .12);
}

.tool-search button {
    position: absolute;
    right: 7px;
    top: 50%;
    width: 28px;
    height: 28px;
    margin-top: -14px;
    border: 0;
    border-radius: 6px;
    background: #f1f3f7;
    color: #667085;
    cursor: pointer;
}

.tool-search button:hover {
    background: #e4e9f2;
    color: #2f66d0;
}

.tool-categories {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
}

.tool-categories button {
    height: 30px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #475467;
    font-size: 13px;
    line-height: 28px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.tool-categories button:hover {
    background: #eef4ff;
    color: #2f66d0;
}

.tool-categories button.is-active {
    border-color: #c7d7fe;
    background: #eef4ff;
    color: #2f66d0;
}

.tool-empty {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding: 16px;
    border: 1px dashed #d6dce8;
    border-radius: 8px;
    background: #ffffff;
    color: #7b8798;
    text-align: center;
    font-size: 13px;
}

.tool-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.tool-tile {
    min-height: 118px;
    padding: 18px;
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #ffffff;
    color: #172033;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.tool-tile i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: #eef4ff;
    color: #2f66d0;
    font-size: 20px;
}

.tool-tile span,
.tool-tile small {
    display: block;
    overflow-wrap: anywhere;
}

.tool-tile span {
    font-size: 16px;
    font-weight: 650;
    line-height: 1.35;
}

.tool-tile small {
    margin-top: 6px;
    color: #728096;
    font-size: 12px;
    line-height: 1.4;
}

.tool-tile.is-active {
    border-color: #2f66d0;
    box-shadow: 0 10px 24px rgba(47, 102, 208, .12);
    transform: translateY(-1px);
}

.tool-tile.is-disabled {
    cursor: not-allowed;
    opacity: .62;
}

.detector-layout {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.tool-section[hidden] {
    display: none !important;
}

.tool-section {
    scroll-margin-top: 96px;
}

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

.detect-panel,
.result-panel,
.utility-panel {
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #ffffff;
}

.detect-panel,
.utility-panel {
    padding: 22px;
}

.detect-panel {
    position: sticky;
    top: 88px;
}

.panel-title {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 22px;
}

.panel-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #eaf7f0;
    color: #198754;
    font-size: 22px;
}

.panel-title h2 {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
}

.panel-title p {
    margin: 0;
    color: #667085;
    font-size: 13px;
    line-height: 1.5;
}

.privacy-tip {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: -8px 0 18px;
    padding: 11px 12px;
    border: 1px solid #cbeed8;
    border-radius: 8px;
    background: #f0fbf4;
    color: #17613a;
    font-size: 13px;
    line-height: 1.6;
}

.privacy-tip i {
    flex: 0 0 auto;
    margin-top: 1px;
    color: #198754;
    font-size: 16px;
}

.usage-notice {
    margin: -6px 0 18px;
    padding: 11px 12px;
    border: 1px solid #f1c27d;
    border-radius: 8px;
    background: #fff9ed;
    color: #805b19;
    font-size: 13px;
    line-height: 1.7;
}

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

.form-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
    color: #344054;
    font-size: 13px;
}

.option-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid #e1e6ef;
    border-radius: 6px;
    background: #fbfcfe;
}

.option-grid input {
    margin: 0;
}

.option-with-number {
    justify-content: space-between;
}

.option-with-number span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.option-number-input {
    width: 68px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid #d6dce8;
    border-radius: 6px;
    background: #ffffff;
    color: #172033;
}

.field {
    display: block;
}

.field span {
    display: block;
    margin-bottom: 8px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.field-hint {
    display: block;
    margin-top: 7px;
    color: #667085;
    font-size: 12px;
    line-height: 1.6;
}

.field input,
.field select {
    width: 100%;
    height: 42px;
    border: 1px solid #d6dce8;
    border-radius: 6px;
    background: #ffffff;
    color: #172033;
    font-size: 14px;
    line-height: 42px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field input {
    padding: 0 12px;
}

.field select {
    padding: 0 10px;
}

.tool-textarea {
    width: 100%;
    min-height: 300px;
    padding: 12px;
    border: 1px solid #d6dce8;
    border-radius: 6px;
    background: #ffffff;
    color: #172033;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    font-family: monospace;
}

.small-textarea {
    min-height: 128px;
    margin-top: 12px;
}

.tool-textarea:focus {
    border-color: #2f66d0;
    box-shadow: 0 0 0 3px rgba(47, 102, 208, .12);
}

.tool-output {
    min-height: 300px;
    max-height: 560px;
    margin: 0;
    padding: 12px;
    overflow: auto;
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
}

.qr-preview {
    min-height: 280px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #d6dce8;
    border-radius: 8px;
    background: #fbfcfe;
}

.qr-preview img {
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
}

.qr-preview img[hidden] {
    display: none !important;
}

.qr-preview-empty {
    color: #7b8798;
    font-size: 13px;
    line-height: 1.6;
}

.qr-capture-tip {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #f4d7a1;
    border-radius: 8px;
    background: #fff8eb;
    color: #925c0b;
    font-size: 13px;
    line-height: 1.6;
}

.copy-result-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.copy-result-list[hidden] {
    display: none !important;
}

.copy-result-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 8px;
    align-items: stretch;
    padding: 8px;
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #ffffff;
}

.copy-result-text {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f8fafc;
    color: #172033;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.copy-result-btn {
    min-height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #2f66d0;
    cursor: pointer;
    font-size: 13px;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.copy-result-btn:hover {
    border-color: #2f66d0;
    background: #eef4ff;
}

.copy-field {
    position: relative;
}

.copy-field input {
    padding-right: 48px;
}

.copy-input-btn {
    position: absolute;
    right: 7px;
    top: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    border: 0;
    border-radius: 6px;
    background: #eef4ff;
    color: #2f66d0;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.copy-input-btn:hover {
    background: #2f66d0;
    color: #ffffff;
}

.copy-input-btn i {
    font-size: 15px;
    line-height: 30px;
}

.history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px 76px;
    gap: 8px;
}

.history-row .layui-btn {
    height: 42px;
    line-height: 42px;
    border-radius: 6px;
    margin: 0;
    padding: 0 14px;
}

.field input:focus,
.field select:focus {
    border-color: #2f66d0;
    box-shadow: 0 0 0 3px rgba(47, 102, 208, .12);
}

.qr-local-reader {
    margin-top: 14px;
}

.qr-local-title {
    display: block;
    margin-bottom: 8px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.qr-local-control {
    position: relative;
    display: grid;
    grid-template-columns: 138px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 46px;
    padding: 6px;
    border: 1px solid #d6dce8;
    border-radius: 8px;
    background: #ffffff;
}

.qr-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.qr-file-trigger {
    height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #172033;
    cursor: pointer;
    font-size: 13px;
    line-height: 32px;
    text-align: center;
    transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.qr-file-trigger:hover {
    border-color: #2f66d0;
    background: #eef4ff;
    color: #2f66d0;
}

.qr-file-name {
    min-width: 0;
    color: #475467;
    font-size: 13px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-local-reader p {
    margin: 8px 0 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.6;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.action-row-wrap {
    flex-wrap: wrap;
}

.action-row .layui-btn {
    min-width: 118px;
    height: 40px;
    border-radius: 6px;
}

.detect-submit {
    background: #2f66d0;
}

.tool-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.tool-result-head h3 {
    margin: 0;
    color: #172033;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 700;
}

.tool-result-head span {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 6px;
    background: #f1f3f7;
    color: #697586;
    font-size: 12px;
    line-height: 1;
}

.tool-result-head .state-ok {
    background: #edf8f0;
    color: #217a43;
}

.tool-result-head .state-error {
    background: #fff1f0;
    color: #b42318;
}

.result-panel {
    min-height: 520px;
    padding: 22px;
}

.result-empty {
    min-height: 474px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px dashed #d6dce8;
    border-radius: 8px;
    color: #7b8798;
    text-align: center;
}

.result-empty i {
    margin-bottom: 12px;
    color: #98a2b3;
    font-size: 42px;
}

.result-empty p {
    margin: 0;
    font-size: 14px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.compact-summary:empty {
    display: none;
}

.compact-summary .summary-item {
    min-height: 64px;
    padding: 12px;
}

.compact-summary .summary-item strong {
    font-size: 15px;
}

.summary-item {
    min-height: 78px;
    padding: 14px;
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #fbfcfe;
}

.summary-item span {
    display: block;
    color: #728096;
    font-size: 12px;
    line-height: 1.4;
}

.summary-item strong {
    display: block;
    margin-top: 8px;
    color: #172033;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.warning-list {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #f4d7a1;
    border-radius: 8px;
    background: #fff8eb;
    color: #925c0b;
    font-size: 13px;
    line-height: 1.7;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 12px;
}

.section-head h3 {
    margin: 0;
    color: #172033;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 700;
}

.section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-count {
    min-width: 72px;
    color: #667085;
    font-size: 13px;
    line-height: 34px;
    text-align: right;
}

.section-head .layui-btn {
    height: 34px;
    line-height: 34px;
    border-radius: 6px;
    margin: 0;
}

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

.model-item {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    min-height: 58px;
    padding: 11px;
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #ffffff;
}

.model-item input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.model-name {
    min-width: 0;
}

.model-copy {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: copy;
}

.model-name strong,
.model-name small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-name strong {
    color: #172033;
    font-size: 13px;
    line-height: 1.4;
}

.model-name small {
    margin-top: 3px;
    color: #7b8798;
    font-size: 12px;
}

.model-copy:hover strong {
    color: #2f66d0;
}

.model-tag {
    padding: 4px 7px;
    border-radius: 6px;
    background: #edf8f0;
    color: #217a43;
    font-size: 12px;
    white-space: nowrap;
}

.model-tag.is-muted {
    background: #f1f3f7;
    color: #697586;
}

.check-list {
    display: grid;
    gap: 12px;
}

.check-item {
    border: 1px solid #e1e6ef;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.check-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid #eef1f6;
}

.check-head strong {
    min-width: 0;
    color: #172033;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.check-status {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
}

.check-status-ok {
    background: #edf8f0;
    color: #217a43;
}

.check-status-error {
    background: #fff1f0;
    color: #b42318;
}

.connection-list {
    display: grid;
    gap: 8px;
    padding: 12px 14px 14px;
}

.connection-item {
    padding: 10px;
    border-radius: 6px;
    background: #f8fafc;
    color: #475467;
    font-size: 13px;
    line-height: 1.6;
}

.connection-item strong {
    display: block;
    margin-bottom: 4px;
    color: #344054;
}

.empty-line {
    padding: 18px;
    border: 1px dashed #d6dce8;
    border-radius: 8px;
    color: #7b8798;
    text-align: center;
    font-size: 13px;
}

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

    .tool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detector-layout {
        grid-template-columns: 1fr;
    }

    .utility-layout {
        grid-template-columns: 1fr;
    }

    .detect-panel {
        position: static;
    }
}

@media (max-width: 720px) {
    .tool-shell {
        padding: 82px 14px 32px;
    }

    .tool-section {
        scroll-margin-top: 84px;
    }

    .tool-board-head,
    .tool-filter-row,
    .section-head,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .tool-search {
        max-width: none;
        width: 100%;
    }

    .tool-categories {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .tool-categories button {
        width: 100%;
    }

    .tool-grid,
    .summary-grid,
    .model-list,
    .form-grid.two-col,
    .option-grid,
    .qr-local-control,
    .copy-result-item {
        grid-template-columns: 1fr;
    }

    .tool-board h1 {
        font-size: 24px;
    }

    .history-row {
        grid-template-columns: 1fr;
    }

    .detect-panel,
    .result-panel,
    .utility-panel {
        padding: 16px;
    }

    .tool-textarea,
    .tool-output {
        min-height: 240px;
    }

    .action-row .layui-btn,
    .section-head .layui-btn {
        width: 100%;
    }

    .action-row-wrap .layui-btn {
        width: 100%;
    }

    .section-actions {
        justify-content: stretch;
        width: 100%;
    }

    .selected-count {
        width: 100%;
        text-align: left;
    }

    .check-head {
        align-items: flex-start;
        flex-direction: column;
    }

}
