:root {
  --blue: #1374e8;
  --blue-dark: #0759bd;
  --blue-soft: #eaf4ff;
  --ink: #152033;
  --muted: #6d788c;
  --line: #e7ebf1;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --green: #19ad73;
  --green-soft: #e8f8f1;
  --coral: #ed6a67;
  --coral-soft: #fff0ef;
  --violet: #7357d8;
  --violet-soft: #f0edff;
  --shadow: 0 18px 45px rgba(29, 47, 75, .09);
}

/* 设备标签：管理列表、设备多选筛选与编辑表单。 */
.device-tag { --tag-color: #0867d0; --tag-background: #eaf4ff; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 9px; border-radius: 6px; background: var(--tag-background); color: var(--tag-color); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.device-tag i { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--tag-color); }
.tag-green { --tag-color: #087c4d; --tag-background: #dcf7e9; }
.tag-orange { --tag-color: #a65a00; --tag-background: #fff1dc; }
.tag-red { --tag-color: #c42b53; --tag-background: #ffe6ed; }
.tag-purple { --tag-color: #7541bf; --tag-background: #f0e7ff; }
.tag-cyan { --tag-color: #00778c; --tag-background: #e0f8fc; }
.tag-gray { --tag-color: #596675; --tag-background: #edf0f3; }
.device-tag-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 12px; }
.tag-filter { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: var(--surface); }
.tag-filter input, .tag-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); box-shadow: none; }
.tag-filter-all { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.tag-filter-all.active { color: var(--blue-dark); border-color: #b6d7ff; background: var(--blue-soft); }
.tag-filter-hint { color: var(--muted); font-size: 11px; }
.tag-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.tag-toolbar .search-box { width: min(320px, 100%); flex: 1 1 220px; }
.tag-toolbar input { height: 40px; }
.tag-toolbar > .muted { margin-left: auto; font-size: 12px; }
.tag-table { min-width: 700px; }
.tag-table td:first-child { width: 28%; }
.tag-device-count { padding: 8px 0; border: 0; background: transparent; color: var(--blue); font-weight: 600; }
.tag-device-count:hover { text-decoration: underline; }
.tag-preview { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.device-tags-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; max-width: 280px; }
.device-tags-cell > div { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-edit-device { flex: 0 0 30px; width: 30px; height: 30px; margin-left: auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--blue); font-size: 17px; }
.tag-edit-device:hover { background: var(--blue-soft); }
.device-tags-options { display: grid; gap: 8px; max-height: 320px; overflow-y: auto; margin-top: 16px; }
.tag-option { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.tag-option:has(input:checked) { border-color: #b6d7ff; background: var(--blue-soft); }
#device-tags-options input { margin: 0; }

/* 设备列表备注：蓝色编辑入口，独立表单只保存备注。 */
.device-note-cell { display: grid; grid-template-columns: minmax(0, 1fr) 26px; align-items: center; gap: 8px; min-width: 180px; max-width: 240px; }
.device-note-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.6; }
.device-note-edit { display: grid; place-items: center; width: 26px; height: 30px; padding: 2px; border: 0; border-radius: 6px; background: transparent; color: var(--blue); }
.device-note-edit svg { width: 22px; height: 22px; fill: currentColor; }
.device-note-edit:hover { background: var(--blue-soft); }
.device-note-edit:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#device-note-dialog textarea { min-height: 140px; }
#device-note-device { overflow-wrap: anywhere; }

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: #4e8edc; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.eyebrow.light { color: rgba(255, 255, 255, .7); }
.eyebrow.light-blue { color: #4d8ee4; }

.login-screen { min-height: 100vh; display: grid; place-items: center; overflow: hidden; position: relative; padding: 32px; background: linear-gradient(135deg, #0d65ce 0%, #167cea 50%, #5ba7f5 100%); }
.login-screen::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(to right, black, transparent 75%); }
.login-orb { position: absolute; border-radius: 50%; filter: blur(2px); background: rgba(255,255,255,.12); }
.orb-one { width: 430px; height: 430px; top: -170px; right: -100px; }
.orb-two { width: 280px; height: 280px; bottom: -100px; left: 10%; }
.login-layout { position: relative; z-index: 1; width: min(1040px, 100%); display: grid; grid-template-columns: 1.08fr .92fr; align-items: center; gap: 90px; }
.login-intro { color: #fff; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #2089fb, #0863cd); font-weight: 900; box-shadow: 0 9px 18px rgba(5, 82, 171, .22); }
.brand-mark-large { width: 58px; height: 58px; margin-bottom: 34px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.16); box-shadow: none; backdrop-filter: blur(8px); font-size: 24px; }
.login-intro h1 { margin: 0; font-size: clamp(42px, 5vw, 68px); line-height: 1.08; letter-spacing: -.04em; }
.login-intro > p:not(.eyebrow) { max-width: 520px; margin: 22px 0 34px; color: rgba(255,255,255,.78); font-size: 17px; line-height: 1.8; }
.login-features { display: flex; flex-wrap: wrap; gap: 11px; }
.login-features span { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid rgba(255,255,255,.17); border-radius: 999px; background: rgba(255,255,255,.09); color: rgba(255,255,255,.84); font-size: 12px; backdrop-filter: blur(6px); }
.login-features i { width: 6px; height: 6px; border-radius: 50%; background: #9fe7ca; box-shadow: 0 0 0 4px rgba(159,231,202,.12); }
.login-card { padding: 48px; border: 1px solid rgba(255,255,255,.54); border-radius: 26px; background: rgba(255,255,255,.96); box-shadow: 0 28px 70px rgba(4, 52, 111, .23); backdrop-filter: blur(14px); }
.login-card h2 { margin: 0; font-size: 29px; letter-spacing: -.02em; }
.login-copy { margin: 10px 0 30px; font-size: 14px; }
.mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 30px; font-weight: 800; }
.field-label { display: block; margin: 17px 0 8px; font-size: 13px; font-weight: 700; color: #3d4a5e; }
.input-wrap { position: relative; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #fafbfc; transition: border-color .2s, box-shadow .2s, background .2s; }
input, select { height: 46px; padding: 0 14px; }
textarea { min-height: 120px; resize: vertical; padding: 13px 14px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: #77b2f5; background: #fff; box-shadow: 0 0 0 4px rgba(19,116,232,.1); }
.input-wrap input { padding-left: 43px; padding-right: 68px; }
.input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #78a9df; font-size: 9px; }
.key-icon { font-size: 11px; }
.password-toggle { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #6e7c90; font-size: 12px; }
.form-error { min-height: 18px; margin: 9px 0 0; color: #dc4b4b; font-size: 12px; }
.primary-button, .secondary-button, .white-button, .text-button, .logout-button, .icon-button, .page-button { border: 0; border-radius: 10px; transition: transform .15s, background .2s, opacity .2s, box-shadow .2s; }
.primary-button { min-height: 42px; padding: 0 18px; color: #fff; background: linear-gradient(135deg, #1683f3, #0966d3); font-weight: 700; box-shadow: 0 8px 18px rgba(19,116,232,.18); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 11px 22px rgba(19,116,232,.25); }
.primary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.login-button { width: 100%; height: 49px; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.security-note { margin: 22px 0 0; text-align: center; color: #8590a1; font-size: 11px; }
.security-note span { color: var(--green); margin-right: 5px; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; background: var(--canvas); }
.sidebar { position: sticky; top: 0; z-index: 20; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; }
.sidebar-brand { height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid #edf0f4; }
.sidebar-brand > div:last-child { display: grid; gap: 3px; }
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand span { color: #8b95a6; font-size: 11px; }
.nav-list { display: grid; gap: 6px; padding: 21px 14px; overflow-y: auto; }
.nav-item { height: 46px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; border: 0; border-radius: 11px; padding: 0 14px; color: #546174; background: transparent; text-align: left; font-weight: 650; }
.nav-item:hover { background: #f6f8fb; }
.nav-item.active { color: #0867d0; background: #eaf4ff; }
.nav-icon { width: 24px; font-size: 20px; font-weight: 400; }
.nav-count { min-width: 23px; padding: 3px 7px; border-radius: 99px; background: #edf0f4; color: #7b8595; font-size: 10px; text-align: center; }
.nav-item.active .nav-count { background: #d5eaff; color: #0967ce; }
.sidebar-footer { margin-top: auto; padding: 15px 14px 19px; }
.safe-mode { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid #dcefe7; border-radius: 12px; background: #f1fbf7; }
.safe-mode > div { display: grid; gap: 4px; }
.safe-mode strong { font-size: 11px; }
.safe-mode span:not(.pulse-dot) { color: #698078; font-size: 9px; line-height: 1.5; }
.pulse-dot { width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(25,173,115,.12); }
.logout-button { width: 100%; height: 42px; margin-top: 10px; color: #687488; background: transparent; }
.logout-button:hover { color: #d34f4f; background: #fff2f2; }
.logout-button span { margin-right: 7px; }

.page-shell { min-width: 0; }
.topbar { height: 78px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.91); backdrop-filter: blur(16px); }
.topbar-kicker { margin: 0 0 3px; color: #97a0ae; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.topbar h2 { margin: 0; font-size: 18px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 13px; }
.connection-chip { height: 31px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border-radius: 99px; background: var(--green-soft); color: #238560; font-size: 10px; }
.connection-chip span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(25,173,115,.1); }
.connection-chip.offline { color: #967239; background: #fff8e7; }
.connection-chip.offline span { background: #e7a728; box-shadow: none; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; color: #536175; font-size: 18px; }
.icon-button:hover { background: #f5f8fc; }
.menu-button { display: none; margin-right: 12px; }
.user-menu { display: flex; align-items: center; gap: 9px; padding-left: 5px; }
.user-menu > div:last-child { display: grid; gap: 2px; }
.user-menu strong { font-size: 12px; }
.user-menu span { color: #8a94a4; font-size: 10px; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #7b61df, #2991ed); font-size: 13px; font-weight: 800; box-shadow: 0 6px 14px rgba(47,119,209,.24); }

.main-content { padding: 25px 30px 40px; }
.view { display: none; animation: view-in .23s ease-out; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hero-card { min-height: 174px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; position: relative; padding: 34px 40px; border-radius: 20px; background: linear-gradient(116deg, #eff2ff 0%, #e8f4ff 57%, #dcedff 100%); }
.hero-card::after { content: ""; position: absolute; width: 310px; height: 310px; right: -80px; top: -165px; border: 45px solid rgba(255,255,255,.42); border-radius: 50%; }
.hero-card h1 { margin: 0 0 12px; font-size: 29px; letter-spacing: -.03em; }
.hero-card p:not(.eyebrow) { margin: 0; color: #64738b; font-size: 13px; }
.white-button { position: relative; z-index: 1; height: 43px; padding: 0 18px; color: #fff; background: var(--blue); font-weight: 700; box-shadow: 0 10px 22px rgba(19,116,232,.22); }
.white-button span { margin-left: 8px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 17px; }
.metric-card { min-height: 144px; position: relative; overflow: hidden; padding: 23px; border: 1px solid; border-radius: 16px; background: #fff; }
.metric-card.blue { border-color: #dcecff; background: linear-gradient(135deg, #fff, #eef7ff); }
.metric-card.green { border-color: #d3efe4; background: linear-gradient(135deg, #fff, #ebfaf4); }
.metric-card.coral { border-color: #f8dcda; background: linear-gradient(135deg, #fff, #fff1f0); }
.metric-card.violet { border-color: #e5ddfb; background: linear-gradient(135deg, #fff, #f3efff); }
.metric-card p { margin: 0 0 8px; color: #68758a; font-size: 12px; }
.metric-card strong { display: block; margin-bottom: 5px; font-size: 31px; letter-spacing: -.03em; }
.metric-card > span { color: #98a0ad; font-size: 10px; }
.metric-icon { position: absolute; right: 18px; top: 20px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: rgba(19,116,232,.08); font-size: 22px; }
.green .metric-icon { color: var(--green); background: rgba(25,173,115,.1); }
.coral .metric-icon { color: var(--coral); background: rgba(237,106,103,.1); }
.violet .metric-icon { color: var(--violet); background: rgba(115,87,216,.1); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 17px; margin-top: 17px; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 3px 12px rgba(36,51,73,.025); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 21px 22px 14px; }
.panel-head h3 { margin: 0; font-size: 17px; }
.text-button { padding: 7px 0; color: var(--blue); background: transparent; font-size: 11px; font-weight: 700; }
.recent-device-list { min-height: 240px; padding: 0 13px 13px; }
.recent-device { display: grid; grid-template-columns: 42px minmax(120px, 1.4fr) minmax(110px, 1fr) minmax(100px, .7fr) auto; align-items: center; gap: 12px; padding: 13px 10px; border-top: 1px solid #eff1f5; }
.device-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #1374e8; background: #edf6ff; font-size: 18px; }
.recent-device strong, .device-name { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.recent-device small { display: block; overflow: hidden; margin-top: 4px; color: #9099a7; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge, .permission-badge, .status-pill { display: inline-flex; align-items: center; gap: 5px; width: fit-content; border-radius: 99px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-badge { padding: 6px 9px; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-badge.online { color: #16865f; background: #e8f8f1; }
.status-badge.online::before { background: #19ad73; }
.status-badge.offline { color: #8c96a5; background: #f0f2f5; }
.status-badge.offline::before { background: #9da5b0; }
.health-panel { padding-bottom: 17px; }
.health-ring { width: 138px; height: 138px; display: grid; place-items: center; margin: 5px auto 18px; border-radius: 50%; background: conic-gradient(var(--blue) var(--health-angle, 0%), #edf1f6 0); position: relative; }
.health-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.health-ring > div { position: relative; z-index: 1; display: grid; text-align: center; }
.health-ring strong { font-size: 25px; }
.health-ring span { color: #8a95a5; font-size: 9px; }
.health-lines { padding: 0 20px; }
.health-lines > div { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid #eff1f5; font-size: 10px; }
.health-lines span { display: flex; align-items: center; gap: 7px; color: #667286; }
.health-lines i { width: 7px; height: 7px; border-radius: 50%; background: #e4a832; }
.health-lines .green-dot { background: var(--green); }
.health-lines .blue-dot { background: var(--blue); }
.success-text { color: var(--green); }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 5px 0 21px; }
.section-heading h1 { margin: 0 0 7px; font-size: 27px; letter-spacing: -.03em; }
.section-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; }
.table-panel { overflow: hidden; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, 150px) auto auto; gap: 9px; padding: 16px; border-bottom: 1px solid var(--line); }
.filter-bar input, .filter-bar select { height: 39px; font-size: 11px; }
.search-box { position: relative; }
.search-box span { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: #8d98a7; }
.search-box input { padding-left: 37px; }
.small { min-height: 39px; height: 39px; padding: 0 15px; font-size: 11px; }
.secondary-button { min-height: 42px; padding: 0 17px; border: 1px solid #dfe4ea; color: #526074; background: #fff; font-weight: 700; }
.secondary-button:hover { background: #f7f9fc; }
.table-wrap { overflow-x: auto; }
.device-table { width: 100%; min-width: 1050px; border-collapse: collapse; }
.device-table th { height: 45px; padding: 0 14px; background: #fafbfc; color: #778295; font-size: 10px; font-weight: 700; text-align: left; white-space: nowrap; }
.device-table td { height: 69px; padding: 10px 14px; border-top: 1px solid #edf0f4; color: #3a4658; font-size: 11px; vertical-align: middle; }
.device-table tbody tr { transition: background .15s; }
.device-table tbody tr:hover { background: #fbfdff; }
.device-subline { display: block; max-width: 175px; overflow: hidden; margin-top: 4px; color: #96a0ae; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.battery-cell { display: flex; align-items: center; gap: 7px; }
.battery-shell { width: 28px; height: 12px; position: relative; padding: 2px; border: 1px solid #bcc5d1; border-radius: 3px; }
.battery-shell::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 5px; border-radius: 0 2px 2px 0; background: #bcc5d1; }
.battery-fill { height: 100%; max-width: 100%; border-radius: 1px; background: var(--green); }
.battery-low .battery-fill { background: var(--coral); }
.permission-stack { display: flex; flex-wrap: wrap; gap: 4px; max-width: 170px; }
.permission-badge { padding: 4px 6px; color: #647187; background: #f0f2f5; }
.permission-badge.yes { color: #16865f; background: #e8f8f1; }
.row-button { height: 31px; padding: 0 10px; border: 1px solid #dbe8f7; border-radius: 8px; color: #1673de; background: #f5faff; font-size: 10px; font-weight: 700; }
.row-button.danger { color: #c94a58; border-color: #f0d5d8; background: #fff7f8; }
.device-row-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.empty-state { min-height: 330px; display: grid; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-state > * { margin: 0; }
.empty-icon { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 18px; color: var(--blue); background: var(--blue-soft); font-size: 30px; }
.empty-state p { margin: 7px 0 17px; color: var(--muted); font-size: 11px; }
.pagination { min-height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-top: 1px solid var(--line); color: #818b9b; font-size: 10px; }
.pagination > div { display: flex; align-items: center; gap: 8px; }
.pagination select { width: 70px; height: 32px; font-size: 10px; }
.page-button { width: 31px; height: 31px; border: 1px solid var(--line); color: #526074; background: #fff; font-size: 18px; }
.page-button:disabled { cursor: not-allowed; opacity: .4; }

.full-width { width: 100%; margin-top: 20px; }

.link-button { display: inline-flex; align-items: center; text-decoration: none; }
.system-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.system-card { min-height: 138px; display: grid; grid-template-columns: 46px 1fr auto; align-items: start; gap: 15px; padding: 21px; }
.system-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: var(--blue); background: var(--blue-soft); font-size: 22px; }
.system-card h3 { margin: 2px 0 7px; font-size: 15px; }
.system-card p { margin: 0 0 11px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.system-card code { padding: 4px 7px; border-radius: 5px; color: #4c627c; background: #f1f3f6; font-size: 9px; }
.status-pill { padding: 6px 8px; }
.status-pill.success { color: #16865f; background: var(--green-soft); }
.status-pill.warning { color: #9b7329; background: #fff6df; }
.status-pill.neutral { color: #768294; background: #f0f2f5; }
.status-pill.unavailable { color: #bb4f50; background: var(--coral-soft); }
.boundary-panel { display: grid; gap: 0; margin-top: 15px; padding: 22px; }
.boundary-panel h3 { margin: 0 0 9px; }
.boundary-panel > div { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid #edf0f4; }
.boundary-panel > div > span { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 800; }
.boundary-panel p { margin: 2px 0 0; color: #718095; font-size: 11px; line-height: 1.6; }
.boundary-panel strong { color: var(--ink); margin-right: 8px; }

.capability-legend { display: flex; flex-wrap: wrap; gap: 7px; }
.capability-legend span, .capability-status { padding: 6px 9px; border-radius: 99px; font-size: 10px; font-weight: 800; }
.capability-client { padding: 6px 9px; border-radius: 99px; font-size: 10px; font-weight: 800; color: #496079; background: #eef2f7; margin-right: 6px; }
.capability-legend .implemented, .capability-status.implemented, .summary-icon.implemented { color: #16865f; background: var(--green-soft); }
.capability-legend .planned, .capability-status.not_implemented, .summary-icon.planned { color: #9a7125; background: #fff5dc; }
.capability-legend .blocked, .capability-status.unavailable, .summary-icon.blocked { color: #bb4f50; background: var(--coral-soft); }
.capability-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 15px; }
.capability-summary article { display: flex; align-items: center; gap: 13px; min-height: 89px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.summary-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-weight: 900; }
.capability-summary strong { display: block; font-size: 22px; }
.capability-summary p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.capability-panel { overflow: hidden; }
.capability-list { display: grid; }
.capability-group-head { padding: 12px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: #65738a; background: #f8fafc; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.capability-group-head:first-child { border-top: 0; }
.capability-row { display: grid; gap: 12px; padding: 18px; border-bottom: 1px solid #edf0f4; }
.capability-row:last-child { border-bottom: 0; }
.capability-row h3 { margin: 0; font-size: 12px; }
.capability-row p { margin: 4px 0 0; color: #8994a4; font-size: 9px; line-height: 1.55; }
.capability-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.capability-interfaces { display: flex; flex-wrap: wrap; gap: 5px; }
.capability-interfaces code { padding: 5px 7px; border-radius: 6px; color: #496079; background: #f1f4f7; font-size: 9px; overflow-wrap: anywhere; }
.capability-protocol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capability-protocol-grid section { min-width: 0; }
.capability-protocol-grid b, .capability-storage b { display: block; margin-bottom: 6px; color: #66758b; font-size: 9px; }
.capability-protocol-grid pre { min-height: 94px; max-height: 260px; margin: 0; padding: 11px; overflow: auto; border: 1px solid #e2e7ed; border-radius: 8px; color: #33465e; background: #f7f9fb; font: 9px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.capability-storage { display: flex; align-items: center; gap: 8px; }
.capability-storage b { margin: 0; }
.capability-storage code { padding: 5px 7px; border-radius: 6px; color: #496079; background: #eef4fb; font-size: 9px; overflow-wrap: anywhere; }
.capability-row.unavailable { background: #fffbfb; }
.capability-row.not_implemented { background: #fffdfa; }

.command-filters { grid-template-columns: minmax(260px, 1fr) 190px 150px auto; }
.command-table .command-id { display: block; max-width: 145px; overflow: hidden; color: #3d526d; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; text-overflow: ellipsis; }
.command-result { max-width: 220px; overflow: hidden; color: #788496; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.command-state { display: inline-flex; padding: 5px 8px; border-radius: 99px; font-size: 9px; font-weight: 800; }
.command-state.success, .command-state.acknowledged { color: #16865f; background: var(--green-soft); }
.command-state.failed { color: #bb4f50; background: var(--coral-soft); }
.command-state.sent, .command-state.queued { color: #326ea8; background: var(--blue-soft); }

.management-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.management-panel { overflow: hidden; }
.compact-form { display: grid; grid-template-columns: .8fr 1.2fr auto; gap: 8px; padding: 0 20px 18px; border-bottom: 1px solid var(--line); }
.compact-form input { height: 40px; font-size: 11px; }
.stack-form { display: grid; gap: 9px; }
.stack-form input, .stack-form select { height: 41px; font-size: 11px; }
.stack-form textarea { min-height: 88px; font-size: 11px; }
.management-panel > .stack-form { padding: 0 20px 18px; border-bottom: 1px solid var(--line); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.management-list { max-height: 390px; overflow-y: auto; padding: 8px 20px 18px; }
.management-item { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid #edf0f4; }
.management-item:last-child { border-bottom: 0; }
.management-item h4 { margin: 0 0 5px; font-size: 11px; }
.management-item p { margin: 0; color: #8893a4; font-size: 9px; line-height: 1.55; }
.management-item code { display: inline-block; margin-top: 6px; padding: 3px 6px; border-radius: 5px; background: #f1f4f7; color: #53677e; font-size: 8px; }
.management-count { min-width: 30px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 9px; font-weight: 800; }

.account-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .6fr); gap: 16px; align-items: start; }
.create-account-panel { position: sticky; top: 99px; }
.padded-form { padding: 0 22px 23px; }
.padded-form .field-label { margin-bottom: -2px; }
.password-section { border-top: 1px solid var(--line); }
.password-section .panel-head { padding-bottom: 8px; }
.user-table { min-width: 790px; }
.user-actions { display: flex; gap: 5px; }
.mini-button { min-height: 28px; padding: 0 8px; border: 1px solid #dce5ef; border-radius: 7px; color: #4e6179; background: #fff; font-size: 9px; }
.mini-button.danger { color: #b94a4a; border-color: #f2d4d4; background: #fff7f7; }
.mini-button.success { color: #16865f; border-color: #ccebdd; background: #f2fbf7; }

.template-grid { display: grid; grid-template-columns: minmax(300px, .55fr) minmax(0, 1.45fr); gap: 16px; align-items: start; }
.template-form-panel, .template-list-panel { overflow: hidden; }
.template-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 650px; overflow-y: auto; padding: 0 20px 20px; }
.template-item { position: relative; min-height: 130px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.template-item h4 { margin: 0 60px 9px 0; font-size: 12px; }
.template-item p { margin: 0; color: #65738a; font-size: 10px; line-height: 1.7; }
.template-item small { display: block; margin-top: 12px; color: #9aa3b1; font-size: 8px; }
.template-item .capability-status { position: absolute; top: 13px; right: 13px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cc-group { margin-bottom: 18px; }
.cc-group > h3 { margin: 4px 2px 10px; font-size: 13px; color: #33465e; }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cc-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cc-head h4 { margin: 0 0 4px; font-size: 12px; }
.cc-head code { padding: 4px 6px; border-radius: 6px; color: #496079; background: #f1f4f7; font-size: 9px; }
.cc-card .field-label { display: grid; gap: 4px; margin: 8px 0 0; font-size: 9px; color: #66758b; }
.cc-card .field-label input { min-height: 30px; padding: 0 9px; border: 1px solid #dbe3eb; border-radius: 7px; font-size: 10px; }
.cc-card .muted { margin: 8px 0 0; }
.cc-result { margin-top: 10px; }
.cc-result pre { max-height: 220px; margin: 6px 0 0; padding: 10px; overflow: auto; border: 1px solid #e2e7ed; border-radius: 8px; color: #33465e; background: #f7f9fb; font: 9px/1.5 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-status { font-size: 10px; font-weight: 800; }
.cc-status.success { color: #16865f; }
.cc-status.failed, .cc-status.error { color: #bb4f50; }
.cc-status.info { color: #496079; }
.cc-status.warning, .cc-status.queued, .cc-status.sent, .cc-status.acknowledged { color: #9a7125; }
.log-message { max-width: 520px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; line-height: 1.6; }
.row-actions button { min-height: 30px; padding: 0 9px; border: 1px solid #dbe3eb; border-radius: 7px; color: #45627e; background: #fff; font-size: 9px; }
.row-actions button.danger { color: #c94a58; border-color: #f0d5d8; }
.template-item .row-actions { margin-top: 12px; }
.multiline-cell { max-width: 220px; white-space: pre-line; overflow-wrap: anywhere; }
.password-panel { margin-top: 16px; }

.metadata-form { display: grid; gap: 8px; }
.metadata-form select, .metadata-form input { height: 38px; font-size: 10px; }
.metadata-form textarea { min-height: 70px; font-size: 10px; }
.metadata-form .primary-button { justify-self: end; min-height: 36px; font-size: 10px; }

.screen-modal { width: min(980px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; background: #111820; box-shadow: 0 30px 90px rgba(0,0,0,.38); }
.screen-modal::backdrop { background: rgba(8,14,22,.72); backdrop-filter: blur(4px); }
.screen-modal-head { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: #fff; background: #18222e; }
.screen-modal-head h3 { margin: 0; font-size: 17px; }
.screen-modal-head .icon-button { border-color: #35414e; color: #dce5ef; background: #202d3b; }
.screen-stage { height: min(68vh, 650px); position: relative; display: grid; place-items: center; overflow: hidden; background: #080c11; }
.screen-stage img { width: 100%; height: 100%; object-fit: contain; }
[data-ui-tree-canvas] { cursor: pointer; touch-action: none; user-select: none; -webkit-user-drag: none; }
[data-ui-tree-canvas].screen-touch-active { cursor: grabbing; }
[data-ui-tree-canvas]::after { content: ""; position: absolute; z-index: 3; left: var(--screen-touch-x); top: var(--screen-touch-y); width: 28px; height: 28px; box-sizing: border-box; border: 2px solid #fff; border-radius: 50%; background: rgba(38,132,255,.45); box-shadow: 0 0 0 2px rgba(24,87,176,.7); transform: translate(-50%,-50%); opacity: 0; pointer-events: none; }
[data-ui-tree-canvas].screen-touch-active::after { opacity: 1; }
[data-ui-tree-canvas].screen-touch-released::after { animation: screen-touch-feedback .3s ease-out; }
@keyframes screen-touch-feedback { from { opacity: 1; transform: translate(-50%,-50%) scale(1); } to { opacity: 0; transform: translate(-50%,-50%) scale(1.8); } }
[data-ui-tree-canvas]:focus-visible { outline: 2px solid #3d9aff; outline-offset: -2px; }
[data-ui-tree-canvas][aria-disabled="true"] { cursor: default; }
.screen-input-bar { display: flex; align-items: center; gap: 7px; }
.screen-input-bar input { min-width: 0; height: 36px; padding: 0 10px; border: 1px solid #354454; border-radius: 8px; color: #edf5ff; background: #101923; }
.screen-input-bar button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; color: #fff; background: var(--blue); white-space: nowrap; }
.screen-input-bar :disabled { cursor: not-allowed; opacity: .5; }
.screen-control-hint { color: #687689; text-align: center; line-height: 1.45; }
.screen-waiting { display: grid; place-items: center; color: #d7e1ec; text-align: center; }
.screen-waiting h3 { margin: 18px 0 7px; font-size: 16px; }
.screen-waiting p { margin: 0; color: #8190a1; font-size: 10px; }
.screen-loader { width: 45px; height: 45px; border: 3px solid #293b4e; border-top-color: #3d9aff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen-modal-footer { min-height: 64px; display: flex; align-items: center; gap: 13px; padding: 0 20px; color: #8f9dac; background: #18222e; }
.screen-modal-footer p { margin: 0; font-size: 9px; }
.screen-modal-footer .danger-button { margin-left: auto; }
.danger-button { min-height: 37px; padding: 0 14px; border: 0; border-radius: 9px; color: #fff; background: #d65454; font-weight: 700; }

.drawer-backdrop { position: fixed; z-index: 39; inset: 0; background: rgba(16,29,48,.35); backdrop-filter: blur(2px); }
.device-drawer { position: fixed; z-index: 40; top: 0; right: 0; width: min(570px, 100%); height: 100vh; transform: translateX(105%); background: #f8fafc; box-shadow: -25px 0 60px rgba(24,39,61,.18); transition: transform .26s ease; }
.device-drawer.open { transform: none; }
.drawer-head { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer-head h2 { margin: 0; font-size: 20px; }
.drawer-content { height: calc(100vh - 82px); overflow-y: auto; padding: 19px; }
.detail-hero { display: flex; align-items: center; gap: 15px; padding: 20px; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #167eea, #125fb9); }
.detail-hero .device-avatar { width: 52px; height: 52px; flex: 0 0 52px; color: #fff; background: rgba(255,255,255,.16); }
.detail-hero h3 { margin: 0 0 5px; }
.detail-hero p { margin: 0; color: rgba(255,255,255,.72); font-size: 10px; }
.detail-hero .status-badge { margin-left: auto; color: #116f4f; background: #fff; }
.detail-section { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.detail-section h4 { margin: 0 0 14px; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 17px; }
.detail-item span { display: block; margin-bottom: 4px; color: #919baa; font-size: 9px; }
.detail-item strong { display: block; overflow-wrap: anywhere; font-size: 11px; }
.command-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.command-button { min-height: 55px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid #e0e8f1; border-radius: 11px; color: #3d5069; background: #f8fbff; text-align: left; font-size: 10px; font-weight: 700; }
.command-button span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: #e6f2ff; font-size: 14px; }
.command-button:hover { border-color: #b8d8fa; background: #f1f8ff; }
.command-button:disabled { cursor: not-allowed; opacity: .45; }
.unavailable-actions { background: #fffbfb; }
.unavailable-command-list { display: grid; gap: 8px; }
.unavailable-command-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.unavailable-command { width: 100%; color: #778292; background: #f6f7f9; }
.unavailable-command span { color: #8c96a5; background: #e9edf1; }
.unavailable-command-list em { padding: 6px 9px; border-radius: 99px; color: #bb4f50; background: var(--coral-soft); font-size: 10px; font-style: normal; font-weight: 800; white-space: nowrap; }
.unavailable-help { margin: 11px 0 0; color: #9a6f70; font-size: 9px; line-height: 1.55; }
.event-list { display: grid; }
.event-item { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid #eff1f4; }
.event-item:first-child { border-top: 0; }
.event-item > i { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #6ea8ec; }
.event-item strong { display: block; font-size: 10px; }
.event-item small { display: block; margin-top: 4px; color: #97a0ad; font-size: 9px; }
.app-log-item { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; min-height: 76px; padding: 10px 0; border-top-color: #f0f1f3; }
.app-log-icon { position: relative; width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; margin-top: 1px; border-radius: 8px; color: #fff; background: #1683ee; font-size: 15px; font-weight: 700; }
.app-log-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2px; box-sizing: border-box; background: #fff; }
.app-log-icon.log-default-icon { color: #fff; background: #5f9f42; }
.app-log-icon.log-default-icon .workbench-icon { width: 22px; height: 22px; }
.app-log-body { min-width: 0; }
.app-log-head { display: flex; align-items: center; gap: 8px; min-height: 18px; }
.app-log-head strong { flex: 1; min-width: 0; overflow: hidden; color: #2f3742; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.app-log-delete { flex: 0 0 auto; padding: 0; border: 0; color: #ee3f68; background: transparent; font-size: 10px !important; cursor: pointer; }
.app-log-delete:hover { color: #c72b51; text-decoration: underline; }
.app-log-time { margin-top: 2px; color: #343b45; font-size: 10px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.app-log-value { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 8px; }
.app-log-value span { color: #8a929b; font-size: 10px; }
.app-log-value b { overflow-wrap: anywhere; color: #232a33; font-size: 12px; font-weight: 500; text-align: right; }
.event-value { margin-top: 7px; }
.event-value > span { display: block; margin-bottom: 3px; color: #768397; font-size: 9px; }
.event-value pre { max-height: 180px; margin: 0; padding: 8px; overflow: auto; border: 1px solid #e2e7ed; border-radius: 7px; color: #33465e; background: #f7f9fb; font: 9px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.loading-block { min-height: 250px; display: grid; place-items: center; color: #8d98a8; font-size: 12px; }

.modal { width: min(480px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(17,29,48,.5); backdrop-filter: blur(3px); }
.modal form { padding: 23px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal > form > p { font-size: 11px; line-height: 1.6; }
.modal textarea, .modal input { margin-top: 12px; }
.character-count { margin-top: 5px; color: #939dab; font-size: 9px; text-align: right; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.small-modal { width: min(420px, calc(100% - 28px)); }
.centered-confirm-modal { position: fixed; inset: 0; margin: auto; max-height: calc(100vh - 28px); }
.centered-confirm-modal > form > p { margin: 18px 0 0; color: #65738a; }
.toast-container { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 9px; }
.toast { min-width: 280px; max-width: 390px; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 9px; padding: 13px 14px; border: 1px solid #dce5ef; border-radius: 12px; background: #fff; box-shadow: 0 15px 40px rgba(28,45,69,.16); animation: toast-in .2s ease; font-size: 11px; }
.toast > span:first-child { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); }
.toast.error > span:first-child { background: var(--coral); }
.toast button { border: 0; color: #8a95a5; background: transparent; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

#command-progress-container { position: fixed; z-index: 110; top: 14px; left: 50%; display: grid; gap: 8px; width: min(520px, calc(100vw - 28px)); transform: translateX(-50%); pointer-events: none; }
.command-progress-toast { position: relative; overflow: hidden; grid-template-columns: 27px minmax(0, 1fr); min-width: 0; max-width: none; padding: 12px 16px 15px; border-color: #f0dfa0; color: #80600f; background: #fff9df; pointer-events: auto; }
.command-progress-toast > span:first-child { background: #d9a323; }
.command-progress-toast.success { border-color: #c6ead9; color: #16734d; background: #effbf5; }
.command-progress-toast.success > span:first-child { background: #24a36a; }
.command-progress-toast.failed { border-color: #f3c7c3; color: #a33d35; background: #fff3f1; }
.command-progress-toast.failed > span:first-child { background: var(--coral); }
.command-progress-track { position: absolute; right: 0; bottom: 0; left: 0; height: 4px; overflow: hidden; background: rgba(181, 138, 26, .13); }
.command-progress-track i { display: block; width: var(--command-progress, 0%); height: 100%; background: #dfae37; animation: command-progress-grow 22s cubic-bezier(.12,.68,.18,1) forwards; }
.command-progress-toast.success .command-progress-track i { background: #24a36a; animation: none; }
.command-progress-toast.failed .command-progress-track i { background: var(--coral); animation: none; }
@keyframes command-progress-grow { from { width: 4%; } to { width: var(--command-progress, 88%); } }

/* Reference-material navigation and inventory layout. */
#view-dashboard .metrics-grid { grid-template-columns: 1fr 1fr; }
.material-status-tabs { display: flex; align-items: center; gap: 3px; padding: 14px 16px 4px; }
.material-status-tabs button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 8px; color: #6f7b8c; background: #f4f5f7; font-size: 10px; }
.material-status-tabs button.active { color: #fff; background: var(--blue); box-shadow: 0 5px 13px rgba(30,126,232,.2); }
#view-devices .filter-bar { grid-template-columns: 130px 150px 130px 115px 140px minmax(180px,1fr) auto auto; }
#view-devices .filter-bar > input { min-width: 0; height: 39px; }
.device-summary-strip { display: flex; flex-wrap: wrap; gap: 7px; padding: 1px 16px 13px; }
.device-summary-strip span { padding: 6px 9px; border-radius: 6px; font-size: 9px; font-weight: 700; }
.device-summary-strip .blue { color: #236eae; background: #e7f3ff; }
.device-summary-strip .green { color: #17865e; background: #e8f8f0; }
.device-summary-strip .red { color: #bd4e63; background: #ffeaf0; }
.device-summary-strip .purple { color: #7451a7; background: #f0e9fb; }
.device-summary-strip .orange { color: #9b6f25; background: #fff2d6; }
#view-devices .device-table { min-width: 2200px; }
.realtime-icons { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.realtime-icons > i { width: 8px; height: 8px; border-radius: 50%; background: #d7dce3; }
.realtime-icons > i.on { background: #29ce83; box-shadow: 0 0 0 4px #e6faef; }
.realtime-icons span.enabled { color: #12a96d; }
.realtime-icons span.disabled { color: #d85a67; }
.realtime-icons span.unknown { color: #a8b0bc; }
.realtime-icons b { font-size: 18px; }
.network-quality { display: inline-flex; padding: 5px 8px; border-radius: 99px; color: #9b6f25; background: #fff4dc; font-size: 9px; white-space: nowrap; }
.network-quality.good { color: #17865e; background: #e7f8ef; }
.network-type-pill { display: inline-flex; padding: 5px 8px; border-radius: 8px; color: #7047a0; background: #f0e6fa; font-size: 9px; }
.package-cell { display: block; max-width: 190px; overflow-wrap: anywhere; }

.material-admin-head { padding-bottom: 10px; }
.material-admin-head h1 { margin: 0; font-size: 20px; }
.material-admin-filters { display: grid; grid-template-columns: 160px minmax(220px,1fr) auto auto; gap: 9px; padding: 0 16px 14px; }
.material-user-table { min-width: 1200px; }
.material-toggle { width: 39px; height: 22px; position: relative; padding: 0; border: 0; border-radius: 99px; background: #ccd3dc; }
.material-toggle i { width: 17px; height: 17px; position: absolute; top: 2.5px; left: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.material-toggle.on { background: #1683ee; }
.material-toggle.on i { transform: translateX(16px); }
.material-toggle:disabled { opacity: .7; }
.material-modal { width: min(760px, calc(100% - 28px)); }
.material-modal form, .build-modal form { max-height: min(820px, calc(100vh - 50px)); overflow-y: auto; }
.material-switch-row { height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-radius: 9px; background: #f5f6f8; }
.material-switch-row input { width: auto; margin: 0; }
.reserved-note, .reserved-module-banner { padding: 10px 12px; border: 1px solid #f1dda9; border-radius: 9px; color: #80652b; background: #fff8e7; font-size: 9px; line-height: 1.55; }

.build-filter-bar { grid-template-columns: 135px 140px 140px 160px 130px 140px minmax(170px,1fr) auto auto; }
.build-table { min-width: 1280px; }
.build-app-icon { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: #eef2f7; }
.build-app-fallback { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(135deg,#ec5796,#7547e8); font-weight: 800; }
.build-table .row-actions { flex-wrap: nowrap; white-space: nowrap; }
.build-action-link { padding: 3px 4px; border: 0; color: #1683ee; background: transparent; font-weight: 700; }
.build-action-link.target { color: #12ad6b; }
.build-action-link.placeholder { color: #d49b20; cursor: not-allowed; opacity: .62; }
.build-action-link:disabled { cursor: not-allowed; opacity: .45; }
.send-panel { padding: 14px 18px; }
.command-send-bar { grid-template-columns: 220px 180px minmax(200px,1fr) auto; }
.send-panel .muted { margin: 8px 2px 0; display: block; }
.build-summary { align-items: center; padding-top: 4px; }
.build-summary small { margin-left: auto; color: #8c96a5; }
.empty-state.compact { min-height: 250px; }
.build-modal { width: min(1120px, calc(100% - 28px)); }
.build-assets { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.build-assets > div { padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.asset-placeholder { min-height: 75px; display: grid; place-items: center; margin-top: 10px; overflow: hidden; border-radius: 10px; color: #8c97a5; background: #f3f5f8; font-size: 10px; text-align: center; overflow-wrap: anywhere; }
.asset-placeholder img { width: 100%; max-height: 120px; object-fit: contain; }
.asset-placeholder.wide { background: linear-gradient(135deg,#111,#f2f2f2); }
.form-section-title { margin: 20px 0 8px; padding-left: 10px; border-left: 4px solid var(--blue); }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row label { display: grid; gap: 7px; color: #667386; font-size: 10px; }
.build-toggle-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.build-toggle-grid label { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 13px; border-radius: 9px; background: #f3f4f6; font-size: 10px; }
.build-toggle-grid input { width: auto; margin: 0; }
.build-toggle-grid em, .build-target-grid em { color: #9d7a28; font-size: 9px; font-style: normal; }
.placeholder-control { color: #8792a1; background: #f8f3e8 !important; }
.build-target-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.build-target-grid label { min-height: 50px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: #f7f9fc; font-size: 10px; }
.build-target-grid input { width: auto; margin: 0; }
.build-details-content { max-height: min(820px, calc(100vh - 50px)); overflow-y: auto; padding: 23px; }
.build-order-hero { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(135deg,#f8fbff,#f8f7fd); }
.build-order-hero .build-app-icon, .build-order-hero .build-app-fallback { width: 62px; height: 62px; border-radius: 14px; }
.build-order-hero h3, .build-order-hero p { margin: 0; }
.build-order-hero p { margin-top: 5px; color: #788497; }
.build-order-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.build-order-badges span { padding: 4px 8px; border-radius: 99px; color: #556173; background: #fff; font-size: 9px; }
.build-detail-section { margin-top: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.build-detail-section h4 { margin: 0 0 5px; }
.build-detail-section > p { margin: 0 0 13px; color: #7c8a98; font-size: 9px; }
.artifact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.artifact-grid article { display: grid; gap: 8px; padding: 14px; border: 1px solid #bdebd6; border-radius: 10px; background: #f0fcf6; }
.artifact-grid article span { color: #7c8a98; font-size: 9px; }
.artifact-grid article button { min-height: 38px; border: 0; border-radius: 7px; color: #fff; background: #25d977; font-weight: 700; }
.artifact-grid article.waiting { border-color: #dde4ec; background: #f7f9fb; }
.artifact-grid article.failed { border-color: #f2c7cd; background: #fff5f6; }
.artifact-grid article.placeholder { border-color: #ebdfbf; background: #fffaf0; }
.artifact-grid article button:disabled { cursor: not-allowed; background: #aeb8c5; }
.artifact-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.artifact-card-head em { padding: 3px 7px; border-radius: 99px; color: #148b5b; background: #d8f8e7; font-size: 8px; font-style: normal; }
.artifact-card-head em.placeholder { color: #95701c; background: #fff0c7; }
.artifact-actions { display: flex; gap: 8px; }
.artifact-actions button { flex: 1; }
.build-progress { display: grid; grid-template-columns: auto 1fr auto 1fr auto 1fr auto; align-items: center; gap: 12px; }
.build-progress > div { display: grid; justify-items: center; gap: 6px; min-width: 72px; }
.build-progress > div b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #9aa5b2; }
.build-progress > div.done b { background: #2bd785; }
.build-progress > div.current b { background: #1683ee; box-shadow: 0 0 0 6px #e5f1ff; }
.build-progress > div.failed b { background: #e05263; }
.build-progress > i { height: 2px; background: #dce3ea; }
.build-progress > i.done { background: #2bd785; }
.build-resource-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.build-resource-list span { padding: 6px 9px; border-radius: 8px; color: #536175; background: #f1f4f8; font-size: 9px; }
.build-empty-note { padding: 13px; border-radius: 9px; color: #6d7888; background: #f5f7fa; font-size: 10px; }

/* Full-width device workbench, matched to the device-terminal reference. */
.device-drawer { width: min(1500px, calc(100vw - 28px)); }
.drawer-content { padding: 14px; }
body.device-detail-page { overflow: hidden; }
body.device-detail-page #sidebar,
body.device-detail-page .page-shell,
body.device-detail-page .drawer-backdrop { display: none !important; }
body.device-detail-page .device-drawer { inset: 0; width: 100vw; height: 100vh; transform: none; box-shadow: none; transition: none; }
body.device-detail-page .drawer-head { display: none; }
body.device-detail-page .drawer-content { height: 100vh; padding: 0; background: #f3f5f7; }
.device-detail-top { min-height: 72px; display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: stretch; border-bottom: 1px solid #e2e5e9; background: #fff; }
.device-detail-top .detail-hero { min-width: 0; gap: 9px; padding: 9px 12px; border-right: 1px solid #eceef1; border-radius: 0; color: #253246; background: #fff; }
.device-detail-top .detail-hero .device-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 7px; color: #fff; background: #145c3d; font-size: 13px; box-shadow: 0 3px 8px rgba(20,92,61,.2); }
.device-detail-top .detail-hero h3 { margin: 0; color: #246b48; font-size: 13px; line-height: 1.1; }
.device-detail-top .detail-hero p { margin: 0 0 3px; color: #7d8792; font-size: 8px; }
.device-detail-top .detail-hero small { color: #2c8b5d; font-size: 8px; white-space: nowrap; }
.device-detail-top .detail-hero .status-badge { display: none; }
.device-identity { min-width: 72px; }
.hero-connectivity { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; color: #7d8792; font-size: 8px; }
.hero-connectivity span { white-space: nowrap; }
.hero-connectivity b { color: #263447; }
.hero-connectivity em { padding: 4px 8px; border-radius: 999px; color: #16714c; background: #dff5e9; font-size: 8px; font-style: normal; font-weight: 800; }
.workbench-toolbar { min-width: 0; display: grid; grid-template-columns: minmax(120px,1.25fr) 82px 82px minmax(120px,1.1fr) minmax(120px,1.1fr) 120px minmax(120px,1fr) 112px; align-items: end; gap: 7px; margin: 0; padding: 8px 10px; border: 0; border-radius: 0; background: #fff; font-size: 8px; }
.workbench-toolbar label { min-width: 0; display: grid; align-content: end; gap: 5px; color: #737d89; }
.workbench-toolbar input:not([type="range"]), .workbench-toolbar select { width: 100%; height: 27px; padding: 0 8px; border: 0; border-radius: 4px; background: #f6f7f8; font-size: 9px; }
.workbench-toolbar input:disabled, .workbench-toolbar select:disabled { color: #273342; opacity: 1; }
.toolbar-range { height: 27px; display: flex; align-items: center; gap: 5px; padding: 0 4px; border-radius: 4px; background: #f6f7f8; }
.workbench-toolbar input[type="range"] { min-width: 45px; width: 100%; height: auto; padding: 0; accent-color: #1683ee; }
.workbench-toolbar output { min-width: 31px; color: #3c4756; font-size: 8px; font-variant-numeric: tabular-nums; }
.workbench-toolbar .primary-button { width: 100%; min-height: 27px; padding: 0 10px; border-radius: 5px; box-shadow: none; font-size: 9px; }
.device-workbench { display: grid; grid-template-columns: minmax(330px,1.28fr) minmax(145px,.55fr) minmax(270px,1.08fr) minmax(170px,.65fr) minmax(270px,1.08fr); gap: 6px; margin: 6px 0 0; padding: 0 4px 4px; align-items: stretch; transform-origin: top left; }
.workbench-data-panel, .overlay-mode-panel, .remote-stage-panel, .remote-control-panel { height: calc(100vh - 82px); min-height: 590px; overflow: hidden; border: 1px solid #e4e7eb; border-radius: 3px; background: #fff; box-shadow: 0 1px 3px rgba(24,39,61,.04); }
.device-workbench button, .device-workbench input, .device-workbench select, .device-workbench textarea, .device-workbench strong, .device-workbench p, .device-workbench th, .device-workbench td { font-size: var(--wb-control-font); }
.device-workbench small, .device-workbench span, .device-workbench label, .device-workbench em { font-size: var(--wb-small-font); }
.device-workbench.theme-light { padding: 8px; border-radius: 14px; background: #f8fbff; }
.device-workbench.theme-dark { padding: 8px; border-radius: 14px; color: #e6ebf2; background: #18202b; }
.device-workbench.theme-dark .workbench-data-panel, .device-workbench.theme-dark .overlay-mode-panel, .device-workbench.theme-dark .remote-stage-panel, .device-workbench.theme-dark .remote-control-panel, .device-workbench.theme-dark button { color: #e6ebf2; border-color: #3b4655; background: #222c39; }
.device-workbench.theme-dark input, .device-workbench.theme-dark select, .device-workbench.theme-dark textarea, .device-workbench.theme-dark .detail-item, .device-workbench.theme-dark pre { color: #e6ebf2; border-color: #455164; background: #18202b; }
.workbench-tabs { min-height: 38px; display: flex; overflow-x: auto; border-bottom: 1px solid #e6e9ed; }
.workbench-tabs button { flex: 1 0 auto; min-height: 38px; padding: 0 9px; border: 0; border-bottom: 2px solid transparent; color: #687485; background: transparent; font-size: 9px; }
.workbench-tabs button.active { color: #2175cb; border-bottom-color: #217ee0; background: #f8fbff; }
.workbench-panel { position: relative; display: none; padding: 10px; }
.workbench-panel.active { display: block; }
.workbench-panel > .search-box { margin: 10px 0; }
.log-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.log-toolbar .material-status-tabs { flex: 1; padding: 0; flex-wrap: wrap; }
.log-toolbar > button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin-left: auto; white-space: nowrap; }
.log-toolbar > button .workbench-icon { width: 16px; height: 16px; }
.workbench-loading-overlay { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; align-content: center; gap: 15px; color: #313943; background: rgba(91,96,102,.56); backdrop-filter: blur(1px); }
.workbench-loading-overlay i { width: 45px; height: 45px; border: 4px solid rgba(255,255,255,.65); border-top-color: #147fe8; border-radius: 50%; animation: spin .78s linear infinite; }
.workbench-loading-overlay span { font-size: 16px; font-weight: 500; }
.device-workbench.theme-dark .workbench-loading-overlay { color: #f1f5f9; background: rgba(5,10,16,.68); }
.device-workbench button.command-loading { position: relative; color: transparent !important; cursor: progress; opacity: 1; }
.device-workbench button.command-loading > * { visibility: hidden; }
.device-workbench button.command-loading::before { content: ""; position: absolute; z-index: 2; top: 50%; left: 50%; width: 18px; height: 18px; margin: -11px 0 0 -11px; border: 2px solid rgba(113,128,145,.35); border-top-color: #147fe8; border-radius: 50%; animation: spin .72s linear infinite; }
.device-workbench .wide-control.command-loading::before,
.device-workbench .control-toggle.command-loading::before,
.device-workbench .control-list-button.command-loading::before { left: calc(50% - 32px); }
.device-workbench .wide-control.command-loading::after,
.device-workbench .control-toggle.command-loading::after,
.device-workbench .control-list-button.command-loading::after { content: "加载中…"; position: absolute; z-index: 2; top: 50%; left: calc(50% - 16px); color: #405066; font-size: 12px; font-weight: 600; line-height: 1; transform: translateY(-50%); white-space: nowrap; }
.device-workbench .green.command-loading::after { color: #20875f; }
.device-workbench.theme-dark button.command-loading::after { color: #e6ebf2; }
.module-placeholder { min-height: calc(100vh - 175px); display: grid; place-items: center; align-content: center; gap: 9px; text-align: center; }
.module-placeholder > * { margin: 0; }
.module-placeholder.has-data { min-height: 0; display: block; text-align: left; }
.module-placeholder.has-data > .empty-icon, .module-placeholder.has-data > h3, .module-placeholder.has-data > button { display: none; }
.module-placeholder code { max-width: 95%; padding: 7px; border-radius: 7px; color: #586a81; background: #f1f4f7; overflow-wrap: anywhere; font-size: 8px; }
.module-result { width: min(100%, 560px); max-height: 300px; overflow: auto; text-align: left; }
.module-result.structured-result { max-height: 510px; }
.workbench-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.workbench-list-heading h4 { margin: 0; }
.workbench-list-heading button { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.workbench-list-heading .workbench-icon { width: 15px; height: 15px; }
.module-result pre { margin: 0; padding: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; color: #304057; background: #f7f9fb; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.permission-header { display: flex; align-items: center; gap: 15px; }
.permission-header h3 { margin-right: auto; }
.permission-header small { color: #8993a2; font-weight: 400; }
.permission-list { display: grid; gap: 8px; margin: 15px 0; }
.permission-row { min-height: 55px; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid #e0e4e9; border-left: 4px solid #cbd1d8; border-radius: 9px; }
.permission-row.enabled { border-color: #bfead7; border-left-color: #27c77e; }
.permission-row > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: #667384; background: #edf0f3; }
.permission-row.enabled > span { color: #1db976; background: #e1f8ed; }
.permission-row em { color: #8993a2; font-size: 9px; font-style: normal; }
.permission-header .permission-heading-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; color: #1674e8; background: #e7f0fd; }
.permission-header h3 { margin: 0; font-size: 14px; }
.permission-header h3 small { margin-left: 6px; font-size: 11px; }
.permission-header p { margin: 4px 0 0; color: #8993a2; font-size: 11px; }
.permission-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 14px 0; }
.permission-toolbar .permission-summary { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 auto 0 0; font-size: 11px; }
.permission-toolbar .permission-summary > * { padding: 3px 6px; border-radius: 5px; font-weight: 400; background: #eef0f3; color: #88909b; }
.permission-toolbar .permission-summary .permission-count-enabled { color: #22b881; background: #e1f6eb; }
.permission-toolbar .permission-summary .permission-count-disabled { color: #d49d32; background: #fff1d7; }
.permission-automation { display: inline-flex; align-items: center; gap: 4px; color: #6e7785; font-size: 11px; white-space: nowrap; }
.permission-automation input { width: 13px; height: 13px; margin: 0; }
.permission-automation small { font-size: 10px; color: #929baa; }
.permission-refresh { min-height: 27px; padding: 0 5px; border: 0; color: #6e7785; background: transparent; font-size: 11px; white-space: nowrap; }
.permission-row > em { padding: 3px 7px; border-radius: 10px; background: #eef0f3; white-space: nowrap; }
.permission-row.enabled > em { color: #20b983; background: #e0f7ed; }
.permission-row.unknown { border-left-color: #e4b85c; }
.permission-authorize-link { min-height: 28px; padding: 0; border: 0; color: #7e8898; background: transparent; font-size: 11px; white-space: nowrap; }
.permission-authorize-link:hover { color: var(--blue); }
.legacy-permission-row { display: none !important; }
.permission-extra-actions { display: grid; gap: 6px; }
.permission-extra-actions button { min-height: 33px; border: 1px solid; border-radius: 8px; font-size: 11px; font-weight: 600; opacity: 1; cursor: not-allowed; }
.permission-extra-actions small { margin-left: 8px; font-size: 10px; font-weight: 400; }
.permission-test { border-color: #f3dcaf !important; color: #a57f39; background: #fff3df; }
.permission-recents { border-color: #b6d5f7 !important; color: #517fae; background: #deedfd; }
.permission-feedback .loading-block, .permission-report-time { margin: 9px 0 0; padding: 0; min-height: 0; color: #8993a2; font-size: 11px; line-height: 1.6; }
.overlay-mode-panel { display: flex; flex-direction: column; gap: 12px; padding: 12px 9px; }
.overlay-mode-panel > strong { padding-bottom: 9px; border-bottom: 1px solid #eceef1; color: #303a47; }
.overlay-mode-panel select { width: 100%; min-height: 35px; }
.overlay-mode-panel small { color: #8993a2; line-height: 1.5; }
.remote-stage-panel { position: relative; display: grid; place-items: center; align-content: start; padding: 8px 9px 12px; background: #eef0f2; }
.overlay-picker { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.overlay-picker select { width: 150px; height: 35px; }
.phone-frame { width: min(270px,96%); height: calc(100vh - 112px); min-height: 545px; max-height: 640px; aspect-ratio: auto; position: relative; padding: 6px; border: 5px solid #050505; border-radius: 29px; background: #050505; box-shadow: 0 9px 18px rgba(0,0,0,.16); }
.phone-camera { width: 8px; height: 8px; position: absolute; z-index: 1; top: 10px; left: calc(50% - 4px); border-radius: 50%; background: #111; }
.phone-screen { height: 100%; position: relative; display: grid; place-items: center; align-content: center; gap: 10px; overflow: hidden; border-radius: 19px; color: #627083; background: #fff; text-align: center; }
.phone-screen.ui-tree-has-navigation { border-bottom-right-radius: 0; border-bottom-left-radius: 0; }
.phone-screen small { max-width: 190px; line-height: 1.5; }
.phone-screen button { padding: 8px 12px; border: 1px solid #d9dee5; border-radius: 8px; background: #f7f8fa; }
.inline-screen-waiting { display: grid; place-items: center; gap: 10px; padding: 12px; }
.phone-screen > [data-inline-screen-frame] { width: 100%; height: 100%; object-fit: contain; border-radius: 19px; background: #111; }
.remote-stage-panel > .screen-input-bar { width: min(270px,96%); margin-top: 6px; }
.remote-stage-panel > .screen-input-bar input { flex: 1; color: #263548; border-color: #d4dde7; background: #fff; }
.phone-screen > .inline-screen-stop { position: absolute; z-index: 2; right: 10px; bottom: 10px; color: #fff; border-color: rgba(255,255,255,.35); background: rgba(13,20,30,.75); }
.remote-control-panel { padding: 11px 10px; overflow-y: auto; }
.remote-state { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wide-control { width: 100%; min-height: 43px; margin: 5px 0; border: 1px solid #dce4ec; border-radius: 10px; color: #58687b; background: #f7f9fb; font-weight: 700; }
.wide-control.green { color: #20875f; border-color: #bde8d5; background: #e9f9f1; }
.inline-controls { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.inline-controls button { min-height: 38px; border: 1px solid #dce4ec; border-radius: 9px; background: #fff; }
.control-toggle, .control-list-button { width: 100%; min-height: 59px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 4px; border: 0; border-bottom: 1px solid #eef0f3; background: #fff; text-align: left; }
.control-toggle div, .control-list-button div { display: grid; gap: 4px; }
.control-toggle small, .control-list-button small { color: #8b95a4; font-size: 8px; }
.control-toggle > i { width: 36px; height: 20px; position: relative; border-radius: 99px; background: #d2d8df; }
.control-toggle > i::after { content: ""; width: 16px; height: 16px; position: absolute; top: 2px; left: 2px; border-radius: 50%; background: #fff; }
.control-toggle > i.on { background: #1683ee; }
.control-toggle > i.on::after { transform: translateX(16px); }
.control-list-button > span { width: 30px; color: var(--blue); text-align: center; font-size: 18px; }
.lock-screen-control > div { flex: 1; }
.lock-state-pill { flex: none; padding: 3px 7px; border-radius: 999px; color: #64748b; background: #eef2f6; font-size: 9px; font-style: normal; font-weight: 700; }
.lock-state-pill.locked { color: #9b2c2c; background: #fee2e2; }
.lock-state-pill.pending { color: #8a5b08; background: #fff1c2; }
.lock-screen-control:disabled { cursor: not-allowed; opacity: .72; }
.camera-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.camera-actions button { padding: 8px 12px; border: 0; border-radius: 8px; color: #fff; background: var(--blue); }
.camera-copy { display: grid; gap: 3px; margin-top: 18px; }
.camera-copy small { color: #8993a2; }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-section-head h4 { margin: 0; }
.stage-label { width: min(270px,96%); min-height: 26px; display: flex; align-items: center; justify-content: space-between; color: #596779; font-size: 10px; font-weight: 700; }
.stage-label button { padding: 3px 7px; border: 1px solid #d9e2ec; border-radius: 5px; color: #3774a8; background: #fff; cursor: pointer; }
.ui-tree-screen { display: block; container-type: size; color: #263548; background: #fff; }
.ui-tree-canvas { position: absolute; top: 50%; left: 50%; width: min(100cqw, calc(100cqh * var(--ui-tree-ratio))); aspect-ratio: var(--ui-tree-ratio); transform: translate(-50%, -50%); container-type: inline-size; overflow: hidden; background: #fff; text-align: left; }
.ui-tree-node { position: absolute; display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 0; min-height: 0; overflow: hidden; padding: .08cqw .25cqw; border: 0; border-radius: 4px; color: #263548; background: transparent; white-space: nowrap; line-height: 1.15; pointer-events: none; }
.ui-tree-control { background: #f3f7fc; box-shadow: inset 0 0 0 1px #dce5ef; }
.ui-tree-editable { justify-content: flex-start; padding-right: 10px; padding-left: 10px; border-radius: 3px; background: #fff; box-shadow: inset 0 0 0 1.5px #718096; text-align: left !important; }
.ui-tree-hint { color: #778394; }
.ui-tree-disabled { opacity: .4; filter: grayscale(.65); }
.device-workbench .phone-screen .ui-tree-node { font-size: max(8px, var(--ui-tree-font-size)); }
.device-workbench .phone-screen .ui-tree-node.ui-tree-multiline { font-size: max(7px, var(--ui-tree-font-size)); }
.device-workbench .phone-screen .ui-tree-label { display: block; width: 100%; max-width: 100%; overflow: hidden; font-size: inherit; line-height: inherit; text-align: inherit; text-overflow: clip; white-space: nowrap; pointer-events: none; }
.device-workbench .phone-screen .ui-tree-multiline { align-items: flex-start; white-space: normal; }
.device-workbench .phone-screen .ui-tree-multiline .ui-tree-label { overflow-wrap: anywhere; white-space: normal; }
.ui-tree-icon-node { gap: .25cqw; }
.ui-tree-icon-placeholder { display: grid; flex: 0 0 auto; place-items: center; width: min(70%, 1.35em); aspect-ratio: 1; border-radius: 4px; color: #fff; background: #526579; font-size: .72em; font-weight: 700; line-height: 1; pointer-events: none; }
.ui-tree-icon-node .ui-tree-label { flex: 1 1 auto; width: auto; min-width: 0; }
.ui-tree-system-layer { position: absolute; box-sizing: border-box; pointer-events: none; }
.ui-tree-status-bar, .ui-tree-status-bar time, .ui-tree-empty, .ui-tree-navigation-glyph, .ui-tree-navigation-label { pointer-events: none; }
.ui-tree-disabled-shake { animation: ui-tree-disabled-shake .3s ease-in-out; }
@keyframes ui-tree-disabled-shake { 0%,100% { translate: 0; } 25% { translate: -3px; } 75% { translate: 3px; } }
.ui-tree-debug-overlay { position: absolute; z-index: 300000; inset: 0; pointer-events: none; }
.ui-tree-debug-bounds { position: absolute; box-sizing: border-box; border: 2px solid #ff3b30; background: rgba(255,59,48,.12); pointer-events: none; }
.ui-tree-debug-overlay output { position: absolute; z-index: 1; right: 2%; bottom: 2%; left: 2%; display: grid; gap: 2px; max-height: 42%; box-sizing: border-box; overflow: hidden; padding: 7px; border-radius: 6px; color: #fff; background: rgba(15,23,42,.9); font: max(8px,2.4cqw)/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; pointer-events: none; }
.ui-tree-system-layer.status { background: rgba(226,231,237,.92); box-shadow: inset 0 -1px rgba(110,124,142,.12); }
.ui-tree-system-layer.navigation { border-radius: 0; background: #0c0d0f; }
.ui-tree-system-navigation { flex-direction: row; gap: .45em; padding: 0 .2em; border-radius: 0; color: #f5f7f9; background: transparent; box-shadow: none; cursor: pointer; pointer-events: auto; }
.ui-tree-system-navigation .ui-tree-navigation-glyph { width: auto; aspect-ratio: auto; color: #f5f7f9; background: transparent; font-size: 1.35em; font-weight: 400; line-height: 1; }
.ui-tree-system-navigation .ui-tree-navigation-label { flex: 0 0 auto; width: auto; max-width: none; overflow: visible; color: inherit; font-size: .9em; line-height: 1; text-overflow: clip; white-space: nowrap; }
.ui-tree-empty { position: absolute; inset: 0; display: grid; place-items: center; box-sizing: border-box; padding: 16px; color: #8d9299; text-align: center; }
.ui-tree-raw-report { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; box-sizing: border-box; overflow: hidden; padding: 12px; color: #475569; background: #fff; text-align: center; }
.ui-tree-raw-report strong { max-width: 100%; font-size: 11px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.ui-tree-raw-report pre { width: 100%; max-width: 100%; max-height: 62%; box-sizing: border-box; overflow: auto; margin: 0; padding: 8px; border: 1px solid #e7edf3; border-radius: 7px; color: #475569; background: #f8fafc; font: 9px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.ui-tree-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #69798c; background: #fff; }
.ui-tree-placeholder.screen-off { color: #a6abb3; background: #111; }
.ui-tree-placeholder .ui-tree-placeholder-copy { display: block; position: static; max-width: 90%; margin: 12px; color: #64748b; font-weight: 400; letter-spacing: 0; text-align: center; line-height: 1.6; }
.ui-tree-clock { position: absolute; top: 17%; right: 0; left: 0; display: grid; justify-items: center; gap: 15px; color: #344256; font-variant-numeric: tabular-nums; }
.ui-tree-clock > div { display: flex; align-items: baseline; justify-content: center; }
.ui-tree-clock span, .device-detail-page .device-workbench .ui-tree-clock span { font-size: clamp(36px, 3.25vw, 62px); font-weight: 300; line-height: 1; letter-spacing: 0; }
.ui-tree-clock small, .device-detail-page .device-workbench .ui-tree-clock small { max-width: none; margin-left: 2px; color: #64748b; font-size: clamp(14px, 1.15vw, 22px); font-weight: 300; line-height: 1; }
.ui-tree-clock time { color: #64748b; font-size: clamp(10px, .68vw, 13px); letter-spacing: 0; }
.ui-tree-clock.compact { top: 4%; gap: 5px; color: #334155; pointer-events: none; }
.ui-tree-clock.compact span, .device-detail-page .device-workbench .ui-tree-clock.compact span { font-size: clamp(22px, 2vw, 36px); }
.ui-tree-clock.compact small, .device-detail-page .device-workbench .ui-tree-clock.compact small { font-size: clamp(12px, .9vw, 16px); }
.ui-tree-placeholder.screen-off .ui-tree-clock { top: 22cqh; right: auto; left: 50%; width: 90cqw; gap: 2cqh; color: #eef0f3; transform: translate(-50%, -50%); }
.ui-tree-placeholder.screen-off .ui-tree-clock span,
.device-detail-page .device-workbench .ui-tree-placeholder.screen-off .ui-tree-clock span { font-size: 18cqw; font-weight: 300; }
.ui-tree-placeholder.screen-off .ui-tree-clock small,
.device-detail-page .device-workbench .ui-tree-placeholder.screen-off .ui-tree-clock small { margin-left: 1cqw; color: #9da3ad; font-size: 7cqw; }
.ui-tree-placeholder.screen-off .ui-tree-clock time { color: #b8bdc5; font-size: 4.5cqw; line-height: 1.2; }
.ui-tree-screen-off-actions { position: absolute; top: 70cqh; left: 50%; display: grid; justify-items: center; gap: 2cqh; width: 90cqw; max-width: 90cqw; transform: translate(-50%, -50%); }
.ui-tree-screen-off-actions > small { max-width: 90cqw; color: #a6abb3; font-size: 3.6cqw; line-height: 1.4; text-align: center; white-space: normal; }
.ui-tree-placeholder.screen-off .ui-tree-screen-off-actions > button { width: min(62cqw, 90cqw); max-width: 90cqw; box-sizing: border-box; padding: 1.7cqh 5cqw; border: max(.25cqw, 1px) solid #777e89; border-radius: 8cqw; color: #e3e6ea; background: transparent; font-size: 4cqw; line-height: 1.2; }
.ui-tree-placeholder.screen-off .ui-tree-screen-off-actions > button:disabled { opacity: .45; }
.ui-tree-locked-content { position: absolute; top: 21%; right: 0; bottom: 0; left: 0; container-type: size; }
.auxiliary-status { width: min(270px,96%); margin-top: 5px; color: #7a8796; text-align: center; }
.auxiliary-status.warning { color: #946200; background: #fff4ce; }
.auxiliary-status.danger, .auxiliary-status.disconnected { color: #b42318; background: #ffebe9; }
.auxiliary-status.paused { color: #747b85; background: transparent; }
.screen-text-dock, .screen-snapshot-dock { width: min(270px,96%); margin-top: 6px; color: #64748b; font-size: 9px; }
.screen-text-dock summary, .screen-snapshot-dock summary { cursor: pointer; }
.screen-snapshot-dock [data-action-result="screenshot"] { max-height: 190px; overflow: auto; padding: 5px; border-radius: 7px; background: #fff; }
.screen-snapshot-dock .action-result-image { max-height: 160px; }
.device-detail-page .detail-section { margin: 8px 4px 14px; border-radius: 4px; }
.action-media-result { margin-top: 12px; }
.action-result-image { width: 100%; height: 100%; max-height: 480px; object-fit: contain; border-radius: 14px; }
.phone-screen > .action-result-image { max-height: none; }
.phone-screen > .action-result-note { max-width: none; position: absolute; z-index: 2; right: 8px; bottom: 8px; left: 8px; padding: 7px 9px; border-radius: 8px; color: #fff; background: rgba(27, 39, 56, .82); backdrop-filter: blur(4px); }
.phone-screen > .action-result-note.delayed { color: #fff4d2; background: rgba(110, 71, 5, .88); }
.phone-screen > .action-result-note.failed { color: #ffe5e5; background: rgba(126, 34, 34, .88); }
.action-result-wait-delayed { color: #8a5b08; }
.phone-screen pre { width: 90%; max-height: 75%; overflow: auto; margin: 0; padding: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-cards, .contact-list { display: grid; gap: 9px; }
.app-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 12px; }
.message-card { position: relative; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; }
.message-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.message-card p { margin: 10px 0; line-height: 1.55; }
.message-card > small { color: #8b95a4; }
.message-card > button { position: absolute; right: 10px; bottom: 8px; border: 0; color: var(--blue); background: transparent; }
.module-tools { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; margin-bottom: 10px; }
.module-tools > * { min-width: 0; height: 35px; }
.app-card { display: grid; grid-template-columns: 52px minmax(0,1fr); align-items: center; gap: 10px 12px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.app-icon { position: relative; width: 52px; height: 52px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; color: #fff; background: var(--blue); font-weight: 800; }
.app-icon img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 3px; object-fit: contain; box-sizing: border-box; background: #f5f7fa; }
.app-card-copy { min-width: 0; display: grid; gap: 3px; }
.app-card small { overflow: hidden; color: #7f8b9c; text-overflow: ellipsis; }
.app-card span { color: #9aa4b2; }
.app-card-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; padding-top: 2px; }
.app-card-actions button, .contact-list button, .module-table button, .clipboard-panel button { min-height: 30px; padding: 0 9px; border: 1px solid #dbe3eb; border-radius: 7px; background: #fff; }
.module-link { display: inline-flex; min-height: 30px; align-items: center; padding: 0 9px; border: 1px solid #dbe3eb; border-radius: 7px; color: var(--blue); background: #fff; text-decoration: none; }
.app-card-actions button.danger { color: #c94a58; }
.permission-summary { display: flex; gap: 8px; margin: 10px 0; }
.permission-summary > * { padding: 7px 10px; border-radius: 8px; background: #f0f4f8; }
.gallery-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.gallery-grid article { min-width: 0; display: grid; gap: 5px; }
.gallery-grid img, .gallery-placeholder { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; background: #edf1f5; }
.gallery-placeholder { display: grid; place-items: center; color: #94a0b0; font-size: 22px; }
.gallery-grid strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-grid small { color: #8b95a4; }
.contact-list article { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 9px; border-bottom: 1px solid var(--line); }
.contact-list article > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #66a4ea; }
.contact-list article > div { display: grid; gap: 3px; }
.file-path { margin: 8px 0; color: #65758a; }
.module-table { width: 100%; border-collapse: collapse; }
.module-table th, .module-table td { padding: 9px; border-bottom: 1px solid var(--line); text-align: left; }
.clipboard-panel { display: grid; gap: 12px; }
.clipboard-panel label { display: grid; gap: 7px; }
.clipboard-panel textarea { min-height: 90px; resize: vertical; }
.clipboard-panel > div { display: flex; gap: 7px; }
.module-detail-grid { margin-top: 10px; }

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: 1fr 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .flow-panel { grid-template-columns: 1fr 1fr; }
  .flow-panel > i { display: none; }
  .account-grid { grid-template-columns: 1fr; }
  .create-account-panel { position: static; }
  #view-devices .filter-bar { grid-template-columns: repeat(3,1fr); }
  .device-workbench { grid-template-columns: 1fr 1fr; }
  .workbench-data-panel { grid-column: 1 / -1; }
  .overlay-mode-panel { min-height: 180px; }
  .build-toggle-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; max-width: 440px; }
  .login-intro { display: none; }
  .mobile-brand { display: flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 244px; box-shadow: 20px 0 50px rgba(27,43,67,.18); transition: transform .23s; }
  .sidebar.open { transform: none; }
  .menu-button { display: grid; }
  .connection-chip b { display: none; }
  .content-grid, .system-grid, .management-grid, .template-grid { grid-template-columns: 1fr; }
  .device-workbench, .build-assets, .form-row.three { grid-template-columns: 1fr; }
  .workbench-data-panel { grid-column: auto; }
  .material-admin-filters, .build-filter-bar { grid-template-columns: 1fr 1fr; }
  .build-target-grid, .build-toggle-grid { grid-template-columns: 1fr 1fr; }
  .artifact-grid { grid-template-columns: 1fr; }
  .build-progress { gap: 6px; }
  .capability-protocol-grid { grid-template-columns: 1fr; }
}

@media (max-width: 590px) {
  .login-screen { padding: 14px; }
  .login-card { padding: 30px 24px; border-radius: 20px; }
  .topbar { height: 68px; padding: 0 15px; }
  .topbar-kicker, .user-menu > div:last-child, .connection-chip { display: none; }
  .main-content { padding: 17px 14px 30px; }
  .hero-card { min-height: 220px; align-items: flex-start; flex-direction: column; padding: 27px; }
  .hero-card h1 { font-size: 25px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 132px; padding: 18px; }
  .metric-card strong { font-size: 27px; }
  .metric-icon { width: 35px; height: 35px; top: 15px; right: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar select { grid-column: auto; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px 16px; }
  .recent-device { grid-template-columns: 38px 1fr auto; }
  .recent-device > div:nth-child(3), .recent-device > div:nth-child(4) { display: none; }
  .detail-grid, .command-grid { grid-template-columns: 1fr; }
  .system-card { grid-template-columns: 42px 1fr; }
  .system-card .status-pill { grid-column: 2; }
  .capability-summary { grid-template-columns: 1fr; }
  .capability-legend { width: 100%; }
  .command-filters, .compact-form, .form-row { grid-template-columns: 1fr; }
  .screen-modal-footer p { display: none; }
  .template-list { grid-template-columns: 1fr; }
  .toast-container { right: 12px; left: 12px; bottom: 12px; }
  .toast { min-width: 0; width: 100%; }
  #command-progress-container { top: 10px; width: calc(100vw - 24px); }
  .command-progress-toast { width: 100%; }
}

/* Keep inventory navigation usable with macOS overlay scrollbars. */
.device-id-link { max-width: 175px; padding: 0; border: 0; color: var(--blue); background: transparent; text-align: left; cursor: pointer; }
.device-id-link:hover { text-decoration: underline; }
.device-owner-button { display: flex; align-items: center; gap: 4px; max-width: 175px; margin-top: 6px; padding: 3px 8px; border: 0; border-radius: 6px; color: #7c3aed; background: #f3e8ff; font-size: 11px; cursor: pointer; }
.device-owner-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-owner-button svg { flex: none; width: 13px; height: 13px; fill: currentColor; }
.device-owner-button:hover { background: #e9d5ff; }
.device-owner-button:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
/* Draw a permanent scrollbar so the OS cannot hide it while idle. */
.device-table-wrap {
  overflow-x: auto;
  scrollbar-width: none;
}
.device-table-wrap::-webkit-scrollbar { display: none; }
.device-scrollbar { position: relative; height: 14px; margin: 0 3px; border-radius: 7px; background: #edf1f5; touch-action: none; user-select: none; }
.device-scrollbar-thumb { position: absolute; top: 2px; left: 0; height: 10px; min-width: 32px; border-radius: 5px; background: #8f9cac; cursor: default; }
.device-scrollbar-thumb:hover, .device-scrollbar.dragging .device-scrollbar-thumb { background: #647187; }
.device-scrollbar:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.device-scrollbar[aria-disabled="true"] .device-scrollbar-thumb { opacity: .4; }
.session-recovery { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }

/* Auxiliary controls must outrank the workbench's generic button/span rules. */
body .device-workbench .phone-screen button.ui-tree-system-navigation {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: .3em; padding: 0; margin: 0; min-width: 0; min-height: 0;
  border: 0; border-radius: 0; color: #f5f7f9; background: #0c0d0f;
  box-shadow: none; font-size: max(8px, var(--ui-tree-font-size)); line-height: 1;
  overflow: visible; white-space: nowrap; pointer-events: auto;
}
body .device-workbench .phone-screen .ui-tree-system-navigation .ui-tree-navigation-label,
body .device-workbench .phone-screen .ui-tree-system-navigation .ui-tree-navigation-glyph {
  display: block; flex: 0 0 auto; width: auto; max-width: none; padding: 0;
  overflow: visible; color: inherit; background: transparent; font-size: inherit; line-height: 1;
}
body .device-workbench .phone-screen .ui-tree-status-bar {
  position: absolute; top: 0; left: 0; width: 100%; z-index: 190000;
  display: flex; align-items: center; box-sizing: border-box; padding: 0 6%;
  color: #f5f7f9; background: #171a20; font-size: max(8px, 3cqw); pointer-events: none;
}
body .device-workbench .phone-screen .ui-tree-status-bar time { font-size: inherit; line-height: 1; }
body .device-workbench .phone-screen .ui-tree-icon-placeholder svg {
  width: 85%; height: 85%; fill: none; stroke: currentColor; stroke-width: 2;
}
body .device-workbench .phone-screen .ui-tree-icon-node .ui-tree-icon-placeholder { font-size: .72em; }
body .device-workbench .phone-screen .ui-tree-icon-node .ui-tree-label { flex: 1 1 auto; width: auto; }
.auxiliary-toolbar { display: flex; gap: 4px; }
.ui-tree-canvas { touch-action: none; user-select: none; overscroll-behavior: contain; }
.screen-gesture-trail {
  position: absolute; z-index: 300000; height: 4px; border-radius: 3px;
  background: rgba(34, 121, 245, .5); transform-origin: 0 50%; pointer-events: none;
}
.screen-gesture-trail::after {
  content: ''; position: absolute; right: 0; top: -3px; width: 8px; height: 8px;
  border-top: 2px solid rgba(34,121,245,.7); border-right: 2px solid rgba(34,121,245,.7); transform: rotate(45deg);
}
