.template-tool-page {
    background: #f5f7f9;
    min-height: 100vh;
}

.template-tool-hero {
    padding: 66px 0 46px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.tool-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: #18bc9c;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.template-tool-hero h1 {
    margin: 0 0 12px;
    color: #1e293b;
    font-size: 38px;
    line-height: 1.15;
    font-weight: 800;
}

.template-tool-hero p {
    max-width: 720px;
    margin: 0;
    color: #64748b;
    font-size: 17px;
    line-height: 1.7;
}

.template-tool-workspace {
    padding: 28px 0 18px;
}

.tool-panel {
    margin-bottom: 16px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.tool-builder-panel {
    margin-bottom: 14px;
}

.tool-panel-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: #1e293b;
    font-size: 15px;
    font-weight: 800;
}

.tool-panel-heading i {
    color: #18bc9c;
}

.tool-entity-grid,
.tool-preset-grid,
.tool-condition-buttons {
    display: grid;
    gap: 8px;
}

.tool-entity-grid {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.tool-preset-grid {
    grid-template-columns: repeat(6, 1fr);
}

.tool-condition-buttons {
    grid-template-columns: repeat(6, 1fr);
}

.tool-entity,
.tool-preset,
.condition-btn {
    min-height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
    transition: all 0.16s;
}

.tool-entity:hover,
.tool-entity.active,
.tool-preset:hover,
.tool-preset.active,
.condition-btn:hover,
.condition-btn.active {
    border-color: #18bc9c;
    background: #ecfdf5;
    color: #0f766e;
}

.tool-entity.active,
.condition-btn.active {
    box-shadow: inset 0 0 0 1px #18bc9c;
}

.tool-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.tool-panel label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.tool-panel .form-control {
    border-color: #e2e8f0;
    border-radius: 6px;
    box-shadow: none;
}

.tool-panel .form-control:focus {
    border-color: #18bc9c;
    box-shadow: 0 0 0 3px rgba(24, 188, 156, 0.1);
}

.template-tool-page .is-hidden {
    display: none;
}

.tool-output-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.tool-generate-btn {
    margin-top: 4px;
}

.tool-output-header h2 {
    margin: 0 0 6px;
    color: #1e293b;
    font-size: 22px;
    font-weight: 800;
}

.tool-output-header p {
    margin: 0;
    color: #64748b;
}

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

.tool-code-pane,
.tool-reference {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.tool-code-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 800;
}

#copy-status {
    color: #18bc9c;
}

.tool-code-pane pre {
    margin: 0;
    min-height: 520px;
    max-height: 640px;
    padding: 18px;
    overflow: auto;
    border: 0;
    border-radius: 0;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.65;
    white-space: pre;
}

.tool-code-pane code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.tool-reference-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.tool-reference {
    padding: 16px;
}

.tool-reference h3 {
    margin: 0 0 10px;
    color: #1e293b;
    font-size: 15px;
    font-weight: 800;
}

.tool-reference ul {
    margin: 0;
    padding-left: 18px;
    color: #64748b;
}

.tool-reference li {
    margin-bottom: 8px;
}

.tool-reference code {
    padding: 2px 5px;
    background: #ecfdf5;
    color: #0f766e;
    border-radius: 4px;
}

@media (max-width: 991px) {
    .template-tool-hero {
        padding: 52px 0 38px;
    }

    .template-tool-hero h1 {
        font-size: 30px;
    }

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

    .tool-entity-grid,
    .tool-preset-grid,
    .tool-condition-buttons,
    .tool-form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .tool-entity-grid,
    .tool-preset-grid,
    .tool-condition-buttons,
    .tool-field-grid,
    .tool-form-grid {
        grid-template-columns: 1fr;
    }

    .tool-output-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-output-actions {
        justify-content: stretch;
    }

    .tool-output-actions .btn {
        flex: 1;
    }

    .tool-code-pane pre {
        min-height: 420px;
        max-height: 420px;
        font-size: 12px;
    }
}
