:root {
  font-family: system-ui, -apple-system, sans-serif;
  color: #152326;
  background: #f3f6f7;
  --teal: #075c59;
  --muted: #52616a;
  --border: #d1dadc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header, nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 62px; padding: 10px 28px; background: white; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: #152326; font-weight: 750; text-decoration: none; }
.brand span { display: grid; place-items: center; color: white; background: var(--teal); border-radius: 7px; width: 35px; height: 35px; }
.agima-logo { display: block; width: 152px; height: auto; border-radius: 5px; }
.dashboard-top .agima-logo { margin-bottom: 6px; }
.host, .muted { color: var(--muted); }
.host { font-size: 13px; overflow-wrap: anywhere; text-align: right; }
.auth { min-height: calc(100svh - 62px); display: grid; align-items: center; justify-items: center; padding: 36px 18px 64px; }
.panel { width: min(100%, 460px); background: white; border: 1px solid var(--border); border-radius: 8px; padding: 32px; box-shadow: 0 2px 4px #182e3610; }
.lock { color: var(--teal); margin-bottom: 7px; }
.lock svg { width: 29px; height: 29px; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
h1 { font-size: 33px; line-height: 1.13; margin: 8px 0 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
.subtitle { color: var(--muted); margin: 10px 0 0; }
form { display: grid; gap: 9px; margin-top: 22px; max-width: 410px; }
label { font-size: 14px; font-weight: 650; }
input, select, button { width: 100%; min-width: 0; min-height: 45px; font: inherit; border-radius: 6px; }
input, select { color: inherit; background: white; border: 1px solid #aab9bc; padding: 9px 11px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; border: 1px solid var(--teal); color: white; background: var(--teal); padding: 9px 12px; font-weight: 650; cursor: pointer; }
button:hover { background: #034a47; }
button:disabled { cursor: wait; opacity: .7; }
a { color: var(--teal); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #197e79; outline-offset: 3px; }
.feedback { margin: 0; font-size: 14px; color: #9c262a; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.foot span { display: inline-flex; align-items: center; gap: 6px; }
.foot svg { flex: none; width: 16px; height: 16px; }
nav { justify-content: flex-start; min-height: 53px; flex-wrap: wrap; }
nav a { padding: 6px; text-decoration: none; color: var(--muted); }
nav a[aria-current] { color: var(--teal); font-weight: 700; text-decoration: underline; }
nav form { margin: 0 0 0 auto; }
button.quiet { color: var(--teal); background: white; margin: 0; min-height: 38px; border-color: var(--border); }
.work { max-width: 1120px; margin: 0 auto; padding: 26px 28px; }
.overview-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.droplet-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin: -4px 0 12px; overflow-wrap: anywhere; }
.service-address { display: block; margin-top: 3px; overflow-wrap: anywhere; }
.service-address a { color: var(--muted); }
.attention ul, .probe-errors { list-style: none; padding: 0; margin: 0; }
.attention li, .probe-errors li { padding: 8px 0; border-top: 1px solid var(--border); }
.attention li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.probe-chart { margin: 12px 0; }
.probe-chart svg { display: block; width: 100%; }
.probe-chart figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.collection-performance { border-top: 1px solid var(--border); margin-top: 22px; }
.work section { border-top: 1px solid var(--border); padding: 18px 0; margin-top: 22px; }
.work form { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: white; text-align: left; font-size: 14px; }
.service-table { min-width: 640px; }
.service-table th:first-child { width: 30%; }
.service-table th:nth-child(2) { width: 22%; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.state { font-weight: 650; }
.state.healthy { color: #206247; }
.state.failed { color: #a02930; }
.state.stale, .state.slow { color: #8a5611; }
.facts { display: flex; gap: 24px; flex-wrap: wrap; }
dd { margin: 4px 0 0; font-weight: 650; }
small { color: var(--muted); font-weight: 400; }
.host-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.host-facts small { display: block; margin-top: 4px; }
output { font-family: monospace; padding: 12px; border: 1px solid var(--border); background: white; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 490px) {
  header, nav { padding-inline: 15px; }
  .panel { padding: 22px; }
  h1 { font-size: 28px; }
  .work { padding-inline: 15px; }
}

.dashboard-shell {
  --rail-width: 72px;
  --muted: #556574;
  --border: #e2e8ef;
  --blue: #088dde;
  --teal: #106ca7;
  min-height: 100vh;
  padding-left: var(--rail-width);
  background: linear-gradient(180deg, #e2f4ff 0, #f5faff 265px, #f8fafc 520px);
  color: #18222d;
}
.dashboard-shell .work { max-width: 1580px; padding: 26px clamp(18px, 3vw, 44px) 38px; }
.dashboard-shell .nav-rail {
  position: fixed; z-index: 5; inset: 0 auto 0 0; width: var(--rail-width); min-height: 0;
  display: flex; flex-flow: column nowrap; align-items: center; justify-content: flex-start;
  padding: 18px 0 14px; gap: 26px; background: #18212c; border: 0;
}
.rail-links { display: grid; gap: 9px; }
.rail-bottom { margin-top: auto; }
.nav-rail .rail-brand, .nav-rail .rail-links a, .nav-rail .rail-links button {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; margin: 0;
  min-height: 0; background: #293442; color: #dce7f2; border: 0; border-radius: 50%;
}
.nav-rail .rail-brand { background: #0a9aee; color: white; }
.nav-rail .rail-links a:hover, .nav-rail .rail-links button:hover { background: #3a4a5c; }
.nav-rail .rail-links a[aria-current] { color: white; background: #087dc3; text-decoration: none; }
.nav-rail form { margin: 0; }
.dashboard-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.dashboard-top h1 { font-size: 30px; margin: 0; font-weight: 790; }
.dashboard-kicker { margin: 0 0 3px; color: #34617e; font-size: 12px; font-weight: 700; }
.dashboard-tools, .infrastructure-tools { display: flex; gap: 10px; align-items: center; min-width: 0; }
.search-field, .filter-control, .icon-control {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: #283747;
  background: white; border: 1px solid var(--border); border-radius: 8px;
}
.search-field { width: min(31vw, 350px); padding: 0 12px; }
.search-field input { border: 0; min-height: 42px; padding: 0; font-size: 14px; background: transparent; }
.search-field svg, .filter-control svg { flex: none; width: 17px; height: 17px; }
.icon-control { width: 42px; height: 42px; flex: 0 0 42px; justify-content: center; position: relative; }
.icon-control:hover { border-color: #94bee0; }
.alert-control i { position: absolute; right: 9px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #dc5556; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card {
  min-width: 0; min-height: 118px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  padding: 16px; text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: 8px; background: white;
}
.metric-card:hover { border-color: #9bc4e0; }
.metric-card.metric-blue { background: #0589d4; border-color: #0589d4; color: #fff; }
.metric-label, .metric-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.metric-label strong { font-size: 14px; overflow-wrap: anywhere; }
.metric-icon { display: grid; place-items: center; border-radius: 50%; width: 36px; height: 36px; flex: 0 0 36px; }
.metric-blue .metric-icon { background: #fff; color: #087cbe; }
.metric-orange .metric-icon { background: #fff1d7; color: #9f5600; }
.metric-green .metric-icon { background: #e7f6e6; color: #2c7032; }
.metric-purple .metric-icon { background: #f1e8fd; color: #7131a8; }
.metric-bottom { align-items: baseline; gap: 3px 10px; }
.metric-bottom b { font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-bottom small { font-size: 12px; }
.metric-blue small { color: #fff; }
.monitor-charts { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.work section.monitor-box {
  min-width: 0; margin: 0; padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: white;
}
.box-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.box-heading h2 { font-size: 19px; margin: 0; font-weight: 760; }
.box-heading .range-form { margin: 0; }
.range-form select, .filter-control select { min-height: 36px; border-color: var(--border); font-size: 13px; }
.panel-glyph { display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; width: 35px; height: 35px; color: #607589; }
.chart-service { margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.chart-value { display: flex; gap: 6px 12px; align-items: baseline; flex-wrap: wrap; }
.chart-value strong { font-size: 26px; font-variant-numeric: tabular-nums; }
.chart-axis { font-size: 11px; fill: #5b6b79; }
.chart-empty { min-height: 125px; display: grid; place-items: center; }
.featured-chart { margin: 10px 0 0; }
.featured-chart figcaption { border-top: 1px solid var(--border); padding-top: 8px; }
.status-box { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.donut-visual { width: min(100%, 195px); margin: 0 auto; }
.donut-visual svg { display: block; width: 100%; }
.donut-value { fill: #087cc2; font-size: 30px; font-weight: 780; }
.donut-caption { fill: #46627a; font-size: 12px; }
.donut-blue { stroke: #169ce8; } .dot.blue { background: #169ce8; }
.donut-orange { stroke: #f7a42c; } .dot.orange { background: #f7a42c; }
.donut-green { stroke: #79b95d; } .dot.green { background: #79b95d; }
.donut-purple { stroke: #ad54e2; } .dot.purple { background: #ad54e2; }
.donut-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; list-style: none; margin: 0; padding: 0; }
.donut-legend li { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.donut-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.work section.infrastructure-box, .work section.attention { margin-top: 18px; }
.work section.infrastructure-box { padding: 0; overflow: hidden; }
.infrastructure-heading { padding: 15px 18px; }
.infrastructure-tools .search-field { width: min(22vw, 220px); }
.infrastructure-tools .search-field input { min-height: 36px; }
.filter-control { padding-left: 10px; }
.filter-control select { background: transparent; border: 0; padding-left: 0; }
.inventory-tree { border-top: 1px solid var(--border); }
.droplet-tree + .droplet-tree { border-top: 1px solid var(--border); }
.droplet-tree summary {
  list-style: none; cursor: pointer; display: grid; align-items: center; grid-template-columns: 30px minmax(0, 1fr) auto 16px;
  gap: 10px; padding: 11px 18px; background: #f6faff; overflow-wrap: anywhere;
}
.droplet-tree summary::-webkit-details-marker { display: none; }
.droplet-tree summary:hover { background: #eaf5ff; }
.droplet-tree summary small { display: block; margin-top: 2px; }
.droplet-tree summary > svg { width: 16px; transform: rotate(-90deg); }
.droplet-tree[open] summary > svg { transform: rotate(0); }
.droplet-symbol { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 6px; background: #e1f1ff; color: #167ab6; }
.droplet-symbol svg { width: 16px; height: 16px; }
.droplet-count { font-size: 12px; color: var(--muted); }
.service-table thead { background: #f0f7fc; color: #42586c; }
.service-table th, .service-table td { padding: 9px 12px; }
.inventory-tree .service-table th:first-child { padding-left: 18px; }
.service-link { color: #164e79; text-decoration: none; }
.service-link:hover { text-decoration: underline; }
.droplet-link { display: inline-flex; gap: 6px; align-items: center; margin: 10px 18px; font-size: 13px; }
.droplet-link svg { width: 14px; height: 14px; }
.no-results { padding: 10px 18px; }
.attention .box-heading { margin-bottom: 12px; }
.attention .box-heading a { font-size: 13px; }

html:has(.dashboard-shell) { scrollbar-gutter: stable; }
html:has(.detail-drawer[open]) { overflow: hidden; }
.detail-drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(640px, 100%); height: 100dvh; max-width: none; max-height: none;
  color: #18222d; background: #fff; border: 0; border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px #18212c20; overflow: hidden;
}
.detail-drawer[open] { display: flex; flex-direction: column; animation: drawer-in 180ms ease-out; }
.detail-drawer::backdrop { background: #14213258; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: .8; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .detail-drawer[open] { animation: none; } }
.drawer-header {
  display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 21px 22px; border-bottom: 1px solid var(--border); background: #f4faff;
}
.drawer-header h2 { font-size: 23px; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.drawer-close { margin: 0; padding: 0; min-height: 0; }
.drawer-close:hover { background: #e6f2fc; color: #183f61; }
.drawer-body { min-height: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 28px; }
.drawer-parent { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 13px; }
.drawer-parent svg, .drawer-action a svg { width: 14px; height: 14px; flex: none; }
.drawer-tabs {
  position: sticky; z-index: 1; top: 0; background: white; display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.drawer-tabs button {
  width: auto; min-height: 39px; padding: 8px 11px; margin: 0; border: 1px solid transparent;
  border-radius: 6px 6px 0 0; color: #465e73; background: transparent; font-size: 13px;
}
.drawer-tabs button:hover { background: #f0f6fd; }
.drawer-tabs button[aria-selected="true"] { color: #075b91; background: #e8f4ff; border-bottom: 2px solid #1488ce; }
.drawer-panel { min-width: 0; }
.drawer-panel h3 { margin: 3px 0 12px; font-size: 16px; }
.drawer-panel .collection-performance { margin: 0; border: 0; }
.drawer-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 20px; gap: 0 16px; }
.drawer-facts div { padding: 10px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.drawer-facts dt { font-size: 13px; color: var(--muted); }
.drawer-facts dd { margin-top: 5px; }
.drawer-action { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.drawer-action form { margin: 0; width: 142px; }
.drawer-action button { margin: 0; }
.drawer-action a { display: inline-flex; align-items: center; min-height: 45px; gap: 5px; }
.drawer-action .feedback[data-success="true"] { color: #206247; }
.droplet-actions { margin: 15px 0 8px; }
.droplet-actions form { width: 170px; }
.drawer-action .restart-link {
  border: 1px solid #edc8c3; border-radius: 6px; padding: 8px 12px;
  color: #982d25; font-weight: 650; text-decoration: none;
}
.drawer-action .restart-link:hover { background: #fff4f2; }
.restart-note { margin: 0 0 16px; font-size: 13px; }
.mobile-metric-label { display: none; }

@media (max-width: 930px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .dashboard-shell { padding-left: 0; }
  .dashboard-shell .nav-rail {
    position: sticky; top: 0; inset-inline: 0; width: 100%; flex-flow: row nowrap; gap: 9px; padding: 8px 11px;
  }
  .rail-links { display: flex; gap: 5px; }
  .rail-bottom { margin: 0 0 0 auto; }
  .nav-rail .rail-brand, .nav-rail .rail-links a, .nav-rail .rail-links button { width: 34px; height: 34px; }
  .nav-rail svg { width: 17px; height: 17px; }
  .dashboard-shell .work { padding: 18px 12px 28px; }
  .dashboard-top { flex-wrap: wrap; gap: 12px; margin-bottom: 15px; }
  .dashboard-top h1 { font-size: 25px; }
  .dashboard-tools { flex: 1 1 100%; }
  .search-field { flex: 1; width: auto; }
  .metric-strip { gap: 9px; }
  .metric-card { min-height: 106px; padding: 10px; gap: 9px; }
  .metric-label { gap: 5px; }
  .metric-label strong { font-size: 13px; }
  .metric-icon { width: 27px; height: 27px; flex-basis: 27px; }
  .metric-icon svg { width: 15px; height: 15px; }
  .metric-bottom b { font-size: 24px; }
  .monitor-charts { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
  .work section.monitor-box { padding: 13px; }
  .work section.infrastructure-box { padding: 0; }
  .infrastructure-heading { padding: 13px; }
  .infrastructure-tools { flex: 1 1 100%; }
  .infrastructure-tools .search-field { width: auto; }
  .droplet-tree summary { padding: 10px 11px; gap: 7px; }
  .droplet-count { display: none; }
  .droplet-tree summary { grid-template-columns: 27px minmax(0, 1fr) 16px; }
  #infrastructure, #attention, #details, #collection-performance { scroll-margin-top: 62px; }
  .detail-drawer { width: 100%; border: 0; }
  .drawer-header { padding: 15px; }
  .drawer-header h2 { font-size: 20px; }
  .drawer-body { padding: 14px 15px 22px; }
  .drawer-tabs button { padding-inline: 7px; font-size: 12px; }
  .drawer-panel .collection-performance .service-table { min-width: 0; display: block; }
  .drawer-panel .collection-performance thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .drawer-panel .collection-performance tbody { display: block; }
  .drawer-panel .collection-performance tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
  .drawer-panel .collection-performance tr th { width: auto; grid-column: 1 / -1; background: #f0f7fc; }
  .drawer-panel .collection-performance td { border: 0; overflow-wrap: anywhere; }
  .drawer-panel .collection-performance .mobile-metric-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 12px; }
}
