:root {
  --ink: #183e35;
  --text: #344e46;
  --muted: #83918c;
  --green: #247b62;
  --green-dark: #1c654f;
  --green-soft: #edf6f1;
  --line: #e6ece8;
  --canvas: #f6f8f7;
  --font: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--text); background: var(--canvas); font: 14px/1.5 var(--font); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; border: 0; background: none; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid #89bca5; outline-offset: 3px; }
input { min-width: 0; outline: none; }
[hidden] { display: none !important; }

/* A standalone login surface: the workspace stays hidden until authentication. */
.auth-screen { min-height: 100%; display: grid; place-items: center; padding: 32px 20px; background: #f4f7f5; }
.login-card { width: 400px; max-width: 100%; padding: 38px 36px 36px; background: #fff; border: 1px solid #e5ebe7; border-radius: 22px; box-shadow: 0 12px 40px #193b2e06, 0 2px 6px #193b2e03; }
.login-mark, .brand-mark { display: grid; place-items: center; background: var(--green); color: white; border-radius: 12px; }
.login-mark { width: 48px; height: 48px; margin: 0 auto 23px; }
.login-mark svg { width: 32px; height: 32px; }
.login-card h1 { color: var(--ink); font-size: 24px; font-weight: 650; text-align: center; letter-spacing: -.6px; }
.login-subtitle { margin: 6px 0 31px; color: #8f9b95; font-size: 13px; text-align: center; letter-spacing: 1px; }
.field-label { display: block; margin-bottom: 9px; font-size: 12px; color: #586d63; font-weight: 550; }
.password-field { display: flex; align-items: center; gap: 10px; border: 1px solid #dfe7e1; border-radius: 10px; background: #fbfcfb; padding: 0 12px; height: 49px; transition: border-color .15s, box-shadow .15s; }
.password-field:focus-within { border-color: #72a58d; box-shadow: 0 0 0 3px #247b620c; background: white; }
.password-field > svg { width: 17px; height: 17px; color: #9aa99e; }
.password-field input { width: 100%; height: 100%; border: 0; background: transparent; color: var(--ink); font-size: 13px; }
input::placeholder { color: #9ba8a1; }
.icon-button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 8px; color: #809289; transition: background .15s, color .15s; }
.icon-button:hover { color: var(--green); background: var(--green-soft); }
.password-toggle { width: 27px; height: 30px; margin-right: -4px; }
.password-toggle svg { width: 17px; height: 17px; }
.login-submit { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 47px; margin-top: 24px; border-radius: 10px; background: var(--green); color: #fff; font-size: 14px; font-weight: 550; transition: background .15s, transform .15s; }
.login-submit:hover { background: var(--green-dark); }
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled { opacity: .65; cursor: wait; }
.login-submit svg { width: 17px; height: 17px; }
.login-status { color: #ad5e4c; padding-top: 10px; font-size: 12px; line-height: 1.7; }
.login-status:not([hidden]) + .login-submit { margin-top: 15px; }

/* Host navigation. */
.manager-shell { height: 100dvh; display: flex; overflow: hidden; }
.device-sidebar { width: 286px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid var(--line); z-index: 30; }
.manager-brand { display: flex; gap: 11px; align-items: center; padding: 25px 24px 30px; flex-shrink: 0; color: var(--ink); }
.brand-mark { width: 35px; height: 35px; border-radius: 10px; }
.brand-mark svg { width: 27px; height: 27px; }
.manager-brand > span:last-child { display: flex; gap: 9px; align-items: baseline; font-size: 21px; font-weight: 700; letter-spacing: -.6px; }
.manager-brand small { font-size: 11px; color: #9aa69f; font-weight: 400; letter-spacing: .2px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 15px 24px; }
.sidebar-heading h2 { color: #36584a; font-size: 14px; font-weight: 650; }
.total-count { margin-left: 5px; font-size: 11px; color: #8b9c92; font-weight: 400; }
.refresh-button svg { width: 17px; height: 17px; }
.refresh-button:disabled svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.device-search { margin: 0 20px 17px; height: 39px; display: flex; align-items: center; gap: 9px; background: #f5f7f6; border: 1px solid #eef1ef; border-radius: 9px; padding: 0 11px; }
.device-search:focus-within { border-color: #a3c5b3; background: #fff; }
.device-search svg { width: 15px; height: 15px; color: #91a297; }
.device-search input { width: 100%; height: 100%; background: none; border: 0; font-size: 12px; color: var(--ink); }
.device-filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px; margin: 0 20px 17px; background: #f3f6f4; border-radius: 8px; padding: 4px; flex-shrink: 0; }
.device-filters button { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 0; border-radius: 6px; font-size: 11px; color: #82958a; white-space: nowrap; }
.device-filters button > span { color: #a0aea5; font-size: 10px; }
.device-filters button.is-active { color: var(--green); background: #fff; box-shadow: 0 1px 4px #294e3310; font-weight: 600; }
.device-filters button.is-active > span { color: #759e88; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #8ab39c; flex-shrink: 0; }
.status-dot.online { background: #3c9f75; }
.status-dot.offline { background: #b7c1ba; }
.device-list { flex: 1; min-height: 0; overflow: auto; padding: 0 13px 16px; scrollbar-width: thin; scrollbar-color: #dce6df transparent; overscroll-behavior: contain; }
.device-group + .device-group { margin-top: 20px; }
.device-group-heading { display: flex; align-items: center; gap: 7px; margin: 4px 12px 8px; font-size: 10px; font-weight: 500; color: #91a398; letter-spacing: .3px; }
.device-group-heading span:last-child { margin-left: auto; color: #b2bdb5; }
.device-row { display: flex; align-items: center; position: relative; padding-right: 5px; border: 1px solid transparent; border-radius: 11px; margin-bottom: 4px; min-width: 0; transition: background .15s; }
.device-row:hover { background: #f8faf8; }
.device-row.is-selected { background: #eef6f1; border-color: #d6e8dc; }
.device-row.is-selected:before { content: ""; position: absolute; left: -1px; top: 19px; bottom: 19px; width: 3px; background: var(--green); border-radius: 0 3px 3px 0; }
.device-select { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; padding: 12px 6px 12px 11px; border-radius: 10px; }
.device-symbol { width: 35px; height: 35px; border-radius: 9px; background: #f0f5f1; color: #7e9b88; display: grid; place-items: center; flex-shrink: 0; }
.device-symbol svg { width: 19px; height: 19px; }
.is-selected .device-symbol { background: #dcece1; color: #3a7959; }
.device-info { display: block; min-width: 0; flex: 1; }
.device-name-line { display: flex; gap: 8px; align-items: center; margin-bottom: 5px; }
.device-name { color: #345443; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-status { font-size: 9px; white-space: nowrap; color: #39805b; background: #e5f2e9; padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.device-meta { display: block; color: #98a89c; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-offline .device-name { color: #89998f; }
.is-offline .device-symbol { background: #f5f6f5; color: #b0bbb2; }
.is-offline .device-status { background: #f0f3f1; color: #a2afa5; }
.is-offline .device-meta { color: #acb7ae; }
.is-offline .device-select { cursor: not-allowed; }
.device-actions { position: relative; flex-shrink: 0; }
.device-actions summary { list-style: none; width: 25px; height: 30px; display: grid; place-items: center; cursor: pointer; color: #a1b0a5; border-radius: 6px; font-size: 18px; }
.device-actions summary::-webkit-details-marker { display: none; }
.device-actions summary:hover, .device-actions[open] summary { background: #e9f0eb; color: var(--green); }
.device-action-menu { position: absolute; right: 0; top: 33px; z-index: 5; padding: 5px; width: 132px; border: 1px solid var(--line); background: #fff; border-radius: 9px; box-shadow: 0 8px 24px #183e3512; }
.revoke { display: flex; align-items: center; gap: 7px; width: 100%; font-size: 11px; color: #a36e60; padding: 9px 8px; border-radius: 5px; text-align: left; }
.revoke:hover { background: #fbf1ed; }
.revoke svg { width: 14px; height: 14px; }
.device-empty { padding: 38px 13px; text-align: center; }
.device-empty > .empty-symbol { display: grid; place-items: center; width: 42px; height: 42px; background: #f2f6f3; border-radius: 12px; margin: 0 auto 14px; color: #9aafa1; }
.device-empty strong { display: block; color: #7c9384; font-weight: 500; font-size: 12px; }
.device-empty p { color: #a1afa5; font-size: 11px; line-height: 1.9; margin-top: 7px; }
.empty-reset { color: var(--green); font-size: 11px; margin-top: 12px; }
.sidebar-sync { display: flex; align-items: center; gap: 7px; padding: 13px 25px; color: #a0afa5; border-top: 1px solid #f1f4f2; font-size: 10px; }
.sidebar-sync .status-dot { width: 4px; height: 4px; }
.sidebar-footer { display: flex; align-items: center; gap: 11px; padding: 18px 20px 21px 24px; border-top: 1px solid var(--line); }
.admin-avatar { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #e2ebe5; border-radius: 50%; background: #f4f7f4; color: #7d9886; font-size: 12px; }
.admin-info { flex: 1; }
.admin-info strong { display: block; color: #536b5d; font-size: 12px; font-weight: 600; }
.admin-info span { font-size: 10px; color: #a0afa4; }
.sidebar-footer svg { width: 17px; height: 17px; }

/* The active host and welcome dashboard. */
.main-workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.workspace-header { height: 79px; display: flex; align-items: center; gap: 14px; padding: 0 35px; border-bottom: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.workspace-heading { min-width: 0; }
.workspace-heading > span { display: block; font-size: 10px; color: #a1afa5; margin-bottom: 3px; }
.workspace-heading h2 { font-size: 16px; color: #3e5b49; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-actions { margin-left: auto; display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.workspace-label { color: #b1bdb4; font-size: 9px; letter-spacing: 1.5px; }
.connection-badge { display: flex; align-items: center; gap: 6px; color: #4d8a65; font-size: 11px; background: #edf6ef; border: 1px solid #e0ede3; border-radius: 20px; padding: 4px 10px; }
.connection-badge.is-offline { color: #8a9a8f; background: #f2f4f2; border-color: #e6ebe7; }
.connection-badge.is-offline .status-dot { background: #acb9af; }
.text-button { color: #7c9283; font-size: 11px; padding: 7px 0; }
.text-button:hover { color: var(--green); }
.text-button span { margin-left: 5px; }
.status-banner { margin: 0; padding: 10px 35px; color: #916f42; border-bottom: 1px solid #ede3d2; background: #fff9ed; font-size: 12px; flex-shrink: 0; }
.workspace-content { flex: 1; min-width: 0; min-height: 0; }
iframe { display: block; width: 100%; height: 100%; border: 0; }
.overview { height: 100%; padding: 43px clamp(24px, 4vw, 64px) 22px; overflow: auto; display: flex; flex-direction: column; }
.overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-eyebrow { color: #9aaba0; font-size: 9px; font-weight: 600; letter-spacing: 2px; }
.overview-heading h1 { color: #254b38; font-size: clamp(23px, 2.2vw, 32px); font-weight: 600; letter-spacing: -1px; margin: 9px 0 10px; }
.overview-heading p { color: #95a498; font-size: 12px; line-height: 1.8; }
.overview-tag { display: flex; gap: 7px; align-items: center; border: 1px solid #e2eae3; padding: 6px 10px; border-radius: 20px; color: #8d9f92; font-size: 10px; white-space: nowrap; }
.overview-tag .status-dot { width: 5px; height: 5px; }
.overview-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.overview-stat { min-height: 110px; display: flex; align-items: center; gap: 15px; padding: 22px 23px; background: #fff; border: 1px solid var(--line); border-radius: 13px; position: relative; }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: #f0f5f1; color: #7d9e87; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.overview-stat > div > span { display: block; font-size: 11px; color: #94a397; margin-bottom: 4px; }
.overview-stat strong { display: block; font-size: 29px; font-weight: 600; line-height: 1.15; color: #325b41; letter-spacing: -.8px; }
.stat-caption { position: absolute; bottom: 23px; right: 20px; display: flex; gap: 5px; align-items: center; color: #a5b0a7; font-size: 9px; }
.stat-caption .status-dot { width: 4px; height: 4px; }
.online-stat { background: #f1f7f2; border-color: #dfece1; }
.online-stat .stat-icon { background: #e0eee4; color: #5c9a72; }
.online-stat strong { color: #2b7951; }
.offline-icon { background: #f4f5f4; color: #a7b4a9; }
.overview-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; flex: 1; min-height: 280px; padding: 28px 15px 30px; }
.overview-empty h2 { color: #46664f; font-size: 19px; font-weight: 550; margin: 17px 0 9px; }
.overview-empty > p { color: #9dac9e; font-size: 12px; line-height: 1.9; }
.primary-button { display: inline-flex; align-items: center; gap: 20px; padding: 11px 20px; border-radius: 9px; background: var(--green); color: white; font-size: 12px; margin-top: 23px; }
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { background: #dce8df; color: #82998a; }
.overview-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid #e6ece6; color: #abb6ab; font-size: 10px; }
.overview-footer > span:first-child { display: flex; align-items: center; gap: 6px; }
.overview-footer svg { width: 13px; height: 13px; color: #93a995; }

/* Small code-native illustration; no external assets or font requests. */
.workspace-illustration { width: 200px; height: 135px; position: relative; margin: 0 auto; }
.illustration-orbit { position: absolute; width: 176px; height: 130px; left: 9px; top: 3px; border: 1px dashed #d5e3d7; border-radius: 50%; transform: rotate(-18deg); }
.illustration-monitor { position: absolute; top: 19px; left: 26px; width: 145px; height: 100px; border-radius: 10px; background: #fff; border: 1px solid #d5e3d7; transform: rotate(-5deg); box-shadow: 0 7px 14px #1c4f2d05; padding: 11px; }
.illustration-window { display: flex; gap: 3px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid #eef3ed; }
.illustration-window span { width: 4px; height: 4px; border-radius: 50%; background: #c8dccc; }
.illustration-row { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.illustration-row i { width: 14px; height: 14px; border-radius: 4px; background: #e8f1e9; }
.illustration-row b { width: 54px; height: 4px; border-radius: 4px; background: #d6e5d8; }
.illustration-row em { width: 15px; height: 4px; margin-left: auto; border-radius: 4px; background: #e8efE8; }
.illustration-row.short b { width: 39px; background: #e3ece3; }
.illustration-check { width: 34px; height: 34px; display: grid; place-items: center; position: absolute; right: 8px; bottom: 15px; border: 4px solid var(--canvas); background: #6ca281; border-radius: 50%; color: white; }
.illustration-check svg { width: 16px; height: 16px; stroke-width: 2.4; }
.device-toggle, .sidebar-backdrop { display: none; }

@media (max-width: 1200px) {
  .device-sidebar { width: 264px; }
  .manager-brand { padding-left: 23px; }
  .device-name-line { gap: 5px; }
  .device-status { font-size: 8px; padding: 1px 4px; }
  .workspace-header { padding: 0 25px; height: 72px; }
  .overview { padding-top: 31px; }
  .overview-tag { display: none; }
  .overview-stat { padding: 19px 17px; gap: 11px; }
  .stat-caption { display: none; }
}
@media (max-width: 900px) {
  .device-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; max-width: calc(100vw - 44px); transform: translateX(-100%); visibility: hidden; transition: transform .2s ease; box-shadow: 8px 0 36px #183e3510; }
  .manager-shell.is-sidebar-open .device-sidebar { transform: translateX(0); visibility: visible; }
  .manager-shell.is-sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: #183e3540; }
  .device-toggle { display: inline-flex; }
  .workspace-header { padding: 0 20px 0 13px; height: 68px; gap: 10px; }
  .workspace-actions { gap: 13px; }
  .workspace-label { font-size: 8px; letter-spacing: 1px; }
  .overview { padding: 32px 28px 20px; }
  .overview-heading h1 { font-size: 28px; }
}
@media (max-width: 580px) {
  .login-card { padding: 32px 26px 28px; border-radius: 18px; }
  .login-card h1 { font-size: 22px; }
  .workspace-header { height: 63px; }
  .workspace-heading h2 { font-size: 14px; max-width: 145px; }
  .workspace-actions { gap: 10px; }
  .workspace-label { display: none; }
  .text-button { font-size: 10px; }
  .connection-badge { font-size: 9px; padding: 3px 7px; }
  .overview { padding: 27px 19px 19px; }
  .overview-heading { margin-bottom: 23px; }
  .overview-heading h1 { font-size: 24px; letter-spacing: -.7px; }
  .overview-heading p { font-size: 11px; max-width: 250px; }
  .overview-stats { gap: 8px; }
  .overview-stat { padding: 14px 12px; min-height: 94px; }
  .stat-icon { display: none; }
  .overview-stat > div > span { font-size: 10px; }
  .overview-stat strong { font-size: 27px; margin-top: 6px; }
  .overview-empty { min-height: 330px; padding: 28px 0 34px; }
  .overview-empty h2 { font-size: 17px; }
  .overview-empty > p { font-size: 11px; max-width: 240px; }
  .overview-footer { justify-content: center; font-size: 10px; }
  .overview-footer > span:last-child { display: none; }
  .status-banner { padding: 9px 20px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
