:root {
  --ink: #17263d;
  --muted: #687b92;
  --line: #e3eaf2;
  --surface: #ffffff;
  --canvas: #f3f7fb;
  --accent: #147dca;
  --accent-dark: #0c5f9e;
  --sidebar: #101f34;
  --sidebar-width: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; font-size: 14px; }
a { color: var(--accent-dark); }
a:hover { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #77c7f2; outline-offset: 2px; }

/* App shell */
.container.body { width: 100%; max-width: none; padding: 0; }
.main_container { min-height: 100vh; }
.left_col { position: fixed; z-index: 1040; inset: 0 auto 0 0; width: var(--sidebar-width); padding: 0; background: var(--sidebar); color: #dbe8f7; box-shadow: 6px 0 24px rgba(15, 39, 68, .08); }
.left_col.scroll-view { position: relative; inset: auto; width: 100%; height: 100%; overflow-y: auto; background: transparent; box-shadow: none; scrollbar-width: thin; scrollbar-color: #45627f transparent; }
.nav_title { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; height: auto; padding: 28px 24px 22px; margin: 0; }
.site_title { display: flex; align-items: center; gap: 13px; min-width: 0; color: #fff; font-size: 17px; font-weight: 800; letter-spacing: .09em; white-space: nowrap; }
.site_title:hover { color: #fff; }
.site_title span { overflow: hidden; text-overflow: ellipsis; }
.site_title .fa { display: grid; place-items: center; flex: 0 0 35px; height: 35px; border-radius: 10px; color: #8be9f2; background: linear-gradient(140deg, #167dbc, #184c8c); font-size: 17px; }
.sidebar-collapse-toggle { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; margin-left: auto; padding: 0; border: 0; border-radius: 8px; background: rgba(255,255,255,.09); color: #c4d4e5; cursor: pointer; }
.sidebar-collapse-toggle:hover { background: rgba(59,158,220,.25); color: #fff; }
.sidebar-collapse-toggle .fa { font-size: 19px; }
.profile { display: flex; align-items: center; gap: 12px; margin: 0 14px 26px; padding: 13px 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.05); }
.profile_pic { flex: 0 0 36px; }
.profile_img { width: 36px; height: 36px; border-radius: 10px; background: #e9f2fb; }
.profile_info { min-width: 0; }
.profile_info span { color: #91a9c0; font-size: 11px; }
.profile_info h2 { margin: 2px 0 0; overflow: hidden; color: #fff; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.menu_section { padding: 0 12px 20px; }
.side-menu { display: block; padding: 0; margin: 0; list-style: none; }
.side-menu > li { display: block; margin: 3px 0; }
.side-menu a { display: flex; align-items: center; gap: 13px; min-height: 43px; padding: 10px 12px; border-radius: 9px; color: #c4d4e5; font-weight: 550; cursor: pointer; }
.side-menu a:hover, .side-menu .current-page > a, .side-menu li.is-current > a, .side-menu li.is-open > a { background: rgba(59, 158, 220, .17); color: #fff; }
.side-menu a > .fa:first-child { width: 20px; color: #81c5e9; text-align: center; font-size: 16px; }
.sidebar-chevron { margin-left: auto; font-size: 11px; transition: transform .2s; }
.is-open > a .sidebar-chevron { transform: rotate(-90deg); }
.child_menu { display: none; padding: 2px 0 5px 32px; margin: 0; list-style: none; }
.is-open > .child_menu { display: block; }
.child_menu a { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.child_menu .dropdown-item { background: transparent; }
.top_nav { position: relative; z-index: 1020; min-height: 72px; margin-left: var(--sidebar-width); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.nav_menu { display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 0 30px; }
.nav.toggle a { display: inline-grid; place-items: center; width: 37px; height: 37px; border-radius: 9px; color: var(--ink); font-size: 18px; cursor: pointer; }
.nav.toggle a:hover { background: #edf5fc; }
.top_nav nav { margin-left: auto; }
.top_nav .navbar-right { display: flex; align-items: center; padding: 0; margin: 0; list-style: none; }
.user-profile { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--ink); font-weight: 650; }
.user-profile:hover { background: #f2f6fb; }
.user-profile img { width: 31px; height: 31px; border-radius: 9px; background: #e8f1fa; }
.dropdown-menu { padding: 6px; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 15px 35px rgba(21,45,74,.13); }
.dropdown-item { padding: 8px 10px; border-radius: 7px; font-size: 13px; }
.panel_toolbox .dropdown-item { display: block; width: 100%; height: auto; text-align: left; }
.right_col { min-width: 0; min-height: calc(100vh - 72px); margin-left: var(--sidebar-width); padding: 30px 32px 50px; }
.nav-sm .left_col { width: 72px; }
.nav-sm .left_col.scroll-view { width: 100%; }
.nav-sm .site_title span, .nav-sm .side-menu a { font-size: 0; }
.nav-sm .profile { display: none; }
.nav-sm .site_title { justify-content: center; }
.nav-sm .nav_title { padding: 28px 12px 22px; }
.nav-sm .nav_title .site_title { display: none; }
.nav-sm .sidebar-collapse-toggle { margin: 2px auto 3px; }
.nav-sm .sidebar-collapse-toggle .fa { transform: rotate(180deg); }
.nav-sm .side-menu a { justify-content: center; padding: 12px 8px; }
.nav-sm .side-menu a > .fa:first-child { font-size: 18px; }
.nav-sm .sidebar-chevron, .nav-sm .child_menu { display: none; }
.nav-sm .top_nav, .nav-sm .right_col { margin-left: 72px; }

/* Overview and content */
.tile_count { display: flex; flex-wrap: wrap; gap: 16px; width: 100%; margin: 0 0 27px; }
.tile_count > .tile_stats_count { flex: 1 1 180px; width: auto; max-width: none; min-width: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 20px rgba(20,48,78,.035); }
.tile_count > .tile_stats_count:empty, .tile_count > div:not(.tile_stats_count) { display: none; }
.count_top { display: block; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .09em; }
.count_top .fa { margin-right: 6px; color: var(--accent); font-size: 13px; }
.count { margin-top: 9px; color: var(--ink); font-size: 31px; font-weight: 750; line-height: 1.1; letter-spacing: -.04em; }
.count.green { color: #0a937b; }
.dashboard_graph { background: transparent; }
.dashboard_graph .x_title, .page-title { margin: 1px 0 10px; padding: 0; border: 0; }
.dashboard_graph .x_title { display: block; width: 100%; }
.dashboard_graph h3, .page-title h3, .page-title h2 { margin: 0; color: var(--ink); font-size: 23px; font-weight: 760; line-height: 1.3; letter-spacing: -.025em; }
.widget { margin-bottom: 18px; }
.x_panel { position: relative; width: 100%; min-height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 7px 22px rgba(19,46,75,.045); }
.x_title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.x_title h2 { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 17px; font-weight: 700; line-height: 1.35; }
.x_title h3 { margin: 0; font-size: 19px; }
.panel_toolbox { display: flex; flex: 0 0 auto; gap: 2px; padding: 0; margin: 0; list-style: none; }
.panel_toolbox > li > a { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.panel_toolbox > li > a:hover { background: #edf5fc; color: var(--accent-dark); }
.panel_toolbox .dropdown { position: relative; }
.panel_toolbox .dropdown-toggle::after { display: none; }
.custom_iot_access { color: #117e98; font-weight: 700; }
.font-14 { color: var(--muted); font-size: 13px; }
.custom_iot_data_block { padding: 0; }
.custom_iot_data_list { padding: 0; margin: 0 0 13px; list-style: none; }
.custom_iot_data_list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #edf1f6; color: #53657c; font-size: 13px; overflow-wrap: anywhere; }
.custom_iot_data_list li strong { color: var(--ink); font-weight: 600; }
.custom_iot_data_list li:last-child { border-bottom: 0; }
.x_content { min-width: 0; }
.nav-pills { gap: 7px; margin: 14px 0 18px; }
.nav-pills > li > a { display: inline-flex; align-items: center; gap: 5px; padding: 8px 12px; border: 1px solid #d7e6f3; border-radius: 8px; background: #f5faff; color: var(--accent-dark); font-size: 13px; line-height: 1.3; }
.nav-pills > li > a:hover { background: #e7f4fe; }
.nav-pills > li > a strong { font-weight: 650; }
.nav-pills .dropdown-menu { min-width: 170px; }
.table-responsive { overflow-x: auto; }
.table { color: var(--ink); background: #fff; }
.table thead th { border-top: 0; border-bottom: 1px solid var(--line); background: #f3f8fc; color: #5d7189; font-size: 11px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.table td, .table th { padding: 11px 12px; vertical-align: middle; border-color: var(--line); }
.table-bordered { border-color: var(--line); }
.table-striped tbody tr:nth-of-type(odd) { background: #fafcfe; }
.pagination { gap: 4px; }
.page-link { border-radius: 8px !important; border-color: var(--line); color: var(--accent-dark); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* Controls and dialogs */
.btn { border-radius: 8px; font-weight: 600; box-shadow: none !important; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: #e8f0f7; border-color: #e8f0f7; color: #284158; }
.btn-secondary:hover { background: #d9e7f3; border-color: #d9e7f3; color: #18334d; }
.form-control, .custom-select { height: auto; min-height: 39px; border-color: #d6e1ec; border-radius: 8px; color: var(--ink); background-color: #fff; }
.form-control:focus, .custom-select:focus { border-color: #53a5d8; box-shadow: 0 0 0 3px rgba(20,125,202,.12); }
.form-control::placeholder { color: #96a6b8; }
.has-feedback-left { padding-left: 35px; }
.has-feedback { position: relative; }
.has-feedback > .form-control-feedback { position: absolute; top: 50%; transform: translateY(-50%); color: #8ca0b6; }
.has-feedback.row > .form-control-feedback.left { left: 27px; pointer-events: none; }
.daterangepicker { z-index: 1060; border-color: var(--line); border-radius: 10px; box-shadow: 0 16px 36px rgba(21,45,74,.16); }
.daterangepicker td.active, .daterangepicker td.active:hover { background: var(--accent); }
label { color: #4b6078; font-weight: 600; }
.modal-content { overflow: hidden; border: 0; border-radius: 15px; box-shadow: 0 25px 75px rgba(8,30,56,.25); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-header { background: #f7fafe; }
.modal-title { color: var(--ink); font-size: 18px; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; }
.alert { border-radius: 10px; }
#all_messages { position: fixed; z-index: 2000; top: 14px; right: 18px; max-width: min(420px, calc(100vw - 36px)); }
#all_messages .alert { box-shadow: 0 10px 30px rgba(8,30,56,.12); }
.switch-container { display: flex; align-items: center; gap: 9px; }
.switch { position: relative; display: inline-block; flex: 0 0 48px; width: 48px; height: 26px; margin: 0; }
.switch input { position: absolute; opacity: 0; }
.slider { position: absolute; inset: 0; border-radius: 30px; background: #bdccda; cursor: pointer; transition: background .2s; }
.slider::before { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; content: ""; box-shadow: 0 1px 4px rgba(0,0,0,.16); transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.switch input:focus-visible + .slider { outline: 3px solid #77c7f2; outline-offset: 2px; }

/* Authentication */
body.login { min-height: 100vh; padding: 36px 16px; background: radial-gradient(circle at 85% 12%, rgba(28,134,204,.13), transparent 31%), linear-gradient(135deg, #eaf3fb, #f7fafc 65%); }
.auth-shell { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 72px); width: 100%; }
.login_wrapper { width: 100%; max-width: 430px; margin: 0 auto; }
.login_wrapper .login_wrapper { max-width: none; }
.login_content { display: block; padding: 34px 34px 26px; border: 1px solid #dfebf5; border-radius: 18px; background: #fff; box-shadow: 0 25px 65px rgba(20,52,85,.12); }
.login_content h1 { margin: 0 0 25px; font-size: 26px; font-weight: 770; letter-spacing: -.03em; }
.login_content .form-group { padding: 0; }
.login_content .form-control { min-height: 46px; padding-right: 38px; }
.has-feedback > .form-control-feedback.right { right: 13px; cursor: pointer; }
.modal .has-feedback > .form-control-feedback.right { right: 27px; }
.modal .has-feedback > .form-control { padding-right: 38px; }
.login_content button[type="submit"] { width: 100%; min-height: 44px; margin-top: 6px; background: var(--accent); border-color: var(--accent); color: #fff; }
.login_content button[type="submit"]:hover { background: var(--accent-dark); }
.login_content .separator { margin-top: 19px; text-align: center; }
.login_content .separator p { margin: 0; }
.login_content .separator a { font-weight: 600; }
.login_wrapper > .form > .text-center, .login_form > .text-center { margin-top: 22px; color: var(--muted); }
.login_wrapper .text-center h1 { margin: 0 0 5px; color: #627b94; font-size: 15px; font-weight: 750; letter-spacing: .08em; }
.login_wrapper .text-center p { margin: 0; font-size: 11px; }
.hiddenanchor { display: none; }

@media (max-width: 767px) {
  .left_col { width: 248px; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-sm .left_col { width: 248px; }
  .nav-sm .site_title span, .nav-sm .side-menu a { font-size: revert; }
  .nav-sm .profile { display: flex; }
  .nav-sm .site_title { justify-content: flex-start; }
  .nav-sm .nav_title { padding: 28px 24px 22px; }
  .nav-sm .nav_title .site_title { display: flex; }
  .nav-sm .sidebar-collapse-toggle { margin: 0 0 0 auto; }
  .nav-sm .sidebar-collapse-toggle .fa { transform: none; }
  .nav-sm .side-menu a { justify-content: flex-start; padding: 10px 12px; }
  .nav-sm .sidebar-chevron { display: inline; }
  .nav-sm .is-open > .child_menu { display: block; }
  .nav-sm .left_col { transform: translateX(0); }
  .top_nav, .right_col, .nav-sm .top_nav, .nav-sm .right_col { margin-left: 0; }
  .nav_menu { padding: 0 15px; }
  .right_col { padding: 22px 16px 38px; }
  .tile_count { gap: 9px; }
  .tile_count > .tile_stats_count { flex-basis: calc(50% - 5px); padding: 16px; }
  .count { font-size: 25px; }
  .dashboard_graph h3 { font-size: 20px; }
  body.login { padding: 20px 12px; }
  .login_content { padding: 27px 23px 21px; }
}

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