/* Kolory i układ są lokalne. Panel działa także bez zewnętrznego CDN. */
:root {
  --bg: #0a0d14;
  --panel: #111620;
  --panel-soft: #151b27;
  --line: #242c3b;
  --text: #edf1f8;
  --muted: #8b96aa;
  --accent: #69dfbe;
  --accent-dark: #17382f;
  --danger: #ff969d;
  --warning: #e5c182;
  --radius: 14px;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color-scheme: dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.2px;
}
h3 {
  font-size: 15px;
}
small {
  font-size: 11px;
}
[hidden] {
  display: none !important;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: #092018;
  padding: 10px;
}
.skip-link:focus {
  top: 12px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 226px;
  background: #0d111a;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  z-index: 20;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 0 10px 42px;
  font-size: 30px;
  font-weight: 750;
  line-height: 1;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #0d2c23;
  font-size: 35px;
  border-radius: 11px;
  width: 43px;
  height: 43px;
}
.brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 2.7px;
  color: var(--muted);
  margin-top: 8px;
}
.brand-dot {
  color: var(--accent);
}
.nav-label {
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 1.6px;
  color: #606e85;
  padding: 0 12px 15px;
}
nav {
  display: grid;
  gap: 7px;
}
nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border-radius: 8px;
  color: #9aa6bb;
  font-size: 12px;
  font-weight: 520;
}
nav a > span {
  font-size: 20px;
  line-height: 1;
  width: 23px;
  text-align: center;
  color: #687a95;
}
nav a:hover {
  background: #151d29;
  color: white;
}
nav a.active {
  color: var(--accent);
  background: #173029;
  border: 1px solid #25483c;
  padding: 11px;
}
nav a.active > span {
  color: var(--accent);
}
nav small {
  margin-left: auto;
  font-size: 10px;
  background: #242e3c;
  color: #bcc7d8;
  padding: 0 6px;
  border-radius: 4px;
}
nav a.active small {
  background: #2a5143;
  color: var(--accent);
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 22px 10px 0;
}
.local-label {
  font-size: 11px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.local-label i,
.connection i {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}
.sidebar-bottom p {
  font-size: 10px;
  color: #64718a;
  line-height: 1.7;
  margin: 10px 0 18px;
}
.sidebar-bottom button {
  font-size: 10px;
  color: var(--muted);
  padding: 0;
}
.workspace {
  margin-left: 226px;
}
.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.breadcrumb {
  font-size: 11px;
  color: #6f7b91;
}
.breadcrumb span {
  padding: 0 14px;
  color: #3c485b;
}
.breadcrumb b {
  font-weight: 500;
  color: #c4cddd;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 19px;
}
.connection {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  gap: 7px;
  align-items: center;
}
.connection.offline i {
  background: var(--danger);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #305548;
  background: #142e26;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.6px;
  font-weight: 650;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.badge.neutral {
  border-color: #3c4351;
  background: #202634;
  color: #a6b2c7;
}
.badge.warning {
  background: #322b20;
  border-color: #584b35;
  color: var(--warning);
}
.badge.danger {
  background: #32202a;
  border-color: #593443;
  color: var(--danger);
}
.icon-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: #a9b6cd;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 20px;
  display: grid;
  place-items: center;
}
.icon-button:hover {
  color: var(--accent);
  border-color: #3d6b5b;
}
main {
  max-width: 1660px;
  margin: auto;
  padding: 34px 38px 0;
  outline: none;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.6px;
  color: #6f7d92;
  font-weight: 600;
  margin-bottom: 9px;
}
h1 {
  font-size: 29px;
  font-weight: 620;
  letter-spacing: -1px;
  margin-bottom: 6px;
}
.page-heading p {
  color: var(--muted);
  font-size: 12px;
}
.heading-actions,
.form-buttons,
.allocation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.button {
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 37px;
  white-space: nowrap;
}
.button.primary {
  background: var(--accent);
  color: #102e24;
  box-shadow: 0 2px 5px #0002;
}
.button.primary:hover {
  background: #90ebd0;
}
.button.secondary {
  background: #151c29;
  color: #bdc9dd;
  border-color: #313b4c;
}
.button.secondary:hover {
  border-color: #6d809c;
}
.button.danger {
  color: var(--danger);
  background: #301e29;
  border-color: #5b3240;
}
.button.small {
  padding: 6px 9px;
  font-size: 10px;
  min-height: 30px;
}
.text-button,
.text-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  padding: 5px 0;
}
.text-button:hover,
.text-link:hover {
  text-decoration: underline;
}
.status-banner {
  border: 1px solid #2a453e;
  border-radius: 10px;
  background: linear-gradient(110deg, #14241f 0%, #101a1b 75%);
  padding: 15px 18px;
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 26px;
}
.status-symbol {
  color: var(--accent);
  font-size: 22px;
}
.status-banner strong {
  font-size: 12px;
  font-weight: 570;
}
.status-banner p {
  font-size: 11px;
  color: #8baca0;
  margin-top: 3px;
}
.status-banner > a {
  font-size: 10px;
  color: #a0c0b4;
  margin-left: auto;
  white-space: nowrap;
}
.status-banner > a span {
  padding-left: 10px;
}
.status-banner.warning {
  border-color: #49402f;
  background: linear-gradient(110deg, #242117, #131820);
}
.status-banner.warning .status-symbol {
  color: var(--warning);
}
.status-banner.warning p {
  color: #b8ab90;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 23px;
}
.metrics article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 19px 20px;
}
.metrics article > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #9ba8bd;
  gap: 8px;
}
.metric-unit {
  font-size: 8px;
  color: #66768f;
  letter-spacing: 0.7px;
}
.metrics strong {
  font-size: 27px;
  letter-spacing: -0.8px;
  font-weight: 560;
  display: block;
  margin: 13px 0 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.metrics small {
  color: #65748d;
  font-size: 9px;
}
.positive {
  color: var(--accent) !important;
}
.negative {
  color: var(--danger) !important;
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(280px, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  min-width: 0;
}
.overview-grid > .panel,
.bottom-grid > .panel {
  margin-bottom: 0;
}
.panel-heading {
  padding: 20px 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.panel-heading p,
.section-title p {
  color: #77869d;
  font-size: 10px;
  margin-top: 5px;
  line-height: 1.6;
}
.panel-heading select {
  min-height: 29px;
  font-size: 10px;
  padding: 5px 8px;
  background: #151c29;
  border: 1px solid #2a3445;
  border-radius: 6px;
  color: #adbad0;
}
.chart-area {
  height: 218px;
  padding: 0 20px;
  position: relative;
}
.chart-area svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.chart-footer {
  padding: 13px 21px;
  border-top: 1px solid #1e2635;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: #78869b;
}
.chart-footer b {
  color: var(--accent);
  font-size: 11px;
  font-weight: 550;
}
.legend-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
}
.empty-state {
  text-align: center;
  color: #74829b;
  padding: 28px 22px;
}
.empty-state > span {
  display: block;
  font-size: 31px;
  color: #40506b;
  line-height: 1.3;
  margin-bottom: 10px;
}
.empty-state h3 {
  font-size: 12px;
  font-weight: 550;
  color: #b8c4d7;
}
.empty-state p {
  font-size: 10px;
  margin-top: 7px;
  line-height: 1.7;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}
.chart-area .empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px #6edcba0d;
}
.live-dot.warning {
  background: var(--warning);
}
.check-list {
  padding: 0 21px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 0;
  border-bottom: 1px solid #202837;
}
.check-row:last-child {
  border-bottom: 0;
}
.check-symbol {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #18342d;
  border-radius: 50%;
  font-size: 10px;
}
.check-symbol.muted {
  color: #8f9bb2;
  background: #212b3b;
}
.check-row b {
  font-size: 10px;
  font-weight: 530;
  display: block;
}
.check-row small {
  font-size: 9px;
  color: #738199;
}
.check-row > span:last-child {
  margin-left: auto;
  font-size: 9px;
  color: #9eacc2;
}
.panel-link {
  display: flex;
  justify-content: space-between;
  padding: 14px 21px;
  background: #131b26;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: #9dacc2;
}
.system-summary {
  display: flex;
  flex-direction: column;
}
.system-summary .check-list {
  flex: 1;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin: 0 0 15px;
}
.section-title h2 {
  font-size: 17px;
}
.agent-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.agent-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
}
.agent-top {
  display: flex;
  align-items: center;
  gap: 11px;
}
.agent-icon {
  height: 33px;
  width: 33px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #a2b4d4;
  background: #233047;
  border: 1px solid #344360;
  border-radius: 9px;
  flex: none;
}
.agent-icon.teal {
  color: #72d8bb;
  background: #19332e;
  border-color: #2c5146;
}
.agent-icon.purple {
  color: #b2a5ed;
  background: #2b2540;
  border-color: #41385f;
}
.agent-top h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.1px;
}
.agent-top small {
  display: block;
  color: #75849b;
  font-size: 9px;
  margin-top: 3px;
}
.agent-top .badge {
  margin-left: auto;
  font-size: 7px;
  padding: 3px 5px;
}
.agent-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 20px 0 15px;
}
.agent-stats span {
  display: block;
  color: #6f7f99;
  font-size: 9px;
  margin-bottom: 5px;
}
.agent-stats b {
  font-size: 15px;
  font-weight: 530;
  font-variant-numeric: tabular-nums;
}
.agent-state {
  border-top: 1px solid #242d3b;
  padding-top: 12px;
  color: #8090a9;
  font-size: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}
.agent-state i {
  height: 4px;
  width: 4px;
  background: #657c96;
  border-radius: 50%;
  flex: none;
}
.agent-state span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-card > a {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.agent-card:has(a:hover) {
  border-color: #4b6a60;
}
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.activity-row {
  display: flex;
  gap: 12px;
  padding: 13px 21px;
  border-top: 1px solid #202837;
}
.activity-row i {
  color: #607e77;
  font-style: normal;
  font-size: 14px;
}
.activity-row p {
  color: #b4c0d3;
  font-size: 10px;
}
.activity-row small {
  display: block;
  color: #64748b;
  margin-top: 3px;
  font-size: 9px;
}
.issue {
  padding: 15px 21px;
  border-top: 1px solid #242d3b;
  display: flex;
  gap: 11px;
}
.issue > span {
  color: var(--warning);
  font-size: 15px;
}
.issue p {
  color: #9eabc0;
  font-size: 11px;
  line-height: 1.7;
}
.issue small {
  color: #64758d;
  font-size: 9px;
}
.notice {
  display: flex;
  gap: 12px;
  padding: 14px 17px;
  border: 1px solid #303a4c;
  background: #141c29;
  border-radius: 9px;
  margin-bottom: 20px;
  color: #9eafc7;
  font-size: 11px;
  line-height: 1.7;
}
.notice > span {
  color: #8cafca;
}
.notice.error {
  color: #ffc0c5;
  border-color: #6e3b48;
  background: #30202b;
}
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 11px;
}
th {
  background: #141c28;
  color: #71839e;
  font-size: 9px;
  letter-spacing: 0.4px;
  font-weight: 550;
  text-align: left;
  padding: 12px 20px;
}
td {
  padding: 17px 20px;
  border-top: 1px solid #242c3a;
  color: #b6c4d9;
  font-variant-numeric: tabular-nums;
}
td strong {
  font-size: 11px;
  color: #d9e1ee;
  font-weight: 550;
}
td small {
  display: block;
  font-size: 9px;
  color: #7888a2;
  margin-top: 4px;
}
.align-right {
  text-align: right;
}
.allocation-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding: 0 21px 22px;
}
.allocation-field > label {
  color: #a9b6c9;
  font-size: 11px;
  display: block;
  margin-bottom: 7px;
}
.allocation-field input[type="number"] {
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.allocation-lock {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #788ca9;
  margin-top: 9px;
}
.allocation-summary {
  border-top: 1px solid var(--line);
  padding: 20px 21px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.allocation-summary span,
.allocation-summary small {
  display: block;
  color: #7e8fa9;
  font-size: 10px;
}
.allocation-summary strong {
  display: block;
  font-size: 21px;
  margin: 3px 0;
  font-weight: 550;
}
.allocation-summary small.error {
  color: var(--danger);
}
.form-feedback {
  padding: 0 21px;
  color: var(--danger);
  font-size: 11px;
}
.form-feedback:not(:empty) {
  padding-bottom: 20px;
}
input,
select {
  border: 1px solid #354155;
  background: #0e141f;
  border-radius: 7px;
  padding: 10px 11px;
  color: #d5deed;
  min-width: 0;
}
input::placeholder {
  color: #586c87;
}
input:focus {
  border-color: #6ebda6;
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
.history-filters {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 0 21px 20px;
  flex-wrap: wrap;
}
.history-filters label {
  font-size: 9px;
  color: #8596ad;
  display: grid;
  gap: 5px;
}
.history-filters input {
  font-size: 10px;
  padding: 7px 9px;
}
.history-filters > span {
  font-size: 10px;
  color: #7c8fa8;
  margin-left: auto;
  align-self: center;
}
.goals-grid,
.system-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
}
.goal-row {
  padding: 20px 21px;
  border-top: 1px solid var(--line);
}
.goal-row h3 {
  font-size: 12px;
}
.goal-row p {
  font-size: 10px;
  color: #7f91ac;
  margin: 7px 0 12px;
}
.goal-row .button {
  margin-right: 5px;
}
.form-stack {
  padding: 0 21px 21px;
  display: grid;
  gap: 18px;
}
.form-stack label {
  font-size: 11px;
  color: #a2b2c9;
  display: grid;
  gap: 8px;
}
.form-stack .form-feedback {
  padding: 0;
}
.form-buttons {
  margin-top: 3px;
}
.settings-list {
  padding: 0 21px 12px;
  margin: 0;
}
.settings-list > div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 0;
  border-top: 1px solid #252f3f;
  font-size: 11px;
}
.settings-list dt {
  color: #8293ad;
}
.settings-list dd {
  margin: 0;
  color: #c2d0e4;
  text-align: right;
}
.panel-note {
  padding: 14px 21px;
  background: #131c29;
  border-top: 1px solid #263146;
  font-size: 10px;
  color: #7e91ad;
  line-height: 1.7;
}
.worker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 21px 20px;
  gap: 10px;
}
.worker {
  background: #141e2c;
  border: 1px solid #29364a;
  border-radius: 7px;
  padding: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: #a2b7d1;
}
footer {
  display: flex;
  justify-content: space-between;
  margin-top: 35px;
  padding: 19px 0;
  color: #52627c;
  border-top: 1px solid #1f2836;
  font-size: 9px;
  letter-spacing: 0.2px;
}
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 70;
  padding: 16px 22px;
  border: 1px solid #3e6458;
  border-radius: 10px;
  background: #19342d;
  color: #d3f4e7;
  box-shadow: 0 15px 50px #0007;
  font-size: 12px;
  max-width: 420px;
}
.toast.error {
  background: #3b2430;
  color: #ffd2d7;
  border-color: #834455;
}
dialog {
  color: var(--text);
  background: #131b28;
  border: 1px solid #3a475b;
  border-radius: 16px;
  padding: 29px;
  max-width: 460px;
  width: calc(100% - 32px);
  box-shadow: 0 30px 120px #0009;
}
dialog::backdrop {
  background: #050911b5;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font-size: 21px;
  margin: 17px 0 12px;
}
dialog p {
  font-size: 12px;
  color: #99aac3;
  line-height: 1.8;
}
.dialog-icon {
  width: 37px;
  height: 37px;
  border-radius: 10px;
  background: #204237;
  color: var(--accent);
  font-size: 22px;
  display: grid;
  place-items: center;
}
.dialog-actions {
  margin-top: 26px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
#changelogDialog {
  max-width: 650px;
  max-height: 80vh;
  overflow: auto;
  padding: 10px;
}
#changelogDialog .panel-heading {
  position: sticky;
  top: -10px;
  background: #131b28;
  margin-bottom: 0;
  z-index: 1;
}
#changelogDialog h2 {
  margin: 0;
  font-size: 20px;
}
.changelog-item {
  border-top: 1px solid var(--line);
  padding: 20px;
}
.changelog-item h3 {
  font-size: 13px;
}
.changelog-item small {
  color: #7a8eaa;
}
.changelog-item ul {
  padding-left: 17px;
  color: #97abc6;
  font-size: 11px;
  line-height: 1.8;
}
.chart-date {
  fill: #657792;
  font-size: 10px;
}
.chart-value {
  fill: #657792;
  font-size: 10px;
}
.chart-grid {
  stroke: #253145;
  stroke-dasharray: 3 5;
}
.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-fill {
  fill: url(#chartFade);
}
@media (min-width: 1600px) {
  main {
    padding-top: 40px;
  }
  .chart-area {
    height: 240px;
  }
  .metrics strong {
    font-size: 31px;
  }
  .agent-card {
    padding: 22px;
  }
}
@media (max-width: 1200px) {
  .sidebar {
    width: 195px;
    padding: 26px 14px;
  }
  .workspace {
    margin-left: 195px;
  }
  .topbar {
    padding: 0 25px;
  }
  main {
    padding: 29px 25px 0;
  }
  .topbar-right {
    gap: 12px;
  }
  .connection {
    font-size: 9px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .heading-actions {
    justify-content: flex-end;
    max-width: 290px;
  }
  .overview-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  }
  .metrics article {
    padding: 17px 15px;
  }
  .metrics strong {
    font-size: 24px;
  }
  .agent-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .allocation-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .worker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 850px) {
  .sidebar {
    position: relative;
    width: auto;
    height: auto;
    padding: 18px 20px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: block;
  }
  .brand {
    padding: 0 0 17px;
    font-size: 25px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 27px;
  }
  .brand small {
    font-size: 7px;
    margin-top: 6px;
  }
  .nav-label,
  .sidebar-bottom {
    display: none;
  }
  nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 10px;
  }
  nav a {
    flex: none;
    padding: 9px 11px;
    font-size: 10px;
    gap: 6px;
  }
  nav a.active {
    padding: 8px 10px;
  }
  nav a > span {
    font-size: 16px;
    width: 18px;
  }
  .workspace {
    margin-left: 0;
  }
  .topbar {
    height: 54px;
    padding: 0 22px;
  }
  .topbar-right {
    gap: 10px;
  }
  .connection {
    font-size: 9px;
  }
  .overview-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(245px, 1fr);
  }
  main {
    padding: 26px 22px 0;
  }
  .metrics {
    gap: 10px;
  }
  .metrics article > span {
    font-size: 9px;
  }
  .metric-unit {
    font-size: 7px;
  }
  .metrics small {
    font-size: 8px;
  }
  .metrics strong {
    font-size: 22px;
  }
  .goals-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }
  .allocation-summary {
    flex-wrap: wrap;
  }
}
@media (max-width: 620px) {
  .topbar {
    padding: 0 17px;
  }
  .breadcrumb {
    font-size: 9px;
  }
  .breadcrumb span {
    padding: 0 7px;
  }
  .topbar-right .connection {
    display: none;
  }
  .topbar-right {
    gap: 9px;
  }
  main {
    padding: 24px 16px 0;
  }
  .page-heading {
    display: block;
    margin-bottom: 20px;
  }
  .page-heading h1 {
    font-size: 27px;
  }
  .heading-actions {
    max-width: none;
    justify-content: flex-start;
    margin-top: 18px;
    gap: 8px;
  }
  .button {
    font-size: 10px;
    padding: 10px 12px;
  }
  .heading-actions .button {
    flex: 1;
  }
  .status-banner {
    padding: 14px 12px;
    gap: 9px;
  }
  .status-banner p {
    font-size: 10px;
  }
  .status-banner > a {
    font-size: 9px;
  }
  .status-symbol {
    font-size: 19px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .metrics strong {
    font-size: 26px;
  }
  .metrics article > span {
    font-size: 10px;
  }
  .metrics small {
    font-size: 8px;
  }
  .metrics article {
    padding: 16px;
  }
  .overview-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .agent-cards {
    grid-template-columns: 1fr;
  }
  .agent-top h3 {
    font-size: 13px;
  }
  .agent-top .badge {
    font-size: 8px;
  }
  .agent-stats {
    margin: 18px 0;
  }
  .agent-stats b {
    font-size: 17px;
  }
  .agent-stats span,
  .agent-state {
    font-size: 10px;
  }
  .agent-card {
    padding: 19px;
  }
  .section-title .text-link {
    font-size: 9px;
  }
  .panel-heading {
    padding: 18px;
  }
  .panel-heading h2 {
    font-size: 14px;
  }
  .panel-heading p {
    font-size: 10px;
  }
  .chart-area {
    height: 200px;
    padding: 0 16px;
  }
  .chart-footer {
    font-size: 8px;
    padding: 12px 16px;
  }
  .allocation-fields {
    grid-template-columns: 1fr;
    padding: 0 18px 20px;
  }
  .allocation-summary {
    padding: 18px;
  }
  .allocation-actions {
    width: 100%;
  }
  .allocation-actions button {
    flex: 1;
    white-space: normal;
  }
  .worker-grid {
    grid-template-columns: 1fr;
  }
  .history-filters {
    padding: 0 18px 18px;
    gap: 10px;
  }
  .history-filters label {
    flex: 1;
  }
  .history-filters input {
    width: 100%;
  }
  footer {
    font-size: 8px;
    gap: 16px;
    align-items: center;
  }
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
  .settings-list {
    padding: 0 18px 12px;
  }
  .status-banner > a {
    display: none;
  }
  .chart-area .empty-state p {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
