.autopilot-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 18px;
}

#autopilot-summary {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}

#autopilot-summary .stat-box {
    flex: 0 0 auto;
    min-width: 160px;
    padding: 12px 16px;
}

.autopilot-board-panel {
    padding-bottom: 14px;
}

.autopilot-panel {
    background: linear-gradient(180deg, rgba(17, 24, 18, 0.96), rgba(12, 15, 12, 0.98));
    border: 1px solid #1e2a1f;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.autopilot-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.autopilot-panel-title {
    font-size: 17px;
    font-weight: 700;
    color: #f4f7f4;
}

.autopilot-panel-subtitle {
    color: #8c9a8f;
    font-size: 12px;
    margin-top: 4px;
}

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

.autopilot-inline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

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

.autopilot-field span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #829284;
}

.autopilot-field-wide {
    grid-column: span 2;
}

.autopilot-textarea {
    min-height: 98px;
    resize: vertical;
}

.autopilot-note {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.07);
    border: 1px solid rgba(34, 197, 94, 0.18);
    color: #b9d7be;
    font-size: 12px;
    line-height: 1.5;
}

.autopilot-accounts-list {
    display: grid;
    gap: 12px;
    max-height: 560px;
    overflow-y: auto;
    padding-right: 4px;
}

#autopilot-dashboard-body {
    margin-top: 4px;
}

.autopilot-account-card {
    border: 1px solid #223225;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(9, 12, 10, 0.72);
}

.autopilot-account-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
}

.autopilot-account-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.autopilot-status-lamp {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
    flex: 0 0 auto;
}

.autopilot-status-active { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12), 0 0 18px rgba(34, 197, 94, 0.35); }
.autopilot-status-selfie,
.autopilot-status-paused { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12), 0 0 18px rgba(245, 158, 11, 0.3); }
.autopilot-status-error,
.autopilot-status-problem { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12), 0 0 18px rgba(239, 68, 68, 0.3); }
.autopilot-status-unknown { background: #6b7280; box-shadow: 0 0 0 4px rgba(107, 114, 128, 0.12), 0 0 18px rgba(107, 114, 128, 0.3); }

.autopilot-account-name {
    font-size: 15px;
    font-weight: 700;
    color: #eff6ef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autopilot-account-meta {
    font-size: 11px;
    color: #8a958c;
    margin-top: 3px;
}

.autopilot-account-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.autopilot-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #d8e0da;
}

.autopilot-chip.alert {
    color: #ffcf7e;
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.08);
}

.autopilot-cabs {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.autopilot-cab-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) auto auto auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.autopilot-cab-main {
    min-width: 0;
}

.autopilot-cab-name {
    color: #eef3ee;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autopilot-cab-meta {
    color: #8b968d;
    font-size: 11px;
    margin-top: 3px;
}

.autopilot-cab-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.autopilot-mini-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #dfe8df;
    border-radius: 9px;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
}

.autopilot-mini-btn:hover {
    border-color: rgba(34, 197, 94, 0.28);
    color: #fff;
}

.autopilot-dropzone {
    margin-bottom: 16px;
    padding: 22px 18px;
    border-radius: 16px;
    border: 1px dashed rgba(34, 197, 94, 0.35);
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 42%),
        linear-gradient(180deg, rgba(12, 16, 12, 0.9), rgba(10, 11, 10, 0.98));
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.autopilot-dropzone:hover,
.autopilot-dropzone.drag-over {
    transform: translateY(-1px);
    border-color: rgba(34, 197, 94, 0.55);
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.2), transparent 45%),
        linear-gradient(180deg, rgba(14, 20, 15, 0.92), rgba(10, 11, 10, 0.98));
}

.autopilot-dropzone-title {
    font-size: 16px;
    font-weight: 700;
    color: #f1f7f1;
    margin-bottom: 6px;
}

.autopilot-dropzone-subtitle {
    color: #8b988d;
    font-size: 12px;
    line-height: 1.5;
}

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

.autopilot-inline-setting {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.autopilot-inline-setting span {
    color: #8b988d;
    font-size: 11px;
    line-height: 1.2;
}

.autopilot-inline-setting input {
    width: 100%;
}

.autopilot-batch-wrap {
    max-height: 620px;
}

.autopilot-batch-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1320px;
}

.autopilot-batch-table th,
.autopilot-batch-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1c241d;
    vertical-align: top;
}

.autopilot-batch-table th {
    background: rgba(255, 255, 255, 0.02);
    color: #7f8b81;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.autopilot-row-error td { background: rgba(239, 68, 68, 0.05); }
.autopilot-row-ready td { background: rgba(34, 197, 94, 0.03); }
.autopilot-row-success td { background: rgba(34, 197, 94, 0.06); }
.autopilot-row-detail td { padding: 0 12px 12px; }
.autopilot-row-detail:not(.is-open) td { display: none; }

.autopilot-bundle-cell,
.autopilot-selector-cell,
.autopilot-start-cell {
    display: grid;
    gap: 5px;
    min-width: 150px;
}

.autopilot-bundle-cell select,
.autopilot-bundle-cell input,
.autopilot-selector-cell select,
.autopilot-start-cell select,
.autopilot-start-cell input {
    width: 100%;
    font-size: 11px;
    padding: 6px 8px;
    background: #101311;
    border: 1px solid #253127;
    border-radius: 8px;
    color: #e3ede4;
}

.autopilot-file-count {
    color: #93a095;
    font-size: 11px;
}

.autopilot-row-summary {
    color: #728073;
    font-size: 11px;
    line-height: 1.45;
    margin-top: 6px;
    max-width: 340px;
}

.autopilot-row-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.autopilot-row-status.uploading,
.autopilot-row-status.launching { color: #60a5fa; background: rgba(96, 165, 250, 0.08); }
.autopilot-row-status.ready { color: #22c55e; background: rgba(34, 197, 94, 0.08); }
.autopilot-row-status.success { color: #22c55e; background: rgba(34, 197, 94, 0.12); }
.autopilot-row-status.error { color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.autopilot-row-status.idle { color: #d5dcd5; background: rgba(255, 255, 255, 0.04); }

.autopilot-row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.autopilot-row-setup-card {
    border: 1px solid rgba(34, 197, 94, 0.14);
    border-radius: 14px;
    padding: 14px;
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(12, 18, 13, 0.98), rgba(10, 12, 10, 0.98));
}

.autopilot-row-setup-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.autopilot-row-setup-title {
    font-size: 14px;
    font-weight: 700;
    color: #eef5ee;
}

.autopilot-row-setup-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #859184;
}

.autopilot-row-setup-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.autopilot-row-setup-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 12px;
}

.autopilot-field-span-2 {
    grid-column: span 2;
}

.autopilot-row-textarea {
    min-height: 76px;
}

.autopilot-row-setup-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.autopilot-row-setup-note.is-good {
    color: #b9d7be;
    border-color: rgba(34, 197, 94, 0.18);
    background: rgba(34, 197, 94, 0.07);
}

.autopilot-row-setup-note.is-warning {
    color: #f4c97a;
    border-color: rgba(245, 158, 11, 0.22);
    background: rgba(245, 158, 11, 0.08);
}

html[data-theme="light"] .autopilot-panel {
    background: linear-gradient(180deg, rgba(251, 253, 251, 0.98), rgba(244, 248, 244, 0.98));
    border-color: #d9e4da;
    box-shadow: 0 12px 28px rgba(15, 23, 15, 0.08);
}

html[data-theme="light"] #autopilot-summary .stat-box {
    border-color: #dde7de;
}

html[data-theme="light"] .autopilot-panel-title,
html[data-theme="light"] .autopilot-account-name,
html[data-theme="light"] .autopilot-cab-name,
html[data-theme="light"] .autopilot-dropzone-title {
    color: #152417;
}

html[data-theme="light"] .autopilot-panel-subtitle,
html[data-theme="light"] .autopilot-field span,
html[data-theme="light"] .autopilot-account-meta,
html[data-theme="light"] .autopilot-cab-meta,
html[data-theme="light"] .autopilot-dropzone-subtitle,
html[data-theme="light"] .autopilot-file-count {
    color: #5e7261;
}

html[data-theme="light"] .autopilot-account-card,
html[data-theme="light"] .autopilot-cab-row {
    background: rgba(255, 255, 255, 0.72);
    border-color: #dde7de;
}

html[data-theme="light"] .autopilot-dropzone {
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.1), transparent 42%),
        linear-gradient(180deg, rgba(251, 254, 251, 0.98), rgba(245, 249, 245, 0.98));
    border-color: rgba(34, 197, 94, 0.35);
}

html[data-theme="light"] .autopilot-batch-table th,
html[data-theme="light"] .autopilot-batch-table td {
    border-color: #dde7de;
}

html[data-theme="light"] .autopilot-batch-table th {
    background: #f4f8f4;
    color: #5f7162;
}

html[data-theme="light"] .autopilot-bundle-cell select,
html[data-theme="light"] .autopilot-bundle-cell input,
html[data-theme="light"] .autopilot-selector-cell select,
html[data-theme="light"] .autopilot-start-cell select,
html[data-theme="light"] .autopilot-start-cell input {
    background: #fff;
    border-color: #d4e0d5;
    color: #182419;
}

html[data-theme="light"] .autopilot-row-setup-card {
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(251, 254, 251, 0.98), rgba(245, 249, 245, 0.98));
    border-color: #dbe7dc;
}

html[data-theme="light"] .autopilot-row-setup-title {
    color: #162518;
}

html[data-theme="light"] .autopilot-row-setup-subtitle,
html[data-theme="light"] .autopilot-row-summary {
    color: #617163;
}

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

    #autopilot-summary {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

@media (max-width: 860px) {
    .autopilot-form-grid,
    .autopilot-inline-grid {
        grid-template-columns: 1fr;
    }

    .autopilot-field-wide {
        grid-column: span 1;
    }

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

    .autopilot-field-span-2 {
        grid-column: span 1;
    }

    .autopilot-row-setup-head {
        flex-direction: column;
    }

    .autopilot-inline-setting {
        min-width: 100%;
    }
}
