.control-page {
    width: 100%;
    margin: 20px 0 40px;
}

.control-hero {
    margin-bottom: 18px;
    padding: 26px 28px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.control-eyebrow {
    margin-bottom: 8px;
    color: #2563eb;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.control-hero h1 {
    margin: 0 0 12px;
    color: #111827;
    font-size: 2rem;
    font-weight: 750;
}

.control-hero p {
    max-width: 980px;
    margin: 0;
    color: #475569;
    font-size: 1.02rem;
    line-height: 1.65;
}

.control-tabs,
.control-subtabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.control-tabs {
    margin-bottom: 12px;
    padding: 0 4px;
    border-bottom: 1px solid #e5e7eb;
}

.control-subtabs {
    margin-bottom: 18px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
}

.control-tab,
.control-subtab {
    flex: 0 0 auto;
    text-decoration: none;
    transition: 0.15s ease;
}

.control-tab {
    padding: 11px 14px;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 650;
}

.control-tab:hover,
.control-tab.active {
    color: #1d4ed8;
    text-decoration: none;
}

.control-tab.active {
    border-bottom-color: #2563eb;
}

.control-subtab {
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
}

.control-subtab:hover {
    color: #1d4ed8;
    text-decoration: none;
}

.control-subtab.active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.control-section {
    padding: 22px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.control-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.control-section-header h2 {
    margin: 0 0 5px;
    color: #111827;
    font-size: 1.28rem;
    font-weight: 760;
}

.control-section-header p {
    max-width: 820px;
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.55;
}

.control-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.73rem;
    font-weight: 750;
    white-space: nowrap;
}

.control-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(480px, 1.42fr);
    gap: 18px;
    align-items: start;
}

.control-input-panel,
.control-result-panel {
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
}

.control-input-panel {
    position: sticky;
    top: 16px;
    padding: 20px;
    background: #f8fafc;
}

.control-result-panel {
    padding: 20px;
    background: #ffffff;
}

.control-field {
    margin-bottom: 15px;
}

.control-field label {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 750;
}

.control-control,
.control-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #111827;
    font-size: 0.9rem;
}

.control-control {
    min-height: 42px;
    padding: 8px 10px;
}

.control-textarea {
    min-height: 188px;
    padding: 10px 11px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    line-height: 1.45;
    white-space: pre;
}

.control-control:focus,
.control-textarea:focus {
    border-color: #60a5fa;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.control-field-help,
.control-data-summary {
    margin-top: 6px;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
}

.control-data-summary {
    color: #475569;
    font-weight: 650;
}

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

.control-info-note {
    margin: 5px 0 16px;
    padding: 10px 11px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    background: #eff6ff;
    color: #475569;
    font-size: 0.77rem;
    line-height: 1.5;
}

.control-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.control-alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.5;
}

.control-alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

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

.control-metric-card {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #f8fafc;
}

.control-metric-card span,
.control-metric-card strong,
.control-metric-card small {
    display: block;
}

.control-metric-card span {
    margin-bottom: 4px;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.control-metric-card strong {
    overflow: hidden;
    color: #111827;
    font-size: 1.32rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
}

.control-metric-card small {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 0.68rem;
}

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

.control-detail-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f7;
    color: #64748b;
    font-size: 0.75rem;
}

.control-detail-item strong {
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}

.control-chart-card,
.control-table-card,
.control-signals {
    margin-top: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
}

.control-chart-card {
    overflow: hidden;
}

.control-chart-heading,
.control-block-title {
    padding: 11px 13px;
    border-bottom: 1px solid #e5e7eb;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 800;
}

.control-plotly-chart {
    min-height: 330px;
    padding: 4px;
}

.control-plotly-chart .plotly-graph-div {
    width: 100% !important;
}

.control-signals {
    padding-bottom: 10px;
}

.control-signal-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    margin: 10px;
    padding: 11px;
    border: 1px solid #fee2e2;
    border-radius: 10px;
    background: #fffafa;
}

.control-signal-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
}

.control-signal-card strong {
    color: #7f1d1d;
    font-size: 0.84rem;
}

.control-signal-points {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 650;
}

.control-signal-card p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
}

.control-no-signals {
    margin-top: 14px;
    padding: 11px 12px;
    border: 1px solid #dcfce7;
    border-radius: 10px;
    background: #f0fdf4;
    color: #166534;
    font-size: 0.8rem;
}

.control-status {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
    padding: 13px 14px;
    border-radius: 11px;
    font-size: 0.8rem;
}

.control-status strong {
    display: block;
    margin-bottom: 2px;
    font-size: 0.88rem;
}

.control-status p {
    margin: 0;
    line-height: 1.45;
}

.control-status > span {
    align-self: center;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.control-status-success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.control-status-danger {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.control-status-warning {
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.control-status-info {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.control-table-wrap {
    overflow-x: auto;
}

.control-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.control-table th,
.control-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f7;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.control-table th:first-child,
.control-table td:first-child {
    text-align: left;
}

.control-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    font-weight: 800;
}

.control-empty-state {
    display: flex;
    min-height: 390px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #64748b;
    text-align: center;
}

.control-empty-icon {
    display: flex;
    width: 68px;
    height: 68px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.9rem;
    font-weight: 850;
    letter-spacing: 0.06em;
}

.control-empty-state h3 {
    margin: 0 0 6px;
    color: #334155;
    font-size: 1rem;
}

.control-empty-state p {
    max-width: 420px;
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
}

#control-within-sigma-field.is-hidden,
#control-vmask-note.is-hidden {
    display: none;
}

@media (max-width: 1120px) {
    .control-workspace {
        grid-template-columns: 1fr;
    }

    .control-input-panel {
        position: static;
    }

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

@media (max-width: 680px) {
    .control-hero,
    .control-section {
        padding: 18px;
        border-radius: 13px;
    }

    .control-hero h1 {
        font-size: 1.55rem;
    }

    .control-section-header {
        display: block;
    }

    .control-badge {
        margin-top: 10px;
    }

    .control-fields-grid,
    .control-metrics,
    .control-details-grid {
        grid-template-columns: 1fr;
    }

    .control-status {
        display: block;
    }

    .control-status > span {
        display: block;
        margin-top: 7px;
        white-space: normal;
    }

    .control-signal-card {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   Pasted-data preview
   Same interaction pattern used by the other application modules.
   ================================================================ */

.control-textarea.data-paste-area.has-preview {
    height: 45px !important;
    min-height: 45px !important;
    resize: none;
    overflow: hidden;
    color: transparent;
    caret-color: #334155;
}

.control-textarea.data-paste-area.has-preview::selection {
    color: transparent;
    background: transparent;
}

.control-data-preview-wrapper {
    display: none;
    max-height: 300px;
    margin-top: 10px;
    overflow: auto;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #ffffff;
}

.control-data-preview-wrapper.has-data {
    display: block;
}

.control-data-preview-table {
    width: 100%;
    border-collapse: collapse;
    color: #334155;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.control-data-preview-table td {
    min-width: 62px;
    padding: 6px 9px;
    border: 1px solid #e5e7eb;
    text-align: right;
    white-space: nowrap;
}

.control-data-preview-table tr:nth-child(even) td {
    background: #f8fafc;
}

.control-data-preview-table tr:first-child td {
    border-top: 0;
}

.control-data-preview-table tr:last-child td {
    border-bottom: 0;
}

.control-data-preview-table td:first-child {
    border-left: 0;
}

.control-data-preview-table td:last-child {
    border-right: 0;
}
