:root {
  --headend-blue-900: #173b5c;
  --headend-blue-700: #244c70;
  --headend-blue-500: #4d87b8;
  --headend-blue-300: #9bb6cf;
  --headend-blue-100: #edf5fc;
  --headend-canvas: #d7e5f4;
  --headend-surface: #ffffff;
  --headend-muted: #42627c;
  --headend-success: #276749;
  --headend-warning: #9a6700;
  --headend-danger: #a12622;
  --headend-space-1: 0.25rem;
  --headend-space-2: 0.5rem;
  --headend-space-3: 0.75rem;
  --headend-space-4: 1rem;
  --headend-radius: 2px;
  --headend-control-height: 2.25rem;
  --headend-focus: 0 0 0 2px #ffffff, 0 0 0 4px #4d87b8;
  --headend-title: linear-gradient(#f7fbff, #c9dced);
  --headend-toolbar: linear-gradient(#ffffff, #d9e8f5);
  --headend-shadow: 0 1px 2px #708da655;
}

.headend-shell {
  min-height: 100vh;
  background: var(--headend-canvas);
  color: var(--headend-blue-900);
  font: 13px Arial, sans-serif;
}

.headend-shell *,
.headend-shell *::before,
.headend-shell *::after { box-sizing: border-box; }

.headend-nav {
  display: flex;
  align-items: center;
  min-height: 38px;
  background: linear-gradient(#e9f3fc, #bdd4e9);
  border-bottom: 1px solid #7297bb;
  box-shadow: 0 1px 3px #7890a566;
}

.headend-nav__brand {
  padding: 0 18px 0 12px;
  font-weight: bold;
  text-shadow: 0 1px #ffffff;
}

.brand-icon,
.tab-icon { display: inline-block; margin-right: .35rem; color: var(--headend-blue-700); }

.headend-tab {
  min-height: 38px;
  box-sizing: border-box;
  padding: 11px 18px 0;
  border-left: 1px solid #abc2d8;
  color: var(--headend-blue-700);
  text-decoration: none;
}

.headend-tab:hover { background: #edf6ff; }
.headend-tab:focus-visible { outline: none; box-shadow: var(--headend-focus); }
.headend-tab.active,
.headend-tab[aria-current="page"] { background: var(--headend-surface); border-top: 3px solid var(--headend-blue-500); padding-top: 8px; font-weight: bold; }

.headend-content {
  max-width: 1180px;
  margin: .65rem auto;
  padding: 0 .65rem 1.25rem;
}

.headend-pagebar {
  display: flex;
  align-items: center;
  gap: .55rem;
  max-width: 1180px;
  min-height: 42px;
  margin: .65rem auto 0;
  padding: .35rem .6rem;
  background: var(--headend-title);
  border: 1px solid var(--headend-blue-300);
  box-shadow: var(--headend-shadow);
}

.headend-pagebar__icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #7d9fbe;
  background: #e8f2fb;
  color: var(--headend-blue-700);
  font-size: 1rem;
}

.headend-pagebar strong,
.headend-pagebar small { display: block; }
.headend-pagebar strong { color: var(--headend-blue-900); font-size: 1rem; }
.headend-pagebar small { margin-top: .1rem; color: var(--headend-muted); font-size: .75rem; }
.headend-pagebar__state { margin-left: auto; padding: .2rem .5rem; border: 1px solid #9bb6cf; background: #fff; color: var(--headend-success); font-size: .78rem; }

.toolbar {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .65rem;
  padding: .35rem .45rem;
  background: var(--headend-toolbar);
  border: 1px solid var(--headend-blue-300);
  box-shadow: var(--headend-shadow);
}

.toolbar-status { margin-left: auto; color: var(--headend-muted); }

.headend-panel,
.panel {
  padding: 0 .65rem .7rem;
  background: var(--headend-blue-100);
  border: 1px solid var(--headend-blue-300);
  border-radius: var(--headend-radius);
  box-shadow: var(--headend-shadow);
}

.headend-panel + .headend-panel,
.panel + .panel { margin-top: var(--headend-space-4); }
.headend-panel__title,
.headend-panel h2,
.panel h2 { margin: 0 -.65rem .65rem; padding: .35rem .6rem; background: var(--headend-title); border-bottom: 1px solid var(--headend-blue-300); color: var(--headend-blue-700); font-size: 1rem; }
.headend-panel .diagnostic,
.panel .diagnostic { display: flex; gap: var(--headend-space-3); margin: .3rem 0; padding: .38rem .5rem; border: 1px solid var(--headend-blue-300); background: var(--headend-surface); }
.headend-panel .diagnostic strong,
.panel .diagnostic strong { min-width: 10rem; }
.headend-panel p,
.panel p { color: var(--headend-muted); }

.headend-content > h1 { margin: 0 0 .45rem; padding: .4rem .6rem; background: var(--headend-title); border: 1px solid var(--headend-blue-300); box-shadow: var(--headend-shadow); font-size: 1.2rem; }
.headend-content > p { color: var(--headend-muted); }
.headend-content fieldset { margin: .65rem 0; padding: .55rem .7rem .7rem; background: var(--headend-blue-100); border: 1px solid var(--headend-blue-300); border-radius: var(--headend-radius); box-shadow: var(--headend-shadow); }
.headend-content legend { padding: 0 var(--headend-space-1); color: var(--headend-blue-700); font-weight: bold; }
.headend-content label { color: var(--headend-blue-700); }
.headend-content form > fieldset label { display: grid; grid-template-columns: minmax(11rem, 18rem) minmax(12rem, 1fr); align-items: center; gap: .6rem; margin: .35rem 0; }
.headend-content form > fieldset label input[type="checkbox"] { justify-self: start; width: auto; }
.headend-content button { min-height: 1.9rem; cursor: pointer; }
.headend-workspace,
.workspace { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.25fr); gap: .65rem; }

.headend-workspace > .headend-panel,
.headend-workspace > .panel { min-width: 0; }

.headend-field { display: grid; gap: var(--headend-space-1); margin: var(--headend-space-3) 0; }
.headend-field__label { color: var(--headend-blue-700); font-weight: bold; }
.headend-field input,
.headend-field select,
.headend-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--headend-control-height);
  padding: var(--headend-space-2);
  border: 1px solid #8ca7be;
  border-radius: var(--headend-radius);
  background: var(--headend-surface);
  color: var(--headend-blue-900);
}

.headend-content input,
.headend-content select,
.headend-content textarea { font: inherit; }

.headend-field input:focus-visible,
.headend-field select:focus-visible,
.headend-field textarea:focus-visible { outline: none; box-shadow: var(--headend-focus); }

.headend-button {
  min-height: var(--headend-control-height);
  padding: 0 var(--headend-space-3);
  border: 1px solid #7297bb;
  border-radius: var(--headend-radius);
  background: linear-gradient(#ffffff, #c8dced);
  color: var(--headend-blue-900);
  cursor: pointer;
}

.headend-content button,
.stream-tab {
  padding: .3rem .65rem;
  border: 1px solid #7297bb;
  border-radius: var(--headend-radius);
  background: var(--headend-toolbar);
  color: var(--headend-blue-900);
  box-shadow: 0 1px 1px #7890a633;
}

.headend-content button:hover,
.stream-tab:hover { background: #edf6ff; }
.headend-content button:focus-visible,
.stream-tab:focus-visible { outline: none; box-shadow: var(--headend-focus); }
.headend-content button::before { display: inline-block; margin-right: .3rem; font-weight: bold; }
#refresh::before,
#refresh-diagnostics::before { content: "\21BB"; }
#download::before { content: "\2193"; }
#add-feed::before { content: "\002B"; }
#save-virtual::before,
#save-restreamers::before,
#discover::before,
form#setup > button[type="submit"]::before,
#save::before { content: "\2713"; }
#delete::before { content: "\2716"; }

.headend-button:hover { background: linear-gradient(#ffffff, #dcebf7); }
.headend-button:focus-visible { outline: none; box-shadow: var(--headend-focus); }
.headend-status--ok { color: var(--headend-success); }
.headend-status--warn { color: var(--headend-warning); }
.headend-status--error { color: var(--headend-danger); }

.agent-choice { display: inline-block; margin: .2rem .3rem .2rem 0; }
.table-wrap { overflow-x: auto; }
.headend-content table { width: 100%; border-collapse: collapse; background: var(--headend-surface); }
.headend-content th { padding: .45rem .5rem; background: var(--headend-toolbar); border: 1px solid var(--headend-blue-300); text-align: left; white-space: nowrap; }
.headend-content td { padding: .3rem .4rem; border: 1px solid #b4c8da; }
.headend-content td input:not([type="checkbox"]) { width: 100%; min-width: 7rem; min-height: 1.9rem; padding: .25rem .35rem; border: 1px solid #8ca7be; }
.headend-content td input[type="number"] { min-width: 5rem; width: 5rem; }
.headend-content td:first-child { text-align: center; }
.empty { padding: 1rem !important; color: var(--headend-muted); text-align: center; }

@media (max-width: 700px) {
  .headend-nav { flex-wrap: wrap; }
  .headend-nav__brand { width: 100%; padding: var(--headend-space-2) var(--headend-space-3); }
  .headend-tab { flex: 1 1 auto; text-align: center; }
  .headend-pagebar { margin: .4rem .4rem 0; }
  .headend-pagebar__state { display: none; }
  .toolbar { flex-wrap: wrap; }
  .toolbar-status { width: 100%; margin-left: 0; }
  .headend-content form > fieldset label { grid-template-columns: 1fr; gap: .2rem; }
  .headend-workspace,
  .workspace { grid-template-columns: 1fr; }
}
