:root {
  color-scheme: light;
  --bg: #e9e7e1;
  --paper: #faf9f5;
  --paper-2: #f1efe9;
  --ink: #16191c;
  --muted: #5e6469;
  --line: #cbc8c0;
  --line-dark: #8b8d89;
  --blue: #155caa;
  --green: #187447;
  --amber: #9c6616;
  --red: #a12f2f;
  --nav: #202326;
  --nav-muted: #aeb3b7;
  --radius: 8px;
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(20, 89, 166, .38); outline-offset: 2px; }

.app-shell { min-height: 100vh; padding-left: 224px; }
.side-nav { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 224px; display: flex; flex-direction: column; padding: 22px 14px; color: #fff; background: var(--nav); border-right: 1px solid #34383c; }
.brand { display: block; padding: 0 10px 24px; text-decoration: none; font-size: .79rem; font-weight: 800; letter-spacing: .15em; }
.brand span { display: block; margin-top: 4px; color: var(--nav-muted); font-size: .66rem; font-weight: 600; letter-spacing: .1em; }
.side-nav nav { display: grid; gap: 3px; }
.side-nav nav a { display: flex; align-items: center; min-height: 42px; padding: 9px 11px; border-radius: 5px; color: var(--nav-muted); text-decoration: none; font-size: .83rem; font-weight: 650; }
.side-nav nav a:hover { color: #fff; background: #2a2e32; }
.side-nav nav a[aria-current="page"] { color: #fff; background: #34393e; }
.nav-foot { margin-top: auto; padding: 15px 10px 0; border-top: 1px solid #383c40; color: var(--nav-muted); font-size: .7rem; line-height: 1.45; }
.nav-foot strong { display: block; color: #fff; }
.logout-link { margin-top: 8px; padding: 0; border: 0; color: #fff; background: transparent; font: inherit; font-weight: 750; cursor: pointer; }
.mobile-only { display: none !important; }

.workspace { width: 100%; max-width: 1500px; margin: 0 auto; padding: 28px 30px 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line-dark); }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: .69rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.65rem, 2.3vw, 2.35rem); line-height: 1.06; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1rem; letter-spacing: -.015em; }
.page-subtitle { max-width: 720px; margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 13px; border: 1px solid var(--line-dark); border-radius: 5px; color: var(--ink); background: var(--paper); text-decoration: none; font-size: .78rem; font-weight: 750; cursor: pointer; }
.button:hover { border-color: #555; background: #fff; }
.button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button.danger { border-color: var(--red); color: #fff; background: var(--red); }
.button:disabled { cursor: not-allowed; opacity: .45; }

.status-line { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .74rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-dark); }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.critical { background: var(--red); }

.section { margin-top: 24px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; }
.count { color: var(--muted); font-size: .73rem; font-weight: 700; }
.section-actions { display: flex; align-items: center; gap: 14px; }
.grid { display: grid; gap: 12px; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.surface { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 1px 0 rgba(255,255,255,.85); }
.metric { min-height: 112px; display: flex; flex-direction: column; }
.metric > span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.metric > strong { margin-top: auto; font-size: 1.8rem; line-height: 1; letter-spacing: -.045em; }
.metric > small { margin-top: 7px; color: var(--muted); font-size: .69rem; }

.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.list-row { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(110px, .7fr) minmax(120px, .8fr) 36px; align-items: center; gap: 12px; min-height: 58px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row strong { display: block; font-size: .83rem; }
.list-row small, .muted { color: var(--muted); font-size: .7rem; line-height: 1.4; }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--paper-2); font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.pill.ok { border-color: rgba(24,116,71,.35); color: var(--green); background: #e4eee8; }
.pill.warn { border-color: rgba(156,102,22,.35); color: var(--amber); background: #f4ebdb; }
.pill.critical { border-color: rgba(161,47,47,.35); color: var(--red); background: #f5e4e2; }
.empty { padding: 24px; color: var(--muted); text-align: center; font-size: .8rem; }

.server-card header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.server-card h3 { margin-bottom: 2px; font-size: .88rem; }
.server-card dl { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; margin: 14px 0 0; font-size: .74rem; }
.server-card dt { color: var(--muted); }
.server-card dd { margin: 0; font-weight: 750; text-align: right; }
.bar { height: 6px; overflow: hidden; border-radius: 99px; background: #d9d7d0; }
.bar > span { display: block; height: 100%; background: var(--blue); }

.progress-inline { display: flex; align-items: center; gap: 8px; }
.progress-inline .bar { width: min(150px, 100%); flex: 1; }
.progress-inline strong { font-size: .72rem; }

.filter-bar { display: flex; gap: 8px; margin: 16px 0 10px; }
.filter-bar input { width: 100%; max-width: 380px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line-dark); border-radius: 6px; color: var(--ink); background: var(--paper); }
.monitor-filters { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(130px, .8fr)) auto; gap: 8px; margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); }
.monitor-filters.compact-filters { grid-template-columns: minmax(180px, 1.5fr) repeat(2, minmax(130px, .8fr)) auto; }
.monitor-filters label { display: grid; gap: 4px; color: var(--muted); font-size: .67rem; font-weight: 750; }
.monitor-filters input, .monitor-filters select { min-width: 0; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line-dark); border-radius: 5px; color: var(--ink); background: var(--paper); }
.monitor-filters .button { align-self: end; }
.source-alert { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(156,102,22,.35); border-radius: 5px; color: var(--amber); background: #f4ebdb; font-size: .75rem; }
.service-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.service-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 14px 0 8px; }
.service-heading h3 { margin: 0; font-size: .88rem; }
.service-heading p { margin: 3px 0 0; color: var(--muted); font-size: .7rem; }
.service-split .list-row { grid-template-columns: minmax(150px, 1.2fr) auto minmax(130px, .8fr); }
.destructive-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 13px 15px; border: 1px solid var(--line-dark); border-radius: var(--radius); background: #dad8d1; }
.destructive-banner.unlocked { border-color: var(--red); color: #fff; background: #782727; }
.destructive-banner p { margin: 2px 0 0; color: inherit; opacity: .78; font-size: .72rem; }
.select-client { width: 20px; height: 20px; accent-color: var(--red); }
.client-row { grid-template-columns: 28px minmax(170px, 1.3fr) minmax(100px, .65fr) minmax(140px, .8fr) minmax(120px, .7fr); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.text-button { padding: 4px 0; border: 0; color: var(--blue); background: transparent; font-size: .71rem; font-weight: 750; cursor: pointer; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(24,26,29,.7); }
.modal { width: min(560px, 100%); padding: 22px; border: 1px solid #5b1919; border-radius: 8px; background: var(--paper); box-shadow: 0 28px 70px rgba(0,0,0,.3); }
.modal h2 { font-size: 1.15rem; }
.modal p { color: var(--muted); font-size: .8rem; line-height: 1.55; }
.modal code { padding: 2px 5px; background: #e7e3db; overflow-wrap: anywhere; }
.modal label { display: block; margin-top: 12px; font-size: .73rem; font-weight: 750; }
.modal input[type="text"] { width: 100%; min-height: 40px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; }
.confirm-check { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 600 !important; line-height: 1.45; }
.confirm-check input { margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.technical-table { width: 100%; border-collapse: collapse; font-size: .73rem; }
.technical-table th, .technical-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.technical-table th { color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .07em; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--nav); }
.login-panel { width: 100%; max-width: 440px; padding: 30px; border: 1px solid #555a5f; border-radius: 8px; background: var(--paper); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-panel h1 { margin-bottom: 9px; }
.login-panel form { display: grid; gap: 14px; margin: 24px 0 18px; }
.login-panel label { color: var(--muted); font-size: .73rem; font-weight: 750; }
.login-panel input { display: block; width: 100%; min-height: 42px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; }
.login-panel .button { width: 100%; min-height: 44px; margin-top: 4px; }
.login-panel > small { display: block; color: var(--muted); text-align: center; font-size: .68rem; }
.login-error { margin: 0; padding: 9px 10px; border: 1px solid rgba(161,47,47,.35); border-radius: 5px; color: var(--red); background: #f5e4e2; font-size: .73rem; }
.tool-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: .73rem; font-weight: 750; }
.tool-label select { display: block; width: 100%; min-height: 38px; margin-top: 6px; padding: 7px 9px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; }
.tool-result { display: grid; gap: 6px; margin-top: 14px; color: var(--muted); font-size: .73rem; }
.tool-finding { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid rgba(24,116,71,.28); border-radius: 5px; background: #e8f0eb; overflow-wrap: anywhere; }
.tool-finding.attention { border-color: rgba(156,102,22,.35); background: #f4ebdb; }
.tool-finding span, .tool-summary span { color: var(--muted); }
.tool-summary { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tool-link { display: flex; flex-direction: column; min-height: 90px; text-decoration: none; }
.tool-link span { margin-top: auto; color: var(--muted); font-size: .7rem; }

@media (max-width: 1050px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { padding-left: 0; padding-bottom: 64px; }
  .side-nav { inset: auto 0 0; width: auto; height: 68px; display: block; padding: 6px 7px calc(6px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid #34383c; }
  .brand, .nav-foot { display: none; }
  .side-nav nav { display: flex; gap: 3px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .side-nav nav::-webkit-scrollbar { display: none; }
  .side-nav nav a { flex: 0 0 76px; justify-content: center; min-height: 52px; padding: 6px 3px; text-align: center; font-size: .64rem; }
  .side-nav nav a[aria-current="page"] { background: #3a4045; }
  .side-nav nav .mobile-only { display: flex !important; }
  .workspace { padding: 20px 14px 40px; }
  .page-head { align-items: flex-start; }
  .page-subtitle { display: none; }
  .head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .grid.four, .grid.three, .grid.two { grid-template-columns: 1fr; }
  .metric { min-height: 96px; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-row, .client-row { grid-template-columns: 28px 1fr auto; gap: 8px; }
  .list-row > :nth-child(n+4):not(.row-actions) { display: none; }
  .client-row > :nth-child(3), .client-row > :nth-child(4) { display: none; }
  .destructive-banner { align-items: stretch; flex-direction: column; }
  .destructive-banner .button { width: 100%; }
  .filter-bar { display: grid; grid-template-columns: minmax(0, 1fr) 130px; }
  .filter-bar input { min-width: 0; }
  .filter-bar .button { width: 130px; padding-inline: 7px; }
  .section-head { align-items: flex-start; }
  .section-actions { align-items: flex-end; flex-direction: column; gap: 3px; }
  .monitor-filters { grid-template-columns: 1fr; }
  .monitor-filters .button { width: 100%; }
  .service-split { grid-template-columns: 1fr; }
  .service-split .list-row { grid-template-columns: minmax(0, 1fr) auto; }
  .service-split .list-row > :nth-child(3) { display: block; grid-column: 1 / -1; }
}

@media (max-width: 460px) {
  .grid.four { grid-template-columns: 1fr; }
  .head-actions { align-items: flex-end; flex-direction: column; }
  .status-line { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
