:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  --ink: #16201d;
  --ink-soft: #35423e;
  --muted: #687570;
  --muted-light: #8b9692;
  --line: #dce3e0;
  --line-strong: #cbd4d0;
  --surface: #ffffff;
  --surface-subtle: #f7f9f8;
  --canvas: #f1f4f3;
  --sidebar: #17201d;
  --sidebar-hover: #222d29;
  --green: #16735a;
  --green-strong: #0e5944;
  --green-soft: #e4f2ed;
  --amber: #9b5a0a;
  --amber-soft: #fff1d8;
  --red: #a23b3b;
  --red-soft: #fbe8e8;
  --blue: #28678f;
  --blue-soft: #e7f0f6;
  --shadow-sm: 0 1px 2px rgba(17, 28, 24, .05);
  --shadow-lg: 0 24px 70px rgba(20, 31, 27, .2);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
strong { font-weight: 700; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 20; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px 16px; overflow: hidden; background: var(--sidebar); color: #f5f8f7; border-right: 1px solid #26312d; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 0 8px; }
.brandMark { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid rgba(213, 240, 230, .38); border-radius: 6px; background: #d8eee6; color: #105940; font-size: 13px; font-weight: 850; }
.brandText { min-width: 0; }
.brand strong, .brand small { display: block; white-space: nowrap; }
.brand strong { font-size: 15px; line-height: 20px; }
.brand small { margin-top: 1px; color: #9eaaa5; font-size: 11px; }
nav { display: grid; gap: 4px; margin-top: 32px; }
.navItem { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #b9c3bf; text-align: left; transition: background .15s ease, color .15s ease; }
.navItem:hover { background: var(--sidebar-hover); color: #fff; }
.navItem.active { background: #d8eee6; color: #104f3c; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .24); }
.navIcon, .commandIcon { width: 17px; height: 17px; flex: 0 0 17px; display: inline-block; background: currentColor; mask-repeat: no-repeat; mask-position: center; mask-size: contain; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: contain; }
.icon-dashboard { mask-image: url('/icons/layout-dashboard.svg'); -webkit-mask-image: url('/icons/layout-dashboard.svg'); }
.icon-building { mask-image: url('/icons/building-2.svg'); -webkit-mask-image: url('/icons/building-2.svg'); }
.icon-key { mask-image: url('/icons/key-round.svg'); -webkit-mask-image: url('/icons/key-round.svg'); }
.icon-device { mask-image: url('/icons/monitor-cog.svg'); -webkit-mask-image: url('/icons/monitor-cog.svg'); }
.icon-package { mask-image: url('/icons/package-open.svg'); -webkit-mask-image: url('/icons/package-open.svg'); }
.icon-audit { mask-image: url('/icons/scroll-text.svg'); -webkit-mask-image: url('/icons/scroll-text.svg'); }
.icon-admin { mask-image: url('/icons/shield-user.svg'); -webkit-mask-image: url('/icons/shield-user.svg'); }
.icon-logout { mask-image: url('/icons/log-out.svg'); -webkit-mask-image: url('/icons/log-out.svg'); }
.icon-plus { mask-image: url('/icons/plus.svg'); -webkit-mask-image: url('/icons/plus.svg'); }
.icon-refresh { mask-image: url('/icons/refresh-cw.svg'); -webkit-mask-image: url('/icons/refresh-cw.svg'); }
.icon-copy { mask-image: url('/icons/copy.svg'); -webkit-mask-image: url('/icons/copy.svg'); }
.icon-close { mask-image: url('/icons/x.svg'); -webkit-mask-image: url('/icons/x.svg'); }
.sidebarFoot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 13px 12px 4px; border-top: 1px solid #2a3531; color: #d5deda; }
.sidebarFoot strong, .sidebarFoot small { display: block; }
.sidebarFoot strong { font-size: 11px; }
.sidebarFoot small { margin-top: 2px; color: #8e9b96; font-size: 10px; }
.statusDot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #45c18d; box-shadow: 0 0 0 3px rgba(69, 193, 141, .13); }

.workspace { min-width: 0; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 15px 30px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
.pageIdentity { min-width: 0; }
.eyebrow, .dialogEyebrow { display: block; color: var(--green); font-size: 10px; font-weight: 800; line-height: 14px; text-transform: uppercase; }
.topbar h1 { margin: 1px 0 0; font-size: 21px; line-height: 28px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.topbarActions { display: flex; align-items: center; gap: 18px; }
.environment { min-height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid #cfe1da; border-radius: 5px; background: #f2f8f5; color: #366054; font-size: 11px; font-weight: 700; }
.account { display: flex; align-items: center; gap: 9px; padding-left: 18px; border-left: 1px solid var(--line); }
.accountAvatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #27332f; color: #fff; font-size: 12px; font-weight: 800; }
.accountText { max-width: 210px; min-width: 0; }
.accountText strong, .accountText small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accountText strong { color: var(--ink-soft); font-size: 12px; }
.accountText small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.content { width: min(1480px, 100%); margin: 0 auto; padding: 26px 30px 44px; }

.metrics { display: grid; grid-template-columns: repeat(6, minmax(126px, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow-sm); }
.metric { position: relative; min-height: 112px; padding: 19px 18px 17px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric::after { content: ""; position: absolute; left: 18px; bottom: 0; width: 28px; height: 3px; border-radius: 3px 3px 0 0; background: var(--metric-accent, var(--green)); }
.metric:nth-child(2) { --metric-accent: var(--blue); }
.metric:nth-child(3) { --metric-accent: #6c5f98; }
.metric:nth-child(4) { --metric-accent: #687570; }
.metric:nth-child(5) { --metric-accent: #188365; }
.metric:nth-child(6) { --metric-accent: var(--amber); }
.metric span { color: var(--muted); font-size: 11px; font-weight: 650; }
.metric strong { display: block; margin-top: 13px; font-size: 28px; line-height: 30px; }
.metric em { display: block; min-height: 16px; margin-top: 5px; color: var(--green); font-size: 10px; font-style: normal; }

.toolbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.toolbar h2 { margin: 0; font-size: 15px; line-height: 22px; }
.toolbarMeta { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.toolbarActions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 24px; }
.sectionHeader { min-height: 32px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 9px; }
.sectionTitle { margin: 0; font-size: 13px; line-height: 20px; }
.sectionMeta { color: var(--muted); font-size: 11px; }
.tableWrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow-sm); scrollbar-color: #c5ceca transparent; }
table { width: 100%; min-width: 780px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e8ecea; text-align: left; vertical-align: middle; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: #f7f9f8; color: #75817c; font-size: 10px; font-weight: 800; text-transform: uppercase; }
td { height: 50px; color: var(--ink-soft); font-size: 12px; }
td strong { color: var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.empty, .loadingState { min-height: 168px; display: grid; place-items: center; align-content: center; gap: 10px; padding: 38px 20px; border: 1px dashed var(--line-strong); border-radius: 6px; background: rgba(255, 255, 255, .5); color: var(--muted); text-align: center; }
.empty::before { content: ""; width: 28px; height: 28px; background: #96a29d; mask: url('/icons/monitor-cog.svg') center / contain no-repeat; -webkit-mask: url('/icons/monitor-cog.svg') center / contain no-repeat; opacity: .65; }
.loadingState::before { content: ""; width: 22px; height: 22px; border: 2px solid #d3ded9; border-top-color: var(--green); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge { min-height: 23px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 4px; background: #edf0ef; color: #4f5955; font-size: 10px; font-weight: 800; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }

.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink-soft); font-weight: 700; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.button:hover { border-color: #aeb9b4; background: #f7f9f8; color: var(--ink); }
.button.primary { border-color: var(--green); background: var(--green); color: #fff; }
.button.primary:hover { border-color: var(--green-strong); background: var(--green-strong); color: #fff; }
.button.danger { border-color: #ddb0b0; background: #fffafa; color: var(--red); }
.button.danger:hover { border-color: #c98282; background: var(--red-soft); }
.button.small { min-height: 29px; padding: 0 9px; font-size: 10px; }
.button.ghost { border-color: transparent; background: transparent; }
.button.wide { width: 100%; }
.buttonWithIcon { gap: 8px; }
.button .commandIcon { width: 14px; height: 14px; flex-basis: 14px; }
.iconButton { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); }
.iconButton:hover { border-color: var(--line); background: var(--surface-subtle); color: var(--ink); }
.logoutButton { width: 32px; height: 32px; }
.rowActions { display: flex; align-items: center; gap: 6px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }

.loginScreen { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: #edf1ef; }
.loginFrame { width: min(820px, 100%); min-height: 500px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(370px, 1.1fr); overflow: hidden; border: 1px solid #d7dfdc; border-radius: 8px; background: var(--surface); box-shadow: 0 24px 80px rgba(24, 37, 32, .12); }
.loginAside { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 38px; overflow: hidden; background: #18231f; color: #fff; }
.loginAside::before { content: ""; position: absolute; inset: 0; background: linear-gradient(145deg, transparent 40%, rgba(64, 158, 122, .13)); }
.loginAside > * { position: relative; }
.loginProduct { margin-bottom: auto; color: #7ec3a8; font-size: 10px; font-weight: 800; }
.loginAside strong { max-width: 260px; font-size: 28px; line-height: 38px; }
.loginAside p { margin: 14px 0 0; color: #93a59e; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.loginSignal { height: 76px; display: flex; align-items: flex-end; gap: 8px; margin-top: 28px; }
.loginSignal span { width: 18px; background: #3e9a77; border-radius: 2px 2px 0 0; }
.loginSignal span:nth-child(1) { height: 32%; background: #5d7169; }
.loginSignal span:nth-child(2) { height: 54%; }
.loginSignal span:nth-child(3) { height: 42%; background: #d0a149; }
.loginSignal span:nth-child(4) { height: 78%; }
.loginSignal span:nth-child(5) { height: 100%; background: #75b69d; }
.loginPanel { display: flex; flex-direction: column; justify-content: center; padding: 48px 52px 38px; }
.loginBrand { margin-bottom: 34px; padding: 0; }
.loginBrand .brandMark { width: 42px; height: 42px; flex-basis: 42px; }
.loginBrand strong { color: var(--ink); font-size: 17px; }
.loginBrand small { color: var(--muted); }
.loginSubmit { margin-top: 2px; }
.loginSecurity { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 32px; color: var(--muted); font-size: 10px; }
label { display: grid; gap: 7px; margin-bottom: 16px; color: #45504c; font-size: 11px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #cbd5d1; border-radius: 4px; background: #fff; color: var(--ink); outline: none; }
input:hover, select:hover, textarea:hover { border-color: #aebbb6; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 115, 90, .1); }
textarea { min-height: 84px; resize: vertical; }
.formMessage { min-height: 18px; margin: 12px 0 0; color: var(--red); font-size: 11px; }

dialog { width: min(590px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(14, 22, 19, .52); backdrop-filter: blur(2px); }
.dialogHead { min-height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.dialogHead h2 { margin: 1px 0 0; font-size: 16px; line-height: 22px; }
.dialogBody { padding: 22px; }
.formGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.formGrid .full { grid-column: 1 / -1; }
.dialogActions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.activationCode { display: block; padding: 20px; overflow-wrap: anywhere; border: 1px dashed #99aaa3; border-radius: 5px; background: #f1f5f3; color: #113f32; font-size: 21px; text-align: center; }
.codeHint { margin: 11px 0 18px; font-size: 11px; text-align: center; }
.toast { position: fixed; z-index: 100; right: 20px; bottom: 20px; max-width: min(380px, calc(100vw - 40px)); padding: 12px 15px; border: 1px solid #31423b; border-radius: 5px; background: #17211d; color: #fff; box-shadow: 0 12px 30px rgba(16, 26, 22, .22); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 218px minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .accountText { display: none; }
}

@media (max-width: 760px) {
  .shell { display: block; padding-bottom: 68px; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 30; width: 100%; height: 68px; display: block; padding: 5px 6px; overflow-x: auto; overflow-y: hidden; border-top: 1px solid #2d3934; border-right: 0; }
  .sidebar .brand, .sidebarFoot { display: none; }
  nav { width: max-content; min-width: 100%; display: flex; justify-content: space-around; gap: 2px; margin: 0; }
  .navItem { width: 76px; min-height: 56px; flex: 0 0 76px; flex-direction: column; justify-content: center; gap: 4px; padding: 3px 4px; font-size: 9px; text-align: center; }
  .navIcon { width: 18px; height: 18px; flex-basis: 18px; }
  .topbar { min-height: 76px; padding: 11px 16px; }
  .topbar h1 { font-size: 18px; line-height: 24px; }
  .topbar p, .environment, .accountAvatar { display: none; }
  .topbarActions { gap: 0; }
  .account { padding-left: 0; border-left: 0; }
  .content { padding: 16px 12px 28px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 96px; padding: 15px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .metric:nth-child(3) { border-right: 1px solid var(--line); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-last-child(-n+2) { border-bottom: 0; }
  .metric::after { left: 14px; }
  .metric strong { margin-top: 9px; font-size: 24px; }
  .toolbar { min-height: auto; align-items: flex-start; flex-direction: column; margin-bottom: 10px; }
  .toolbarActions { width: 100%; }
  .toolbarActions .button { flex: 1 1 auto; }
  .section { margin-top: 20px; }
  .sectionHeader { min-height: auto; }
  .tableWrap { border-radius: 5px; }
  th, td { padding: 11px 12px; }
  .formGrid { grid-template-columns: 1fr; }
  .formGrid .full { grid-column: auto; }
  .loginScreen { padding: 14px; }
  .loginFrame { min-height: auto; display: block; }
  .loginAside { display: none; }
  .loginPanel { min-height: 520px; padding: 36px 26px 28px; }
  dialog { max-height: calc(100vh - 20px); }
  .dialogBody { padding: 18px; }
  .dialogActions .button { flex: 1; }
  .activationCode { font-size: 15px; }
}

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