:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  color: #111c2f;
  background: #f3f6fb;
  --navy: #0c1729;
  --navy-2: #12213a;
  --navy-3: #1a2c4b;
  --ink: #111c2f;
  --muted: #68758a;
  --muted-2: #8f9aae;
  --line: #dde4ee;
  --line-soft: #e9edf4;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --blue: #346ee8;
  --blue-dark: #245ac8;
  --blue-soft: #edf3ff;
  --green: #149c78;
  --green-soft: #eaf8f4;
  --amber: #d98a19;
  --amber-soft: #fff6e8;
  --red: #d9535b;
  --red-soft: #fff0f1;
  --shadow: 0 10px 30px rgba(24, 45, 82, .07);
  --sidebar-width: 256px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f6fb; }
button, input, select, textarea { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(52, 110, 232, .28); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: #b9333d; }
.wide { width: 100%; }

/* Authentication */
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr); min-height: 100vh; background: var(--surface); }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 42px clamp(36px, 6vw, 92px); color: #fff; overflow: hidden; background: var(--navy); }
.auth-brand::before { content: ""; position: absolute; width: 560px; height: 560px; right: -260px; top: -230px; border: 1px solid rgba(103, 143, 224, .22); border-radius: 50%; box-shadow: 0 0 0 70px rgba(58, 99, 183, .05), 0 0 0 150px rgba(58, 99, 183, .035); }
.auth-brand::after { content: ""; position: absolute; inset: auto 0 0; height: 42%; opacity: .23; background-image: linear-gradient(rgba(89, 124, 186, .18) 1px, transparent 1px), linear-gradient(90deg, rgba(89, 124, 186, .18) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(transparent, #000); }
.brand-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid rgba(116, 154, 241, .38); border-radius: 12px; color: #75a1ff; background: rgba(58, 93, 160, .12); box-shadow: inset 0 0 18px rgba(72, 117, 218, .08); }
.brand-lockup b { display: block; font-size: 1.2rem; letter-spacing: .01em; }
.brand-lockup small { display: block; margin-top: 3px; color: #8593a9; font-size: .78rem; }
.auth-brand-copy { position: relative; z-index: 1; max-width: 650px; }
.eyebrow, .section-kicker, .panel-kicker { color: var(--blue); font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.auth-brand .eyebrow { color: #729ef8; }
.auth-brand-copy h1 { max-width: 620px; margin: 18px 0; font-size: clamp(2.2rem, 4.6vw, 4.7rem); line-height: 1.08; letter-spacing: -.045em; }
.auth-brand-copy p { max-width: 540px; margin: 0; color: #9cabc1; font-size: 1.05rem; line-height: 1.8; }
.auth-trust { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: fit-content; padding: 14px 18px; border: 1px solid rgba(109, 143, 201, .2); border-radius: 13px; background: rgba(255, 255, 255, .035); }
.auth-trust > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #54d2ae; background: rgba(35, 166, 128, .14); }
.auth-trust b, .auth-trust small { display: block; }
.auth-trust b { font-size: .88rem; }
.auth-trust small { margin-top: 3px; color: #8e9cb1; font-size: .75rem; }
.auth-panel { display: grid; place-items: center; padding: 36px; background: #f7f9fc; }
.auth-card { width: min(420px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 10px 0 8px; font-size: 2rem; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 26px; color: var(--muted); line-height: 1.6; }
.form-stack { display: grid; gap: 16px; }
.form-stack label, .inline-form label { display: grid; gap: 7px; color: #40506a; font-size: .84rem; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #cfd8e5; border-radius: 10px; color: var(--ink); background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
input, select { min-height: 42px; padding: 9px 12px; }
textarea { padding: 11px 12px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: #afbdd1; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(52, 110, 232, .11); outline: 0; }
.button { min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: 10px; font-weight: 700; font-size: .86rem; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; transform: none; }
.button.primary { color: #fff; background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: var(--line); color: #34435b; background: #fff; }
.button.secondary:hover { border-color: #b7c5d8; background: #f9fbfe; }
.form-message { min-height: 1.35rem; margin: 10px 0 0; font-size: .82rem; }

/* Application shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 25px 18px 18px; color: #e8eef8; background: var(--navy); overflow-y: auto; }
.sidebar-brand { padding: 0 8px 24px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.nav-label { display: block; margin: 0 8px 9px; color: #687a97; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.side-nav { margin-top: 26px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 9px 12px; border-radius: 9px; color: #8798b2; text-decoration: none; font-size: .84rem; }
.side-nav a > span { width: 16px; color: #5e7fc4; text-align: center; }
.side-nav a:hover { color: #dbe6f7; background: rgba(255, 255, 255, .035); }
.side-nav a.active { color: #fff; background: #142640; box-shadow: inset 3px 0 0 #5f8dff; }
.privacy-card { display: flex; gap: 10px; margin-top: auto; padding: 14px; border: 1px solid rgba(99, 130, 184, .13); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.privacy-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 auto; border-radius: 10px; color: #49c3a1; background: rgba(20, 156, 120, .12); font-size: .7rem; font-weight: 800; }
.privacy-card b, .privacy-card small { display: block; }
.privacy-card b { font-size: .78rem; }
.privacy-card small { margin-top: 4px; color: #6f809b; font-size: .68rem; line-height: 1.5; }
.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
html.popup-view .sidebar,
html.popup-view .mobile-menu,
html.popup-view .mobile-backdrop { display: none !important; }
html.popup-view .workspace { margin-left: 0; }
html.popup-view:not(.popup-ready) #authShell,
html.popup-view:not(.popup-ready) #app { visibility: hidden; }
html.popup-view:not(.popup-ready) body::after {
  content: "正在读取员工详情…";
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #f3f6fb;
  color: var(--muted);
  font-size: .92rem;
}
.topbar { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; gap: 18px; min-height: 76px; padding: 13px 31px; border-bottom: 1px solid var(--line); background: rgba(250, 252, 255, .95); backdrop-filter: blur(14px); }
.page-heading { min-width: 190px; }
.breadcrumb { color: var(--muted-2); font-size: .72rem; }
.breadcrumb i { margin: 0 6px; font-style: normal; }
.page-heading h1 { margin: 3px 0 0; font-size: 1.12rem; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.freshness { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; }
.freshness i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(20, 156, 120, .08); }
.period-control { display: flex; align-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.period-control span { padding-left: 12px; color: var(--muted); font-size: .72rem; }
.period-control select { width: 83px; min-height: 40px; border: 0; padding: 8px 9px; background: transparent; box-shadow: none; }
.account-button, .icon-button { display: grid; place-items: center; border: 0; }
.account-button { width: 40px; height: 40px; border-radius: 11px; color: #fff; background: var(--navy-2); font-size: .76rem; font-weight: 800; }
.icon-button { width: 36px; height: 36px; border-radius: 9px; color: #41506a; background: #fff; font-size: 1rem; }
.mobile-menu { display: none; border: 1px solid var(--line); }
.content { width: min(100%, 1480px); padding: 29px 31px 48px; }
.page { animation: page-in .24s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.notice { margin-bottom: 18px; padding: 12px 15px; border-radius: 10px; font-size: .86rem; line-height: 1.55; }
.notice.danger { border: 1px solid #f2c6ca; color: #9e3038; background: #fff4f5; }

/* Dashboard */
.intro-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; margin: 5px 0 22px; }
.intro-row h2 { max-width: 730px; margin: 5px 0 5px; font-size: clamp(1.55rem, 2.2vw, 2.2rem); line-height: 1.2; letter-spacing: -.035em; }
.intro-row p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.intro-actions { display: flex; gap: 9px; flex: 0 0 auto; }
.compact-intro { align-items: flex-start; margin-bottom: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 13px; margin-bottom: 15px; }
.metric-card { position: relative; min-height: 139px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 6px 18px rgba(24, 45, 82, .045); overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--metric-color, var(--blue)); }
.metric-card.neutral::after { background: #8391a7; }
.metric-card.good::after { background: var(--green); }
.metric-card.warn::after { background: var(--amber); }
.metric-card.danger::after { background: var(--red); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .78rem; }
.metric-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--metric-color, var(--blue)); background: var(--blue-soft); font-size: .7rem; font-weight: 800; }
.metric-card.good .metric-icon { color: var(--green); background: var(--green-soft); }
.metric-card.warn .metric-icon { color: var(--amber); background: var(--amber-soft); }
.metric-card.danger .metric-icon { color: var(--red); background: var(--red-soft); }
.metric-card strong { display: block; margin-top: 13px; font-size: clamp(1.7rem, 2.5vw, 2.25rem); letter-spacing: -.04em; }
.metric-card strong small { margin-left: 3px; color: #7c889b; font-size: .72rem; font-weight: 700; letter-spacing: 0; }
.metric-card > small { display: block; margin-top: 10px; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.dashboard-grid { display: grid; gap: 15px; }
.upper-grid { grid-template-columns: 1.08fr .92fr; }
.lower-grid { grid-template-columns: 1fr 1fr; margin-top: 15px; }
.owner-grid { grid-template-columns: 1.12fr .88fr; margin-top: 15px; }
.panel { padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-header h3 { margin: 4px 0 0; font-size: 1.03rem; letter-spacing: -.015em; }
.panel-meta { color: var(--muted); font-size: .72rem; }
.health-layout { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 25px; min-height: 215px; }
.ring-chart { --rate: 0; position: relative; display: grid; place-items: center; width: 158px; aspect-ratio: 1; margin: auto; border-radius: 50%; background: conic-gradient(var(--blue) calc(var(--rate) * 1%), #e9eef6 0); }
.ring-chart::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: #fff; }
.ring-chart > div { position: relative; text-align: center; }
.ring-chart strong, .ring-chart span { display: block; }
.ring-chart strong { font-size: 1.75rem; letter-spacing: -.05em; }
.ring-chart span { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.health-legend { display: grid; gap: 2px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: .78rem; }
.legend-row i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot-color); }
.legend-row strong { color: var(--ink); font-size: .92rem; }
.panel-note { display: flex; gap: 9px; padding: 10px 12px; border-radius: 9px; color: var(--muted); background: var(--surface-alt); font-size: .73rem; line-height: 1.5; }
.panel-note b { color: var(--blue); }
.count-badge { min-width: 43px; padding: 5px 9px; border-radius: 999px; color: #745218; background: var(--amber-soft); font-size: .71rem; font-weight: 800; text-align: center; }
.attention-list { display: grid; gap: 8px; }
.attention-item { display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 55px; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; color: inherit; background: var(--surface-alt); text-align: left; }
.attention-item:hover { border-color: #d7e0ed; background: #f3f6fb; }
.attention-severity { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: .68rem; font-weight: 800; }
.attention-item.recent .attention-severity { color: var(--amber); background: var(--amber-soft); }
.attention-item b, .attention-item small { display: block; }
.attention-item b { font-size: .78rem; }
.attention-item small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.attention-item time { color: var(--muted); font-size: .68rem; }
.empty-state { display: grid; place-items: center; min-height: 150px; padding: 20px; border: 1px dashed #d9e1ec; border-radius: 11px; color: var(--muted); font-size: .82rem; text-align: center; }
.devices-panel { margin-top: 15px; }
.devices-header { align-items: center; }
.search-box { display: flex; align-items: center; gap: 7px; width: min(260px, 100%); min-height: 39px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted-2); background: #fff; }
.search-box input { min-height: 36px; padding: 6px 2px; border: 0; box-shadow: none; font-size: .78rem; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; font-weight: 700; white-space: nowrap; }
td { color: #46536a; font-size: .78rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
.device-inventory { min-width: 1180px; }
.cpu-cell { max-width: 260px; line-height: 1.45; white-space: normal; }
.click-row { cursor: pointer; }
.click-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.device-page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.identity-cell { display: flex; align-items: center; gap: 9px; min-width: 170px; }
.person-avatar { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 auto; border-radius: 10px; color: #315eb6; background: #eaf1ff; font-size: .68rem; font-weight: 800; }
.identity-cell b, .identity-cell small { display: block; }
.identity-cell b { color: var(--ink); font-size: .8rem; }
.identity-cell small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.table-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.table-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--status-color, #8a96a8); }
.table-status.online { --status-color: var(--green); color: #177a61; }
.table-status.recent { --status-color: var(--amber); color: #91600f; }
.table-status.offline { --status-color: var(--red); color: #a93b43; }
.row-action, .text-button { padding: 5px 8px; border: 0; color: var(--blue); background: transparent; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.row-action:hover, .text-button:hover { color: var(--blue-dark); text-decoration: underline; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #86580f; background: var(--amber-soft); font-size: .68rem; font-weight: 800; }
.status-pill.good { color: #11775b; background: var(--green-soft); }
.boundary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.boundary-stats > div { padding: 14px 10px; border-radius: 10px; background: var(--surface-alt); text-align: center; }
.boundary-stats strong, .boundary-stats span { display: block; }
.boundary-stats strong { font-size: 1rem; }
.boundary-stats span { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.check-list { display: grid; gap: 8px; margin: 15px 0 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding-left: 23px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.check-list li::before { content: "✓"; position: absolute; left: 0; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: .62rem; font-weight: 900; }
.audit-list { display: grid; gap: 2px; }
.audit-item { display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.audit-item:last-child { border-bottom: 0; }
.audit-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #496aa9; background: #edf3ff; font-size: .68rem; font-weight: 800; }
.audit-item b, .audit-item small { display: block; }
.audit-item b { font-size: .75rem; }
.audit-item small, .audit-item time { color: var(--muted); font-size: .67rem; }

/* Owner view */
.owner-summary-strip { display: grid; grid-template-columns: 88px 170px 1fr; align-items: center; gap: 16px; min-height: 70px; margin-bottom: 14px; padding: 13px 18px; border: 1px solid var(--line); border-left: 4px solid var(--navy-2); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.owner-summary-strip > span { color: var(--muted); font-size: .73rem; }
.owner-summary-strip strong { font-size: .95rem; }
.owner-summary-strip p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.chart-legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .7rem; }
.chart-legend i { width: 17px; height: 3px; border-radius: 2px; background: var(--blue); }
.trend-chart { min-height: 250px; }
.trend-chart svg { display: block; width: 100%; height: 250px; overflow: visible; }
.trend-grid { stroke: #e5eaf2; stroke-width: 1; }
.trend-area { fill: url(#trendFill); }
.trend-line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-dot { fill: #fff; stroke: var(--blue); stroke-width: 2.5; }
.trend-label { fill: #8390a3; font: 11px "Segoe UI", sans-serif; }
.department-bars { display: grid; gap: 14px; }
.department-row { display: grid; grid-template-columns: 100px 1fr 64px; align-items: center; gap: 10px; }
.department-name b, .department-name small { display: block; }
.department-name b { font-size: .76rem; }
.department-name small { margin-top: 3px; color: var(--muted); font-size: .66rem; }
.department-track { height: 7px; border-radius: 999px; background: #edf1f6; overflow: hidden; }
.department-track i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--blue); }
.department-value { text-align: right; }
.department-value b, .department-value small { display: block; }
.department-value b { font-size: .76rem; }
.department-value small { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.small-disclaimer { margin: 17px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.focus-list { display: grid; gap: 10px; }
.focus-item { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: start; width: 100%; padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; color: inherit; background: #fff; font: inherit; text-align: left; }
button.focus-item { cursor: pointer; }
button.focus-item:hover { border-color: #b7c8e4; background: #f8fbff; }
.focus-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: .67rem; font-weight: 800; }
.focus-item b, .focus-item small { display: block; }
.focus-item b { font-size: .77rem; }
.focus-item small { margin-top: 4px; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.focus-value { color: var(--ink); font-size: .9rem; font-weight: 800; white-space: nowrap; }
.brief-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; counter-reset: brief; }
.brief-list li { position: relative; padding: 10px 10px 10px 46px; border-bottom: 1px solid var(--line-soft); counter-increment: brief; }
.brief-list li:last-child { border-bottom: 0; }
.brief-list li::before { content: counter(brief, decimal-leading-zero); position: absolute; left: 5px; top: 11px; color: #8ba2cf; font-size: .72rem; font-weight: 800; }
.brief-list b, .brief-list span { display: block; }
.brief-list b { font-size: .77rem; }
.brief-list span { margin-top: 4px; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.privacy-banner { display: flex; align-items: center; gap: 13px; margin-top: 15px; padding: 15px 17px; border: 1px solid #d4ebe5; border-radius: 13px; background: #f1faf7; }
.privacy-banner strong, .privacy-banner p { display: block; }
.privacy-banner strong { color: #176f59; font-size: .78rem; }
.privacy-banner p { margin: 4px 0 0; color: #5c7f76; font-size: .71rem; line-height: 1.45; }

/* People and settings */
.form-panel { margin-bottom: 15px; }
.inline-form { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; gap: 12px; }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.employee-import { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: end; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.employee-import label { display: grid; gap: 7px; min-width: 0; color: #40506a; font-size: .84rem; font-weight: 600; }
.employee-import input[type="file"] { width: 100%; max-width: none; height: 42px; min-height: 42px; padding: 8px 12px; color: #40506a; font-size: .82rem; line-height: 1.4; }
.employee-import .button { white-space: nowrap; }
.employee-import + .panel-note { margin-top: 12px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; align-items: start; }
.compact-form { padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.panel-header .button { flex: 0 0 auto; white-space: nowrap; }
html:not([data-role="system"]) .system-only { display: none !important; }
.admin-actions { display: flex; align-items: center; gap: 8px; }
.admin-actions select { width: auto; min-height: 34px; padding: 4px 8px; font-size: .78rem; }
.compact-list { display: grid; margin-top: 8px; }
.compact-item { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.compact-item:last-child { border-bottom: 0; }
.compact-item b { font-size: .8rem; }
.compact-item > span { display: grid; gap: 3px; }
.compact-item > span small { color: var(--muted); font-size: .7rem; }
.compact-item time { color: var(--muted); font-size: .69rem; }
.license-block { padding-top: 17px; border-top: 1px solid var(--line-soft); }
.license-block:first-of-type { padding-top: 0; border-top: 0; }
.license-block + .license-block { margin-top: 20px; }
.license-block h4 { margin: 0 0 6px; font-size: .86rem; }
.license-block p { margin: 0 0 10px; font-size: .74rem; line-height: 1.5; }
.license-block textarea, .license-block input[type="file"] { margin-bottom: 9px; }
.license-block input[type="file"] { min-height: 43px; padding: 8px; font-size: .74rem; }
.license-block .button { margin-right: 7px; }

/* Drawer and dialog */
.drawer-backdrop { position: fixed; z-index: 60; inset: 0; background: rgba(6, 13, 25, .46); backdrop-filter: blur(2px); }
.device-drawer { position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); padding: 24px; background: #fff; box-shadow: -18px 0 46px rgba(8, 19, 39, .16); transform: translateX(105%); transition: transform .24s ease; overflow-y: auto; }
.device-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 4px 0 0; font-size: 1.45rem; }
.drawer-head .icon-button { border: 1px solid var(--line); font-size: 1.25rem; }
.drawer-status { display: flex; align-items: center; gap: 11px; margin: 18px 0; padding: 13px; border-radius: 11px; background: var(--surface-alt); }
.drawer-status.online { color: #176f59; background: var(--green-soft); }
.drawer-status.recent { color: #8d5d12; background: var(--amber-soft); }
.drawer-status.offline { color: #9f3540; background: var(--red-soft); }
.drawer-status i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.drawer-status b, .drawer-status small { display: block; }
.drawer-status b { font-size: .82rem; }
.drawer-status small { margin-top: 3px; opacity: .72; font-size: .7rem; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.detail-list > div { padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-list > div:nth-child(even) { border-right: 0; }
.detail-list > div:nth-last-child(-n+2) { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: .68rem; }
.detail-list dd { margin: 4px 0 0; font-size: .8rem; font-weight: 700; word-break: break-word; }
.drawer-section { margin-top: 20px; }
.drawer-section h3 { margin: 0 0 9px; font-size: .86rem; }
.drawer-section .panel-note { margin-top: 10px; }
.app-rank { display: grid; gap: 7px; }
.app-rank > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 9px 10px; border-radius: 9px; background: var(--surface-alt); font-size: .74rem; }
.app-rank span { color: var(--muted); }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 22px; }
.drawer-actions #unbindDevice { grid-column: 1 / -1; }
.drawer-loading { padding: 40px 0; color: var(--muted); text-align: center; font-size: .8rem; }
.secret-dialog { width: min(430px, calc(100% - 32px)); padding: 29px; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 26px 80px rgba(7, 17, 34, .26); }
.secret-dialog::backdrop { background: rgba(5, 12, 23, .5); backdrop-filter: blur(3px); }
.machine-board { display: grid; grid-template-columns: repeat(auto-fill, 180px); gap: 14px; }
.machine-card { display: flex; flex-direction: column; align-items: center; width: 180px; height: 200px; min-width: 0; padding: 10px 8px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
button.machine-card { font: inherit; color: inherit; cursor: pointer; }
button.machine-card:hover { border-color: #b7c6dc; }
.machine-plot { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100px; margin-top: 0; padding: 8px 8px 0; border-radius: 12px; background: linear-gradient(#f7f9fc, #fff); }
.machine-bar { width: 36px; height: var(--level, 4%); min-height: 6px; border-radius: 9px 9px 4px 4px; background: linear-gradient(180deg, #8aa4c8, #5d7394); }
.machine-card.online .machine-bar { background: linear-gradient(180deg, #3dcaa4, #149c78); }
.machine-duration { margin-top: 6px; font-size: .82rem; font-weight: 700; letter-spacing: -.02em; }
.machine-name { max-width: 100%; margin: 6px 0 0; font-size: .82rem; font-weight: 700; line-height: 1.35; text-align: center; word-break: break-all; }
.presence-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #9aa6b8; vertical-align: 1px; }
.machine-card.online .presence-dot { background: var(--green); }
.machine-host { display: block; max-width: 100%; margin: 3px 0 0; overflow: hidden; color: var(--blue); font-size: .75rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-dialog { width: min(1180px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); max-width: none; padding: 0; overflow: hidden; border: 0; border-radius: 16px; }
.dashboard-dialog::backdrop { background: rgba(5, 12, 23, .5); }
.dashboard-dialog iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.dashboard-dialog .dialog-close { z-index: 2; background: #fff; }
.owner-title-line { display: flex; align-items: center; gap: 8px; }
.help-button { min-height: 24px; padding: 1px 8px; border: 1px solid #c5d4ea; border-radius: 999px; color: var(--blue); background: #fff; font-size: .72rem; font-weight: 700; letter-spacing: 0; line-height: 1.4; }
.help-button:hover { border-color: var(--blue); background: #f3f7ff; }
.help-dialog { width: min(560px, calc(100% - 32px)); }
.help-dialog h2 { margin-bottom: 10px; }
.help-list { display: grid; gap: 10px; margin: 0 0 16px; }
.help-list div { display: grid; gap: 2px; }
.help-list dt { color: var(--ink); font-size: .78rem; font-weight: 700; }
.help-list dd { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.secret-dialog h2 { margin: 6px 0; font-size: 1.45rem; }
.secret-dialog p { margin: 0 0 18px; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 33px; height: 33px; border: 0; border-radius: 8px; color: var(--muted); background: var(--surface-alt); font-size: 1.2rem; }
.secret-code { margin: 15px 0; padding: 17px; border: 1px dashed #b7c7df; border-radius: 11px; color: #1c4da8; background: var(--blue-soft); font: 700 1.65rem ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; text-align: center; }
.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: 360px; padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--navy-2); box-shadow: 0 14px 34px rgba(7, 17, 34, .22); font-size: .78rem; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .upper-grid, .owner-grid { grid-template-columns: 1fr; }
  .health-layout { grid-template-columns: 210px 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 250px; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { position: fixed; z-index: 35; inset: 0; display: block; background: rgba(8, 16, 30, .4); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; }
  .content { padding: 24px 20px 40px; }
  .topbar { padding: 12px 20px; }
  .freshness { display: none; }
  .lower-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { min-height: 100vh; }
}

@media (max-width: 660px) {
  .topbar { gap: 10px; padding: 10px 14px; }
  .page-heading { min-width: 0; }
  .breadcrumb { display: none; }
  .page-heading h1 { font-size: .98rem; }
  .period-control > span { display: none; }
  .period-control select { width: 72px; }
  .account-button { width: 36px; height: 36px; }
  .content { padding: 20px 14px 36px; }
  .intro-row { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .intro-actions { width: 100%; }
  .intro-actions .button { flex: 1; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 126px; padding: 15px; }
  .panel { padding: 15px; border-radius: 13px; }
  .health-layout { grid-template-columns: 1fr; gap: 12px; }
  .ring-chart { width: 142px; }
  .owner-summary-strip { grid-template-columns: 1fr; gap: 5px; }
  .devices-header { align-items: flex-start; flex-direction: column; }
  .search-box { width: 100%; }
  .inline-form, .employee-import { grid-template-columns: 1fr; }
  .department-row { grid-template-columns: 82px 1fr 58px; }
  .drawer-actions { grid-template-columns: 1fr; }
  .auth-panel { padding: 18px; }
  .auth-card { padding: 28px 22px; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .topbar-actions { gap: 6px; }
  .metric-card { min-height: 116px; }
  .boundary-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
