* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7f8;
    color: #172126;
}
a { color: #126c5a; text-decoration: none; }
a:hover { text-decoration: underline; }
.topnav {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 58px;
    padding: 0 24px;
    border-bottom: 1px solid #d9e2e0;
    background: #ffffff;
}
.topnav .brand {
    font-weight: 700;
    color: #172126;
    margin-right: auto;
}
.topnav form { margin: 0; }
.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}
.auth {
    width: min(420px, 100%);
    margin: 10vh auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #d9e2e0;
    border-radius: 8px;
}
.pagehead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
h1 { margin: 0 0 10px; font-size: 28px; }
h2 { margin-top: 28px; font-size: 20px; }
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.card, .panel, .form, .tablewrap {
    background: #ffffff;
    border: 1px solid #d9e2e0;
    border-radius: 8px;
}
.card {
    display: grid;
    gap: 8px;
    padding: 16px;
    color: #172126;
}
.card span, .muted { color: #637174; }
.panel { padding: 18px; }
pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 14px;
    background: #eef3f1;
    border-radius: 6px;
}
.form {
    display: grid;
    gap: 16px;
    padding: 18px;
}
label { display: grid; gap: 6px; font-weight: 600; }
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #bdc9c6;
    border-radius: 6px;
    font: inherit;
    background: #ffffff;
}
fieldset {
    display: grid;
    gap: 8px;
    border: 1px solid #d9e2e0;
    border-radius: 8px;
    padding: 12px;
}
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border: 0;
    border-radius: 6px;
    background: #126c5a;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.button.secondary {
    color: #172126;
    background: #dfe8e5;
}
button:hover, .button:hover { text-decoration: none; filter: brightness(0.96); }
.tablewrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 11px 12px;
    border-bottom: 1px solid #e4ebe9;
    text-align: left;
    vertical-align: top;
}
th { color: #637174; font-size: 13px; }
.result-details-button { white-space: nowrap; }
.result-dialog {
    width: min(860px, calc(100% - 32px));
    max-height: min(760px, calc(100% - 32px));
    padding: 0;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 18px 50px rgb(23 33 38 / 30%);
}
.result-dialog::backdrop { background: rgb(23 33 38 / 55%); }
.result-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 18px 0;
}
.result-dialog__header h2 { margin: 0; }
.result-dialog__header form { margin: 0; }
.result-dialog__content {
    max-height: min(620px, calc(100vh - 160px));
    margin: 18px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
.mention {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    line-height: 1;
}
.mention-yes {
    background: #e7f4ef;
    color: #0a7a4b;
}
.mention-no {
    background: #f8e8e8;
    color: #b42318;
}
.mention-unknown {
    background: #eef3f1;
    color: #637174;
}
.status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e7f4ef;
    color: #126c5a;
    font-size: 13px;
}
.status-queued, .status-running {
    background: #eef3f1;
    color: #415052;
}
.status-auth_required {
    background: #fff1d9;
    color: #8a5a00;
}
.status-failed {
    background: #f8e8e8;
    color: #8e2929;
}
.status-completed {
    background: #e7f4ef;
    color: #126c5a;
}
.flash, .error {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.flash { background: #e7f4ef; color: #126c5a; }
.error { background: #f8e8e8; color: #8e2929; }
.project-recent { margin-top: 28px; }
.project-recent[data-project-history] { min-height: 88px; }
.autosave-status { margin: 0; min-height: 20px; }
.autosave-status[data-state="saved"] { color: #126c5a; }
.autosave-status[data-state="error"] { color: #8e2929; }
.project-prompts { padding-left: 24px; }
.project-prompts li + li { margin-top: 16px; }
.project-prompts pre, .history-prompt pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.history-prompt summary { cursor: pointer; min-width: 180px; max-width: 320px; }
@media (max-width: 680px) {
    .topnav { flex-wrap: wrap; padding: 12px 16px; }
    .topnav .brand { width: 100%; }
    .shell { width: calc(100% - 20px); margin: 18px auto; }
    .pagehead { align-items: flex-start; flex-direction: column; }
}
