.tasks-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.52);
    border-radius: 14px;
    overflow: hidden;
}

.tasks-table {
    margin-top: 12px;
}

.tasks-table th,
.tasks-table td,
.history-table th,
.history-table td {
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.tasks-table th,
.tasks-table td {
    padding: 10px 12px;
    vertical-align: top;
}

.history-table th,
.history-table td {
    padding: 10px 14px;
}

.tasks-table th,
.history-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.tasks-table tr.disabled {
    color: var(--muted);
    background: rgba(90, 69, 50, 0.04);
}

.history-table tr:hover td {
    background: rgba(90, 69, 50, 0.04);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
}

.badge-on,
.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-off,
.badge-fail {
    background: #fee2e2;
    color: #991b1b;
}

.badge-manual,
.badge-pending {
    background: #f1f5f9;
    color: #475569;
}

.badge-weekly {
    background: #dbeafe;
    color: #1e40af;
}

.badge-monthly {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-dry {
    background: #fef9c3;
    color: #854d0e;
}

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.row-actions button {
    font-size: 0.85em;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop.show {
    display: flex;
}

.modal-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: 22px;
    max-width: 720px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.modal-card h2 {
    margin-top: 0;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.module-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0 4px;
}

.module-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255,255,255,0.56);
}

.module-row.enabled {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.module-row .order-btns {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.module-row .order-btns button {
    padding: 0 6px;
    font-size: 0.8em;
    line-height: 1.2;
}

.module-row .module-name {
    flex: 1;
}

.dow-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.dow-grid label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85em;
    background: rgba(255,255,255,0.56);
}

.dow-grid label.checked {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.form-help {
    font-size: 0.85em;
    color: var(--muted);
    margin-top: 4px;
}

.rm-required {
    color: #dc2626;
}

.rm-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
}

.rm-section-title-spaced {
    margin-top: 24px;
}

.rm-hidden-panel {
    display: none;
}

.rm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-card-wide {
    max-width: 1024px;
}

.modal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-meta {
    font-size: 0.85em;
}

.task-description-note {
    font-size: 0.85em;
}

.task-modules-cell {
    font-size: 0.85em;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
    margin-bottom: 12px;
}

.detail-error-hidden {
    display: none;
}

.preview-pane {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: var(--bg-secondary);
    max-height: 60vh;
    overflow-y: auto;
    margin-top: 12px;
}

.preview-pane iframe {
    width: 100%;
    height: 60vh;
    border: 0;
    background: white;
}

.detail-box {
    margin-top: 16px;
    display: none;
}

.detail-box.visible {
    display: block;
}

.output-iframe {
    width: 100%;
    height: 500px;
    border: 1px solid var(--border);
    border-radius: 14px;
}
