.ifg-tool {
    --ifg-ink: #172033;
    --ifg-muted: #667085;
    --ifg-line: #d8e2ee;
    --ifg-soft: #f5f8fb;
    --ifg-card: #ffffff;
    --ifg-primary: #0f6fb5;
    --ifg-primary-dark: #0a4f82;
    --ifg-accent: #0d9488;
    --ifg-accent-dark: #0f766e;
    --ifg-warn: #b7791f;
    --ifg-danger: #c43d3d;
    --ifg-shadow: 0 16px 38px rgba(30, 48, 80, .10);
    color: var(--ifg-ink);
    display: grid;
    gap: 16px;
    width: 100%;
}
.ifg-tool * {
    box-sizing: border-box;
}
.ifg-tool button,
.ifg-tool input,
.ifg-tool select {
    font: inherit;
}
.ifg-guide {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(15, 111, 181, .22);
    border-radius: 8px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(15, 111, 181, .10), rgba(13, 148, 136, .08)), #fff;
    box-shadow: var(--ifg-shadow);
}
.ifg-guide strong {
    display: block;
    margin-bottom: 5px;
    font-size: 17px;
    line-height: 1.35;
}
.ifg-guide span {
    color: var(--ifg-muted);
    font-size: 13px;
    line-height: 1.65;
}
.ifg-guide-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.ifg-guide-pills span {
    border: 1px solid rgba(15, 111, 181, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .80);
    color: var(--ifg-primary-dark);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
}
.ifg-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.ifg-tab {
    border: 1px solid var(--ifg-line);
    border-radius: 8px;
    background: #fff;
    color: #10365c;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 64px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ifg-tab:hover {
    border-color: rgba(15, 111, 181, .44);
    transform: translateY(-1px);
}
.ifg-tab.active {
    border-color: var(--ifg-primary);
    background: linear-gradient(180deg, #ffffff, #eef7fc);
    box-shadow: 0 12px 26px rgba(15, 111, 181, .14);
}
.ifg-tab-index {
    align-items: center;
    background: #e7f1fb;
    border-radius: 999px;
    color: var(--ifg-primary-dark);
    display: inline-flex;
    font-weight: 900;
    height: 32px;
    justify-content: center;
    width: 32px;
}
.ifg-tab.active .ifg-tab-index {
    background: var(--ifg-primary);
    color: #fff;
}
.ifg-tab-label {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.ifg-tab-label b {
    color: #0d3558;
    font-size: 15px;
    line-height: 1.25;
}
.ifg-tab-label small {
    color: #4e637b;
    font-size: 12px;
    line-height: 1.35;
}
.ifg-workspace {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.04fr) minmax(340px, .96fr);
}
.ifg-panel,
.ifg-preview {
    background: var(--ifg-card);
    border: 1px solid var(--ifg-line);
    border-radius: 8px;
    box-shadow: var(--ifg-shadow);
}
.ifg-panel {
    padding: 18px;
}
.ifg-step {
    display: none;
    gap: 16px;
}
.ifg-step.active {
    display: grid;
}
.ifg-step-head,
.ifg-section-title,
.ifg-preview-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}
.ifg-step-head {
    border-bottom: 1px solid #edf1f6;
    padding-bottom: 12px;
}
.ifg-step-head h3 {
    font-size: 18px;
    line-height: 1.35;
    margin: 0 0 6px;
}
.ifg-step-head p {
    color: var(--ifg-muted);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}
.ifg-badge {
    align-items: center;
    background: #ecfdf5;
    border: 1px solid rgba(13, 148, 136, .22);
    border-radius: 999px;
    color: var(--ifg-accent-dark);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    min-height: 28px;
    padding: 5px 10px;
}
.ifg-dropzone {
    align-items: center;
    background:
        linear-gradient(#fff, #fff) padding-box,
        repeating-linear-gradient(135deg, rgba(15, 111, 181, .42) 0 10px, rgba(13, 148, 136, .38) 10px 20px) border-box;
    border: 1px dashed transparent;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: 8px;
    justify-items: center;
    min-height: 210px;
    padding: 26px;
    text-align: center;
    transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ifg-dropzone.dragover {
    background:
        linear-gradient(180deg, #f7fbff, #eef9f7) padding-box,
        repeating-linear-gradient(135deg, rgba(15, 111, 181, .55) 0 10px, rgba(13, 148, 136, .50) 10px 20px) border-box;
    box-shadow: 0 16px 30px rgba(15, 111, 181, .12);
    transform: translateY(-1px);
}
.ifg-dropzone input {
    display: none;
}
.ifg-drop-icon {
    align-items: center;
    background: var(--ifg-primary);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 30px;
    font-weight: 600;
    height: 56px;
    justify-content: center;
    line-height: 1;
    width: 56px;
}
.ifg-drop-main {
    color: #102a43;
    font-size: 17px;
    font-weight: 800;
}
.ifg-drop-sub {
    color: var(--ifg-muted);
    font-size: 13px;
    line-height: 1.6;
}
.ifg-actions,
.ifg-output-actions,
.ifg-run-box,
.ifg-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ifg-run-box {
    align-items: center;
}
.ifg-btn,
.ifg-preset {
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.ifg-btn:hover,
.ifg-preset:hover {
    transform: translateY(-1px);
}
.ifg-btn:disabled {
    cursor: not-allowed;
    opacity: .62;
    transform: none;
}
.ifg-btn-primary {
    background: var(--ifg-primary);
    border: 1px solid var(--ifg-primary);
    box-shadow: 0 12px 24px rgba(15, 111, 181, .16);
    color: #fff;
}
.ifg-btn-primary:hover {
    background: var(--ifg-primary-dark);
    border-color: var(--ifg-primary-dark);
}
.ifg-btn-secondary {
    background: #eef7fc;
    border: 1px solid rgba(15, 111, 181, .28);
    color: var(--ifg-primary-dark);
}
.ifg-btn-ghost,
.ifg-preset {
    background: #fff;
    border: 1px solid var(--ifg-line);
    color: #163a5f;
}
.ifg-btn-large {
    min-height: 48px;
    padding-inline: 20px;
}
.ifg-preset.active {
    background: var(--ifg-accent);
    border-color: var(--ifg-accent);
    box-shadow: 0 10px 22px rgba(13, 148, 136, .14);
    color: #fff;
}
.ifg-file-box,
.ifg-result-box {
    background: var(--ifg-soft);
    border: 1px solid #e3ebf4;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    padding: 14px;
}
.ifg-section-title b,
.ifg-preview-head b {
    color: #102a43;
    font-size: 15px;
}
.ifg-section-title span,
.ifg-preview-head span {
    color: var(--ifg-muted);
    font-size: 12px;
    line-height: 1.45;
}
.ifg-file-list,
.ifg-result-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.ifg-file-item,
.ifg-result-item {
    background: #fff;
    border: 1px solid #e2eaf3;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    overflow: hidden;
    padding: 8px;
}
.ifg-file-thumb,
.ifg-result-thumb {
    align-items: center;
    background:
        linear-gradient(45deg, #eef2f6 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f6 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f6 75%),
        #fff;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    border-radius: 6px;
    display: flex;
    min-height: 104px;
    justify-content: center;
    overflow: hidden;
}
.ifg-file-thumb img,
.ifg-result-thumb img {
    display: block;
    height: 104px;
    object-fit: cover;
    width: 100%;
}
.ifg-file-meta,
.ifg-result-meta {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.ifg-file-meta b,
.ifg-result-meta b {
    color: #172033;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ifg-file-meta span,
.ifg-result-meta span {
    color: var(--ifg-muted);
    font-size: 12px;
}
.ifg-control-grid,
.ifg-slider-grid {
    display: grid;
    gap: 12px;
}
.ifg-control-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ifg-slider-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ifg-field,
.ifg-slider {
    background: #fbfcff;
    border: 1px solid #e2eaf3;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    padding: 11px;
}
.ifg-field span,
.ifg-slider span {
    color: #23364d;
    display: flex;
    font-size: 13px;
    font-weight: 800;
    justify-content: space-between;
    line-height: 1.35;
}
.ifg-slider b {
    color: var(--ifg-primary-dark);
}
.ifg-field select,
.ifg-field input[type="color"] {
    background: #fff;
    border: 1px solid var(--ifg-line);
    border-radius: 7px;
    color: var(--ifg-ink);
    min-height: 38px;
    padding: 7px 9px;
    width: 100%;
}
.ifg-color-field input[type="color"] {
    padding: 4px;
}
.ifg-slider input[type="range"] {
    accent-color: var(--ifg-primary);
    width: 100%;
}
.ifg-preview {
    display: grid;
    gap: 14px;
    padding: 16px;
    position: sticky;
    top: 12px;
}
.ifg-preview-grid {
    display: grid;
    gap: 12px;
}
.ifg-preview figure {
    display: grid;
    gap: 8px;
    margin: 0;
}
.ifg-preview figcaption {
    color: #23364d;
    font-size: 13px;
    font-weight: 800;
}
.ifg-canvas-wrap {
    align-items: center;
    background:
        linear-gradient(45deg, #eff3f7 25%, transparent 25%),
        linear-gradient(-45deg, #eff3f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eff3f7 75%),
        linear-gradient(-45deg, transparent 75%, #eff3f7 75%),
        #fff;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
    border: 1px solid #e2eaf3;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    min-height: 210px;
    overflow: hidden;
    padding: 10px;
}
.ifg-canvas-wrap canvas {
    display: block;
    max-height: 380px;
    max-width: 100%;
}
.ifg-toast {
    background: #f7fafc;
    border: 1px solid #e1e9f2;
    border-radius: 8px;
    color: #38516b;
    font-size: 13px;
    line-height: 1.55;
    padding: 10px 12px;
}
.ifg-toast.good {
    background: #ecfdf5;
    border-color: rgba(13, 148, 136, .25);
    color: #0f766e;
}
.ifg-toast.warn {
    background: #fffbeb;
    border-color: rgba(183, 121, 31, .25);
    color: #925b0b;
}
.ifg-toast.bad {
    background: #fff1f2;
    border-color: rgba(196, 61, 61, .25);
    color: #b42318;
}
.ifg-progress {
    display: grid;
    gap: 8px;
}
.ifg-progress-track {
    background: #e7edf5;
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
}
.ifg-progress-track span {
    background: linear-gradient(90deg, var(--ifg-primary), var(--ifg-accent));
    display: block;
    height: 100%;
    width: 0;
}
.ifg-progress p {
    color: var(--ifg-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}
@media (max-width: 1100px) {
    .ifg-workspace {
        grid-template-columns: 1fr;
    }
    .ifg-preview {
        position: static;
    }
}
@media (max-width: 860px) {
    .ifg-guide {
        grid-template-columns: 1fr;
    }
    .ifg-guide-pills {
        justify-content: flex-start;
    }
    .ifg-tabs,
    .ifg-control-grid,
    .ifg-slider-grid {
        grid-template-columns: 1fr;
    }
    .ifg-tab {
        min-height: 58px;
    }
}
@media (max-width: 560px) {
    .ifg-panel,
    .ifg-preview,
    .ifg-guide {
        padding: 14px;
    }
    .ifg-actions,
    .ifg-output-actions,
    .ifg-run-box,
    .ifg-preset-row {
        display: grid;
        grid-template-columns: 1fr;
    }
    .ifg-btn,
    .ifg-preset {
        width: 100%;
    }
    .ifg-dropzone {
        min-height: 180px;
        padding: 20px;
    }
}
