.tvc-tool {
    --tvc-ink: #172033;
    --tvc-muted: #667085;
    --tvc-line: #d9e2ec;
    --tvc-soft: #f5f8fb;
    --tvc-card: #ffffff;
    --tvc-primary: #0f6fb5;
    --tvc-primary-dark: #0a4f82;
    --tvc-accent: #0d9488;
    --tvc-warm: #d4572a;
    --tvc-danger: #d34242;
    --tvc-shadow: 0 16px 38px rgba(28, 46, 72, .10);
    width: 100%;
    color: var(--tvc-ink);
}

.tvc-tool * {
    box-sizing: border-box;
}

.tvc-tool button,
.tvc-tool input,
.tvc-tool select,
.tvc-tool textarea {
    font: inherit;
}

.tvc-workbench {
    display: grid;
    gap: 16px;
}

.tvc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(15, 111, 181, .10), rgba(13, 148, 136, .09)), #fff;
    border: 1px solid var(--tvc-line);
    border-radius: 8px;
    box-shadow: var(--tvc-shadow);
}

.tvc-status,
.tvc-toolbar-actions,
.tvc-actions,
.tvc-preset-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tvc-status {
    color: #29435c;
    font-weight: 800;
    line-height: 1.5;
}

.tvc-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tvc-accent);
    box-shadow: 0 0 0 5px rgba(13, 148, 136, .12);
    flex: 0 0 auto;
}

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

.tvc-tab {
    border: 1px solid var(--tvc-line);
    background: #fff;
    color: #1c3553;
    border-radius: 8px;
    padding: 13px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    min-height: 68px;
    text-align: left;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.tvc-tab i {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e7f1fa;
    color: var(--tvc-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.tvc-tab b,
.tvc-tab small {
    display: block;
}

.tvc-tab b {
    color: #102a43;
    font-size: 15px;
}

.tvc-tab small {
    color: var(--tvc-muted);
    font-size: 12px;
    margin-top: 3px;
}

.tvc-tab:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 111, 181, .45);
}

.tvc-tab.active {
    border-color: var(--tvc-primary);
    background: linear-gradient(180deg, #ffffff, #eef7fc);
    box-shadow: 0 10px 24px rgba(15, 111, 181, .14);
}

.tvc-tab.active i {
    background: var(--tvc-primary);
    color: #fff;
}

.tvc-tab.active b {
    color: var(--tvc-primary-dark);
}

.tvc-panel {
    display: none;
}

.tvc-panel.active {
    display: block;
}

.tvc-layout {
    display: grid;
    grid-template-columns: minmax(360px, .95fr) minmax(420px, 1.05fr);
    gap: 16px;
    align-items: start;
}

.tvc-layout.batch {
    grid-template-columns: minmax(420px, .92fr) minmax(460px, 1.08fr);
}

.tvc-input-side,
.tvc-result-side,
.tvc-section,
.tvc-preview,
.tvc-result-card {
    background: var(--tvc-card);
    border: 1px solid var(--tvc-line);
    border-radius: 8px;
    box-shadow: var(--tvc-shadow);
}

.tvc-input-side,
.tvc-result-card {
    padding: 16px;
}

.tvc-result-side {
    display: grid;
    gap: 16px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.tvc-step-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf1f6;
    margin-bottom: 14px;
}

.tvc-step-head b {
    display: block;
    font-size: 18px;
    line-height: 1.3;
    margin-bottom: 5px;
}

.tvc-step-head span {
    color: var(--tvc-muted);
    font-size: 13px;
    line-height: 1.6;
}

.tvc-section {
    padding: 16px;
    margin-top: 14px;
    box-shadow: none;
}

.tvc-section:first-of-type {
    margin-top: 0;
}

.tvc-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.tvc-section-title b {
    font-size: 15px;
}

.tvc-section-title span {
    color: var(--tvc-muted);
    font-size: 12px;
}

.tvc-choice-grid,
.tvc-methods {
    display: grid;
    gap: 10px;
}

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

.tvc-methods {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.tvc-choice,
.tvc-method {
    border: 1px solid #dfe7f0;
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    min-height: 78px;
    color: #24364b;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.tvc-choice {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
}

.tvc-choice input,
.tvc-method input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tvc-choice i {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f2fb;
    color: var(--tvc-primary-dark);
}

.tvc-choice b,
.tvc-choice small,
.tvc-method b,
.tvc-method small {
    display: block;
}

.tvc-choice b,
.tvc-method b {
    font-size: 14px;
    margin-bottom: 4px;
}

.tvc-choice small,
.tvc-method small {
    color: var(--tvc-muted);
    font-size: 12px;
    line-height: 1.5;
}

.tvc-choice:hover,
.tvc-choice.active,
.tvc-method:hover,
.tvc-method.active {
    border-color: var(--tvc-primary);
    background: #f2f8fc;
}

.tvc-choice.active,
.tvc-method.active {
    box-shadow: 0 8px 18px rgba(15, 111, 181, .10);
}

.tvc-choice.active i {
    background: var(--tvc-primary);
    color: #fff;
}

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

.tvc-field {
    display: grid;
    gap: 6px;
}

.tvc-field.wide {
    margin-top: 12px;
}

.tvc-field span:first-child {
    font-weight: 800;
    font-size: 13px;
    color: #344054;
}

.tvc-field input,
.tvc-field select,
.tvc-field textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #d7dfeb;
    border-radius: 7px;
    padding: 9px 10px;
    background: #fff;
    color: var(--tvc-ink);
    outline: none;
}

.tvc-field textarea {
    resize: vertical;
    min-height: 180px;
    font-family: Consolas, Monaco, monospace;
    line-height: 1.6;
}

.tvc-field input:focus,
.tvc-field select:focus,
.tvc-field textarea:focus {
    border-color: var(--tvc-primary);
    box-shadow: 0 0 0 3px rgba(15, 111, 181, .12);
}

.tvc-input-unit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 8px;
}

.tvc-input-unit.compact {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.tvc-unit-note {
    min-height: 40px;
    border: 1px solid #d7dfeb;
    border-radius: 7px;
    padding: 9px 10px;
    background: var(--tvc-soft);
    color: var(--tvc-muted);
    font-weight: 800;
    white-space: nowrap;
}

.tvc-field.is-hidden {
    display: none;
}

.tvc-field.is-invalid input,
.tvc-field.is-invalid select,
.tvc-field.is-invalid textarea {
    border-color: var(--tvc-danger);
    background: #fff6f6;
}

.tvc-preset-row {
    margin-top: 12px;
}

.tvc-preset-row button {
    border: 1px solid #dfe7f0;
    border-radius: 999px;
    background: #fff;
    color: #344054;
    padding: 7px 11px;
    cursor: pointer;
    font-weight: 800;
    font-size: 13px;
}

.tvc-preset-row button:hover {
    border-color: var(--tvc-primary);
    color: var(--tvc-primary-dark);
    background: #f5fafc;
}

.tvc-actions {
    margin-top: 14px;
}

.tvc-btn {
    border: 1px solid #cfd8e6;
    background: #fff;
    color: #24364b;
    border-radius: 7px;
    padding: 9px 13px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.tvc-btn:hover {
    border-color: var(--tvc-primary);
    color: var(--tvc-primary-dark);
}

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

.tvc-btn.primary:hover {
    background: var(--tvc-primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.tvc-btn.accent {
    background: var(--tvc-accent);
    border-color: var(--tvc-accent);
    color: #fff;
}

.tvc-btn.ghost {
    background: rgba(255, 255, 255, .78);
}

.tvc-btn.danger {
    border-color: #efb7b7;
    color: var(--tvc-danger);
}

.tvc-preview {
    overflow: hidden;
}

.tvc-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid #edf1f6;
    background: #f7f9fc;
}

.tvc-preview-head b {
    font-size: 15px;
}

.tvc-preview-head span {
    color: var(--tvc-muted);
    font-size: 13px;
    font-weight: 800;
}

.tvc-pipe-svg {
    display: block;
    width: 100%;
    height: auto;
    background: linear-gradient(180deg, #fbfdff, #f4f8fb);
}

.tvc-result-card {
    min-height: 280px;
}

.tvc-result-empty {
    min-height: 248px;
    display: grid;
    place-items: center;
    text-align: center;
    gap: 10px;
    color: var(--tvc-muted);
    border: 1px dashed #c9d5e5;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfcff, #f6f9fc);
}

.tvc-result-empty i {
    display: block;
    font-size: 38px;
    color: var(--tvc-primary);
}

.tvc-result-content {
    display: grid;
    gap: 14px;
}

.tvc-hero-result {
    border-radius: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #0f6fb5, #0d9488);
    color: #fff;
    display: grid;
    gap: 4px;
}

.tvc-hero-result span {
    font-size: 13px;
    opacity: .9;
    font-weight: 800;
}

.tvc-hero-result b {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    word-break: break-word;
}

.tvc-hero-result small {
    font-size: 14px;
    opacity: .92;
}

.tvc-metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: #e6edf5;
    border: 1px solid #e6edf5;
    border-radius: 8px;
    overflow: hidden;
}

.tvc-metric-grid div {
    background: #fbfcff;
    padding: 12px;
    min-width: 0;
}

.tvc-metric-grid span {
    display: block;
    color: var(--tvc-muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.tvc-metric-grid b {
    display: block;
    color: #172033;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.tvc-result-table-wrap {
    border: 1px solid var(--tvc-line);
    border-radius: 8px;
    overflow: auto;
}

.tvc-result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 560px;
    font-size: 13px;
}

.tvc-result-table th,
.tvc-result-table td {
    border-bottom: 1px solid #edf1f6;
    padding: 9px 10px;
    text-align: left;
    white-space: nowrap;
}

.tvc-result-table th {
    position: sticky;
    top: 0;
    background: #f3f6fa;
    color: #344054;
    font-weight: 900;
    z-index: 1;
}

.tvc-result-table tr:last-child td {
    border-bottom: 0;
}

.tvc-result-table td:last-child,
.tvc-result-table th:last-child {
    text-align: right;
}

.tvc-formula {
    border: 1px solid #dfe7f0;
    border-radius: 8px;
    padding: 12px;
    background: #f8fbfd;
    color: #344054;
    font-family: Consolas, Monaco, monospace;
    overflow: auto;
}

.tvc-file-zone {
    border: 2px dashed #b9c7d8;
    border-radius: 8px;
    background: #f8fbfd;
    margin-top: 12px;
    transition: border-color .18s ease, background .18s ease;
}

.tvc-file-zone.dragover {
    border-color: var(--tvc-primary);
    background: #eef7fc;
}

.tvc-file-zone label {
    min-height: 128px;
    padding: 22px;
    display: grid;
    place-items: center;
    gap: 7px;
    text-align: center;
    cursor: pointer;
}

.tvc-file-zone i {
    font-size: 30px;
    color: var(--tvc-primary);
}

.tvc-file-zone b {
    font-size: 15px;
}

.tvc-file-zone span {
    color: var(--tvc-muted);
    font-size: 13px;
    line-height: 1.6;
}

.tvc-file-list,
.tvc-history,
.tvc-export-summary,
.tvc-more-hint {
    margin-top: 12px;
    border: 1px solid #e3eaf2;
    border-radius: 8px;
    background: #fbfcff;
    color: var(--tvc-muted);
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.tvc-file-list {
    display: grid;
    gap: 7px;
    max-height: 170px;
    overflow: auto;
}

.tvc-file-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e8edf5;
    border-radius: 7px;
    background: #fff;
    padding: 8px 10px;
}

.tvc-file-item b {
    color: #24364b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tvc-file-item span {
    flex: 0 0 auto;
}

.tvc-result-table-wrap.batch-table {
    max-height: 480px;
}

.tvc-export-grid {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(320px, .8fr);
    gap: 16px;
}

.tvc-export-grid .tvc-section {
    margin-top: 0;
    box-shadow: var(--tvc-shadow);
}

.tvc-export-summary {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 0;
}

.tvc-export-summary i {
    color: var(--tvc-primary);
    font-size: 18px;
    margin-top: 2px;
}

.tvc-history {
    display: grid;
    gap: 8px;
    max-height: 330px;
    overflow: auto;
}

.tvc-history-item {
    border: 1px solid #e8edf5;
    border-radius: 7px;
    background: #fff;
    padding: 9px 10px;
    color: #344054;
}

.tvc-history-item b {
    display: block;
    margin-bottom: 3px;
    color: #172033;
}

.tvc-history-item small {
    color: var(--tvc-muted);
}

.tvc-hidden {
    display: none !important;
}

@media (max-width: 1180px) {
    .tvc-layout,
    .tvc-layout.batch,
    .tvc-export-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .tvc-toolbar,
    .tvc-step-head {
        display: grid;
    }

    .tvc-tabs,
    .tvc-choice-grid,
    .tvc-methods,
    .tvc-form-grid,
    .tvc-metric-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .tvc-tabs,
    .tvc-choice-grid,
    .tvc-methods,
    .tvc-form-grid,
    .tvc-metric-grid {
        grid-template-columns: 1fr;
    }

    .tvc-input-side,
    .tvc-result-card,
    .tvc-section {
        padding: 14px;
    }

    .tvc-input-unit {
        grid-template-columns: minmax(0, 1fr) 82px;
    }
}
