:root {
    --surface: #fff;
    --bg: #f5f7fb;
    --text: #0f172a;
    --muted: #64748b;
    --ring: rgba(37,99,235,.18);
    --steel-primary: #f8fafc;
    --steel-secondary: #e2e8f0;
    --steel-accent: #3b82f6;
    --steel-dark: #1e293b;
    --steel-medium: #475569;
    --steel-light: #cbd5e1;
    --steel-surface: #ffffff;
    --steel-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --steel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --steel-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --modal-offset: 70px;
}

body {
    background: var(--steel-gradient);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--steel-dark);
}

.main-container,
.content-area,
.content-page {
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    will-change: auto !important;
}

.modern-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--steel-secondary);
    box-shadow: var(--steel-shadow);
    top: 0;
    z-index: 1050;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--steel-accent), #2563eb);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--steel-shadow);
}

.nav-actions .btn {
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--steel-light);
    background: var(--steel-surface);
    color: var(--steel-medium);
    padding: 0.5rem 1rem;
}

    .nav-actions .btn:hover {
        background: var(--steel-primary);
        border-color: var(--steel-accent);
        color: var(--steel-accent);
        transform: translateY(-1px);
        box-shadow: var(--steel-shadow-lg);
    }

.main-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

.navigation-panel {
    background: var(--steel-surface);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--steel-shadow-lg);
    border: 1px solid var(--steel-secondary);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.nav-section {
    margin-bottom: 2rem;
}

    .nav-section:last-child {
        margin-bottom: 0;
    }

.section-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--steel-medium);
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--steel-medium);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

    .nav-item:hover {
        background: var(--steel-primary);
        color: var(--steel-dark);
        text-decoration: none;
        transform: translateX(4px);
        border-color: var(--steel-light);
    }

    .nav-item.active {
        background: linear-gradient(135deg, var(--steel-accent), #2563eb);
        color: white;
        box-shadow: var(--steel-shadow);
        border-color: var(--steel-accent);
    }

        .nav-item.active:hover {
            transform: translateX(4px) scale(1.02);
            background: linear-gradient(135deg, #2563eb, var(--steel-accent));
        }

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Content Area */
.content-area {
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--steel-shadow-lg);
    border: 1px solid var(--steel-secondary);
    min-height: 600px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--steel-secondary);
}

.page-title-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--steel-accent), #2563eb);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--steel-shadow);
}

.page-title h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--steel-dark);
}

.page-subtitle {
    margin: 0;
    color: var(--steel-medium);
    font-size: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 991.98px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .navigation-panel {
        position: static;
        order: 2;
    }

    .content-area {
        order: 1;
    }
}

/* Mobile Navigation */
.mobile-nav {
    background: var(--steel-surface);
    border-radius: 20px;
    margin: 1rem;
    box-shadow: var(--steel-shadow-lg);
    border: 1px solid var(--steel-secondary);
}

    .mobile-nav .offcanvas-header {
        border-bottom: 1px solid var(--steel-secondary);
        padding: 1.5rem;
    }

    .mobile-nav .offcanvas-body {
        padding: 1.5rem;
    }

    .mobile-nav .nav-item {
        margin-bottom: 0.5rem;
    }

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.navigation-panel, .content-area {
    animation: fadeIn 0.6s ease-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--steel-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--steel-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--steel-medium);
}

/* Brand area */
.brand-section {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--steel-dark);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
}

@media (min-width: 992px) {
    .brand-logo {
        height: 32px;
    }

    .modal-dialog {
        margin-top: 4rem; /* ~64px */
        margin-bottom: 2rem;
    }
}

.brand-text {
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: .2px;
}

/* Page background & height */
body, .content-page {
    background: var(--bg) !important;
}

    .content-page .container-fluid {
        min-height: calc(100vh - 180px);
    }

@supports (height: 100dvh) {
    .content-page .container-fluid {
        min-height: calc(100dvh - 180px);
    }
}

/* Site-wide page photo background */
.content-page > .content > .container-fluid {
    --page-radius: 20px;
    --page-pad: clamp(12px, 2vw, 24px);
    position: relative;
    isolation: isolate; 
    border-radius: var(--page-radius);
    overflow: hidden;
    background: transparent; 
    padding: var(--page-pad);
}

    .content-page > .content > .container-fluid::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: url("/assets/images/kitchen.jpg") center/cover no-repeat;
        opacity: .05;
        border-radius: inherit;
    }

/* Band */
.band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #0d6efd;
    color: #fff;
    border-radius: 14px;
    padding: .9rem 1rem;
    margin-bottom: 14px;
}

    .band .title {
        margin: 0;
        font-weight: 800;
    }

    .band .sub {
        opacity: .9;
        font-size: .9rem;
    }

    .band .crumbs a {
        color: #dce8ff;
        text-decoration: none;
    }

        .band .crumbs a:hover {
            color: #fff;
            text-decoration: underline;
        }

/* Surfaces */
.cardx {
    border: 1px solid #e6ecf5;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 14px 36px -18px rgba(15,23,42,.22);
}

/* Pills */
.pill, .stat-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border: 1px solid #e9eef7;
    background: #fbfdff;
    border-radius: 999px;
    padding: .18rem .55rem;
    font-weight: 700;
    font-size: .8rem;
}

    .pill.gold, .pill-gold {
        background: #fff8e1;
        border-color: #ffe9a8;
    }

/* Key/Value grid */
.kv {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: .25rem .75rem;
}

    .kv .k {
        color: var(--muted);
    }

/* Text helpers */
.section-title {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: .4rem;
}

.soft {
    color: var(--muted);
}

/* Tables */
.table-modern thead th {
    background: #f7f9fd;
    border-bottom: 1px solid #edf2f7;
    color: #475569;
    font-weight: 700;
}

.table-modern tbody td {
    vertical-align: middle;
}

/* Buttons & toolbar */
.btn-round {
    border-radius: 10px;
}

.toolbar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

    .toolbar .btn {
        border-radius: 10px;
    }

/* Search box */
.search-box {
    border: 1px solid #e6ecf5;
    background: var(--surface);
    border-radius: 14px;
    padding: .9rem 1rem;
    box-shadow: 0 12px 30px -18px rgba(15,23,42,.25);
    margin-bottom: 14px;
}

.search-row {
    row-gap: .5rem;
}

    .search-row .form-control {
        border-radius: 10px;
    }

/* User card */
.user-card {
    position: relative;
    border: 1px solid #e6ecf5;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 30px -16px rgba(15,23,42,.18);
    height: 100%;
}

    .user-card .name {
        font-weight: 700;
    }

/* Compact ID button */
.cid-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 10px;
    padding: .35rem .6rem;
    font-weight: 600;
}

/* Account card hover */
.account-card {
    border-radius: 16px;
    transition: all .2s ease;
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word
}

    .account-card:hover {
        box-shadow: 0 12px 24px rgba(0,0,0,.08);
    }

/* Icon button */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f8f9fa;
    color: #0d6efd;
    font-size: 20px;
    transition: background .2s ease, box-shadow .2s ease;
}

    .icon-btn:hover {
        background-color: #e7f1ff;
    }

    .icon-btn:focus-visible {
        outline: 0;
        box-shadow: 0 0 0 4px var(--ring);
    }

/* Card actions */
.card-actions {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 2;
}

/* KPI */
.kpi-row {
    row-gap: 1.25rem;
}

.kpi-card {
    position: relative;
    display: flex;
    gap: 1rem;
    align-items: center;
    border: 1px solid #e6ecf5;
    border-radius: 18px;
    background: var(--surface);
    padding: 1rem 1.15rem;
    box-shadow: 0 10px 28px -14px rgba(15,23,42,.18);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

    .kpi-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 20px 42px -18px rgba(15,23,42,.25);
        border-color: #dbe6f5;
    }

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    flex: 0 0 52px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg,#eef4ff,#f3f8ff);
    color: #1d4ed8;
    border: 1px solid #e1eaff;
    box-shadow: 0 6px 14px rgba(37,99,235,.16);
}

    .kpi-icon.success {
        color: #0f766e;
        background: linear-gradient(135deg,#e9fff7,#f1fffe);
        border-color: #c9f6e9;
    }

    .kpi-icon.info {
        color: #0369a1;
        background: linear-gradient(135deg,#e6f6ff,#eefbff);
        border-color: #cfeeff;
    }

    .kpi-icon.danger {
        color: #b91c1c;
        background: linear-gradient(135deg,#ffe8e8,#fff1f1);
        border-color: #ffd6d6;
    }

.kpi-body {
    min-width: 0;
}

.kpi-title {
    margin: 0;
    font-size: .8rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.kpi-value {
    margin: .2rem 0 0;
    font-weight: 800;
    font-size: 2rem;
    line-height: 1;
    color: var(--text);
}

/* Transparent boxes used elsewhere */
.card-box, .panel-body {
    background-color: transparent !important;
}

/* Page-specific card + button group */
.card {
    border-radius: 16px !important;
    box-shadow: 0 20px 40px -10px rgba(31,45,58,0.08) !important;
}

.btn-group .btn {
    background: #eef3fa;
    border: 1px solid #d7e0ee;
    color: #374151;
    font-weight: 500;
}

    .btn-group .btn.active {
        background: #fff;
        box-shadow: 0 4px 16px rgba(31,45,58,0.08);
    }

/* Gauges */
.gauge-head .badge {
    letter-spacing: .3px;
}

.gauge-value {
    font-weight: 800;
    font-size: clamp(20px, 3.2vw, 28px);
    line-height: 1;
}

.gauge-unit {
    font-weight: 600;
    font-size: clamp(14px, 2.4vw, 20px);
    color: var(--bs-secondary-color);
    margin-left: 2px;
}

/* Toolbar row */
.toolbar-row {
    --pill-h: 38px;
}

    .toolbar-row .btn {
        height: var(--pill-h);
        padding: 0 14px;
        display: inline-flex;
        align-items: center;
        line-height: 1;
        flex-shrink: 0;
    }

    .toolbar-row .btn-group {
        height: var(--pill-h);
        display: inline-flex;
        align-self: center;
        flex-shrink: 0;
    }

        .toolbar-row .btn-group .btn {
            height: 100%;
            padding: 0 14px;
            display: inline-flex;
            align-items: center;
            line-height: 1;
            flex-shrink: 0;
        }

/* Rule card */
.rule-card .kv-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--bs-secondary-color);
    margin-bottom: .25rem;
}

.rule-card .chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .35rem .6rem;
    border-radius: 50rem;
    font-weight: 600;
    line-height: 1;
}

/* Base sizing */
html, body {
    height: 100%;
    margin: 0;
    overflow-x: clip;
}

/* Auth */
.auth-wrap {
    min-height: 80dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(1200px 600px at -10% -10%, rgba(59,130,246,.08), transparent 60%), radial-gradient(900px 500px at 110% 10%, rgba(34,197,94,.08), transparent 60%), linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.auth-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(15,23,42,.08);
    width: 100%;
}

.brand {
    height: auto;
    max-height: 150px;
    max-width: 70%;
}

/* Inputs */
.form-control {
    height: 46px;
}

.input-group-text {
    background: #fff;
}

/* Small-screen refinements */
@media (max-width: 576.98px) {
    .auth-wrap {
        padding: 16px;
    }

    .brand {
        max-height: 96px;
        max-width: 80%;
    }

    .auth-title {
        font-size: 1.125rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .form-control {
        height: 44px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* Access tiles */
.access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.access-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid #e6ecf5;
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 10px 24px -14px rgba(15,23,42,.16);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    outline: 0;
}

    .access-tile:hover {
        transform: translateY(-2px);
        box-shadow: 0 18px 34px -16px rgba(15,23,42,.22);
    }

    .access-tile[aria-pressed="true"] {
        border-color: #3b82f6;
        box-shadow: 0 0 0 4px rgba(59,130,246,.15), 0 14px 30px -16px rgba(15,23,42,.24);
    }

    .access-tile .icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        display: grid;
        place-items: center;
        background: linear-gradient(135deg,#eef4ff,#f3f8ff);
        color: #1d4ed8;
        border: 1px solid #e1eaff;
    }

    .access-tile[aria-pressed="true"] .icon {
        background: linear-gradient(135deg,#3b82f6,#2563eb);
        color: #fff;
        border-color: transparent;
    }

    .access-tile .txt .title {
        display: block;
        font-weight: 700;
    }

    .access-tile .txt .sub {
        display: block;
        font-size: .8rem;
        color: #64748b;
    }

    .access-tile .check {
        position: absolute;
        right: 10px;
        top: 10px;
        width: 22px;
        height: 22px;
        border-radius: 999px;
        display: grid;
        place-items: center;
        font-size: .9rem;
        background: #16a34a;
        color: #fff;
    }

@media (max-width: 575.98px) {
    .access-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tilebox-two {
        padding: 1rem !important;
    }

    .gauge-value {
        font-size: 1.6rem !important;
    }

    .gauge-unit {
        font-size: 1rem !important;
    }

}

/* International Tel Input */
.iti {
    width: 100%;
}

.iti__country-list {
    z-index: 2000;
}
/* above modal content */
.iti__flag-container {
    z-index: 1;
}

.input-group.iti-group .iti {
    display: block;
    flex: 1 1 auto;
}

    .input-group.iti-group .iti input.form-control {
        width: 100%;
    }

.iti--separate-dial-code input.form-control {
    padding-left: 92px !important;
}

@media (max-width: 400px) {
    .iti--separate-dial-code input.form-control {
        padding-left: 80px !important;
    }
}

/* Tighten modal padding on small screens */
@media (max-width: 576.98px) {
    .modal-body {
        padding: 1rem !important;
    }
}

/* Dash header */
.dash-header {
    margin-top: .75rem;
    margin-bottom: .5rem;
}

.dash-sub {
    color: var(--muted);
    margin-bottom: 1.25rem;
}

/* Stat cards */
.stat-card {
    position: relative;
    border: 1px solid #e6ecf5;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 10px 30px -12px rgba(31,45,58,.18);
    padding: 1.25rem 1.25rem 1rem;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

    .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 18px 42px -16px rgba(31,45,58,.22);
        border-color: #d9e3f2;
    }

.stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .35rem;
}

.stat-title {
    margin: 0;
    font-weight: 700;
    letter-spacing: .3px;
}

.stat-sub {
    color: var(--muted);
    margin: 0 0 .25rem 0;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    letter-spacing: .2px;
    margin: .25rem 0 .5rem 0;
}

.stat-kicker {
    color: var(--muted);
    margin: 0;
}

.icon-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex: 0 0 42px;
    background: linear-gradient(135deg,#e9effe,#eef6ff);
    color: #1d4ed8;
    box-shadow: 0 4px 10px rgba(37,99,235,.15);
    border: 1px solid #e3ebff;
}

.primary .icon-chip {
    color: #1d4ed8;
    background: linear-gradient(135deg,#e9effe,#eef6ff);
}

.success .icon-chip {
    color: #0f766e;
    background: linear-gradient(135deg,#d1fae5,#ecfeff);
    border-color: #c7f7ec;
}

.warning .icon-chip {
    color: #92400e;
    background: linear-gradient(135deg,#fff7ed,#fef3c7);
    border-color: #fde9b5;
}

/* Progress line */
.progress-line {
    height: 8px;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
    outline: 1px solid #eef2f7;
}

    .progress-line > span {
        display: block;
        height: 100%;
        border-radius: 999px;
        background: linear-gradient(90deg,#60a5fa,#2563eb);
        box-shadow: 0 0 0 3px var(--ring);
        transition: width .5s ease;
    }

/* Grid spacing */
.tiles {
    row-gap: 1.25rem;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    pointer-events: all;
}

.loading-box {
    background: #fff;
    border: 1px solid #e6ecf5;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 30px -12px rgba(31,45,58,.25);
    display: flex;
    align-items: center;
    gap: .75rem;
}

.loading-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 1s infinite ease-in-out;
}

    .loading-dot:nth-child(1) {
        animation-delay: 0s;
        background: #2563eb;
    }

    .loading-dot:nth-child(2) {
        animation-delay: .15s;
        background: #60a5fa;
    }

    .loading-dot:nth-child(3) {
        animation-delay: .30s;
        background: #93c5fd;
    }

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(0.85);
        opacity: .8;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

.top-arch {
    width: 100%;
    height: clamp(42px, 7vw, 110px);
    background: url("/assets/images/arch.png") center top / 100% 100% no-repeat;
    pointer-events: none;
    filter: drop-shadow(0 6px 14px rgba(15,23,42,.12));
    margin-top: -1px;
    position: relative;
    z-index: 900;
    overflow-x: hidden;
}

@media (max-width: 576px) {
    .top-arch {
        height: 42px;
    }

    .nav-actions {
        flex-wrap: wrap;
        gap: .5rem;
    }

    .nav-actions .btn {
        padding: .45rem .75rem;
    }

    .devices-header .col {
        flex-direction: column;
        align-items: stretch !important;
    }

    .store-count {
        justify-content: flex-start;
    }

    .modal-dialog {
        margin-top: 120px !important; 
        margin-left: auto;
        margin-right: auto;
        max-width: 95vw !important;
    }

    .modal-content {
        border-radius: 0 !important;
        max-height: calc(100dvh - 130px);
        overflow-y: auto;
    }

    .modal-body {
        padding: 1rem !important;
    }

        .modal-body .form-control {
            height: 40px;
            font-size: 0.9rem;
        }

        .modal-body button {
            font-size: 0.9rem;
            padding: 0.5rem 0.75rem;
        }

    .btn-toggle-group {
        flex-direction: column;
        width: 100%;
    }

        .btn-toggle-group .btn-toggle {
            width: 100%;
            text-align: center;
            border-radius: 0;
        }

            .btn-toggle-group .btn-toggle + .btn-toggle {
                border-left: none;
                border-top: 1px solid var(--steel-light);
            }

    .toolbar-row .btn-group[role="group"] {
        display: flex;
        width: 100%;
        border: 1px solid var(--steel-light);
        border-radius: 999px;
        overflow: hidden;
        box-shadow: var(--steel-shadow);
    }

        .toolbar-row .btn-group[role="group"] .btn {
            flex: 1 1 auto;
            padding: 0.5rem 0.75rem;
            text-align: center;
            font-weight: 600;
            border-radius: 0;
            border: none;
        }

            .toolbar-row .btn-group[role="group"] .btn + .btn {
                border-left: 1px solid var(--steel-light);
            }

            .toolbar-row .btn-group[role="group"] .btn.active {
                background: linear-gradient(135deg, var(--steel-accent), #2563eb);
                color: white;
                font-weight: 700;
                box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.1);
            }
}

/* Tablet */
@media (min-width: 768px) {
    .rule-card .chip {
        white-space: nowrap;
        word-break: normal;
    }

        .rule-card .chip i {
            flex-shrink: 0;
        }

    .modal-dialog {
        margin-top: 2rem !important;
        margin-bottom: 2rem !important;
    }
}

/* Phone */
@media (max-width: 767.99px) {
    .rule-card .kv {
        grid-template-columns: 1fr;
    }

    .rule-card .kv-label {
        margin-bottom: .35rem;
    }
}

@media (max-width: 991.98px) {
    .content-page > .content > .container-fluid {
        --page-pad: 14px;
        --page-radius: 0;
        border-radius: 0 !important;
        overflow: visible !important;
        padding-left: var(--page-pad);
        padding-right: var(--page-pad);
    }
}

/* Internal navigation strip */
.internal-nav {
    margin-bottom: 1rem;
}

    .internal-nav h4 {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem;
        margin: 0;
    }

    .internal-nav a.btn {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        font-weight: 600;
        border-radius: 10px;
        padding: .45rem .85rem;
        transition: var(--transition);
    }

        .internal-nav a.btn.btn-outline-dark {
            border-color: var(--steel-light);
            color: var(--steel-dark);
        }

            .internal-nav a.btn.btn-outline-dark:hover {
                background: var(--steel-light);
                color: var(--steel-dark);
            }

        .internal-nav a.btn.btn-outline-primary {
            border-color: var(--steel-accent);
            color: var(--steel-accent);
        }

            .internal-nav a.btn.btn-outline-primary:hover {
                background: var(--steel-accent);
                color: #fff;
            }

@media (max-width: 767.98px) {
    .modal-dialog {
        margin: var(--modal-offset, 90px) auto 1rem auto !important;
        max-width: 95vw !important;
    }

    .modal-content {
        max-height: calc(100dvh - 100px) !important;
        overflow-y: auto !important;
        border-radius: 12px;
    }

    .modal-body {
        padding: 1rem !important;
    }

    .toolbar-row {
        flex-direction: column !important;
        align-items: stretch;
    }

        .toolbar-row .btn,
        .toolbar-row .btn-group,
        .toolbar-row .btn-group .btn {
            width: 100%;
            justify-content: center;
            margin-bottom: 0.5rem;
        }
}

/* Store groups / stores header */
.devices-header {
    border-bottom: 1px solid var(--steel-secondary);
    padding-bottom: .5rem;
}

.btn-toggle-group {
    display: inline-flex;
    border: 1px solid var(--steel-light);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--steel-shadow);
}

.btn-toggle {
    background: var(--surface);
    color: var(--steel-medium);
    border: none;
    padding: .5rem 1rem;
    font-weight: 600;
    transition: var(--transition);
}

    .btn-toggle + .btn-toggle {
        border-left: 1px solid var(--steel-light);
    }

    .btn-toggle:hover {
        background: var(--steel-primary);
        color: var(--steel-dark);
    }

    .btn-toggle.active {
        background: linear-gradient(135deg, var(--steel-accent), #2563eb);
        color: #fff;
    }

/* Store count badge */
.store-count {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--steel-dark);
    display: flex;
    align-items: center;
    gap: .5rem;
}

    .store-count .badge {
        background: var(--steel-accent);
        color: #fff;
        border-radius: 999px;
        padding: .3rem .65rem;
        font-size: 0.85rem;
        font-weight: 700;
        box-shadow: 0 2px 6px rgba(37,99,235,.25);
    }

/* Prevent cards from overflowing in Devices or Locations grids */
.device-grid-wrapper .col,
.device-grid-wrapper .card,
.device-grid-wrapper .card-body {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Titles and paragraphs inside cards */
.device-grid-wrapper .card-title,
.device-grid-wrapper h5,
.device-grid-wrapper h6,
.device-grid-wrapper p {
    white-space: normal;
    word-break: break-word;
}

.device-grid-wrapper .card-body h5.card-title,
.device-grid-wrapper .card-body h6.text-muted {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    max-width: 100% !important;
}

/* Consistent modal behavior across all breakpoints */
.modal,
.modal-backdrop {
    z-index: 2000 !important;
}

.modern-navbar,
.top-arch {
    z-index: 1000 !important;
}

@media (max-width: 400px) {
    .modal-content {
        max-height: calc(100dvh - 100px) !important;
    }

    .modal-body .form-control {
        font-size: 0.85rem;
        height: 34px;
    }

    .modal-body button {
        font-size: 0.85rem;
        padding: 0.4rem;
    }
}

.modal-dialog {
    max-width: 95vw !important;
    width: auto !important;
}

.modal-content {
    max-height: calc(100vh - 140px) !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
}

.modal-body {
    padding: 1rem !important;
}

@media (max-width: 400px) {
    .modal-dialog {
        margin: 80px auto 0.5rem auto !important;
    }

    .modal-content {
        max-height: calc(100vh - 100px) !important;
    }

    .modal-body .form-control {
        font-size: 0.85rem;
        height: 34px;
    }

    .modal-body button {
        font-size: 0.85rem;
        padding: 0.4rem;
    }
}

@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 100px auto 1rem auto !important;
        max-width: 95vw !important;
        width: auto !important;
    }

    .modal-content {
        background: #fff !important;
        border-radius: 14px !important;
        max-height: calc(100dvh - 120px) !important;
        overflow-y: auto !important;
        box-shadow: 0 12px 30px -12px rgba(0,0,0,0.25);
    }

    .modal-body {
        padding: 1rem !important;
    }
}

@media (max-width: 768px) {
    .rule-card .chip {
        flex-shrink: 1;
        flex-grow: 1;
        min-width: fit-content;
        text-align: center;
    }

    .rule-card .d-flex.justify-content-md-end {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center !important;
    }
}

@media (min-width: 577px) and (max-width: 767.98px) {
    .toolbar-row .btn-group[role="group"] {
        display: flex;
        width: 100%;
        border: 1px solid var(--steel-light);
        border-radius: 999px;
        overflow: hidden;
        box-shadow: var(--steel-shadow);
    }

        .toolbar-row .btn-group[role="group"] .btn {
            flex: 1 1 auto;
            padding: 0.5rem 0.75rem;
            text-align: center;
            font-weight: 600;
            border-radius: 0;
            border: none;
        }

            .toolbar-row .btn-group[role="group"] .btn + .btn {
                border-left: 1px solid var(--steel-light);
            }

            .toolbar-row .btn-group[role="group"] .btn.active {
                background: linear-gradient(135deg, var(--steel-accent), #2563eb);
                color: white;
                font-weight: 700;
                box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.1);
            }
}

@media (max-width: 420px) {
    .page-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding-bottom: 1rem;
    }

    .band {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .btn-group {
        flex-wrap: wrap;
        width: 100%;
    }

    .btn-group .btn {
        flex: 1 1 auto;
        text-align: center;
    }

    .toolbar-row .btn-group.range-selector {
        display: inline-flex !important;
        flex-wrap: wrap !important;
        width: auto !important;
        gap: 0.25rem;
    }

        .toolbar-row .btn-group.range-selector .btn {
            flex: 0 1 auto !important;
            width: auto !important;
            padding: 0.35rem 0.6rem !important;
            font-size: 0.8rem;
        }

    .access-grid {
        grid-template-columns: 1fr !important;
    }

    .devices-header {
        flex-direction: column;
        gap: .5rem;
    }
}

@media (max-width: 576px) {
    .tiles {
        row-gap: 0.75rem !important;
    }

    .stat-card {
        padding: 0.85rem 0.75rem 0.75rem 0.75rem !important;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .stat-title {
        font-size: 1rem !important;
        word-break: break-word;
    }

    .stat-value {
        font-size: 1.4rem !important;
    }

    .stat-sub, .stat-kicker {
        font-size: 0.95rem !important;
    }

    .icon-chip {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.25rem !important;
    }

    .stat-card, .stat-card * {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
}

.data-list {
    display: grid;
    gap: 10px;
}

.data-item {
    border: 1px solid #e6ecf5;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 6px 14px -6px rgba(15,23,42,.12);
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

    .data-item .form-check-input {
        margin-left: 0;
        cursor: pointer;
    }

.di-main {
    min-width: 0;
}

.di-title {
    font-weight: 700;
    color: var(--steel-dark);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.di-sub {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.di-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    white-space: normal;
}
    .di-meta .badge-soft {
        flex: 0 0 auto;
    }
.badge-soft {
    background: #f7f9fd;
    border: 1px solid #e6ecf5;
    color: #475569;
    border-radius: 999px;
    padding: .15rem .5rem;
    font-weight: 700;
    font-size: .72rem;
}

.di-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .di-actions .btn {
        padding: .35rem .6rem;
        white-space: nowrap;
    }

@media (max-width: 390px) {
    .data-item {
        grid-template-columns: 20px 1fr auto;
        padding: 8px 10px;
    }

    .di-sub {
        font-size: .86rem;
    }
}

.stat-card .table-wrap {
    width: 100%;
}

    .stat-card .table-wrap .table {
        width: 100% !important;
        table-layout: auto;
    }

.table-modern th, .table-modern td {
    padding: .6rem .75rem;
    vertical-align: middle;
}

.di-title, .di-sub {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 767.98px) {
    .table-modern {
        display: none !important;
    }
}

/* Hide mobile list on desktop */
@media (min-width: 768px) {
    .m-list {
        display: none !important;
    }
}

/* Hide desktop table on mobile */
@media (max-width: 767.98px) {
    .d-desktop {
        display: none !important;
    }
}



