:root {
  --bg: #f4f6f9; --card: #ffffff; --text: #1a202c; --muted: #5a6577; --line: #dfe4ec;
  --brand: #1f4e8c; --brand-2: #173c6c; --ok: #1b7f3b; --warn: #b7791f; --bad: #c53030;
  --info: #2b6cb0; --grey: #718096;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
       color: var(--text); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; padding: .7rem 1.2rem;
       background: var(--brand); color: #fff; }
.top a { color: #fff; text-decoration: none; }
.top a:hover { text-decoration: underline; }
.brand { font-weight: 700; }
.top nav { display: flex; flex-wrap: wrap; gap: .3rem 1rem; flex: 1; }
.top .sep { opacity: .5; }
.who { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.tag { background: #ffd166; color: #3a2a00; border-radius: 3px; padding: 0 .35rem; font-size: .75rem; font-weight: 700; }
main { max-width: 1280px; margin: 0 auto; padding: 1.2rem 16px 2rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 16px 2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.pagehead, .runhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
label { display: block; margin: .6rem 0; font-weight: 600; font-size: .92rem; }
label.radio, label.checkbox { font-weight: 400; display: flex; gap: .5rem; align-items: flex-start; }
input[type=text], input[type=password], input[type=email], input[type=number], input:not([type]), select {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; font: inherit; font-weight: 400;
  border: 1px solid #c3cad6; border-radius: 6px; background: #fff; }
input[type=file] { display: block; margin-top: .35rem; font: inherit; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; padding: .4rem 1rem .6rem; }
legend { font-weight: 700; padding: 0 .3rem; }
.row { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; }
.row > label { flex: 1 1 180px; }
.row > label.w-small { flex: 0 1 140px; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.filters select, .filters input { width: auto; display: inline-block; margin: 0; }
button, .button { display: inline-block; padding: .5rem .95rem; font: inherit; font-weight: 600; border-radius: 6px;
  border: 1px solid #c3cad6; background: #fff; color: var(--text); cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: #eef2f7; }
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--brand-2); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button:disabled { opacity: .6; cursor: default; }
button.link { background: none; border: 0; color: #fff; padding: 0; text-decoration: underline; font-weight: 400; }
form.inline { display: inline; }
.flash { padding: .6rem .8rem; border-radius: 6px; margin: .6rem 0; background: #e8f0fb; border: 1px solid #c4d7f2; }
.flash.ok { background: #e7f6ec; border-color: #b8e2c4; }
.flash.error { background: #fdecec; border-color: #f3c2c2; }
.flash.warn { background: #fff6e0; border-color: #f2d99b; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.big { font-size: 1.15rem; font-weight: 700; user-select: all; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f9fc; font-size: .85rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
table.small td, table.small th { font-size: .85rem; }
.log { background: #0f1720; color: #d7e0ea; padding: .8rem 1rem; border-radius: 8px; max-height: 420px;
       overflow: auto; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.log.tall { max-height: 640px; }
.counts { margin: .3rem 0; }
.stats { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem; min-width: 150px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.files { columns: 2; font-size: .85rem; }
@media (max-width: 700px) { .files { columns: 1; } }
.badge { display: inline-block; color: #fff; border-radius: 4px; padding: .05rem .45rem; font-size: .75rem;
         font-weight: 700; white-space: nowrap; background: var(--grey); }
/* run states */
.st-queued { background: var(--grey); } .st-running { background: var(--info); }
.st-finished { background: var(--ok); } .st-failed { background: var(--bad); }
.st-cancelled, .st-interrupted { background: var(--warn); }
/* PBX statuses */
.s-UPGRADED, .s-ELIGIBLE { background: var(--ok); } .s-UP_TO_DATE { background: var(--info); }
.s-BEHIND, .s-NOT_ELIGIBLE, .s-NO_UPDATE_OFFERED { background: var(--warn); }
.s-FAILED, .s-NOT_SWITCHVOX, .s-BLOCKED { background: var(--bad); }
.s-SKIPPED, .s-WAITING, .s-NOT_RUN { background: var(--grey); } .s-IN_PROGRESS { background: #6b46c1; }
.s-PROBED { background: #553c9a; }

/* list editor */
table.editor td { padding: .25rem .35rem; }
table.editor input { margin: 0; padding: .35rem .45rem; min-width: 7rem; }
table.editor td.rownum { color: var(--muted); text-align: right; width: 2.5rem; vertical-align: middle; }
table.editor .del-row { padding: .25rem .55rem; }
label.w-name { max-width: 420px; }
td.actions { display: table-cell; white-space: nowrap; }
td.actions .button { margin: .1rem .2rem .1rem 0; }
button.big-btn { font-size: 1.05rem; padding: .65rem 1.3rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
