:root {
    color-scheme: light;
    --bg: #f5f6f8;
    --panel: #ffffff;
    --border: #dde1e6;
    --text: #1c1f24;
    --muted: #6b7280;
    --accent: #2f6feb;
    --accent-hover: #2558c4;
    --danger: #d1453b;
    --danger-hover: #b23a31;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

header.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

header.topbar h1 {
    font-size: 1.1rem;
    margin: 0;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    main {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        grid-template-areas:
            "sequence status"
            "sequence media";
        align-items: start;
    }

    .panel-sequence {
        grid-area: sequence;
    }

    .panel-status {
        grid-area: status;
    }

    .panel-media {
        grid-area: media;
    }
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.panel h2 {
    margin-top: 0;
    font-size: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

input[type=text],
input[type=number],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 3em;
}

button {
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font: inherit;
}

button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

button.primary:hover {
    background: var(--accent-hover);
}

button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

button.danger:hover {
    background: var(--danger-hover);
}

button.icon {
    padding: 0.25rem 0.5rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

.error {
    color: var(--danger);
    margin-bottom: 1rem;
}

.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    width: 300px;
}

.login-card h1 {
    font-size: 1.2rem;
    margin-top: 0;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

.media-preview img,
.media-preview video {
    max-width: 150px;
    max-height: 90px;
}

.media-preview audio {
    width: 150px;
    max-width: 100%;
}

.media-file {
    overflow-wrap: anywhere;
}

.media-type,
.media-size {
    white-space: nowrap;
}

.table-scroll {
    overflow-x: auto;
}

.sequence-table {
    min-width: 680px;
}

.media-table {
    min-width: 520px;
}

.step-fields {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.delay-inputs {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.delay-inputs input[type=number] {
    width: 3.2rem;
    text-align: right;
}

.delay-inputs span {
    font-size: 0.8rem;
}

.step-timing {
    margin-bottom: 0.3rem;
}

/* Visually separate days in the sequence editor. */
tr:has(.step-timing-fixed) td {
    border-top: 3px solid var(--border);
}

.run-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.run-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.run-who {
    min-width: 0;
    overflow-wrap: anywhere;
}

.run-bot {
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 0.45rem;
    margin-left: 0.3rem;
    white-space: nowrap;
}

.run-chat,
.run-step {
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.run-times {
    font-size: 0.8rem;
}

.run-waiting {
    color: #b45309;
}

.run-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.3rem;
    margin-top: 0.15rem;
}

.run-actions button {
    white-space: nowrap;
    font-size: 0.85rem;
}

.run-card .progress-bar {
    margin-bottom: 0;
}

.progress-bar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.progress-bar-fill {
    background: var(--accent);
    height: 100%;
    transition: width 0.3s ease;
}
