:root { --sidebar-width: 214px; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 2; width: var(--sidebar-width);
  display: flex; flex-direction: column; padding: 28px 14px 18px;
  background: var(--sidebar); border-right: 1px solid var(--line);
}
.app-brand { display: flex; align-items: center; gap: 10px; margin: 0 4px 32px; color: var(--ink); text-decoration: none; }
.app-brand strong, .app-brand small { display: block; }
.app-brand strong { font-size: 15px; letter-spacing: .02em; }
.app-brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.brand-mark { display: block; flex: none; width: 36px; height: 36px; border-radius: 8px; }
.app-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 8px 11px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 550; }
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--raised); color: var(--ink); }
.nav-item[aria-current] { color: var(--accent); background: var(--tint); border-color: #345043; }
.sidebar-status { margin-top: auto; padding: 15px 7px 2px; border-top: 1px solid var(--line); }
.sidebar-status p { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.sidebar-status .connection { min-height: 24px; border-radius: 6px; padding: 3px 5px; color: var(--ink); }
.sidebar-status div.connection { background: transparent; border-color: transparent; padding-left: 0; }
.connection[data-state="connected"], .connection[data-connected="true"] { color: var(--accent); }
.connection[data-state="connected"] span { background: var(--accent); }
.connection[data-state="loading"] span { background: var(--muted); }
.worker-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--muted); font-size: 12px; text-decoration: none; }
.worker-link svg { width: 14px; height: 14px; }
.worker-link:hover { color: var(--accent); }
.app-main { max-width: 1560px; margin-left: var(--sidebar-width); margin-right: auto; padding: 32px 32px 24px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-heading h1 { font-size: 30px; line-height: 1.2; }
#monitor-title { display: flex; align-items: center; gap: 15px; color: #f0f2f0; font-size: 36px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
#monitor-title svg { flex: none; width: 1em; height: 1em; color: #68d99a; }
.page-heading p { color: var(--muted); margin-top: 7px; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.button svg { width: 15px; height: 15px; flex: none; }
.button:active:not(:disabled), .nav-item:active { filter: brightness(.88); }
#run-all { min-height: 40px; padding-inline: 16px; }
.monitor-metrics { display: grid; grid-template-columns: 1.15fr .85fr 1.2fr; margin: 0 0 13px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; }
.monitor-metrics > div { min-width: 0; padding: 14px 18px; }
.monitor-metrics > div + div { border-left: 1px solid var(--line); }
.monitor-metrics dt { color: var(--muted); font-size: 12px; }
.monitor-metrics dt small { margin-left: 3px; font-size: 11px; }
.monitor-metrics dd { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 9px; margin: 4px 0 0; font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; }
.monitor-metrics dd small { color: var(--muted); font-size: 11px; font-weight: 450; }
.rules-strip { display: flex; align-items: center; gap: 13px; min-height: 53px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--sidebar); margin-bottom: 20px; }
.rules-strip > strong { white-space: nowrap; font-size: 13px; }
.rules-strip .button { margin-left: auto; }
.rules-values { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 13px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rules-values span { padding-left: 13px; border-left: 1px solid var(--control); }
.monitor-panel { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.work-toolbar, .work-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; }
.work-toolbar { justify-content: space-between; padding: 12px 14px; }
.segments { display: flex; gap: 3px; border: 1px solid var(--line); border-radius: 7px; padding: 3px; background: var(--field); }
.segments button { min-height: 29px; padding: 4px 11px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-weight: 620; font-size: 12px; white-space: nowrap; }
.segments button:hover { color: var(--ink); background: var(--raised); }
.segments button[aria-pressed="true"] { color: var(--ink); border-color: var(--control); background: #303732; }
.account-search { position: relative; width: 168px; }
.account-search svg { position: absolute; top: 8px; left: 8px; color: var(--muted); pointer-events: none; }
.account-search input { padding-left: 30px; min-height: 34px; font-size: 12px; }
.work-tools .check { min-height: 34px; color: var(--muted); }
.add-button { color: var(--accent); }
.work-table { min-width: 796px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.work-table .date-col { width: 114px; }
.work-table .number-col { width: 88px; }
.work-table .delta-col { width: 72px; }
.work-table .state-col { width: 156px; }
.work-table .action-col { width: 92px; }
.work-table th, .work-table td { padding: 12px 12px; vertical-align: middle; }
.work-table th:first-child, .work-table td:first-child { width: auto; min-width: 0; padding-left: 17px; }
.work-table th:last-child, .work-table td:last-child { padding-right: 17px; }
.work-table thead { border-block: 1px solid var(--line); }
.work-table thead th { font-size: 12px; font-weight: 590; }
.work-table tbody tr:not(.account-row):hover { background: var(--raised); }
.work-table .numeric { text-align: right; white-space: nowrap; }
.work-table td.numeric { font-size: 13px; }
.work-table .current { font-weight: 650; }
.work-table .secondary { color: var(--muted); }
.work-table .positive { color: var(--accent); }
.work-table .negative { color: var(--danger); }
.published, .row-action { white-space: nowrap; }
.work-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.5; font-weight: 540; }
.work-table .account-row th { padding: 8px 14px; background: #202723; border-block: 1px solid var(--line); }
.account-line, .account-toggle, .account-meta, .account-tools { display: flex; align-items: center; gap: 8px; }
.account-line { gap: 12px; }
.account-toggle { min-width: 0; max-width: 48%; min-height: 33px; padding: 2px 3px; border: 0; background: transparent; text-align: left; border-radius: 5px; font-weight: 650; }
.account-toggle:hover { color: var(--accent); }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-avatar { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 6px; background: #33453b; color: #c1e6d3; font-size: 12px; }
.chevron { display: inline-block; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); flex: none; margin: 0 3px 0 1px; color: var(--muted); }
.account-toggle[aria-expanded="true"] .chevron { transform: rotate(45deg); margin-top: -3px; }
.account-meta { color: var(--muted); font-size: 11px; }
.account-tools { margin-left: auto; }
.account-tools .button { padding: 4px 8px; min-height: 28px; }
.state { display: inline-block; border: 1px solid transparent; border-radius: 5px; padding: 2px 6px; font-size: 11px; font-weight: 580; line-height: 1.35; white-space: nowrap; }
.state.success { color: #99dfbc; background: #253b30; border-color: #39594a; }
.state.neutral { color: #c1c9c3; background: #2c322e; border-color: #424b45; }
.state.warning { color: var(--warning); background: #3a2e22; border-color: #63472f; }
.state.danger { color: var(--danger); background: #3b2827; border-color: #654440; }
.row-status { display: flex; flex-wrap: wrap; gap: 4px; }
.row-status small { flex-basis: 100%; color: var(--muted); overflow-wrap: anywhere; line-height: 1.4; }
.text-action { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 560; text-decoration: none; }
.text-action:hover { text-decoration: underline; }
.text-action svg { flex: none; width: 15px; height: 15px; }
.monitor-empty { min-height: 164px; border-top: 1px solid var(--line); }
.panel-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 14px; padding: 10px 15px; color: var(--muted); font-size: 11px; }
.empty + .panel-meta { border-top: 1px solid var(--line); }
.run-strip { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(140px, 1fr) minmax(190px, 1.6fr) auto; align-items: center; gap: 16px 22px; margin-top: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--sidebar); }
.run-heading h2 { font-size: 13px; }
.run-heading p, .run-summary p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.run-summary strong { font-size: 12px; font-weight: 580; }
.run-progress { min-width: 0; font-variant-numeric: tabular-nums; }
.run-progress > div { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; }
.run-progress > div span + span { color: var(--muted); white-space: nowrap; }
.run-progress progress { width: 100%; height: 5px; border: 0; border-radius: 4px; vertical-align: 2px; appearance: none; }
.run-progress progress::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
.run-progress progress::-webkit-progress-value { background: var(--green); border-radius: 4px; }
.feedback { position: fixed; z-index: 3; right: 20px; bottom: 17px; max-width: min(380px, calc(100% - 40px)); padding: 10px 13px; background: var(--raised); border: 1px solid var(--control); border-radius: 7px; color: var(--accent); line-height: 1.5; overflow-wrap: anywhere; }
.feedback[data-error="true"], .form-error[data-error="true"] { color: var(--warning); }
.monitor-history-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.history-table th:first-child { width: 15%; }
.history-table th:nth-child(2) { width: 23%; }
.history-table th:nth-child(8) { width: 18%; }
.history-table th:nth-child(6), .history-table th:nth-child(7) { white-space: normal; }
.dialog { color: var(--ink); background: var(--raised); border: 1px solid var(--control); border-radius: 12px; width: min(480px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; }
.dialog::backdrop { background: rgb(9 12 10 / 72%); }
.dialog form { display: grid; gap: 14px; padding: 19px 22px; }
.dialog form > p { color: var(--muted); line-height: 1.55; font-size: 13px; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-head h2 { font-size: 19px; }
.dialog-actions { flex-wrap: wrap; justify-content: end; padding-top: 10px; border-top: 1px solid var(--line); }
.dialog-actions #test-notification { margin-right: auto; }
.dialog .form-error { color: var(--accent); margin: 0; }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-pair label { min-width: 0; }
.icon-button { display: grid; place-items: center; min-width: 33px; min-height: 33px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.icon-button:hover { border-color: var(--control); background: var(--surface); color: var(--ink); }
.comment-page .capture { padding-top: 19px; }
.comments table { min-width: 670px; }
#worker-status { color: var(--muted); line-height: 1.6; margin-block: 12px; }
.monitor-capture { padding-bottom: 24px; }
@media (max-width: 1100px) {
  :root { --sidebar-width: 182px; }
  .app-main { padding-inline: 22px; }
  .run-strip { grid-template-columns: minmax(120px, 1fr) minmax(125px, 1fr); }
  .run-strip .text-action { justify-self: end; }
}
@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }
  .app-sidebar { position: sticky; top: 0; width: auto; padding: 8px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 6px 10px; }
  .app-brand { margin: 0; }
  .app-brand small { display: none; }
  .brand-mark { width: 28px; height: 28px; }
  .app-nav { grid-column: 1/-1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px 4px; }
  .nav-item { min-height: 32px; gap: 5px; padding: 4px 7px; font-size: 12px; }
  .nav-item svg { width: 14px; height: 14px; }
  .sidebar-status { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; margin: 0; padding: 0; border: 0; }
  .sidebar-status p, .worker-link { margin: 0; }
  .sidebar-status:has(button) p { display: none; }
  .worker-link svg { display: none; }
  .app-main { padding: 20px 14px; }
  .page-heading h1 { font-size: 25px; }
  #monitor-title { gap: 9px; font-size: 27px; }
  .page-heading p { font-size: 12px; }
  .monitor-metrics > div { padding: 10px; }
  .monitor-metrics dd { font-size: 15px; }
  .monitor-history-controls { width: 100%; }
  .monitor-panel .table-head { align-items: start; flex-wrap: wrap; }
}
@media (max-width: 450px) {
  .work-toolbar, .work-tools { gap: 7px; }
  .account-search { width: 128px; }
  .rules-strip { flex-wrap: wrap; gap: 6px; }
  .rules-values { order: 3; flex-basis: 100%; }
  .rules-values span:first-child { border-left: 0; padding-left: 0; }
  .run-strip { padding: 11px; gap: 11px; }
  .run-summary { grid-column: 1/-1; }
  .run-strip .text-action { grid-column: 1/-1; justify-self: start; }
  .panel-meta { gap: 4px; }
}

