:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #fff;
  --panel: #172d43;
  --ink: #172838;
  --muted: #506477;
  --line: #d8e0e8;
  --blue: #2055a8;
  --blue-hover: #173f83;
  --good: #11674e;
  --issue: #8a490c;
  --error: #a32e35;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 750; letter-spacing: -0.025em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--blue); }
.brand-mark::before {
  content: "";
  width: 18px;
  height: 14px;
  background: linear-gradient(#fff 0 0) 0 0 / 18px 3px,
              linear-gradient(#fff 0 0) 0 6px / 13px 3px,
              linear-gradient(#b9d6ff 0 0) 0 12px / 18px 2px;
  background-repeat: no-repeat;
}

.secondary, .primary, .open-device {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 650;
}
.secondary { padding: 0 15px; background: var(--surface); color: var(--ink); border: 1px solid #c9d4df; }
.secondary:hover, .open-device:hover { background: #e8f1fd; border-color: #a5bee0; }
.secondary[aria-disabled="true"] { cursor: wait; color: var(--muted); }
.primary { border: 1px solid transparent; background: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-hover); }

.dashboard { padding-block: 34px 52px; }
.summary {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 30px;
  min-height: 156px;
  padding: 30px 34px;
  border-radius: 16px;
  color: #f7fbff;
  background: var(--panel);
}
.summary-title { align-self: center; }
.summary h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.05em;
}
.summary-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(116px, 1fr));
  margin: 0;
  align-items: center;
}
.summary-counts > div { display: flex; flex-direction: column-reverse; gap: 7px; padding: 3px 18px; border-left: 1px solid #526780; }
.summary-counts dt { color: #cad6e3; font-size: 13px; line-height: 1.35; }
.summary-counts dd { margin: 0; font-size: 32px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.summary-counts [data-count="available"] { color: #a1e3c9; }
.summary-counts [data-count="issue"] { color: #ffd199; }
.summary-counts [data-count="pending"] { color: #d7e3ed; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block: 32px 16px; }
.toolbar h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -0.035em; }
.site-total { min-width: 26px; padding: 3px 6px; background: #dfe8f2; border-radius: 5px; color: #324b62; text-align: center; font: 700 13px/1.3 "Segoe UI", system-ui, sans-serif; }
.check-time { margin: 5px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.refresh-glyph { color: var(--blue); font-size: 21px; line-height: 1; }

.sites { display: grid; gap: 13px; }
.site {
  display: grid;
  grid-template-columns: minmax(145px, 21%) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.site-heading { padding: 21px 23px; border-right: 1px solid var(--line); background: #f8fafc; border-radius: 11px 0 0 11px; }
.site-heading h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.site-heading p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.devices { margin: 0; padding: 0 20px; list-style: none; }
.device {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) max-content;
  align-items: center;
  gap: 16px;
  min-height: 65px;
  padding-block: 8px;
}
.device + .device { border-top: 1px solid #e4eaf0; }
.device-name, .device-status { display: grid; justify-items: start; gap: 3px; min-width: 0; }
.device-name strong { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.port, .device-detail { color: var(--muted); font-size: 12px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 7px; border-radius: 5px; color: #42596d; background: #eaf0f5; font-size: 12px; font-weight: 700; line-height: 1.25; }
.status-pill::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill[data-state="available"] { color: var(--good); background: #e5f4eb; }
.status-pill[data-state="issue"] { color: var(--issue); background: #fbefdc; }
.open-device {
  padding-inline: 12px;
  color: var(--blue);
  background: #f4f8fd;
  border: 1px solid #dbe7f6;
  text-decoration: none;
}
.open-device span { font-size: 15px; }

.login-layout { display: grid; justify-items: center; padding-block: clamp(30px, 10vh, 102px) 40px; }
.login-panel {
  width: min(100%, 440px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 32px #18324b12;
}
.login-intro { padding: 29px 32px; color: #f7fbff; background: var(--panel); }
.login-intro h1 { margin: 0; font-size: 31px; letter-spacing: -0.045em; line-height: 1.15; }
.login-intro p { margin: 8px 0 0; color: #cad6e3; font-size: 14px; line-height: 1.4; }
.login-form { display: grid; padding: 26px 32px 32px; }
.login-form label { margin-bottom: 6px; font-size: 14px; font-weight: 650; }
.login-form input:not([type="hidden"]) {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #a8b8c7;
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfe;
}
#username { margin-bottom: 17px; }
.password-field { position: relative; }
.password-field:has(button:not([hidden])) input { padding-right: 103px; }
.password-field button {
  position: absolute;
  top: 1px;
  right: 2px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 650;
}
.password-field button:hover { background: #e8f1fd; }
.login-submit { margin-top: 22px; }
.login-error { margin: 12px 0 -4px; padding: 9px 11px; background: #fcecef; color: var(--error); border-radius: 6px; font-size: 14px; }

@media (max-width: 760px) {
  .shell { width: calc(100% - 36px); }
  .masthead-inner { min-height: 62px; }
  .dashboard { padding-top: 20px; }
  .summary { display: grid; gap: 21px; padding: 23px; }
  .summary-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-counts > div { padding-inline: 11px 4px; }
  .summary-counts > div:first-child { padding-left: 0; border-left: 0; }
  .summary-counts dd { font-size: 27px; }
  .site { grid-template-columns: minmax(0, 1fr); }
  .site-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 17px; border-right: 0; border-bottom: 1px solid var(--line); border-radius: 11px 11px 0 0; }
  .site-heading p { margin: 0; flex: 0 0 auto; }
  .devices { padding-inline: 15px; }
}

@media (max-width: 470px) {
  .shell { width: calc(100% - 24px); }
  .toolbar { margin-top: 23px; }
  .toolbar h2 { font-size: 22px; }
  .summary-counts dt { font-size: 12px; }
  .device { grid-template-columns: minmax(0, 1fr) max-content; gap: 5px 11px; padding-block: 10px; }
  .device-status { grid-column: 1; }
  .open-device { grid-area: 1 / 2 / 3 / 3; align-self: center; }
  .login-intro, .login-form { padding-inline: 23px; }
}
