/* automation.css — Automate rail: schedules + alerts. Prefix: au- */

#panel-automation .automation-sec {
    position: relative;
}

.au-grid-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.au-grid-wrap {
    flex: 1;
}

.au-count {
    font-size: 12px;
}

.au-table th, .au-table td {
    vertical-align: top;
}

.au-table td {
    font-family: inherit;
    white-space: normal;
    max-width: 260px;
    padding-top: 4px;
    padding-bottom: 4px;
    line-height: 1.35;
}

.au-table td.num, .au-table td.au-mono {
    font-family: var(--mono);
}

.au-table td.au-actions {
    white-space: nowrap;
}

.au-actions button.small {
    padding: 2px 6px;
    font-size: 11.5px;
}

.au-name {
    font-weight: 600;
    color: var(--text);
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.au-sub {
    font-size: 11px;
    line-height: 1.4;
}

.au-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
}

.au-disabled td {
    color: var(--muted);
}

.au-disabled .au-name {
    color: var(--text-2);
}

.au-actions {
    white-space: nowrap;
}

.au-actions button {
    margin-right: 2px;
}

.au-current {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.au-current .au-ico {
    margin-left: 4px;
    vertical-align: -2px;
    color: var(--muted);
}

.au-has-error {
    color: var(--danger);
}

.au-ico {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: middle;
}

.au-deliv {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.au-deliv-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-2);
}

/* status badges (colours via variables only) */
.badge.au-st-ok {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: transparent;
}

.badge.au-st-warn {
    background: var(--warn-soft);
    color: var(--warn);
    border-color: transparent;
}

.badge.au-st-bad {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.badge.au-st-muted {
    background: var(--surface-3);
    color: var(--muted);
}

.au-empty {
    margin: 28px auto;
    max-width: 560px;
    padding: 18px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.55;
    text-align: center;
}

.au-note {
    margin: 10px 14px 0;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--warn);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 12px;
    color: var(--text-2);
}

/* firing strip */
.au-strip {
    flex: none;
}

.au-strip .mon-cards {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.au-firing-card .mon-card-sub {
    white-space: normal;
}

.au-allclear {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

/* ---- silences (maintenance windows) ---- */

/*
 * Active silences sit above the firing cards: when nothing paged during an incident, the first
 * question is whether a maintenance window was still open, and this is where that is answered.
 */
.au-silences {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.au-silence {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-2);
}

.au-silence-what {
    font-weight: 600;
    color: var(--text);
}

.au-silence .au-sub {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.au-firing-silence {
    margin-top: 8px;
    align-self: flex-start;
}

/* drawer */
.au-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .18);
    z-index: 40;
}

.au-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(760px, 92vw);
    background: var(--surface);
    border-left: 1px solid var(--border-strong);
    box-shadow: -12px 0 32px rgba(15, 23, 42, .14);
    z-index: 41;
    display: flex;
    flex-direction: column;
}

.au-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.au-drawer-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.au-drawer-sub {
    font-size: 11.5px;
    margin-top: 2px;
}

.au-drawer-body {
    flex: 1;
    overflow: auto;
    padding: 12px 16px 16px;
    min-height: 0;
}

.au-drawer-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.au-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.au-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    flex: 1;
    min-width: 0;
}

.au-field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
}

.au-field input, .au-field select, .au-field textarea {
    width: 100%;
    box-sizing: border-box;
}

.au-field .hint {
    font-size: 11px;
}

.au-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.au-row > .au-check {
    margin-top: 22px;
    flex: none;
}

.au-sql {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    resize: vertical;
    min-height: 90px;
}

.au-section {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--surface-2);
}

.au-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.au-next {
    font-size: 12px;
    color: var(--text-2);
    min-height: 16px;
}

.au-invalid {
    border-color: var(--danger) !important;
}

.au-error-inline {
    color: var(--danger);
}

.au-error {
    color: var(--danger);
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid var(--danger-soft);
    background: var(--danger-bg);
    border-radius: var(--r-sm);
    white-space: pre-wrap;
}

.au-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
    padding-bottom: 4px;
}

.au-check-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.au-params-table {
    width: 100%;
}

.au-params-table input {
    width: 100%;
    box-sizing: border-box;
}

.au-metric-desc {
    margin-top: 4px;
    line-height: 1.45;
}

.au-test-host {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.au-test-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.au-preview {
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    max-height: 320px;
}

.au-null {
    color: var(--muted);
    font-style: italic;
}

/* runs drawer */
.au-split {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

.au-runs-list {
    max-height: 260px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    flex: none;
}

.au-run-detail {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.au-ellipsis {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.au-wrap {
    white-space: normal;
    max-width: 380px;
}

.au-summary {
    font-size: 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.au-summary > span + span {
    margin-left: 6px;
}

.au-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.au-name-line .au-name {
    max-width: 180px;
}

.au-metric-label {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
