:root {
  color: #20252b;
  background: #f3f5f7;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --topbar-height: 52px;
  --nav-width: 188px;
  --brand-red: #e23d3d;
  --border: #d9dee4;
  --border-strong: #c6ccd3;
  --muted: #68717c;
  --surface: #fff;
  --surface-alt: #f7f8fa;
  --ink: #20252b;
  --header: #252a30;
  --good: #198754;
  --warning: #ad6500;
  --danger: #c93636;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-width: 320px; min-height: 100vh; overflow: hidden; }
[hidden] { display: none !important; }
button, input, select { color: inherit; font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .65; }
:focus-visible { outline: 2px solid #3d82bd; outline-offset: 2px; }

svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.icon-sprite { height: 0; left: -9999px; overflow: hidden; position: absolute; width: 0; }
.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-page {
  align-items: flex-start;
  background-color: #eef1f2;
  background-image: url("./inpadi-background.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(48px, 10vh, 112px) 20px 28px;
}

.auth-panel {
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(32, 37, 43, .16);
  overflow: hidden;
  width: min(390px, 100%);
}

.auth-brand {
  align-items: center;
  background: var(--header);
  display: flex;
  height: 58px;
  justify-content: space-between;
  padding: 0 20px;
}

.auth-brand img, .topbar-brand img {
  background: #fff;
  border-radius: 4px;
  object-fit: contain;
  padding: 5px 8px;
  width: auto;
}

.auth-brand img { height: 30px; max-width: 116px; }
.auth-brand span { color: #e7eaed; font-size: 12px; font-weight: 600; }
.auth-panel form { padding: 25px 28px 22px; }
.auth-heading { margin-bottom: 22px; }
.auth-heading h1 { font-size: 23px; line-height: 1.2; margin: 0 0 6px; }
.auth-heading p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }

.auth-error {
  align-items: flex-start;
  background: #fff2f2;
  border: 1px solid #efc2c2;
  border-radius: 5px;
  color: #9d2929;
  display: flex;
  font-size: 13px;
  gap: 8px;
  line-height: 1.4;
  margin-bottom: 16px;
  padding: 9px 10px;
}

.field-label { display: block; font-size: 12px; font-weight: 700; margin: 0 0 5px; }
.auth-panel input {
  background: #fff;
  border: 1px solid #bfc6ce;
  border-radius: 5px;
  font-size: 14px;
  height: 39px;
  margin: 0 0 14px;
  padding: 7px 10px;
  width: 100%;
}
.auth-panel input:focus { border-color: #4a83b0; box-shadow: 0 0 0 3px rgba(74, 131, 176, .14); outline: none; }
.auth-panel .mfa-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 20px; height: 46px; text-align: center; }

.primary-button {
  align-items: center;
  background: #2e7d46;
  border: 1px solid #276c3c;
  border-radius: 5px;
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  height: 39px;
  justify-content: center;
  padding: 0 14px;
}
.primary-button:hover { background: #286e3d; }
.auth-submit { gap: 7px; margin-top: 4px; width: 100%; }
.text-button { background: none; border: 0; color: #276b9d; font-size: 13px; padding: 0; }
.auth-back { display: block; margin: 15px auto 0; }
.auth-security {
  align-items: center;
  background: #f7f8f9;
  border-top: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
}

.app-shell { background: #f3f5f7; height: 100vh; overflow: hidden; }
.topbar {
  align-items: center;
  background: var(--header);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  color: #fff;
  display: flex;
  gap: 12px;
  height: var(--topbar-height);
  inset: 0 0 auto 0;
  padding: 0 10px 0 8px;
  position: fixed;
  z-index: 60;
}
.topbar .icon-button { color: #dfe4e8; }
.topbar-menu { display: none !important; }
.topbar-brand { align-items: center; display: flex; flex: 0 0 168px; gap: 8px; }
.topbar-brand img { height: 28px; padding: 5px 7px; width: 74px; }
.topbar-brand span { color: #cbd1d6; font-size: 12px; font-weight: 700; }

.customer-picker {
  align-items: center;
  background: #343a41;
  border: 1px solid #484f57;
  border-radius: 5px;
  display: grid;
  flex: 0 1 270px;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  height: 34px;
  min-width: 180px;
  padding: 0 7px 0 10px;
}
.customer-picker > span { color: #aeb6be; font-size: 10px; font-weight: 700; margin-right: 8px; text-transform: uppercase; }
.customer-picker select {
  appearance: none;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  height: 32px;
  min-width: 0;
  outline: none;
  padding: 0;
}
.customer-picker select option { color: var(--ink); }

.global-search {
  align-items: center;
  background: #fff;
  border-radius: 5px;
  color: #555e67;
  display: flex;
  flex: 1 1 420px;
  height: 34px;
  max-width: 600px;
  min-width: 150px;
  padding: 0 8px;
}
.global-search input { background: transparent; border: 0; font-size: 13px; height: 100%; min-width: 0; outline: none; padding: 0 8px; width: 100%; }
.global-search button { align-items: center; background: transparent; border: 0; color: #707983; display: flex; height: 26px; justify-content: center; padding: 0 3px; width: 24px; }
.topbar-actions { align-items: center; display: flex; gap: 5px; margin-left: auto; }
.icon-button { align-items: center; background: transparent; border: 0; border-radius: 4px; display: inline-flex; height: 34px; justify-content: center; padding: 0; width: 34px; }
.icon-button:hover { background: rgba(255, 255, 255, .1); }
.auto-refresh { align-items: center; color: #cdd3d8; display: flex; font-size: 11px; gap: 4px; height: 34px; padding: 0 5px; }
.auto-refresh input { accent-color: #4cad6e; height: 14px; margin: 0; width: 14px; }
.user-menu-wrap { position: relative; }
.user-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 1px solid #454c53;
  color: #e6e9eb;
  display: flex;
  font-size: 12px;
  gap: 6px;
  height: 34px;
  margin-left: 2px;
  max-width: 190px;
  padding: 0 6px 0 10px;
}
.user-button span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .16);
  color: var(--ink);
  min-width: 230px;
  padding: 12px;
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 90;
}
.user-menu > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.user-menu strong { font-size: 13px; }
.user-menu span, .session-expiry { color: var(--muted); font-size: 11px; }
.session-expiry { border-bottom: 1px solid var(--border); margin: 10px -12px 6px; padding: 0 12px 10px; }
.user-menu button { align-items: center; background: transparent; border: 0; display: flex; font-size: 12px; gap: 8px; height: 30px; padding: 0 3px; width: 100%; }

.side-nav {
  background: #fff;
  border-right: 1px solid var(--border);
  bottom: 0;
  display: flex;
  flex-direction: column;
  left: 0;
  position: fixed;
  top: var(--topbar-height);
  width: var(--nav-width);
  z-index: 40;
}
.side-nav nav { padding: 10px 7px; }
.side-nav nav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 3px;
  color: #505963;
  display: grid;
  font-size: 12px;
  font-weight: 600;
  gap: 9px;
  grid-template-columns: 19px minmax(0, 1fr) auto;
  height: 36px;
  margin-bottom: 2px;
  padding: 0 7px;
  text-align: left;
  width: 100%;
}
.side-nav nav button:hover { background: #f1f3f5; color: #252b31; }
.side-nav nav button.active { background: #f3f4f5; border-left-color: var(--brand-red); color: #20252b; }
.side-nav nav button b { background: #d43d3d; border-radius: 9px; color: #fff; font-size: 10px; min-width: 18px; padding: 2px 5px; text-align: center; }
.connection-state { align-items: center; border-top: 1px solid var(--border); color: var(--good); display: flex; font-size: 11px; gap: 7px; margin-top: auto; min-height: 38px; padding: 0 12px; }

.workspace { bottom: 0; left: var(--nav-width); overflow: hidden; position: fixed; right: 0; top: var(--topbar-height); }
.summary-strip { background: #fff; border-bottom: 1px solid var(--border); display: flex; height: 62px; overflow-x: auto; padding: 0 14px; }
.summary-strip > div { align-items: flex-start; border-right: 1px solid #e5e8eb; display: flex; flex: 0 0 120px; flex-direction: column; justify-content: center; padding: 0 18px; }
.summary-strip > div:first-child { padding-left: 4px; }
.summary-strip span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.summary-strip strong { font-size: 21px; line-height: 1.2; }
.summary-strip .metric-good { color: var(--good); }
.summary-strip .metric-danger { color: var(--danger); }
.summary-strip .summary-source { border-right: 0; flex-basis: 190px; }
.summary-strip .summary-source strong { font-size: 12px; margin-top: 4px; white-space: nowrap; }

.content-header { align-items: center; background: #f3f5f7; display: flex; height: 58px; justify-content: space-between; padding: 0 18px; }
.content-header h1 { font-size: 17px; line-height: 1.15; margin: 0 0 3px; }
.content-header > div:first-child span, .content-meta { color: var(--muted); font-size: 11px; }
.content-meta { align-items: center; display: flex; gap: 12px; }
.partial-flag { align-items: center; color: var(--warning); display: inline-flex; gap: 4px; }
.content-body { background: #fff; border: 1px solid var(--border); bottom: 12px; left: 14px; overflow: hidden; position: absolute; right: 14px; top: 120px; }

.table-controls { align-items: center; background: #fff; border-bottom: 1px solid var(--border); display: flex; height: 43px; justify-content: space-between; padding: 0 10px; }
.segmented-control { display: inline-flex; }
.segmented-control button { background: #fff; border: 1px solid var(--border-strong); border-right: 0; font-size: 11px; height: 27px; min-width: 68px; padding: 0 9px; text-transform: capitalize; }
.segmented-control button:first-child { border-radius: 4px 0 0 4px; }
.segmented-control button:last-child { border-radius: 0 4px 4px 0; border-right: 1px solid var(--border-strong); }
.segmented-control button.active { background: #3f474f; border-color: #3f474f; color: #fff; }
.row-count { color: var(--muted); font-size: 11px; }
.table-scroll { height: 100%; overflow: auto; }
.table-controls + .table-scroll { height: calc(100% - 43px); }

.data-table { border-collapse: separate; border-spacing: 0; font-size: 11px; min-width: 960px; table-layout: auto; width: 100%; }
.data-table th { background: #f0f2f4; border-bottom: 1px solid var(--border-strong); color: #505964; font-size: 10px; font-weight: 700; height: 31px; padding: 0 9px; position: sticky; text-align: left; text-transform: uppercase; top: 0; white-space: nowrap; z-index: 2; }
.data-table td { border-bottom: 1px solid #e6e9ec; height: 37px; max-width: 260px; padding: 4px 9px; vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:nth-child(even) { background: #fafbfb; }
.data-table tbody tr:hover { background: #eef5fa; }
.systems-table tbody tr { cursor: pointer; }
.system-name { align-items: center; display: flex; font-weight: 700; gap: 7px; }
.device-icon { align-items: center; background: #e6eaed; border-radius: 3px; color: #4a5660; display: inline-flex; height: 23px; justify-content: center; width: 25px; }
.device-router { background: #e6f0f6; color: #236a9f; }

.status-badge { align-items: center; background: #eef0f2; border-radius: 10px; color: #56606a; display: inline-flex; font-size: 10px; font-weight: 700; gap: 5px; line-height: 20px; padding: 0 7px; text-transform: capitalize; white-space: nowrap; }
.status-dot { background: currentColor; border-radius: 50%; height: 6px; width: 6px; }
.status-online, .status-good, .status-compliant, .status-available { background: #e6f5ec; color: #197246; }
.status-offline, .status-critical, .status-non_compliant, .status-unavailable, .status-issues, .status-bad { background: #fdeaea; color: #b52d2d; }
.status-warning, .status-delayed, .status-unknown { background: #fff2d9; color: #9a5b00; }
.test-count { font-variant-numeric: tabular-nums; font-weight: 700; }
.test-count-bad, .danger-text { color: var(--danger); font-weight: 700; }
.secondary-text { text-transform: capitalize; }
.cell-subtext { color: var(--muted); display: block; font-size: 10px; line-height: 1.2; }
.strong-cell { font-weight: 700; }
.truncate-cell { max-width: 170px !important; overflow: hidden; text-overflow: ellipsis; }
.wide-cell { max-width: 340px !important; overflow: hidden; text-overflow: ellipsis; }

.state-panel { align-items: center; color: var(--muted); display: flex; font-size: 13px; gap: 9px; height: 100%; justify-content: center; min-height: 190px; padding: 24px; }
.state-panel-empty { flex-direction: column; gap: 6px; text-align: center; }
.state-panel-empty strong { color: #343a40; font-size: 14px; }
.state-panel-empty span { max-width: 440px; }

.drawer-backdrop { background: rgba(25, 29, 33, .28); border: 0; inset: var(--topbar-height) 0 0 var(--nav-width); padding: 0; position: fixed; z-index: 69; }
.detail-drawer { background: #fff; bottom: 0; box-shadow: -8px 0 24px rgba(20, 25, 30, .14); overflow-y: auto; position: fixed; right: 0; top: var(--topbar-height); width: min(390px, calc(100vw - var(--nav-width))); z-index: 70; }
.drawer-header { align-items: flex-start; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; min-height: 70px; padding: 15px 15px 12px 18px; }
.drawer-eyebrow { color: var(--muted); display: block; font-size: 10px; font-weight: 700; margin-bottom: 3px; text-transform: uppercase; }
.drawer-header h2 { font-size: 18px; margin: 0; }
.drawer-header .icon-button:hover { background: #eef0f2; }
.drawer-status-line { align-items: center; background: var(--surface-alt); border-bottom: 1px solid var(--border); color: var(--muted); display: flex; font-size: 11px; gap: 12px; min-height: 43px; padding: 7px 18px; text-transform: capitalize; }
.detail-section { border-bottom: 1px solid var(--border); padding: 16px 18px; }
.detail-section h3 { font-size: 11px; margin: 0 0 12px; text-transform: uppercase; }
.monitor-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.monitor-counts > div { border-right: 1px solid var(--border); display: flex; flex-direction: column; padding-left: 12px; }
.monitor-counts > div:first-child { padding-left: 0; }
.monitor-counts > div:last-child { border-right: 0; }
.monitor-counts strong { font-size: 20px; }
.monitor-counts span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.monitor-counts .count-danger strong { color: var(--danger); }
.detail-list { margin: 0; }
.detail-list > div { display: grid; font-size: 12px; gap: 12px; grid-template-columns: 115px minmax(0, 1fr); min-height: 30px; padding: 6px 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.feature-list { display: flex; flex-wrap: wrap; gap: 5px; }
.feature-list span { background: #edf1f4; border-radius: 3px; color: #4b5660; font-size: 10px; padding: 4px 6px; }
.nav-backdrop { display: none; }

@media (max-width: 980px) {
  :root { --nav-width: 174px; }
  .topbar-brand { flex-basis: 154px; }
  .topbar-brand span, .auto-refresh span { display: none; }
  .customer-picker > span { display: none; }
  .customer-picker { flex-basis: 210px; grid-template-columns: minmax(80px, 1fr) auto; }
}

@media (max-width: 820px) {
  :root { --nav-width: 188px; }
  .topbar-menu { display: inline-flex !important; }
  .topbar-brand { flex-basis: auto; }
  .topbar-brand span { display: none; }
  .side-nav { box-shadow: 6px 0 20px rgba(20, 25, 30, .14); transform: translateX(-102%); transition: transform 160ms ease; }
  .side-nav.nav-open { transform: translateX(0); }
  .nav-backdrop { background: rgba(20, 25, 30, .32); border: 0; bottom: 0; display: block; left: 0; padding: 0; position: fixed; right: 0; top: var(--topbar-height); z-index: 35; }
  .workspace { left: 0; }
  .drawer-backdrop { left: 0; }
  .detail-drawer { width: min(390px, 100vw); }
}

@media (max-width: 680px) {
  :root { --topbar-height: 96px; }
  .topbar { align-content: center; flex-wrap: wrap; gap: 5px; padding: 6px 7px; }
  .topbar-brand img { height: 27px; width: 66px; }
  .customer-picker { flex: 1 1 140px; height: 32px; min-width: 118px; }
  .customer-picker select { font-size: 12px; }
  .global-search { flex: 1 0 calc(100% - 10px); height: 33px; max-width: none; order: 10; }
  .auto-refresh, .user-button span, .user-button > svg:last-child { display: none; }
  .user-button { border-left: 0; height: 32px; margin: 0; padding: 0; width: 28px; }
  .summary-strip { height: 56px; padding: 0 8px; }
  .summary-strip > div { flex-basis: 92px; padding: 0 12px; }
  .summary-strip strong { font-size: 18px; }
  .summary-strip .summary-source { flex-basis: 162px; }
  .content-header { height: 54px; padding: 0 10px; }
  .content-meta > span:last-child { display: none; }
  .content-body { bottom: 6px; left: 6px; right: 6px; top: 110px; }
  .segmented-control { overflow-x: auto; }
  .segmented-control button { min-width: 60px; padding: 0 7px; }
  .table-controls { padding: 0 6px; }
  .row-count { flex: 0 0 auto; margin-left: 8px; }
  .auth-page { align-items: center; background-position: center top; padding: 18px 12px; }
  .auth-panel form { padding: 22px 20px 18px; }
}

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