* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1c2430;
  background: #f5f6f8;
}
main { max-width: 1080px; margin: 0 auto; padding: 20px 24px 60px; }
a { color: #2456c4; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 14px 0; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.muted { color: #71809a; }
.block { display: block; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  background: #101828; color: #fff; padding: 10px 24px;
}
.topbar nav { display: flex; gap: 16px; }
.topbar a { color: #cfd8ea; }
.brand { font-weight: 700; font-size: 16px; color: #fff !important; }
.brand span { color: #7aa2ff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: #93a3bd; font-size: 12px; }
button.link { background: none; border: 0; color: #93a3bd; cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

table { border-collapse: collapse; width: 100%; background: #fff; border: 1px solid #e3e7ee; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
th { background: #f0f2f6; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #5b6b84; }
tr.friction { background: #fff7f5; }
.title-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.chip-dev { background: #e3efff; color: #1d4fa1; }
.chip-prod { background: #ffe7d6; color: #a14d0f; }
.chip-error { background: #ffe0e0; color: #a11d1d; }
.chip-denied { background: #fff0c2; color: #8a6d00; }
.chip-mode { background: #24344f; color: #9fb4d8; }

.status { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.status-queued { background: #eef1f5; color: #5b6b84; }
.status-running { background: #e3efff; color: #1d4fa1; }
.status-completed { background: #ddf5e4; color: #14682e; }
.status-error { background: #ffe0e0; color: #a11d1d; }
.status-cancelled { background: #eee; color: #666; }

.button, button.primary, button.danger {
  display: inline-block; border: 1px solid #c9d2df; border-radius: 6px;
  background: #fff; color: #1c2430; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.button.primary, button.primary { background: #2456c4; border-color: #2456c4; color: #fff; }
.button.danger, button.danger { background: #fff; border-color: #d33; color: #d33; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 14px 16px; }
.card h2 { margin: 0 0 10px; }
.stat-row { display: flex; gap: 22px; margin-bottom: 8px; }
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 11px; color: #71809a; text-transform: uppercase; }
.stat.bad b { color: #a11d1d; }

.flash { padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.flash-error { background: #ffe0e0; color: #7c1414; }

.login-card { max-width: 360px; margin: 80px auto; background: #fff; border: 1px solid #e3e7ee; border-radius: 10px; padding: 28px; }
.login-card h1 { margin-top: 0; }

form label { display: block; margin: 10px 0; font-weight: 600; font-size: 13px; }
form label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  display: block; width: 100%; max-width: 420px; margin-top: 4px;
  padding: 7px 9px; border: 1px solid #c9d2df; border-radius: 6px; font: inherit; background: #fff;
}
label.radio { font-weight: 400; }
label.radio input { margin-right: 6px; }
fieldset { border: 1px solid #e3e7ee; border-radius: 8px; background: #fff; margin: 14px 0; padding: 10px 16px 14px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.run-form { max-width: 640px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 18px; }
.folder-grid code { font-size: 12px; }
.filters { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 10px 16px 14px; margin-bottom: 16px; }
.filters label { margin: 0; }
.filters input, .filters select { width: auto; min-width: 110px; }

dl.meta { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 10px 16px; }
dl.meta div { display: flex; gap: 10px; padding: 2px 0; }
dl.meta dt { width: 90px; color: #71809a; font-size: 12px; text-transform: uppercase; padding-top: 2px; }
dl.meta dd { margin: 0; word-break: break-all; }

details.scenario { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 8px 14px; margin: 8px 0; }
details.scenario > summary { cursor: pointer; }
.run-block { border-left: 3px solid #ddf5e4; margin: 10px 0 10px 6px; padding: 4px 12px; }
.run-block.failed { border-left-color: #ffb3b3; }
.assertions { margin: 4px 0; color: #a11d1d; }
.tools-line .tool { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 7px; border-radius: 4px; background: #eef1f5; font-size: 12px; font-family: ui-monospace, monospace; }
.tools-line .tool.error { background: #ffe0e0; color: #a11d1d; }
pre { white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
pre.reply { background: #f7f8fa; border: 1px solid #eef1f5; border-radius: 6px; padding: 10px; font-size: 13px; }
pre.error-text { color: #a11d1d; }
pre.log { background: #101828; color: #cfd8ea; border-radius: 8px; padding: 14px; font: 12px/1.5 ui-monospace, monospace; max-height: 480px; overflow: auto; }

.transcript { max-width: 860px; }
.msg { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 8px 14px; margin: 10px 0; }
.msg-user { border-left: 4px solid #2456c4; }
.msg-assistant { border-left: 4px solid #14682e; }
.msg-head { font-size: 11px; text-transform: uppercase; color: #71809a; margin-bottom: 2px; }
.msg pre { font: inherit; }
details.toolcall { margin: 6px 0 6px 24px; border: 1px solid #e3e7ee; border-radius: 6px; background: #fbfcfd; padding: 5px 12px; }
details.toolcall.error { border-color: #ffb3b3; background: #fff7f5; }
details.toolcall.permission_denied { border-color: #ffe08a; background: #fffdf2; }
details.toolcall summary { cursor: pointer; }
.toolcall-body pre { background: #f2f4f7; border-radius: 5px; padding: 8px; font: 12px/1.5 ui-monospace, monospace; max-height: 320px; overflow: auto; }
.session-title { margin-bottom: 2px; }

.gantt { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px; padding: 10px 12px; }
.gantt-row { display: flex; align-items: center; min-height: 34px; border-bottom: 1px solid #f2f4f7; }
.gantt-row:last-child { border-bottom: 0; }
.gantt-line { width: 150px; flex: none; font-size: 12px; font-weight: 600; color: #5b6b84; }
.gantt-lane { position: relative; flex: 1; height: 26px; background: repeating-linear-gradient(90deg, #fafbfc 0 10%, #f4f6f9 10% 10.2%); border-radius: 4px; }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; overflow: hidden; font-size: 10px; line-height: 20px; color: #fff; padding: 0 4px; white-space: nowrap; }
.gantt-bar.op-resegment_job, .gantt-bar.op-reschedule_job, .gantt-bar.op-reassign_job { background: #2456c4; }
.gantt-bar.op-create_job { background: #14682e; }
.gantt-bar.op-plan_production { background: #2e9e57; }
.gantt-bar.op-apply_disruption { background: repeating-linear-gradient(45deg, #c0392b 0 6px, #e57368 6px 12px); }
.gantt-bar.op-set_pin { background: #6b7a94; }
.gantt-bar.op-delete_job { background: #fff; border: 1px dashed #c0392b; color: #c0392b; }
.gantt-legend { display: flex; gap: 14px; align-items: center; margin-top: 6px; font-size: 12px; }
.gantt-key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: baseline; }
.gantt-key.op-resegment_job { background: #2456c4; }
.gantt-key.op-create_job { background: #14682e; }
.gantt-key.op-plan_production { background: #2e9e57; }
.gantt-key.op-apply_disruption { background: repeating-linear-gradient(45deg, #c0392b 0 4px, #e57368 4px 8px); }
.gantt-key.op-set_pin { background: #6b7a94; }
