/*
 * Afaqy MDM theme — CSS overlay over Bootstrap 3 + HMDM main.css.
 *
 * Loaded LAST in index.html so its rules win on equal specificity. Do not
 * fork upstream templates; everything here is a CSS rule.
 *
 * Palette: dark navy + green derived from the Afaqy wordmark.
 */

:root {
    /* Brand palette */
    --afq-navy:        #1F3863;
    --afq-navy-soft:   #2A4A7C;
    --afq-navy-deep:   #15264A;
    --afq-green:       #0E893E;
    --afq-green-soft:  #1FA856;
    --afq-green-deep:  #0A6B30;

    /* Neutrals */
    --afq-bg:          #F4F6FA;
    --afq-surface:     #FFFFFF;
    --afq-divider:     #E4E8EF;
    --afq-text:        #1A1F2E;
    --afq-text-muted:  #6B7280;
    --afq-text-faint:  #9AA1AC;

    /* Status */
    --afq-danger:      #DC2626;
    --afq-warning:     #D97706;
    --afq-info:        #0EA5E9;
    --afq-success:     #0E893E;

    /* Elevation */
    --afq-shadow-sm:   0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --afq-shadow-md:   0 2px 4px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.08);
    --afq-shadow-lg:   0 4px 8px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.12);

    /* Geometry */
    --afq-radius-sm:   4px;
    --afq-radius:      6px;
    --afq-radius-lg:   8px;
}

/* ==========================================================================
   Typography & body
   ========================================================================== */

body {
    background-color: var(--afq-bg);
    color: var(--afq-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Header is navbar-fixed-top (position:fixed) at 56px tall — body needs
       matching top padding so content doesn't slide under it. */
    padding-top: 56px;
}

/* HMDM main.css sets * { font-size: 14px } — override targeted */
* {
    font-size: inherit;
}

body, p, td, th, input, select, textarea, button, .form-control {
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--afq-text);
    letter-spacing: -0.01em;
}

h1 { font-size: 24px; line-height: 1.3; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 17px; line-height: 1.4; }
h4 { font-size: 15px; line-height: 1.4; }

a {
    color: var(--afq-navy-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover, a:focus {
    color: var(--afq-navy);
    text-decoration: none;
}

hr {
    border-top: 1px solid var(--afq-divider);
}

/* ==========================================================================
   Top navigation header
   ========================================================================== */

.navbar.header,
.header {
    background: linear-gradient(90deg, var(--afq-navy) 0%, var(--afq-navy-soft) 100%);
    border: none;
    box-shadow: var(--afq-shadow-md);
    height: 56px;
    margin-bottom: 0;
    border-radius: 0;
}

.header .logo-text a,
.header .logo-text a:active,
.header .logo-text a:hover,
.header .logo-text a:focus {
    color: #FFFFFF;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: 0.01em;
    line-height: 56px;
    padding: 0 20px;
}

.header a, .header .navbar-nav > li > a {
    color: rgba(255, 255, 255, 0.88);
    line-height: 56px;
    padding-top: 0;
    padding-bottom: 0;
    height: 56px;
    transition: background 0.15s ease, color 0.15s ease;
}
.header a:hover, .header .navbar-nav > li > a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
}
.header .open a, .header .selected, .header .open .dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
}

.header .open .dropdown-menu {
    background: var(--afq-surface);
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
    box-shadow: var(--afq-shadow-lg);
    margin-top: 0;
    padding: 6px;
}
.header .open .dropdown-menu a {
    color: var(--afq-text);
    line-height: 1.5;
    height: auto;
    padding: 8px 14px;
    border-radius: var(--afq-radius-sm);
}
.header .open .dropdown-menu a:hover {
    background: var(--afq-bg);
    color: var(--afq-navy);
}

.header .expiry-warning,
.navbar-nav .expiry-warning {
    color: #FCD34D !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   Tabs / sub-navigation
   ========================================================================== */

.nav.nav-tabs {
    border-bottom: 1px solid var(--afq-divider);
    background: var(--afq-surface);
    padding: 0 12px;
    margin-bottom: 0;
}
.nav.nav-tabs > li > a {
    border: none;
    border-bottom: 2px solid transparent;
    margin: 0;
    padding: 14px 18px;
    color: var(--afq-text-muted);
    font-weight: 500;
    border-radius: 0;
    transition: color 0.15s ease, border-color 0.15s ease;
    background: transparent;
}
.nav.nav-tabs > li > a:hover {
    background: transparent;
    color: var(--afq-navy);
    border-bottom-color: var(--afq-divider);
}
.nav.nav-tabs > li.active > a,
.nav.nav-tabs > li.active > a:hover,
.nav.nav-tabs > li.active > a:focus {
    color: var(--afq-navy);
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--afq-green);
    font-weight: 600;
}

/* HMDM uses `nav nav-pills` in some places too */
.nav.nav-pills > li > a {
    border-radius: var(--afq-radius);
    color: var(--afq-text-muted);
    padding: 8px 14px;
}
.nav.nav-pills > li.active > a {
    background: var(--afq-navy);
    color: #FFFFFF;
}

/* ==========================================================================
   Content wrapper
   ========================================================================== */

.content-wrapper {
    background: var(--afq-surface);
    border-radius: var(--afq-radius-lg);
    box-shadow: var(--afq-shadow-sm);
    padding: 24px;
    margin: 16px;
}

/* The fullscreen tab card is height:100% (one viewport); long content (e.g. a tall
   table) would otherwise overflow below the card onto the page background. Make the
   card a scroll container so content stays inside it. Verified across Summary,
   Monitoring, Devices, and plugin settings. */
.content-wrapper.fullscreen {
    overflow-y: auto;
}

.width-1000 { max-width: 1000px; }
.width-700  { max-width: 700px; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    border-radius: var(--afq-radius);
    font-weight: 500;
    padding: 7px 16px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid transparent;
    line-height: 1.5;
    box-shadow: none;
}
.btn:focus, .btn:active:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 56, 99, 0.18);
}

.btn-default {
    background: var(--afq-surface);
    color: var(--afq-text);
    border-color: var(--afq-divider);
}
.btn-default:hover, .btn-default:focus {
    background: var(--afq-bg);
    border-color: var(--afq-text-faint);
    color: var(--afq-text);
}

.btn-primary {
    background: var(--afq-navy);
    color: #FFFFFF;
    border-color: var(--afq-navy);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--afq-navy-deep);
    border-color: var(--afq-navy-deep);
    color: #FFFFFF;
}

.btn-success {
    background: var(--afq-green);
    border-color: var(--afq-green);
    color: #FFFFFF;
}
.btn-success:hover, .btn-success:focus, .btn-success:active {
    background: var(--afq-green-deep);
    border-color: var(--afq-green-deep);
    color: #FFFFFF;
}

.btn-danger {
    background: var(--afq-danger);
    border-color: var(--afq-danger);
    color: #FFFFFF;
}
.btn-danger:hover, .btn-danger:focus, .btn-danger:active {
    background: #B91C1C;
    border-color: #B91C1C;
    color: #FFFFFF;
}

.btn-warning {
    background: var(--afq-warning);
    border-color: var(--afq-warning);
    color: #FFFFFF;
}
.btn-warning:hover, .btn-warning:focus, .btn-warning:active {
    background: #B45309;
    border-color: #B45309;
    color: #FFFFFF;
}

.btn-info {
    background: var(--afq-info);
    border-color: var(--afq-info);
    color: #FFFFFF;
}
.btn-info:hover, .btn-info:focus, .btn-info:active {
    background: #0284C7;
    border-color: #0284C7;
    color: #FFFFFF;
}

.btn-link {
    color: var(--afq-navy-soft);
    text-decoration: none;
}
.btn-link:hover, .btn-link:focus {
    color: var(--afq-navy);
    text-decoration: underline;
}

.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-lg { padding: 10px 22px; font-size: 16px; }

.btn-promo, .btn-promo:hover {
    background: var(--afq-green);
    color: #FFFFFF;
    border-color: var(--afq-green);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-control {
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
    background: var(--afq-surface);
    color: var(--afq-text);
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    padding: 7px 12px;
    height: 38px;
}
.form-control:focus {
    border-color: var(--afq-navy-soft);
    box-shadow: 0 0 0 3px rgba(31, 56, 99, 0.15);
    outline: none;
}
.form-control::placeholder {
    color: var(--afq-text-faint);
}

textarea.form-control {
    height: auto;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.control-label {
    color: var(--afq-text);
    font-weight: 500;
}

.field-hint {
    color: var(--afq-text-muted);
    font-size: 12px;
}

.field-warning {
    color: var(--afq-danger);
    font-size: 12px;
}

input[type="checkbox"], input[type="radio"] {
    accent-color: var(--afq-navy);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
    background: var(--afq-surface);
    border-radius: var(--afq-radius-lg);
    /* No overflow:hidden — it would clip per-row dropdown menus (Bootstrap
       dropdowns use position:absolute and overflow outside the row). The
       border-radius is preserved by clipping individual corners on the first
       and last header/body cells below. */
    margin-bottom: 16px;
}

.table > thead > tr:first-child > th:first-child { border-top-left-radius: var(--afq-radius-lg); }
.table > thead > tr:first-child > th:last-child  { border-top-right-radius: var(--afq-radius-lg); }
.table > tbody > tr:last-child > td:first-child  { border-bottom-left-radius: var(--afq-radius-lg); }
.table > tbody > tr:last-child > td:last-child   { border-bottom-right-radius: var(--afq-radius-lg); }

.table > thead > tr > th {
    background: var(--afq-bg);
    color: var(--afq-text-muted);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--afq-divider);
    padding: 12px 14px;
}

.table > tbody > tr > td,
.table > tfoot > tr > td {
    padding: 12px 14px;
    border-top: 1px solid var(--afq-divider);
    color: var(--afq-text);
    vertical-align: middle;
}

.table > tbody > tr:hover {
    background: var(--afq-bg);
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background: transparent;
}
.table-striped > tbody > tr:nth-of-type(odd):hover {
    background: var(--afq-bg);
}

.table-bordered,
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > td {
    border-color: var(--afq-divider);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-content {
    border: none;
    border-radius: var(--afq-radius-lg);
    box-shadow: var(--afq-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--afq-divider);
    padding: 18px 24px;
}
.modal-header .modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--afq-text);
}
.modal-header .close {
    color: var(--afq-text-muted);
    text-shadow: none;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}
.modal-header .close:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
    /* Bootstrap's `.modal-open .modal { overflow-y: auto }` already scrolls
       tall modals as a single unit. Capping modal-body here would create a
       clipping context that traps absolutely-positioned dropdown menus (the
       multi-select used in the role / customer / device / user modals). */
}

/* ==========================================================================
   Sticky tab toolbar
   ==========================================================================
   Reusable for any full-page tab whose top toolbar (search + pagination)
   should stay visible while the table body scrolls under it.
   The page itself scrolls naturally — this just pins the toolbar to the
   top of the visible area when the user scrolls past it. */
.afq-sticky-toolbar {
    position: sticky;
    top: 56px;            /* below the fixed header */
    background: var(--afq-bg);
    z-index: 5;
    padding: 10px 0 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--afq-divider);
}

.modal-footer {
    border-top: 1px solid var(--afq-divider);
    padding: 16px 24px;
}

.modal-backdrop.in {
    opacity: 0.5;
    background: var(--afq-navy-deep);
}

/* ==========================================================================
   Panels / cards
   ========================================================================== */

.panel {
    background: var(--afq-surface);
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius-lg);
    box-shadow: var(--afq-shadow-sm);
}
.panel-default > .panel-heading {
    background: var(--afq-bg);
    border-bottom: 1px solid var(--afq-divider);
    color: var(--afq-text);
    font-weight: 600;
    border-radius: var(--afq-radius-lg) var(--afq-radius-lg) 0 0;
    padding: 14px 18px;
}
.panel-body {
    padding: 18px;
}
.panel-footer {
    background: var(--afq-bg);
    border-top: 1px solid var(--afq-divider);
    border-radius: 0 0 var(--afq-radius-lg) var(--afq-radius-lg);
}

/* ==========================================================================
   Alerts / toast notifications
   ========================================================================== */

.alert {
    border: none;
    border-left: 3px solid transparent;
    border-radius: var(--afq-radius);
    box-shadow: var(--afq-shadow-md);
    padding: 12px 16px;
}
.alert-success { background: #ECFDF5; color: var(--afq-green-deep); border-left-color: var(--afq-green); }
.alert-danger  { background: #FEF2F2; color: #991B1B;             border-left-color: var(--afq-danger); }
.alert-warning { background: #FFFBEB; color: #92400E;             border-left-color: var(--afq-warning); }
.alert-info    { background: #F0F9FF; color: #075985;             border-left-color: var(--afq-info); }

/* ==========================================================================
   Login screen
   ========================================================================== */

.login {
    background: var(--afq-surface);
    border-radius: var(--afq-radius-lg);
    box-shadow: var(--afq-shadow-lg);
    padding: 32px;
    margin: 80px auto 0;
    width: 460px;
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo img {
    max-height: 60px;
    margin-bottom: 8px;
}
.login-logo .logo {
    display: block;
    color: var(--afq-text);
    font-weight: 600;
    font-size: 20px;
    margin-top: 12px;
    padding: 0;
    max-height: none;
}
.login-footer {
    text-align: center;
    color: var(--afq-text-muted);
    font-size: 12px;
    margin-top: 24px;
}
.login-footer a {
    color: var(--afq-navy-soft);
}
.login-min-height {
    min-height: 240px !important;
}

/* ==========================================================================
   Status indicators (the colored dots HMDM uses for online/offline)
   ========================================================================== */

.device-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 0;
    vertical-align: middle;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination > li > a, .pagination > li > span {
    color: var(--afq-text-muted);
    border-color: var(--afq-divider);
    padding: 6px 12px;
}
.pagination > .active > a, .pagination > .active > span,
.pagination > .active > a:hover, .pagination > .active > span:hover {
    background: var(--afq-navy);
    border-color: var(--afq-navy);
    color: #FFFFFF;
}
.pagination > li > a:hover {
    background: var(--afq-bg);
    color: var(--afq-navy);
    border-color: var(--afq-divider);
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumb {
    background: transparent;
    padding: 8px 0;
    margin-bottom: 12px;
    font-size: 13px;
}
.breadcrumb > li + li:before {
    content: "/";
    color: var(--afq-text-faint);
    padding: 0 8px;
}
.breadcrumb a {
    color: var(--afq-text-muted);
}
.breadcrumb .active {
    color: var(--afq-text);
}

/* ==========================================================================
   Dropdowns (generic, not the header one)
   ========================================================================== */

.dropdown-menu {
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
    box-shadow: var(--afq-shadow-lg);
    padding: 6px;
    margin-top: 4px;
}
.dropdown-menu > li > a {
    color: var(--afq-text);
    padding: 8px 14px;
    border-radius: var(--afq-radius-sm);
}
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
    background: var(--afq-bg);
    color: var(--afq-navy);
}

/* ==========================================================================
   Labels / badges
   ========================================================================== */

.label, .badge {
    font-weight: 500;
    border-radius: 99px;
    padding: 3px 9px;
    font-size: 12px;
}
.label-default, .badge { background: var(--afq-text-muted); }
.label-primary { background: var(--afq-navy); }
.label-success { background: var(--afq-green); }
.label-danger  { background: var(--afq-danger); }
.label-warning { background: var(--afq-warning); }
.label-info    { background: var(--afq-info); }

/* ==========================================================================
   Misc tightening
   ========================================================================== */

.error {
    color: var(--afq-danger);
    font-size: 13px;
}
.success {
    color: var(--afq-green-deep);
    font-size: 13px;
}

.list-desc, .configuration-hint, .field-hint {
    color: var(--afq-text-muted);
    font-size: 12px;
}

::selection {
    background: rgba(31, 56, 99, 0.18);
}

/* Subtle scrollbar (Webkit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--afq-divider);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--afq-text-faint);
}

/* ==========================================================================
   Afaqy Remote Control plugin — modal + tab UI
   ========================================================================== */

.afq-rc-modal .modal-dialog {
    width: 90vw;
    max-width: 1200px;
}
.afq-rc-modal .modal-body {
    background: #0E1116;
}

.afq-rc-tab .afq-rc-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--afq-surface);
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
}

/* Status pill — green when streaming, amber when connecting, red on error */
.afq-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 500;
    background: var(--afq-bg);
    color: var(--afq-text-muted);
}
.afq-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--afq-text-faint);
}
.afq-status-streaming  { background: #ECFDF5; color: var(--afq-green-deep); }
.afq-status-streaming  .afq-status-dot { background: var(--afq-green); }
.afq-status-connecting { background: #FFFBEB; color: #92400E; }
.afq-status-connecting .afq-status-dot { background: var(--afq-warning); animation: afq-pulse 1.4s ease-in-out infinite; }
.afq-status-error      { background: #FEF2F2; color: #991B1B; }
.afq-status-error      .afq-status-dot { background: var(--afq-danger); }

@keyframes afq-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* Stats strip under the canvas */
.afq-stats-strip {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 16px;
    background: var(--afq-bg);
    color: var(--afq-text-muted);
    font-size: 12px;
    border-top: 1px solid var(--afq-divider);
    border-bottom: 1px solid var(--afq-divider);
}
.afq-rc-modal .afq-stats-strip {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.72);
    border-color: rgba(255, 255, 255, 0.08);
}
.afq-rc-modal .afq-stats-strip strong { color: #FFFFFF; }

/* Canvas stage — dark backdrop the canvas is centered inside */
.afq-canvas-stage {
    position: relative;
    background: #0B0E13;
    text-align: center;
    min-height: 360px;
    padding: 16px;
    overflow: hidden;
    border-radius: var(--afq-radius);
}
.afq-rc-modal .afq-canvas-stage {
    border-radius: 0;
    min-height: 60vh;
}
.afq-canvas {
    display: inline-block;
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    cursor: crosshair;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-radius: var(--afq-radius-sm);
}
.afq-canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-align: center;
}

.afq-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--afq-green);
    border-radius: 50%;
    animation: afq-spin 0.9s linear infinite;
}
@keyframes afq-spin { to { transform: rotate(360deg); } }

/* Device clipboard panel */
.afq-clipboard-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--afq-bg);
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
    font-size: 13px;
}
.afq-clipboard-panel code {
    background: transparent;
    color: var(--afq-text);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.afq-rc-modal .afq-clipboard-panel {
    margin: 0 16px 16px 16px;
}

/* Remote-control modal header — title + subline + close. */
.afq-rc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--afq-divider);
}
.afq-rc-title {
    flex: 1;
    min-width: 0;
}
.afq-rc-title-line {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--afq-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.afq-rc-name { font-weight: 500; }
.afq-rc-subline {
    margin-top: 2px;
    font-size: 11px;
    color: var(--afq-text-muted);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
}
.afq-rc-close { margin-left: auto; }

/* Modal body becomes a horizontal split: main column + side panel. The
   side panel is absolutely positioned and slides over the main column so
   the canvas keeps its full width when collapsed. */
.afq-rc-body {
    position: relative;
    padding: 0;
    overflow: hidden;
}
.afq-rc-main {
    transition: margin-right 0.25s ease;
}
.afq-rc-body.afq-rc-details-open .afq-rc-main {
    margin-right: 320px;
}
.afq-rc-error { margin: 12px; }

/* Side panel — slides in from the right. translateX so the layout doesn't
   reflow underneath; opacity carries the entrance feel. */
.afq-rc-details {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background: #FFFFFF;
    border-left: 1px solid var(--afq-divider);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    z-index: 10;
}
.afq-rc-details.open {
    transform: translateX(0);
    opacity: 1;
}
.afq-rc-details-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--afq-divider);
}
.afq-rc-details-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--afq-text);
}
.afq-rc-details-close {
    background: transparent;
    border: none;
    color: var(--afq-text-muted);
    font-size: 22px;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
}
.afq-rc-details-close:hover { color: var(--afq-text); }
.afq-rc-details-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px 16px 14px;
}
.afq-rc-details-empty {
    padding: 24px 14px;
    color: var(--afq-text-muted);
    font-size: 13px;
    text-align: center;
}
.afq-rc-detail {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--afq-divider);
    font-size: 13px;
}
.afq-rc-detail:last-child { border-bottom: none; }
.afq-rc-detail-key {
    color: var(--afq-text-muted);
    flex: 0 0 auto;
}
.afq-rc-detail-val {
    color: var(--afq-text);
    text-align: right;
    word-break: break-word;
    max-width: 200px;
}

/* Placeholder text under the spinner — tighter spacing than the previous
   inline div so the status copy reads as one block with the spinner. */
.afq-canvas-placeholder-text {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* Footer controls — grouped icon buttons with dividers. End-session pinned
   right. Buttons disable themselves until frames flow so taps that would
   land on a black canvas don't fire silently. */
.afq-rc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #FFFFFF;
    border-top: 1px solid var(--afq-divider);
}
.afq-rc-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.afq-rc-ctl-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.afq-rc-ctl-divider {
    width: 1px;
    height: 22px;
    background: var(--afq-divider);
    margin: 0 6px;
}
.afq-rc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 12px;
    background: #FFFFFF;
    border: 1px solid var(--afq-divider);
    border-radius: 6px;
    color: var(--afq-text);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.afq-rc-btn:hover:not([disabled]) {
    background: #F4F6FA;
    border-color: #B8C2D6;
}
.afq-rc-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.afq-rc-btn-icon {
    font-size: 14px;
    line-height: 1;
    color: var(--afq-text-muted);
}
.afq-rc-btn-label { font-weight: 500; }
.afq-rc-btn-info.active {
    background: #1F3863;
    border-color: #1F3863;
    color: #FFFFFF;
}
.afq-rc-btn-info.active .afq-rc-btn-icon { color: #FFFFFF; }
.afq-rc-end {
    flex: 0 0 auto;
}

/* Liveness pill on the device list — drawn next to the lastUpdate column.
   Green/yellow/red states are computed in devices.controller.js
   (ageSeconds → afq-pill-green / -yellow / -red / -gray). */
.afq-pill {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.afq-pill-green  { background: #28a745; }
.afq-pill-yellow { background: #f0ad4e; }
.afq-pill-orange { background: #e8651a; }
.afq-pill-red    { background: #d9534f; animation: afq-pill-blink 2s ease-in-out infinite; }
.afq-pill-gray   { background: #c0c0c0; }
@keyframes afq-pill-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Tile view (screenshots plugin) — modeled after AirDroid Business's grid.
   Page header with online count + 4-way rotation; each tile = small header
   bar (icon + device + age + dot), large screenshot thumb, footer label. */

.afq-tiles-page {
    padding-top: 16px;
}
.afq-tiles-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 6px 0 12px 0;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 8px;
}
.afq-tiles-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.afq-tiles-toolbar .afq-tiles-filters { margin-left: 0; }
.afq-tiles-toolbar .afq-tiles-search {
    margin-left: 0;
    flex: 1 1 auto;
    min-width: 200px;
}
.afq-tiles-showing {
    color: #888;
    font-size: 12px;
    margin: 0 0 16px 0;
    line-height: 1.4;
}
.afq-tiles-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #28a745;
    font-weight: 500;
}
.afq-tiles-count {
    font-size: 14px;
}
.afq-tiles-actions {
    display: flex;
    gap: 6px;
}
.afq-rot-btn {
    background: #fff;
    border: 1px solid #d4d4d4;
    border-radius: 999px;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.afq-rot-btn:hover {
    border-color: #1F3863;
    color: #1F3863;
}
.afq-rot-btn.active {
    background: #1F3863;
    color: #fff;
    border-color: #1F3863;
}
.afq-rot-icon {
    display: inline-block;
    transition: transform 0.2s;
    line-height: 1;
}
.afq-rot-label { font-family: monospace; }

.afq-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.afq-tile {
    position: relative;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}
.afq-tile:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}
.afq-tile-header {
    background: #f5f5f5;
    padding: 6px 36px 6px 10px;  /* right pad reserves space for the corner 3-dot menu */
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    border-bottom: 1px solid #ececec;
}

/* Per-tile 3-dot menu. Mirrors the device-row dropdown so app settings +
   plugin actions are reachable from the tile view. Uses dropdown-append-to-body
   on the markup side so the menu escapes .afq-tile's overflow:hidden. */
.afq-tile-menu {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
}
.afq-tile-menu-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    background: rgba(255,255,255,0.75);
    color: #444;
    border-radius: 4px;
    cursor: pointer;
    line-height: 26px;
    text-align: center;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}
.afq-tile-menu-btn:focus { outline: none; }
.afq-tile:hover .afq-tile-menu-btn,
.afq-tile-menu.open .afq-tile-menu-btn {
    opacity: 1;
}
.afq-tile-menu-btn:hover {
    background: rgba(255,255,255,0.95);
    color: #000;
}
.afq-tile-icon {
    color: #28a745;
    font-size: 14px;
    line-height: 1;
}
.afq-tile-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    font-weight: 500;
}
.afq-tile-age {
    color: #888;
    font-size: 11px;
    margin-left: auto;
    white-space: nowrap;
}
.afq-pill-sm { width: 8px; height: 8px; margin-right: 0; }

/* Afaqy (S-2026-07 #7): secondary filter row sitting below the chip strip.
   Holds groups + configurations multi-selects, launcher-version text
   filter, and root-status chips. Flex-wrap so it reflows on narrow
   viewports. Each cell labels itself so the row reads top-down. */
.afq-tiles-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 8px 0 4px 0;
    border-top: 1px dashed var(--afq-divider);
    margin-top: 6px;
}
.afq-tiles-filter-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
}
.afq-tiles-filter-label {
    font-size: 12px;
    color: var(--afq-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.afq-tiles-mselect {
    display: inline-block;
    min-width: 160px;
}
.afq-tiles-mselect .dropdown-toggle {
    background: var(--afq-surface);
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
    color: var(--afq-text);
    padding: 4px 28px 4px 10px;
    font-size: 12px;
    min-height: 28px;
}
.afq-tiles-chips {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.afq-tiles-version-input {
    background: var(--afq-surface);
    border: 1px solid var(--afq-divider);
    border-radius: var(--afq-radius);
    padding: 4px 26px 4px 10px;
    font-size: 12px;
    height: 28px;
    width: 140px;
    color: var(--afq-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.afq-tiles-version-input:focus {
    border-color: var(--afq-navy-soft);
    box-shadow: 0 0 0 2px rgba(31, 56, 99, 0.15);
}
.afq-tiles-version-clear {
    background: transparent;
    border: none;
    color: var(--afq-text-muted);
    font-size: 16px;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
    margin-left: -22px;
}
.afq-tiles-version-clear:hover { color: var(--afq-text); }
.afq-tiles-clear-all {
    background: transparent;
    border: 1px solid var(--afq-divider);
    border-radius: 99px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--afq-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    margin-left: auto;
}
.afq-tiles-clear-all:hover {
    background: var(--afq-bg);
    color: var(--afq-danger);
    border-color: var(--afq-divider);
}

/* Tile filter buttons — All / Online / Offline tab strip above the grid. */
.afq-tiles-filters {
    display: inline-flex;
    gap: 4px;
    margin-left: 16px;
    align-items: center;
}
.afq-tile-filter-btn {
    background: transparent;
    border: 1px solid #d0d0d0;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12px;
    color: #444;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.afq-tile-filter-btn:hover {
    background: #f0f0f0;
}
.afq-tile-filter-btn.active {
    background: #2470c9;
    color: #fff;
    border-color: #2470c9;
}

/* Search input sits between the filter chips and the rotation buttons.
   Compact pill shape matching the chip aesthetic. */
.afq-tiles-search {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    flex: 0 1 240px;
}
.afq-tiles-search-input {
    width: 100%;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 14px;
    padding: 4px 28px 4px 12px;
    font-size: 12px;
    color: #333;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.afq-tiles-search-input:focus {
    border-color: #2470c9;
    box-shadow: 0 0 0 2px rgba(36, 112, 201, 0.15);
}
.afq-tiles-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #888;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.afq-tiles-search-clear:hover { color: #2470c9; }

/* Relative-time reachability chip — shows "Now / 5m ago / 2h ago" with a
   colour ramp green→yellow→orange→red as the gap grows. Replaces the binary
   LIVE/OFFLINE pill that flapped on every cellular handoff. */
.afq-mqtt-badge {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 2px 6px;
    border-radius: 3px;
    color: #fff;
    margin-left: 4px;
}
.afq-mqtt-badge.afq-pill-green  { background: #0E893E; }
.afq-mqtt-badge.afq-pill-yellow { background: #c98a16; }
.afq-mqtt-badge.afq-pill-orange { background: #c4541b; }
.afq-mqtt-badge.afq-pill-red    { background: #c0392b; animation: none; }
.afq-mqtt-badge.afq-pill-gray   { background: #aaa; color: #fff; }

.afq-tile-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #2b2b2b;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.afq-tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
    transform-origin: center center;
}
.afq-tile-placeholder {
    color: #888;
    font-size: 12px;
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, #3a4a6a 0%, #4a5a7a 100%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.afq-tile-refresh-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 16px;
    line-height: 26px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.afq-tile:hover .afq-tile-refresh-overlay {
    opacity: 1;
}
.afq-tile-refresh-overlay:hover {
    background: rgba(0,0,0,0.8);
}
.afq-tile-refresh-overlay[disabled] {
    opacity: 0.6 !important;
    cursor: progress;
}
.afq-tile-spinner {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.afq-tile-spinner-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    animation: afq-tile-spin 0.8s linear infinite;
}
@keyframes afq-tile-spin {
    to { transform: rotate(360deg); }
}
.afq-tile-refresh-failed {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #d9534f;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.afq-tile-footer {
    background: #f9f9f9;
    padding: 6px 10px;
    font-size: 12px;
    color: #555;
    border-top: 1px solid #ececec;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Summary page — multi-column grid layout ===== */
.summary-wrap {
    padding: 16px;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
    gap: 16px;
}
.summary-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 16px;
    height: 320px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.summary-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    text-align: center;
    line-height: 1.2;
}
.summary-card-body {
    flex: 1;
    display: flex;
    gap: 12px;
    min-height: 0;
}
.summary-canvas-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
    min-height: 0;
}
/* Donut cards have side-by-side chart + counts */
.summary-card-body-donut .summary-canvas-wrap {
    flex: 1;
}
.summary-counts {
    flex: 0 0 160px;
    align-self: center;
    font-size: 13px;
    padding-right: 4px;
}
.summary-count-row {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    align-items: baseline;
}
.summary-count-row .label {
    flex: 1;
    text-align: right;
    color: #666;
    font-size: 12px;
}
.summary-count-row .value {
    font-weight: 600;
    font-size: 14px;
    min-width: 40px;
    text-align: right;
}
@media (max-width: 700px) {
    .summary-card-body-donut { flex-direction: column; }
    .summary-counts { flex: none; align-self: stretch; }
    .summary-counts .label { text-align: left; }
}

/* ===========================================================================
 * Login screen polish (afaqy)
 * ======================================================================== */
.afaqy-login {
    max-width: 420px;
    margin: 0 auto;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(21, 38, 74, 0.12), 0 2px 8px rgba(21, 38, 74, 0.06);
    overflow: hidden;
}
.afaqy-login-body {
    padding: 32px 32px 28px;
    background: #FFFFFF;
}
.afaqy-login .form-group { margin-bottom: 18px; }
.afaqy-login label {
    font-weight: 600;
    color: var(--afq-navy);
    margin-bottom: 6px;
}
.afaqy-login .form-control {
    height: 44px;
    border-radius: 8px;
    border: 1px solid #d7deea;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.afaqy-login .form-control:focus {
    border-color: var(--afq-navy-soft);
    box-shadow: 0 0 0 3px rgba(42, 74, 124, 0.15);
}

/* Prominent inline alert (replaces the faint panel-heading) */
.afaqy-login-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    border-left: 4px solid transparent;
}
.afaqy-login-alert .glyphicon { font-size: 18px; flex: none; }
.afaqy-login-alert-error {
    background: #fdecec;
    color: #b42318;
    border-left-color: #d92d20;
}
.afaqy-login-alert-success {
    background: #e9f7ef;
    color: #11704a;
    border-left-color: var(--afq-green);
}

/* Show-password eye toggle */
.afaqy-pw-wrap { position: relative; }
.afaqy-pw-wrap .form-control { padding-right: 42px; }
.afaqy-pw-toggle {
    position: absolute;
    top: 0; right: 0;
    height: 44px; width: 42px;
    border: none;
    background: transparent;
    color: #8a93a6;
    cursor: pointer;
}
.afaqy-pw-toggle:hover { color: var(--afq-navy); }
.afaqy-pw-toggle:focus { outline: none; color: var(--afq-navy); }

/* Full-width primary login button with spinner */
.afaqy-login-btn {
    display: block;
    width: 100%;
    height: 46px;
    margin-top: 6px;
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    opacity: 1;
}
.afaqy-login-btn[disabled] { opacity: .65; cursor: not-allowed; }

.afaqy-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: afaqy-spin .7s linear infinite;
}
@keyframes afaqy-spin { to { transform: rotate(360deg); } }

/* Secondary links, centered under the button */
.afaqy-login-links {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    line-height: 1.9;
}

/* Version stamp in the footer */
.afaqy-login-version {
    display: inline-block;
    margin-left: 8px;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

/* CI/CD plugin: one-time minted-key reveal — inline above the table.
 * NOT the Bootstrap .alert class, which HMDM styles as a fixed bottom-left toast. */
.afaqy-cicd-minted {
    margin: 0 0 16px;
    padding: 14px 16px;
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FCD34D;
    border-left: 4px solid var(--afq-warning);
    border-radius: var(--afq-radius);
}
.afaqy-cicd-minted-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: 8px;
}
.afaqy-cicd-minted-key {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: #FFFFFF;
    border: 1px solid #FDE68A;
    border-radius: 6px;
    word-break: break-all;
    font-family: monospace;
    font-size: 13px;
    color: var(--afq-text);
    cursor: pointer;
}
.afaqy-cicd-copy-btn {
    flex: 0 0 auto;
    align-self: stretch;
    white-space: nowrap;
}
