:root {
  --sx-primary: #3370ff;
  --sx-primary-hover: #245ee8;
  --sx-success: #16a779;
  --sx-warning: #d97706;
  --sx-danger: #e5484d;
  --sx-sidebar: #001529;
  --sx-sidebar-2: #002140;
  --sx-canvas: #f2f4f7;
  --sx-surface: #fff;
  --sx-border: #e5e7eb;
  --sx-text: #1f2937;
  --sx-muted: #667085;
  --sx-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

html, body { letter-spacing: 0; }
body { color: var(--sx-text); background: var(--sx-canvas); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--sx-primary); }
a:hover { color: var(--sx-primary-hover); }

.navbar-static-side { width: 224px; flex: 0 0 224px; background: var(--sx-sidebar); border-right: 0; box-shadow: 2px 0 8px rgba(0, 21, 41, .16); }
.nav-header { min-height: 58px; padding: 0 16px !important; background: var(--sx-sidebar-2) !important; }
.brand-lockup { display: flex !important; align-items: center; gap: 10px; height: 58px; color: #fff !important; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; color: #fff; background: var(--sx-primary); border-radius: 6px; box-shadow: 0 6px 16px rgba(51, 112, 255, .25); }
.brand-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-copy strong { color: #fff; font-size: 13px; white-space: nowrap; }
.brand-copy small { color: rgba(255, 255, 255, .58); font-size: 10px; text-transform: uppercase; }
.top-account-dropdown { position: relative; margin-left: 2px; }
.top-account-trigger { display: flex !important; align-items: center; gap: 7px; min-height: 38px !important; margin: 6px 0; padding: 0 9px !important; color: #344054 !important; border: 1px solid transparent; border-radius: 4px; }
.top-account-trigger:hover, .top-account-dropdown.open .top-account-trigger { background: #f7f9fc !important; border-color: var(--sx-border); }
.top-account-avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; color: var(--sx-primary); background: #eef4ff; border-radius: 4px; }
.top-account-name { max-width: 120px; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-menu { top: calc(100% + 2px); right: 0; left: auto; min-width: 150px; }
.account-menu > li { display: block; height: auto; }
.account-menu > li > a, .account-menu > li > button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 0; padding: 8px 10px; color: #344054; background: transparent; border: 0; border-radius: 3px; text-align: left; font-size: 12px; }
.account-menu > li > a:hover, .account-menu > li > button:hover { color: var(--sx-primary); background: #f2f6ff; }
.account-menu i { width: 15px; text-align: center; }
.account-menu-caption { margin: 1px 5px 5px; padding: 5px 6px 8px; color: #98a2b3; border-bottom: 1px solid var(--sx-border); font-size: 10px; }
#side-menu > li > a { display: flex; align-items: center; min-height: 46px; margin: 2px 8px; padding: 0 13px; color: rgba(255, 255, 255, .66); border-radius: 4px; font-weight: 500; }
#side-menu > li > a i { width: 21px; margin-right: 9px; font-size: 14px; text-align: center; }
#side-menu > li > a:hover, #side-menu > li.active > a { color: #fff; background: var(--sx-primary); }
#side-menu > li.active { border-left: 0; background: transparent; }
#page-wrapper { min-width: 0; min-height: 100vh; flex: 1 1 auto; margin-left: 0; background: var(--sx-canvas); }
.navbar-fixed-top { left: 224px; height: 50px; min-height: 50px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--sx-border); box-shadow: none; }
.navbar-minimalize { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; margin: 8px 0; color: var(--sx-muted) !important; background: transparent !important; border: 0; border-radius: 4px; box-shadow: none !important; }
.navbar-minimalize:hover { color: var(--sx-primary) !important; background: #eef4ff !important; }
.navbar-top-links { display: flex; align-items: center; height: 50px; }
.navbar-top-links > li { display: flex; align-items: center; height: 50px; }
.navbar-top-links > li > a { color: var(--sx-muted); }
.welcome-message { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.system-dot { display: inline-block; width: 8px; height: 8px; background: var(--sx-success); border-radius: 50%; box-shadow: 0 0 0 3px rgba(22, 167, 121, .12); }
#languagemenu { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 34px; padding: 0 9px; color: var(--sx-muted); background: transparent; border: 0; border-radius: 4px; }
#languagemenu:hover { color: var(--sx-primary); background: #eef4ff; }
.wrapper-content { padding: 70px 24px 52px; }
.ibox { margin-bottom: 16px; background: transparent; }
.ibox-title { min-height: 48px; padding: 15px 18px 10px; background: var(--sx-surface); border: 1px solid var(--sx-border); border-bottom: 0; border-radius: 5px 5px 0 0; }
.ibox-title h3, .ibox-title h5 { margin: 0; color: #344054; font-size: 14px; font-weight: 650; }
.ibox-content { padding: 18px; background: var(--sx-surface); border: 1px solid var(--sx-border); border-radius: 0 0 5px 5px; box-shadow: var(--sx-shadow); }
.ibox > .ibox-content:first-child { border-radius: 5px; }
.row:first-child > [class*="col-lg-3"]:nth-child(1) .ibox-content { border-top: 3px solid var(--sx-primary); }
.row:first-child > [class*="col-lg-3"]:nth-child(2) .ibox-content { border-top: 3px solid var(--sx-success); }
.row:first-child > [class*="col-lg-3"]:nth-child(3) .ibox-content { border-top: 3px solid #7c3aed; }
.row:first-child > [class*="col-lg-3"]:nth-child(4) .ibox-content { border-top: 3px solid var(--sx-warning); }
.no-margins { color: #101828; font-size: 30px; font-weight: 700; }
.list-group-item { padding: 13px 18px; border-color: #edf0f3; }
.list-group-item strong:first-child { color: var(--sx-muted); font-weight: 500; }
.list-group-item .text-right strong { color: var(--sx-text); font-weight: 600; }
.content { padding: 0 18px; background: var(--sx-surface); border-right: 1px solid var(--sx-border); border-left: 1px solid var(--sx-border); }
#toolbar { display: flex; gap: 8px; padding: 12px 0; }
.btn { min-height: 34px; border-radius: 4px; font-weight: 500; box-shadow: none !important; }
.btn-primary, .btn-success { color: #fff; background: var(--sx-primary); border-color: var(--sx-primary); }
.btn-primary:hover, .btn-success:hover { background: var(--sx-primary-hover); border-color: var(--sx-primary-hover); }
.btn-danger { background: var(--sx-danger); border-color: var(--sx-danger); }
.btn-warning { background: var(--sx-warning); border-color: var(--sx-warning); }
.btn-outline { background: #fff; }
.btn.dim { margin-bottom: 0 !important; box-shadow: none !important; }
.table { color: #344054; }
.bootstrap-table .fixed-table-container { border: 1px solid var(--sx-border); border-radius: 4px; }
.bootstrap-table .table > thead > tr > th { height: 44px; color: #475467; background: #f8fafc; border-color: var(--sx-border); font-size: 12px; font-weight: 650; }
.bootstrap-table .table > tbody > tr > td { height: 46px; vertical-align: middle; border-color: #edf0f3; }
.bootstrap-table .table-hover > tbody > tr:hover { background: #f7faff; }
.badge-primary, .label-primary { color: #087a57; background: #dff7ee; }
.badge-badge { color: #667085; background: #f2f4f7; }
.pagination > li > a, .pagination > li > span { color: #475467; border-color: var(--sx-border); }
.pagination > .active > a, .pagination > .active > span { color: #fff; background: var(--sx-primary); border-color: var(--sx-primary); }
.form-control { min-height: 38px; color: var(--sx-text); background: #fff; border: 1px solid #d0d5dd; border-radius: 4px; box-shadow: none; }
.form-control:focus { border-color: var(--sx-primary); box-shadow: 0 0 0 3px rgba(51, 112, 255, .12); }
.control-label { color: #344054; font-size: 13px; }
.help-block { color: #98a2b3; font-size: 12px; }
.dropdown-menu { padding: 5px; border: 1px solid var(--sx-border); border-radius: 5px; box-shadow: 0 10px 28px rgba(16, 24, 40, .12); }
.dropdown-menu > li > a { padding: 8px 10px; border-radius: 3px; }
.footer.fixed { min-height: 38px; padding: 10px 18px; color: #98a2b3; background: #fff; border-top: 1px solid var(--sx-border); font-size: 12px; }
body.mini-navbar .navbar-static-side { width: 70px; flex-basis: 70px; }
body.mini-navbar #page-wrapper { width: auto; margin-left: 0; }
body.mini-navbar .navbar-fixed-top { left: 70px; }
body.mini-navbar .footer.fixed { margin-left: 0; }

/* Shared workspace and legacy forms */
.wrapper-content:not(.gateway-dashboard) { width: calc(100% - 48px); max-width: 1680px; margin-right: auto; margin-left: auto; padding-right: 0; padding-left: 0; }
#page-wrapper > .row:not(.border-bottom), #page-wrapper > .tile { width: calc(100% - 48px); max-width: 1680px; margin: 74px auto 52px; }
#page-wrapper > .row:not(.border-bottom) > [class*="col-"], #page-wrapper > .tile > [class*="col-"] { padding-right: 0; padding-left: 0; }
.form-horizontal { padding: 4px 6px; }
.form-horizontal .form-group { display: grid; grid-template-columns: 180px minmax(280px, 640px); align-items: start; gap: 18px; margin-right: 0; margin-left: 0; padding: 2px 0; }
.form-horizontal .form-group[style*="display: block"] { display: grid !important; }
.form-horizontal .form-group > .control-label { width: auto; padding: 10px 0 0; text-align: left; }
.form-horizontal .form-group > [class*="col-sm-"] { width: auto; max-width: 640px; padding-right: 0; padding-left: 0; float: none; }
.form-horizontal .form-group > [class*="col-sm-offset-"] { grid-column: 2; }
.form-horizontal .hr-line-dashed { max-width: 838px; margin: 18px 0; }
.form-horizontal textarea.form-control { resize: vertical; }

/* Gateway dashboard */
.gateway-dashboard { width: calc(100% - 48px); max-width: 1680px; margin: 0 auto; padding: 70px 0 52px; }
.gateway-command { min-height: 112px; margin-bottom: 14px; padding: 20px 24px; }
.gateway-command::after { display: none; }
.gateway-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 7px; color: #9a6b2f; font-size: 10px; font-weight: 700; }
.gateway-eyebrow i { font-size: 7px; filter: drop-shadow(0 0 5px #22c55e); }
.gateway-command h1 { margin: 0 0 5px; color: #101828; font-size: 22px; line-height: 1.25; font-weight: 720; letter-spacing: 0; }
.gateway-command p { margin: 0; color: #667085; font-size: 12px; }
.gateway-actions { display: flex; align-items: center; gap: 10px; }
.gateway-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 15px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 5px; font-size: 13px; font-weight: 600; }
.gateway-action:hover { transform: translateY(-1px); }
.gateway-action-secondary { color: #344054; background: #fff; border-color: #d0d5dd; }
.gateway-action-primary { color: #fff; background: #3370ff; border-color: #3370ff; box-shadow: 0 7px 20px rgba(51, 112, 255, .3); }
.gateway-action-primary:hover { color: #fff; }
.gateway-action-secondary:hover { color: var(--sx-primary); border-color: #b8c7ea; }
.gateway-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.gateway-stat { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 96px; padding: 16px; overflow: hidden; background: #fff; border: 1px solid var(--sx-border); border-radius: 6px; box-shadow: var(--sx-shadow); }
.gateway-stat::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; content: ""; background: var(--stat-color); }
.gateway-stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 44px; color: var(--stat-color); background: var(--stat-bg); border-radius: 6px; font-size: 17px; }
.gateway-stat > div { min-width: 0; }
.gateway-stat-label, .gateway-stat small { display: block; color: #667085; font-size: 11px; }
.gateway-stat strong { display: block; margin: 3px 0 2px; overflow: hidden; color: #101828; font-size: 21px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.gateway-stat.stat-blue strong { overflow: visible; font-size: 19px; text-overflow: clip; white-space: normal; }
.gateway-stat strong em { color: #98a2b3; font-size: 13px; font-style: normal; font-weight: 500; }
.gateway-stat .gateway-running { color: #087a57; font-size: 17px; }
.gateway-running i { margin-right: 3px; font-size: 7px; vertical-align: middle; }
.stat-blue { --stat-color: #3370ff; --stat-bg: #eef4ff; }
.stat-green { --stat-color: #16a779; --stat-bg: #e9f8f2; }
.stat-violet { --stat-color: #7c3aed; --stat-bg: #f3eefe; }
.stat-amber { --stat-color: #d97706; --stat-bg: #fff6e8; }
.gateway-dashboard .ibox-title { padding-left: 20px; }
.gateway-dashboard .ibox-content { border-color: #e4e7ec; }
.gateway-dashboard .progress { height: 6px; margin-top: 9px; overflow: hidden; background: #edf1f5; border-radius: 3px; }
.gateway-dashboard .progress-bar { background: #3370ff; border-radius: 3px; }
.gateway-dashboard canvas { border-radius: 4px; }
.dashboard-device-panel { margin-bottom: 14px; overflow: hidden; }
.dashboard-device-head { min-height: 66px; }
.dashboard-device-intro { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dashboard-device-intro > div { min-width: 0; }
.dashboard-device-intro h2, .dashboard-device-intro span { display: block; }
.dashboard-device-intro h2 { margin: 0 0 3px; color: #101828; font-size: 14px; font-weight: 680; }
.dashboard-device-intro span { margin-top: 3px; color: #667085; font-size: 11px; }
.dashboard-device-intro b { color: #087a57; }
.dashboard-download-area { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 14px; padding: 14px 18px 16px; }
.dashboard-download-label { color: #667085; font-size: 11px; font-weight: 600; }
.dashboard-downloads { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.dashboard-downloads a { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 48px; padding: 8px 10px; color: #475467; background: #f9fafb; border: 1px solid var(--sx-border); border-radius: 4px; }
.dashboard-downloads a > i { color: var(--sx-primary); }
.dashboard-downloads a span { min-width: 0; }
.dashboard-downloads a strong, .dashboard-downloads a small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-downloads a strong { font-size: 11px; }
.dashboard-downloads a small { margin-top: 2px; color: #98a2b3; font-size: 9px; }
.dashboard-device-actions a { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px; color: #475467; background: #fff; border: 1px solid var(--sx-border); border-radius: 4px; font-size: 11px; white-space: nowrap; }
.dashboard-downloads a:hover, .dashboard-device-actions a:hover { color: var(--sx-primary); border-color: #b8c7ea; }
.dashboard-device-actions { display: flex; gap: 6px; }
.dashboard-device-actions a.is-primary { color: #fff; background: var(--sx-primary); border-color: var(--sx-primary); }

/* Access control and account */
.rbac-page, .account-page { width: 100%; max-width: 1680px; margin: 0 auto; }
.management-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding: 18px 20px; color: #344054; background: #fff; border: 1px solid var(--sx-border); border-radius: 6px; box-shadow: var(--sx-shadow); }
.management-header.compact { align-items: center; }
.management-eyebrow { display: block; margin-bottom: 6px; color: #9a6b2f; font-size: 9px; font-weight: 700; }
.management-header h1 { margin: 0 0 4px; color: #101828; font-size: 20px; line-height: 1.25; font-weight: 700; }
.management-header p { margin: 0; color: #667085; font-size: 12px; }
.management-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.management-header .btn-white { color: #344054; background: #fff; border-color: #d0d5dd; }
.management-section, .management-form, .account-shell { margin-bottom: 16px; background: #fff; border: 1px solid var(--sx-border); border-radius: 6px; box-shadow: var(--sx-shadow); }
.management-section-head { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 12px 18px; border-bottom: 1px solid var(--sx-border); }
.management-section-head h2, .form-section-title h2 { margin: 0 0 3px; color: #101828; font-size: 15px; font-weight: 680; }
.management-section-head span, .form-section-title > span { color: var(--sx-muted); font-size: 12px; }
.rbac-table { min-width: 780px; margin: 0; }
.rbac-table > thead > tr > th { padding: 11px 14px; color: #667085; background: #f8fafc; border-bottom: 1px solid var(--sx-border); font-size: 11px; font-weight: 650; }
.rbac-table > tbody > tr > td { padding: 12px 14px; vertical-align: middle; border-top-color: #edf0f3; font-size: 12px; }
.identity-cell { display: flex; align-items: center; gap: 10px; min-width: 145px; }
.identity-cell > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.identity-cell strong { overflow: hidden; color: #344054; text-overflow: ellipsis; white-space: nowrap; }
.identity-cell small { color: #98a2b3; }
.identity-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: 0 0 32px; color: var(--sx-primary); background: #eef4ff; border-radius: 5px; }
.scope-label, .permission-count { display: inline-flex; align-items: center; gap: 5px; color: #475467; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; color: #667085; white-space: nowrap; }
.status-pill i { font-size: 6px; }
.status-pill.is-active { color: #087a57; }
.table-actions { white-space: nowrap; }
.table-actions a, .table-actions button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-left: 3px; padding: 0; color: #475467; background: #fff; border: 1px solid #d0d5dd; border-radius: 4px; }
.table-actions a:hover, .table-actions button:hover { color: var(--sx-primary); border-color: var(--sx-primary); }
.table-actions .is-danger:hover { color: var(--sx-danger); border-color: var(--sx-danger); }
.empty-state { height: 110px; color: #98a2b3; text-align: center; }
.empty-state i, .empty-state span { display: block; margin: 4px auto; }
.empty-state i { font-size: 24px; }
.form-section { padding: 20px; border-bottom: 1px solid var(--sx-border); }
.form-section:last-of-type { border-bottom: 0; }
.form-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-page .form-grid { max-width: 920px; }
.form-page .permission-grid, .form-page .role-grid { max-width: 1100px; }
.form-field { display: block; min-width: 0; margin: 0; color: #344054; font-size: 12px; font-weight: 600; }
.form-field > span:first-child { display: block; margin-bottom: 7px; }
.form-field-wide { grid-column: 1 / -1; }
.permission-grid, .role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-option, .role-option { position: relative; display: flex; align-items: flex-start; gap: 11px; min-height: 66px; margin: 0; padding: 13px; cursor: pointer; background: #f9fafb; border: 1px solid var(--sx-border); border-radius: 5px; }
.permission-option:hover, .role-option:hover { border-color: #b8c7ea; }
.permission-option > input, .role-option > input, .toggle-field > input { position: absolute; opacity: 0; pointer-events: none; }
.permission-check, .role-check { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 26px; color: #98a2b3; background: #fff; border: 1px solid #d0d5dd; border-radius: 4px; }
.permission-check i { opacity: 0; font-size: 10px; }
.permission-option input:checked + .permission-check, .role-option input:checked + .role-check { color: #fff; background: var(--sx-primary); border-color: var(--sx-primary); }
.permission-option input:checked + .permission-check i { opacity: 1; }
.permission-option strong, .role-option strong, .permission-option small, .role-option small { display: block; }
.permission-option strong, .role-option strong { margin-bottom: 3px; color: #344054; font-size: 12px; }
.permission-option small, .role-option small { color: #98a2b3; font-size: 11px; font-weight: 400; line-height: 1.45; }
.toggle-field { position: relative; display: inline-flex; align-items: center; gap: 9px; margin: 2px 0 0; cursor: pointer; color: #344054; font-size: 12px; }
.toggle-ui { position: relative; display: inline-block; width: 36px; height: 20px; background: #d0d5dd; border-radius: 10px; transition: background .2s; }
.toggle-ui::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; content: ""; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle-field input:checked + .toggle-ui { background: var(--sx-primary); }
.toggle-field input:checked + .toggle-ui::after { transform: translateX(16px); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; }
.form-error { min-height: 18px; margin: 10px 20px 0; color: var(--sx-danger); font-size: 12px; }
.rbac-modal .modal-header, .rbac-modal .modal-footer { border-color: var(--sx-border); }
.rbac-modal, .account-modal { border-radius: 6px; box-shadow: 0 18px 50px rgba(16, 24, 40, .18); }
.rbac-modal .modal-header h3 { margin: 0; font-size: 16px; }
.account-modal .modal-header, .account-modal .modal-footer { border-color: var(--sx-border); }
.account-modal .modal-header h3 { margin: 0; color: #101828; font-size: 16px; }
.account-modal .modal-body { padding: 20px; }
.account-modal .form-field { margin-bottom: 14px; }
.account-modal .form-error { margin: 0; }
.rbac-modal .modal-body { padding: 20px; }
.rbac-modal .form-error { margin-right: 0; margin-left: 0; }
.modal-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.modal-section-title h4 { margin: 0; color: #344054; font-size: 13px; }
.modal-section-title span { color: #98a2b3; font-size: 11px; }
.compact-role-grid .role-option { min-height: 58px; padding: 10px; }
.modal-user { color: #475467; font-weight: 600; }
.account-shell { width: min(460px, 100%); margin: 18px auto 0; padding: 24px; }
.account-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.account-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex: 0 0 42px; color: var(--sx-primary); background: #eef4ff; border-radius: 6px; }
.account-heading h1 { margin: 0 0 3px; color: #101828; font-size: 20px; font-weight: 700; }
.account-heading p { margin: 0; color: var(--sx-muted); font-size: 12px; }
.account-shell .form-field { margin-bottom: 15px; }
.account-shell .form-error { margin: 0 0 8px; }

/* Device operations */
.device-page, .terminal-page { width: 100%; max-width: 1680px; margin: 0 auto; }
.device-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.device-summary > div { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 82px; padding: 15px 17px; background: #fff; border: 1px solid var(--sx-border); border-radius: 6px; box-shadow: var(--sx-shadow); }
.device-summary-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 38px; color: #3370ff; background: #eef4ff; border-radius: 6px; }
.device-summary-icon.online { color: #087a57; background: #e9f8f2; }
.device-summary-icon.secure { color: #7c3aed; background: #f3eefe; }
.device-summary span:last-child { min-width: 0; }
.device-summary small, .device-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-summary small { margin-bottom: 3px; color: #667085; font-size: 11px; }
.device-summary strong { color: #101828; font-size: 15px; }
.device-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--sx-border); }
.device-search { position: relative; width: min(320px, 100%); margin-right: auto; }
.device-search i { position: absolute; top: 50%; left: 12px; z-index: 1; color: #98a2b3; transform: translateY(-50%); }
.device-search .form-control { padding-left: 34px; }
.device-table { min-width: 1030px; }
.credential-warning, .security-note { padding: 11px 13px; color: #7a4d08; background: #fff8e8; border: 1px solid #f5d89a; border-radius: 5px; font-size: 12px; }
.copy-field { display: flex; align-items: stretch; gap: 7px; }
.copy-field code { display: block; flex: 1 1 auto; padding: 10px 12px; overflow: auto; color: #344054; background: #f7f8fa; border: 1px solid var(--sx-border); border-radius: 4px; white-space: nowrap; }
.terminal-shell { overflow: hidden; background: #0b1220; border: 1px solid #253047; border-radius: 6px; box-shadow: 0 16px 34px rgba(11, 18, 32, .2); }
.terminal-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 15px; color: #94a3b8; background: #111b2e; border-bottom: 1px solid #253047; font-size: 11px; }
.terminal-toolbar i { margin-right: 5px; color: #ef4444; font-size: 7px; }
.terminal-toolbar i.is-online { color: #22c55e; }
#device-terminal { height: calc(100vh - 255px); min-height: 420px; padding: 10px; }
#device-terminal .xterm { height: 100%; }
.guide-section { overflow: hidden; }
.guide-content, .download-grid { padding: 18px 20px; }
.download-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.download-item { display: flex; align-items: center; gap: 11px; min-width: 0; min-height: 64px; padding: 12px; color: #344054; background: #f9fafb; border: 1px solid var(--sx-border); border-radius: 5px; }
.download-item:hover { color: var(--sx-primary); border-color: #b8c7ea; background: #f3f7ff; }
.download-item > i { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: 0 0 32px; color: var(--sx-primary); background: #eef4ff; border-radius: 5px; }
.download-item span { min-width: 0; }
.download-item strong, .download-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-item strong { font-size: 12px; }
.download-item small { margin-top: 3px; color: #98a2b3; font-size: 10px; }
.guide-step { margin-bottom: 18px; }
.guide-step > span { display: block; margin-bottom: 8px; color: #344054; font-size: 13px; font-weight: 650; }
.guide-content pre { margin: 0 0 15px; padding: 16px 18px; overflow: auto; color: #e7edf5; background: #101828; border: 0; border-radius: 5px; font-size: 13px; line-height: 1.75; }
.guide-content pre code { padding: 0; color: inherit; background: transparent; border: 0; font-size: inherit; white-space: pre; }
.guide-content > p { color: #667085; font-size: 13px; line-height: 1.7; }
.guide-content > p code { color: #344054; background: #f2f4f7; }
.guide-credential { margin-top: 12px; }

/* Login */
.nps-login-page { position: relative; min-height: 100vh; overflow: hidden; color: #fff; background: #1c4d96 url("../img/login-bg.png") center / cover no-repeat; }
.nps-login-page::before { position: absolute; inset: 0; content: ""; background: rgba(7, 23, 48, .18); }
.login-topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; height: 70px; padding: 0 38px; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.login-brand strong { font-size: 17px; }
.login-brand small { color: rgba(255, 255, 255, .65); font-size: 10px; text-transform: uppercase; }
.login-language { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 38px; height: 36px; color: #fff; background: rgba(0, 21, 41, .3); border: 1px solid rgba(255, 255, 255, .2); border-radius: 4px; }
.login-shell { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; gap: 72px; width: min(1080px, calc(100vw - 80px)); min-height: 100vh; margin: 0 auto; padding: 84px 0 58px; }
.login-intro { width: min(560px, 52vw); text-shadow: 0 2px 20px rgba(0, 21, 41, .18); }
.login-intro h1 { margin: 0 0 15px; color: #fff; font-size: 48px; line-height: 1.15; font-weight: 750; letter-spacing: 0; }
.login-intro > p { margin: 0; color: rgba(255, 255, 255, .76); font-size: 18px; }
.intro-rule { display: block; width: 72px; height: 3px; margin-top: 28px; background: #86efac; border-radius: 2px; }
.login-panel { width: 390px; flex: 0 0 390px; margin-top: 0; padding: 32px; color: var(--sx-text); background: rgba(255, 255, 255, .97); border: 1px solid rgba(255, 255, 255, .65); border-radius: 7px; box-shadow: 0 24px 68px rgba(0, 21, 41, .28); transform: translateY(-24px); }
.login-panel-head { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.login-panel-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; color: var(--sx-primary); background: #eef4ff; border-radius: 6px; }
.login-panel-head h2 { margin: 0 0 3px; color: #101828; font-size: 22px; font-weight: 700; }
.login-panel-head p { margin: 0; color: var(--sx-muted); font-size: 12px; }
.login-field { display: block; margin-bottom: 17px; color: #344054; font-size: 13px; font-weight: 600; }
.login-field > span:first-child { display: block; margin-bottom: 7px; }
.input-shell { position: relative; display: block; }
.input-shell > i { position: absolute; top: 50%; left: 13px; z-index: 1; color: #98a2b3; transform: translateY(-50%); }
.input-shell .form-control { height: 43px; padding-left: 38px; background: #f9fafb; border-radius: 5px; }
.captcha-row { display: grid; grid-template-columns: 1fr 118px; gap: 10px; }
.captcha-image { display: flex !important; align-items: center; justify-content: center; height: 43px; overflow: hidden; background: #f2f4f7; border: 1px solid #d0d5dd; border-radius: 5px; }
.captcha-image .captcha { display: block; width: 100%; height: 100%; }
.captcha-image img { width: 100%; height: 100%; object-fit: cover; }
.captcha-image input[type="hidden"] { display: none; }
.login-error { min-height: 20px; margin: -5px 0 8px; color: var(--sx-danger); font-size: 12px; }
.login-submit { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 44px; color: #fff; background: var(--sx-primary); border: 0; border-radius: 5px; font-size: 14px; font-weight: 650; transition: background .2s, transform .2s; }
.login-submit:hover { background: var(--sx-primary-hover); }
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled { cursor: wait; opacity: .7; }
.login-submit.is-loading i { animation: sx-pulse .8s ease-in-out infinite alternate; }
.login-register { display: block; margin-top: 14px; text-align: center; }
.login-footer { position: absolute; right: 0; bottom: 18px; left: 0; z-index: 2; color: rgba(255, 255, 255, .6); text-align: center; font-size: 11px; }
@keyframes sx-pulse { to { transform: translateX(4px); } }

@media (max-width: 991px) {
  .login-shell { justify-content: center; width: calc(100vw - 40px); }
  .login-intro { display: none; }
  .navbar-static-side { width: 224px; flex-basis: 224px; }
  #page-wrapper { margin-left: 0; }
  .navbar-fixed-top { left: 224px; }
  .gateway-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-download-area { grid-template-columns: 1fr; }
  .dashboard-downloads { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rbac-page { max-width: none; }
  .download-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .navbar-static-side { width: 0; flex-basis: 0; overflow: hidden; }
  #page-wrapper { margin-left: 0; }
  .navbar-fixed-top { left: 0; }
  body.mini-navbar .navbar-static-side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 2300; display: block; width: 224px; height: 100vh; flex-basis: auto; overflow-x: hidden; overflow-y: auto; }
  body.mini-navbar .brand-lockup { display: flex !important; }
  body.mini-navbar .logo-element { display: none; }
  body.mini-navbar .nav-label,
  body.mini-navbar .navbar-default .nav li a span { display: inline; }
  body.mini-navbar .navbar-default .nav > li > a { color: #e6edf7; font-size: 13px; }
  body.mini-navbar .navbar-default .nav > li > a:hover,
  body.mini-navbar .navbar-default .nav > li.active > a { color: #fff; }
  body.mini-navbar #page-wrapper { width: 100%; margin-left: 0; }
  body.mini-navbar .navbar-fixed-top { left: 0; }
  .wrapper-content { padding: 64px 10px 52px; }
  .wrapper-content:not(.gateway-dashboard), .gateway-dashboard { width: calc(100% - 20px); }
  #page-wrapper > .row:not(.border-bottom), #page-wrapper > .tile { width: calc(100% - 20px); margin-top: 64px; }
  .welcome-message { display: none; }
  .ibox-title, .ibox-content { padding-right: 12px; padding-left: 12px; }
  .content { padding: 0 12px; }
  .table-responsive { overflow-x: auto; }
  .form-horizontal .form-group, .form-horizontal .form-group[style*="display: block"] { display: block !important; }
  .form-horizontal .form-group > .control-label { display: block; padding: 0 0 7px; text-align: left; }
  .form-horizontal .form-group > [class*="col-sm-"] { max-width: none; }
  .login-topbar { height: 60px; padding: 0 18px; }
  .login-shell { width: calc(100vw - 28px); padding-top: 74px; }
  .login-panel { width: min(390px, 100%); flex-basis: auto; padding: 26px 20px; transform: translateY(-12px); }
  .login-footer { bottom: 10px; }
  .gateway-command { align-items: flex-start; min-height: 0; padding: 24px 20px; }
  .gateway-command h1 { font-size: 22px; }
  .gateway-actions { flex-direction: column; align-items: stretch; }
  .gateway-action { width: 154px; }
  .management-header { display: block; padding: 19px 17px; }
  .management-actions { margin-top: 16px; }
  .management-actions .btn { flex: 1 1 0; }
  .form-grid, .permission-grid, .role-grid { grid-template-columns: 1fr; }
  .form-section { padding: 16px; }
  .form-actions { padding: 13px 16px; }
  .top-action-label { display: none; }
  .navbar-header { float: left; }
  .navbar-top-links { position: absolute; top: 0; right: 7px; flex-wrap: nowrap; margin: 0; }
  .navbar-top-links > li > a { min-height: 40px; padding: 12px 9px; }
  #languagemenu { min-width: 34px; padding: 0 8px; }
  #languagemenu span { display: none; }
  .top-account-name { display: none; }
  .top-account-trigger { padding: 0 7px !important; }
  .rbac-table > thead > tr > th, .rbac-table > tbody > tr > td { white-space: nowrap; }
  .device-summary { grid-template-columns: 1fr; }
  .device-toolbar { flex-wrap: wrap; }
  .device-search { width: 100%; flex-basis: 100%; }
  .download-grid { grid-template-columns: 1fr; padding: 14px; }
  #device-terminal { height: calc(100vh - 230px); min-height: 360px; }
  .footer.fixed { position: static !important; margin-left: 0; }
}

@media (max-width: 560px) {
  .gateway-command { display: block; }
  .gateway-actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 20px; }
  .gateway-action { width: auto; padding: 0 10px; }
  .gateway-metrics { grid-template-columns: 1fr; gap: 10px; }
  .dashboard-device-head { display: block; }
  .dashboard-device-actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .dashboard-device-actions a { justify-content: center; }
  .dashboard-downloads { grid-template-columns: 1fr; }
  .gateway-stat { min-height: 96px; }
}
