:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #17202a;
  background: #f4f6f8;
  font-size: 15px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf1f4;
}
.auth-panel {
  width: min(390px, 100%);
  background: #fff;
  border: 1px solid #d9e0e5;
  border-radius: 6px;
  padding: 32px;
  box-shadow: 0 16px 40px rgba(23, 32, 42, .08);
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #202a33;
  color: #fff;
  font-weight: 800;
}
.brand-mark.small { width: 36px; height: 36px; font-size: 13px; flex: 0 0 auto; }
.auth-panel h1 { margin: 24px 0 4px; font-size: 24px; letter-spacing: 0; }
.auth-panel > p { margin: 0 0 28px; color: #65717c; }
label { display: grid; gap: 7px; margin: 0 0 16px; }
label span { font-size: 13px; color: #55616d; }
input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #c8d0d7;
  border-radius: 4px;
  outline: none;
}
input:focus { border-color: #167d68; box-shadow: 0 0 0 3px rgba(22,125,104,.12); }
.primary-command {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  border: 0;
  border-radius: 4px;
  background: #167d68;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.form-error { min-height: 20px; margin-top: 14px; color: #b42318; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #202a33;
  color: #eef3f6;
  padding: 20px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 2px; color: #9eabb5; font-size: 12px; }
nav { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b9c4cc;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active { background: #303c46; color: #fff; }
.nav-item.active { box-shadow: inset 3px 0 #3fc4a4; }
.sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid #39444e;
  display: grid;
  gap: 10px;
  color: #c6d0d7;
  font-size: 13px;
}
.quiet-command {
  padding: 0;
  border: 0;
  background: none;
  color: #8fcfbe;
  text-align: left;
  cursor: pointer;
}

main { min-width: 0; background: #f4f6f8; }
.topbar {
  min-height: 82px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dce2e7;
  background: #fff;
}
.topbar h1 { margin: 0; font-size: 21px; }
.topbar p { margin: 4px 0 0; color: #6e7983; font-size: 12px; }
.icon-command {
  width: 38px;
  height: 38px;
  border: 1px solid #ccd4da;
  border-radius: 4px;
  background: #fff;
  color: #27323b;
  font-size: 21px;
  cursor: pointer;
}
.spinning { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-section { padding: 24px 28px 40px; }
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  border: 1px solid #dbe1e6;
  background: #fff;
  border-radius: 6px;
}
.summary-strip > div { padding: 18px 20px; border-right: 1px solid #e4e8eb; }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span { display: block; color: #6b7680; font-size: 12px; }
.summary-strip strong { display: block; margin-top: 5px; font-size: 26px; }
.monitor-strip {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 14px;
  border: 1px solid #dbe1e6;
  border-top: 0;
  background: #f9fafb;
  color: #68747e;
  font-size: 12px;
}
.monitor-strip span { display: inline-flex; align-items: center; gap: 7px; }
.monitor-strip span:last-child { margin-left: auto; }
.monitor-strip i { width: 8px; height: 8px; border-radius: 50%; background: #a3abb2; }
.monitor-strip i.online { background: #169b72; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 28px 0 12px;
}
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading span { color: #73808a; font-size: 12px; }
.service-table { border: 1px solid #dbe1e6; background: #fff; border-radius: 6px; overflow: hidden; }
.service-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(130px, .7fr) 74px 124px 58px 68px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #e7ebee;
}
.service-row:last-child { border-bottom: 0; }
.service-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.service-main strong, .service-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-main span { margin-top: 4px; color: #68747e; font-size: 12px; }
.service-initial {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid !important;
  place-items: center;
  border-radius: 5px;
  background: #e8edef;
  color: #33414b !important;
  font-weight: 800;
}
.service-resource, .service-latency { color: #5e6a74; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #a3abb2; }
.status-online i { background: #169b72; }
.status-prepared i { background: #2f75bd; }
.status-offline i, .status-prepared_offline i { background: #d14343; }
.open-command {
  color: #146f5e;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.details-command {
  padding: 0;
  border: 0;
  background: none;
  color: #46545f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.open-command[aria-disabled="true"] { color: #9aa3aa; pointer-events: none; }
.service-groups { display: grid; gap: 22px; }
.service-group h3 { margin: 0 0 9px; color: #59656e; font-size: 12px; text-transform: uppercase; }
.audit-table { border: 1px solid #dbe1e6; background: #fff; border-radius: 6px; overflow: hidden; }
.audit-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 180px 150px 1fr 140px;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid #e7ebee;
  font-size: 12px;
}
.audit-row:last-child { border-bottom: 0; }
.audit-row time, .audit-row code { color: #69757f; }
.empty-state { padding: 28px; color: #75818b; text-align: center; }
.segmented-control { display: inline-flex; border: 1px solid #ccd4da; border-radius: 4px; overflow: hidden; }
.incident-filter {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #ccd4da;
  background: #fff;
  color: #55616d;
  font-size: 12px;
  cursor: pointer;
}
.incident-filter:last-child { border-right: 0; }
.incident-filter.active { background: #26323b; color: #fff; }
.incident-table { border: 1px solid #dbe1e6; background: #fff; border-radius: 6px; overflow: hidden; }
.incident-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: 5px minmax(240px, 1fr) 190px 150px;
  align-items: center;
  gap: 14px;
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid #e7ebee;
}
.incident-row:last-child { border-bottom: 0; }
.incident-mark { align-self: stretch; background: #d14343; }
.incident-mark.resolved { background: #169b72; }
.incident-row strong, .incident-row span { display: block; }
.incident-row > div > span { margin-top: 4px; color: #68747e; font-size: 12px; }
.incident-time { color: #68747e; font-size: 12px; }
.incident-time time { display: block; margin-top: 4px; }
.service-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid #cfd7dd;
  border-radius: 6px;
  background: #fff;
  color: #17202a;
  box-shadow: 0 24px 70px rgba(23, 32, 42, .22);
}
.service-dialog::backdrop { background: rgba(21, 29, 35, .48); }
.dialog-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e5e9;
}
.dialog-header span { color: #6b7680; font-size: 11px; text-transform: uppercase; }
.dialog-header h2 { margin: 4px 0 0; font-size: 20px; }
.service-dialog > p { margin: 18px 20px; color: #5e6a74; }
.dialog-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 20px;
  border: 1px solid #dbe1e6;
}
.dialog-facts > div { min-width: 0; padding: 13px; border-right: 1px solid #e4e8eb; }
.dialog-facts > div:last-child { border-right: 0; }
.dialog-facts span, .dialog-facts strong { display: block; }
.dialog-facts span { color: #6b7680; font-size: 11px; }
.dialog-facts strong { margin-top: 5px; font-size: 12px; overflow-wrap: anywhere; }
.section-heading.compact { margin: 22px 20px 10px; }
.section-heading.compact h3 { margin: 0; font-size: 14px; }
.primary-link { color: #146f5e; font-size: 12px; font-weight: 700; text-decoration: none; }
.history-list {
  max-height: 330px;
  margin: 0 20px 20px;
  border: 1px solid #dbe1e6;
  overflow: auto;
}
.history-row {
  min-height: 43px;
  display: grid;
  grid-template-columns: 130px 150px minmax(120px, 1fr) 70px;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-bottom: 1px solid #e7ebee;
  font-size: 11px;
}
.history-row:last-child { border-bottom: 0; }
.history-row time, .history-row span { color: #68747e; }
.history-row strong { text-align: right; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 74px minmax(0, 1fr); }
  .brand > div:last-child, .nav-item { font-size: 0; }
  .nav-item::first-letter { font-size: 15px; }
  .sidebar-footer span { display: none; }
  .service-row { grid-template-columns: minmax(220px, 1fr) 110px 58px 68px; }
  .service-resource, .service-latency { display: none; }
  .monitor-strip { flex-wrap: wrap; gap: 8px 16px; padding: 9px 14px; }
  .monitor-strip span:last-child { margin-left: 0; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 10px 12px; flex-direction: row; align-items: center; }
  .brand { display: none; }
  nav { margin-left: 0; display: flex; }
  .nav-item { width: auto; min-height: 36px; font-size: 13px; }
  .nav-item::first-letter { font-size: inherit; }
  .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; }
  .topbar { min-height: 68px; padding: 14px 16px; }
  .page-section { padding: 16px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip > div:nth-child(2) { border-right: 0; }
  .summary-strip > div:nth-child(-n+2) { border-bottom: 1px solid #e4e8eb; }
  .service-row { grid-template-columns: minmax(0, 1fr) 112px 58px; gap: 8px; padding: 12px; }
  .open-command, .service-resource, .service-latency { display: none; }
  .service-main { overflow: hidden; }
  .service-main span { white-space: normal; }
  .audit-row { grid-template-columns: 1fr 1fr; }
  .audit-row code { display: none; }
  .incident-row { grid-template-columns: 4px minmax(0, 1fr); }
  .incident-time, .incident-row > .status { display: none; }
  .dialog-facts { grid-template-columns: 1fr; }
  .dialog-facts > div { border-right: 0; border-bottom: 1px solid #e4e8eb; }
  .dialog-facts > div:last-child { border-bottom: 0; }
  .history-row { grid-template-columns: 110px 1fr; }
  .history-row span, .history-row strong { display: none; }
}
