:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #1d2939;
  background: #f4f7fa;
  --primary: #176b87;
  --primary-dark: #11566d;
  --sidebar: #16212c;
  --border: #e3e9ef;
  --muted: #667085;
  --success: #16865b;
  --danger: #c43d4b;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f4f7fa; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.app-layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 30; display: flex; flex-direction: column; color: #d5dde5; background: var(--sidebar); border-right: 1px solid #253442; }
.brand { height: 76px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid #283744; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: #20a071; color: #fff; border-radius: 7px; }
.brand-mark svg { width: 23px; height: 23px; }
.brand strong, .brand span { display: block; }
.brand strong { color: #fff; font-size: 16px; font-weight: 600; }
.brand span { margin-top: 4px; color: #8494a3; font-size: 11px; }
.side-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-label { padding: 11px 12px 7px; color: #718293; font-size: 11px; }
.nav-item { width: 100%; height: 44px; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; margin: 3px 0; padding: 0 12px; border: 0; border-radius: 6px; color: #c6d0da; background: transparent; text-align: left; cursor: pointer; transition: background .18s, color .18s; }
.nav-item:hover { color: #fff; background: #202f3c; }
.nav-item.active { color: #fff; background: #176b87; box-shadow: inset 3px 0 #42c496; }
.nav-item span { font-size: 14px; }
.nav-item small { color: #718293; font-size: 11px; }
.nav-item.active small { color: #cce7ef; }
.nav-count { min-width: 22px; padding: 2px 6px; border-radius: 9px; color: #d5f5e8; background: #274b50; font-size: 11px; text-align: center; }
.sidebar-foot { display: flex; gap: 10px; align-items: center; padding: 16px 20px; border-top: 1px solid #283744; }
.system-dot { width: 9px; height: 9px; border-radius: 50%; background: #38bf85; box-shadow: 0 0 0 4px rgba(56,191,133,.12); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { color: #d9e2e9; font-size: 12px; font-weight: 500; }
.sidebar-foot small { margin-top: 3px; color: #718293; font-size: 10px; }

.main-area { min-height: 100vh; margin-left: 248px; }
.app-header { position: sticky; top: 0; z-index: 20; height: 76px; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.header-left, .header-right, .user-block { display: flex; align-items: center; }
.header-left { gap: 14px; }
.header-left h1 { margin-top: 3px; font-size: 20px; font-weight: 600; letter-spacing: 0; }
.breadcrumb { color: #98a2b3; font-size: 12px; }
.header-right { gap: 18px; }
.connection { display: flex; align-items: center; gap: 7px; color: #4c6475; font-size: 12px; }
.connection span { width: 7px; height: 7px; border-radius: 50%; background: #22a66f; }
.connection b { font-weight: 500; }
.connection.offline span { background: #d1842c; }
.user-block { gap: 9px; padding-left: 18px; border-left: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #dcecf1; color: var(--primary-dark); font-size: 13px; font-weight: 700; }
.user-block strong, .user-block span { display: block; }
.user-block strong { font-size: 13px; font-weight: 600; }
.user-block span { margin-top: 2px; color: #98a2b3; font-size: 10px; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 6px; color: #536273; background: #fff; cursor: pointer; text-decoration: none; }
.icon-button:hover { color: var(--primary); background: #f6fafb; }
.menu-button { display: none; }

.workspace { padding: 26px 30px 44px; }
.page-view { display: none; }
.page-view.active { display: block; }
.page-intro { min-height: 54px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-intro h2 { font-size: 22px; font-weight: 600; }
.page-intro p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.primary-button, .secondary-button, .table-action, .text-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 13px; text-decoration: none; }
.primary-button { color: #fff; background: var(--primary); }
.primary-button:hover { background: var(--primary-dark); }
.secondary-button { color: #344054; background: #fff; border-color: #d7dfe7; }
.secondary-button:hover { color: var(--primary); border-color: #aac5cf; background: #f8fbfc; }
.text-button { padding: 5px 0; color: var(--primary); background: transparent; }
.text-button svg { width: 15px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { min-height: 130px; display: flex; align-items: center; gap: 16px; padding: 22px; background: #fff; border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 4px 12px rgba(26,44,61,.035); }
.metric-icon { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 6px; }
.metric-icon svg { width: 23px; height: 23px; }
.accent-blue .metric-icon { color: #2768b1; background: #eaf2fb; }
.accent-amber .metric-icon { color: #b36d19; background: #fff4df; }
.accent-green .metric-icon { color: #178258; background: #e8f7f0; }
.accent-cyan .metric-icon { color: #13758f; background: #e6f5f8; }
.metric-card span, .metric-card strong, .metric-card small { display: block; }
.metric-card span { color: #667085; font-size: 13px; }
.metric-card strong { margin: 5px 0 3px; color: #152331; font-size: 27px; line-height: 1; }
.metric-card small { color: #98a2b3; font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); gap: 20px; }
.content-panel { background: #fff; border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 4px 14px rgba(26,44,61,.035); }
.panel-head { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid #edf1f4; }
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-head p { margin-top: 5px; color: #98a2b3; font-size: 11px; }
.status-panel { padding-bottom: 10px; }
.device-summary { display: flex; align-items: center; gap: 18px; padding: 24px 22px; }
.progress-ring { --rate: 0%; width: 82px; height: 82px; flex: 0 0 82px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#22a671 var(--rate), #e9eef2 0); position: relative; }
.progress-ring::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.progress-ring span { position: relative; z-index: 1; font-size: 16px; font-weight: 700; }
.device-summary strong { font-size: 14px; }
.device-summary p { margin-top: 7px; color: #7a8795; font-size: 12px; }
.reserved-status { display: flex; justify-content: space-between; align-items: center; margin: 0 20px; padding: 13px 2px; border-top: 1px solid #edf1f4; font-size: 13px; }
.reserved-status span { display: flex; align-items: center; gap: 9px; }
.reserved-status svg { color: #7a8a98; }
.reserved-status em { padding: 3px 8px; border-radius: 4px; color: #8a6a2f; background: #fff5df; font-size: 11px; font-style: normal; }

.toolbar { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #edf1f4; }
.search-box { width: min(360px, 50%); height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #d7dfe7; border-radius: 6px; background: #fff; }
.search-box:focus-within { border-color: #6da6b8; box-shadow: 0 0 0 3px rgba(23,107,135,.08); }
.search-box svg { width: 16px; color: #98a2b3; }
.search-box input { width: 100%; border: 0; outline: 0; color: #344054; background: transparent; }
.search-box input::placeholder { color: #a3adb9; }
.toolbar select, .form-grid select, .form-grid input, .form-grid textarea { border: 1px solid #d7dfe7; border-radius: 6px; color: #344054; background: #fff; outline: none; }
.toolbar select { height: 38px; padding: 0 34px 0 11px; }
.result-count { margin-left: auto; color: #7a8795; font-size: 12px; }
.result-count b { color: #344054; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 56px; padding: 11px 16px; border-bottom: 1px solid #edf1f4; text-align: left; font-size: 13px; white-space: nowrap; }
th { height: 44px; color: #7d8996; background: #fafbfc; font-size: 12px; font-weight: 500; }
tbody tr:hover { background: #fbfdfe; }
tbody tr:last-child td { border-bottom: 0; }
td.muted { height: 140px; color: #98a2b3; text-align: center; }
.align-right { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.table-action { min-height: 30px; padding: 5px 9px; color: #475467; background: #fff; border-color: #dfe5eb; }
.table-action:hover { color: var(--primary); border-color: #9ebfca; }
.table-action.danger:hover { color: var(--danger); border-color: #e4abb1; background: #fff8f8; }
.table-action:disabled { color: #98a2b3; background: #f2f4f6; border-color: #e5e9ed; cursor: default; }
.table-action svg { width: 14px; height: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 4px; color: #a85f10; background: #fff4dd; font-size: 11px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.success { color: #147951; background: #e9f7f0; }
.pill.info { color: #2666a5; background: #eaf2fb; }
.pill.disabled { color: #667085; background: #f0f2f4; }

.placeholder-panel { min-height: 440px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; border: 1px solid var(--border); border-radius: 7px; background: #fff; text-align: center; }
.placeholder-icon { width: 66px; height: 66px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 8px; color: var(--primary); background: #e8f3f6; }
.placeholder-icon svg { width: 30px; height: 30px; }
.placeholder-panel > span { padding: 4px 9px; border-radius: 4px; color: #866329; background: #fff4db; font-size: 11px; }
.placeholder-panel h3 { margin-top: 14px; font-size: 18px; }
.placeholder-panel p { max-width: 520px; margin-top: 9px; color: #7a8795; font-size: 13px; line-height: 1.8; }

dialog { width: min(680px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 20px 60px rgba(15,28,40,.25); }
dialog::backdrop { background: rgba(15,28,40,.48); backdrop-filter: blur(2px); }
.dialog-form { margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 18px; }
.dialog-head p { margin-top: 5px; color: #7a8795; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 20px 22px 6px; }
.form-grid label { display: grid; gap: 7px; color: #475467; font-size: 12px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; padding: 10px 11px; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: #6da6b8; box-shadow: 0 0 0 3px rgba(23,107,135,.08); }
.form-grid textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.error { min-height: 18px; margin: 5px 22px; color: var(--danger); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 22px 20px; }
.sidebar-mask { display: none; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef3f5; }
.login-panel { width: min(410px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 18px 48px rgba(29,50,67,.12); }
.login-panel .eyebrow { color: var(--primary); font-size: 12px; margin-bottom: 7px; }
.login-panel h1 { font-size: 23px; }
.login-panel .form { display: grid; gap: 15px; margin-top: 26px; }
.login-panel label { display: grid; gap: 7px; color: #475467; font-size: 13px; }
.login-panel input { width: 100%; padding: 11px; border: 1px solid #d7dfe7; border-radius: 6px; outline: none; }
.login-panel input:focus { border-color: #6da6b8; box-shadow: 0 0 0 3px rgba(23,107,135,.08); }
.login-panel button { min-height: 42px; border: 0; border-radius: 6px; color: #fff; background: var(--primary); cursor: pointer; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; z-index: 25; background: rgba(15,28,40,.42); }
  .sidebar-mask.show { display: block; }
  .main-area { margin-left: 0; }
  .menu-button { display: inline-grid; }
  .app-header { padding: 0 16px; }
  .connection, .user-block div:not(.avatar) { display: none; }
  .user-block { padding-left: 0; border-left: 0; }
  .workspace { padding: 20px 16px 36px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 112px; padding: 16px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { width: 100%; }
  .result-count { margin-left: 0; }
}
@media (max-width: 520px) {
  .header-right { gap: 8px; }
  .page-intro { flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
