:root {
  color-scheme: light;
  --ink: #182338;
  --muted: #718096;
  --line: #e7ebf2;
  --blue: #3267da;
  --blue-dark: #2455c1;
  --green: #21895c;
  --green-bg: #eaf7f0;
  --surface: #fff;
  --page: #f5f7fb;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
.shell { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8edf4; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #1d2b45; text-decoration: none; font-size: 18px; font-weight: 760; letter-spacing: -.7px; }
.brand-light { color: #68768c; font-weight: 520; }
.brand-mark { width: 29px; height: 29px; display: flex; align-items: end; gap: 3px; padding: 6px; background: #eaf0ff; border-radius: 9px; }
.brand-mark span { width: 4px; border-radius: 3px; background: var(--blue); }
.brand-mark span:nth-child(1) { height: 7px; opacity: .58; }
.brand-mark span:nth-child(2) { height: 12px; opacity: .78; }
.brand-mark span:nth-child(3) { height: 17px; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: #67768b; font-size: 12px; font-weight: 600; }
.account-name { margin-left: 10px; color: #35445c; font-size: 11px; font-weight: 650; }
.header-link, .header-button { border: 1px solid #dce4f0; border-radius: 8px; padding: 7px 10px; background: #fff; color: #3c5278; text-decoration: none; font: inherit; font-size: 11px; cursor: pointer; }
.header-link:hover, .header-button:hover { border-color: #b9caf1; color: var(--blue); }
.header-button:disabled { opacity: .6; cursor: wait; }
.gateway-indicator, .footer-dot { width: 7px; height: 7px; border-radius: 100%; background: #2bae70; box-shadow: 0 0 0 3px #dff4e9; }
main { min-height: calc(100vh - 148px); }
.intro { padding: 30px 0 20px; }
.eyebrow { color: #76849a; font-size: 10px; font-weight: 750; letter-spacing: 1.65px; display: flex; gap: 9px; align-items: center; }
.eyebrow-line { width: 18px; height: 2px; background: #6590ed; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-top: 15px; }
h1 { margin: 0; font-size: clamp(28px, 3.1vw, 34px); letter-spacing: -1.9px; line-height: 1.13; font-weight: 690; }
h1 span { color: #72809a; font-weight: 480; }
.intro-copy { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.summary { width: 110px; min-width: 110px; padding: 13px 17px 11px; border: 1px solid var(--line); background: rgba(255,255,255,.7); border-radius: 12px; display: flex; flex-direction: column; align-items: flex-start; }
.summary-number { font-size: 25px; line-height: 1.1; font-weight: 700; letter-spacing: -.8px; }
.summary-label { margin-top: 5px; color: #8a97aa; font-size: 9px; font-weight: 750; letter-spacing: 1.2px; }
.devices-section { padding: 16px 0 64px; border-top: 1px solid #e5eaf1; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 19px; }
h2 { margin: 0; font-size: 17px; letter-spacing: -.3px; font-weight: 690; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.refresh-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: #697990; cursor: pointer; font-size: 19px; transition: color .15s, border-color .15s, transform .3s; }
.refresh-button:hover { color: var(--blue); border-color: #b9caf1; transform: rotate(45deg); }
.device-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 15px; }
.device-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: 0 4px 16px rgba(35,54,87,.035); transition: border-color .18s, box-shadow .18s, transform .18s; }
.device-card:hover { border-color: #d4deef; box-shadow: 0 8px 23px rgba(35,54,87,.07); transform: translateY(-1px); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.device-identity { display: flex; gap: 13px; align-items: center; min-width: 0; }
.device-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #416bc6; background: #edf2fc; }
.device-icon svg { width: 22px; height: 22px; }
.device-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 680; letter-spacing: -.2px; }
.device-kind { margin-top: 5px; color: #8a96a9; font-size: 10px; letter-spacing: .15px; }

.status-checking {
  opacity: .65;
}

.status-online {
  background: var(--green-bg);
  color: var(--green);
}

.status-online::before {
  background: #31a970;
}

.status-offline {
  background: #fff0f0;
  color: #b42318;
}

.status-offline::before {
  background: #d92d20;
}

.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 99px; background: var(--green-bg); color: var(--green); font-size: 10px; font-weight: 680; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 100%; background: #31a970; }
.card-divider { margin: 17px 0 14px; border: 0; border-top: 1px solid #eff2f6; }
.card-details { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.detail-label { color: #8a97a9; font-size: 10px; }
.detail-value { color: #35445c; font-size: 11px; font-weight: 610; font-variant-numeric: tabular-nums; }
.card-actions { margin-top: 18px; display: flex; align-items: center; gap: 10px; }
.open-button { flex: 1; min-height: 39px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 8px; color: #fff; background: var(--blue); font-size: 11px; font-weight: 670; cursor: pointer; transition: background .15s, transform .15s; }
.open-button:hover { background: var(--blue-dark); }
.open-button:active { transform: translateY(1px); }
.open-button:disabled { background: #9aafd9; cursor: wait; }
.open-button svg { width: 14px; height: 14px; }
.card-note { color: #94a0b1; font-size: 10px; }
.state-card { min-height: 148px; grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; border: 1px dashed #d9e1ed; border-radius: 14px; color: #7a889c; background: rgba(255,255,255,.55); font-size: 12px; }
.spinner { width: 19px; height: 19px; border: 2px solid #d8e2f2; border-top-color: #4a76d6; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-message { margin: 14px 0 0; color: #b54747; font-size: 12px; }
.page-message[hidden] { display: none; }
footer { height: 70px; display: flex; align-items: center; gap: 9px; border-top: 1px solid #e8edf4; color: #8793a5; font-size: 10px; }
.footer-dot { width: 6px; height: 6px; box-shadow: none; }
.auth-dialog { width: min(450px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 16px; background: transparent; color: var(--ink); box-shadow: 0 24px 80px rgba(14,29,55,.25); }
.auth-dialog::backdrop { background: rgba(19,32,55,.53); backdrop-filter: blur(3px); }
.auth-card { padding: 30px; border: 1px solid #e6ebf3; border-radius: 16px; background: #fff; }
.auth-card h1 { margin-top: 18px; font-size: 27px; letter-spacing: -1px; }
.auth-form { display: grid; gap: 14px; margin-top: 23px; }
.auth-form label, .admin-form > label { display: grid; gap: 7px; color: #56657a; font-size: 11px; font-weight: 650; }
.auth-form input, .admin-form input, .admin-form select, .admin-row-identity input { min-width: 0; width: 100%; border: 1px solid #dfe5ee; border-radius: 8px; padding: 10px 11px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; }
.auth-form input:focus, .admin-form input:focus, .admin-form select:focus, .admin-row-identity input:focus { outline: 3px solid #dce7ff; border-color: #7d9de0; }
.auth-form .open-button { width: 100%; margin-top: 3px; }
.admin-shell main { padding-bottom: 36px; }
.admin-intro { padding-bottom: 32px; }
.admin-intro h1 { margin-top: 14px; }
.admin-section { padding: 24px 0 35px; border-top: 1px solid #e5eaf1; }
.device-create-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.55); }
.device-create-panel summary { padding: 12px 15px; color: #3c5278; font-size: 12px; font-weight: 680; cursor: pointer; }
.device-create-panel[open] summary { border-bottom: 1px solid var(--line); }
.device-create-panel .admin-form { margin: 14px; }
.device-create-panel .muted { line-height: 1.5; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.admin-row-identity { display: grid; flex: 1 1 260px; gap: 7px; }
.muted { color: #8390a3; font-size: 10px; }
.enabled-option { margin-left: auto; }
.check-option { display: inline-flex; align-items: flex-start; gap: 8px; color: #526176; font-size: 11px; font-weight: 550; }
.check-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.small-button { border: 1px solid #dce4f0; border-radius: 7px; padding: 7px 10px; background: #fff; color: #3c5278; font: inherit; font-size: 10px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.small-button:hover { border-color: #aebfe4; color: var(--blue); }
.small-button:disabled { opacity: .55; cursor: wait; }
.danger-button { color: #a84444; }
.danger-button:hover { border-color: #e8bcbc; color: #963939; }
.user-row-title { display: grid; flex: 1 1 180px; gap: 5px; }
.user-access-controls { display: flex; flex: 1 1 350px; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-grid { display: flex; flex-wrap: wrap; gap: 9px 15px; }
.admin-form { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) minmax(120px, .8fr); align-items: end; gap: 14px; margin: 0 0 16px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.admin-form fieldset { grid-column: 1 / -1; display: grid; gap: 10px; margin: 0; padding: 12px; border: 1px solid #e9edf3; border-radius: 8px; }
.admin-form legend { padding: 0 5px; color: #76849a; font-size: 10px; font-weight: 650; }
.admin-submit { min-height: 38px; }
.admin-submit:disabled { opacity: .6; cursor: wait; }
.error-message { color: #b54747; }
.page-message.error-message { color: #b54747; }
.page-message[hidden] { display: none; }
fieldset[hidden] { display: none; }
@media (max-width: 580px) {
  .shell { width: min(100% - 32px, 1100px); }
  .topbar { height: 66px; }
  .intro { padding: 45px 0 32px; }
  .intro-row { align-items: flex-start; }
  h1 { max-width: 330px; }
  .summary { width: 75px; min-width: 75px; padding: 10px 11px; }
  .summary-number { font-size: 21px; }
  .summary-label { font-size: 8px; }
  .device-card { padding: 17px; }
  .card-top { gap: 8px; }
  .status { padding: 5px 7px; font-size: 9px; }
  .topbar-right { gap: 6px; font-size: 10px; }
  .header-link, .header-button { padding: 6px 8px; font-size: 10px; }
  .account-name { display: none; }
  .auth-card { padding: 24px; }
  .admin-form { grid-template-columns: 1fr; }
  .admin-form fieldset { grid-column: auto; }
  .admin-row { align-items: flex-start; }
  .enabled-option { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
