/* ============================================================
   License Portal - application styles
   ============================================================ */
:root {
    --lp-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --lp-sidebar-w: 264px;
    --lp-sidebar-collapsed: 76px;
    --lp-sidebar-bg: #0a1b36;
    --lp-sidebar-bg2: #0c2347;
    --lp-sidebar-text: #9db3d1;
    --lp-sidebar-active: #e2e8f0;
    --lp-primary: #017eff;
    --lp-primary-rgb: 1, 126, 255;
    --lp-primary-dark: #0066d6;
    --lp-bg: #f1f5f9;
    --lp-card: #ffffff;
    --lp-border: #e2e8f0;
    --lp-text: #0f172a;
    --lp-muted: #64748b;
    --lp-radius: 14px;
    --lp-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
    --bs-primary: #017eff;
    --bs-primary-rgb: 1, 126, 255;
    --bs-link-color: #017eff;
    --bs-link-hover-color: #0066d6;
    --bs-body-font-family: var(--lp-font);
    --bs-body-bg: #f1f5f9;
    --bs-body-color: #0f172a;
    --bs-border-color: #e2e8f0;
}

html, body { height: 100%; }
body { font-family: var(--lp-font); background: var(--lp-bg); color: var(--lp-text); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; }
.btn-primary { --bs-btn-bg: var(--lp-primary); --bs-btn-border-color: var(--lp-primary); --bs-btn-hover-bg: var(--lp-primary-dark); --bs-btn-hover-border-color: var(--lp-primary-dark); --bs-btn-active-bg: var(--lp-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--lp-primary); --bs-btn-border-color: var(--lp-primary); --bs-btn-hover-bg: var(--lp-primary); --bs-btn-hover-border-color: var(--lp-primary); }
.btn { border-radius: 10px; font-weight: 500; }
.btn-sm { border-radius: 8px; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 10px; color: var(--lp-text); }
.btn-icon:hover { background: #e2e8f0; }
.form-control, .form-select { border-radius: 10px; border-color: var(--lp-border); padding: .55rem .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--lp-primary); box-shadow: 0 0 0 3px rgba(var(--lp-primary-rgb), .15); }
.input-group-text { border-radius: 10px; background: #f8fafc; border-color: var(--lp-border); }
.form-label { font-weight: 500; font-size: .85rem; color: #334155; }
.card { border: 1px solid var(--lp-border); border-radius: var(--lp-radius); box-shadow: var(--lp-shadow); background: var(--lp-card); }
.card-header { background: transparent; border-bottom: 1px solid var(--lp-border); padding: 1rem 1.25rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.dropdown-menu { border-radius: 12px; border-color: var(--lp-border); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; }
.modal-content { border-radius: 16px; border: none; }
.table { --bs-table-color: var(--lp-text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem 1rem; vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--lp-muted); font-weight: 600; background: #f8fafc; border-bottom: 1px solid var(--lp-border); white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table td { border-color: #eef2f7; }
.text-muted { color: var(--lp-muted) !important; }
.fs-7 { font-size: .8rem; }
.fw-semibold { font-weight: 600; }
code, .mono { font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace; }

/* ---- layout ---- */
.lp-shell { display: flex; min-height: 100vh; }
.lp-sidebar { width: var(--lp-sidebar-w); background: linear-gradient(180deg, var(--lp-sidebar-bg) 0%, var(--lp-sidebar-bg2) 100%); color: var(--lp-sidebar-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 1040; transition: width .2s ease, transform .25s ease; overflow: hidden; }
.lp-main { flex: 1; margin-left: var(--lp-sidebar-w); display: flex; flex-direction: column; min-width: 0; transition: margin-left .2s ease; }
.lp-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.lp-brand-link { display: flex; align-items: center; gap: 12px; color: #fff; }
.lp-brand-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #3b9bff, #22d3ee); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff; flex-shrink: 0; box-shadow: 0 6px 16px rgba(1,126,255, .35); }
.lp-brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.lp-brand-text strong { font-size: 1rem; }
.lp-brand-text small { font-size: .72rem; color: var(--lp-sidebar-text); }
.lp-sidebar-close { background: none; border: 0; color: #fff; font-size: 1.1rem; }
.lp-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.lp-nav::-webkit-scrollbar { width: 6px; }
.lp-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.lp-nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #475569; padding: 16px 12px 6px; white-space: nowrap; }
.lp-nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px; border-radius: 10px; color: var(--lp-sidebar-text); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.lp-nav-link i { font-size: 1.15rem; width: 22px; text-align: center; flex-shrink: 0; }
.lp-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.lp-nav-link.active { background: rgba(var(--lp-primary-rgb), .9); color: #fff; box-shadow: 0 6px 14px rgba(var(--lp-primary-rgb), .35); }
.lp-sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.lp-user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); white-space: nowrap; overflow: hidden; }
.lp-user-meta { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.lp-user-meta strong { color: #fff; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.lp-user-meta small { font-size: .72rem; }
.lp-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #3b9bff, #017eff); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.lp-avatar.sm { width: 30px; height: 30px; font-size: .8rem; }

/* collapsed sidebar (desktop) */
@media (min-width: 992px) {
    .lp-shell.collapsed .lp-sidebar { width: var(--lp-sidebar-collapsed); }
    .lp-shell.collapsed .lp-main { margin-left: var(--lp-sidebar-collapsed); }
    .lp-shell.collapsed .lp-brand { justify-content: center; padding-left: 0; padding-right: 0; }
    .lp-shell.collapsed .lp-brand-text, .lp-shell.collapsed .lp-nav-link span, .lp-shell.collapsed .lp-user-meta, .lp-shell.collapsed .lp-nav-section span { display: none; }
    .lp-shell.collapsed .lp-nav-section { padding: 10px 0 2px; border-top: 1px solid rgba(255,255,255,.06); margin-top: 6px; }
    .lp-shell.collapsed .lp-nav-link { justify-content: center; padding: 12px 0; }
    .lp-shell.collapsed .lp-user-chip { justify-content: center; padding: 8px 0; }
    .lp-backdrop { display: none !important; }
}
@media (max-width: 991.98px) {
    .lp-sidebar { transform: translateX(-100%); box-shadow: none; }
    .lp-shell.mobile-open .lp-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .lp-main { margin-left: 0; }
    .lp-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1035; opacity: 0; pointer-events: none; transition: opacity .2s; }
    .lp-shell.mobile-open .lp-backdrop { opacity: 1; pointer-events: auto; }
}

.lp-topbar { height: 64px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--lp-border); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 1020; }
.lp-topbar-title { flex: 1; min-width: 0; }
.lp-topbar-title h1 { font-size: 1.1rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-topbar-actions { display: flex; align-items: center; gap: 10px; }
.lp-global-search { position: relative; align-items: center; }
.lp-global-search i { position: absolute; left: 12px; color: var(--lp-muted); }
.lp-global-search input { padding-left: 34px; width: 240px; background: #f8fafc; }
.lp-user-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; font-weight: 500; }
.lp-user-btn:hover { background: #f1f5f9; }
.lp-content { padding: 24px; flex: 1; }
.lp-footer { display: flex; justify-content: space-between; padding: 12px 24px; font-size: .75rem; color: var(--lp-muted); border-top: 1px solid var(--lp-border); }
@media (max-width: 575.98px) { .lp-content { padding: 16px; } .lp-topbar { padding: 0 12px; } }

/* ---- page header ---- */
.lp-page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.lp-page-head h2 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.lp-page-head p { margin: 2px 0 0; color: var(--lp-muted); }
.breadcrumb { font-size: .8rem; margin-bottom: 4px; }

/* ---- stat cards ---- */
.stat-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; height: 100%; }
.stat-card .stat-icon { width: 50px; height: 50px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-card .stat-label { font-size: .78rem; color: var(--lp-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.stat-card .stat-sub { font-size: .75rem; color: var(--lp-muted); }
.stat-card.clickable { transition: transform .15s, box-shadow .15s; cursor: pointer; color: inherit; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.1); }
.bg-soft-primary { background: rgba(1,126,255,.12); color: #0066d6; }
.bg-soft-success { background: rgba(16,185,129,.14); color: #047857; }
.bg-soft-info { background: rgba(14,165,233,.14); color: #0369a1; }
.bg-soft-warning { background: rgba(245,158,11,.16); color: #b45309; }
.bg-soft-danger { background: rgba(239,68,68,.14); color: #b91c1c; }
.bg-soft-secondary { background: rgba(100,116,139,.14); color: #475569; }
.bg-soft-dark { background: rgba(15,23,42,.12); color: #0f172a; }
.bg-soft-purple { background: rgba(139,92,246,.14); color: #6d28d9; }

/* ---- badges ---- */
.badge { font-weight: 600; padding: .4em .65em; border-radius: 8px; font-size: .72rem; letter-spacing: .01em; }
.badge-soft-primary { background: rgba(1,126,255,.12); color: #0066d6; }
.badge-soft-success { background: rgba(16,185,129,.14); color: #047857; }
.badge-soft-info { background: rgba(14,165,233,.14); color: #0369a1; }
.badge-soft-warning { background: rgba(245,158,11,.18); color: #b45309; }
.badge-soft-danger { background: rgba(239,68,68,.14); color: #b91c1c; }
.badge-soft-secondary { background: rgba(100,116,139,.14); color: #475569; }
.badge-soft-dark { background: rgba(15,23,42,.14); color: #0f172a; }
.badge-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; }

/* ---- data tables ---- */
.lp-table-wrap { position: relative; }
.lp-table-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--lp-border); }
.lp-table-toolbar .form-control, .lp-table-toolbar .form-select { min-width: 140px; }
.lp-table-wrap table { width: 100%; }
.lp-table-wrap th[data-sort] { cursor: pointer; user-select: none; }
.lp-table-wrap th[data-sort]:hover { color: var(--lp-primary); }
.lp-table-wrap th[data-sort]::after { content: "\F283"; font-family: "bootstrap-icons"; opacity: .25; margin-left: 5px; font-size: .7rem; }
.lp-table-wrap th[data-sort].asc::after { content: "\F235"; opacity: 1; color: var(--lp-primary); }
.lp-table-wrap th[data-sort].desc::after { content: "\F229"; opacity: 1; color: var(--lp-primary); }
.lp-table-loading { position: absolute; inset: 0; background: rgba(255,255,255,.65); display: none; align-items: center; justify-content: center; z-index: 5; backdrop-filter: blur(1px); }
.lp-table-wrap.loading .lp-table-loading { display: flex; }
.lp-table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--lp-border); font-size: .82rem; color: var(--lp-muted); }
.pagination { margin: 0; --bs-pagination-border-radius: 8px; --bs-pagination-padding-y: .3rem; --bs-pagination-padding-x: .65rem; --bs-pagination-font-size: .8rem; --bs-pagination-active-bg: var(--lp-primary); --bs-pagination-active-border-color: var(--lp-primary); --bs-pagination-color: var(--lp-text); }
.page-item .page-link { margin: 0 2px; border-radius: 8px !important; }
.lp-empty { padding: 48px 16px; text-align: center; color: var(--lp-muted); }
.lp-empty i { font-size: 2.2rem; display: block; margin-bottom: 8px; opacity: .5; }
.row-actions { white-space: nowrap; }
.row-actions .btn { padding: .25rem .5rem; }
.cell-primary { font-weight: 600; color: var(--lp-text); }
.cell-sub { font-size: .75rem; color: var(--lp-muted); }
.days-pill { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- activation code display ---- */
.code-card { border: 2px dashed var(--lp-border); border-radius: var(--lp-radius); padding: 18px 20px; background: #f7fbff; }
.code-value { font-family: "JetBrains Mono", Menlo, Consolas, monospace; font-size: 1.7rem; font-weight: 700; letter-spacing: .12em; color: var(--lp-primary); word-break: break-all; }
.device-row { border: 1px solid var(--lp-border); border-radius: 12px; padding: 14px; background: #fff; margin-bottom: 10px; }
.device-row .device-index { width: 30px; height: 30px; border-radius: 50%; background: var(--lp-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--lp-border); }
.timeline li { position: relative; padding-left: 36px; padding-bottom: 16px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--lp-primary); }
.timeline li.warn::before { border-color: #f59e0b; }
.timeline li.bad::before { border-color: #ef4444; }
.timeline li.good::before { border-color: #10b981; }
.timeline .t-time { font-size: .72rem; color: var(--lp-muted); }

/* ---- permissions matrix ---- */
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table .form-check-input { width: 1.15em; height: 1.15em; cursor: pointer; }
.perm-table .form-check-input:checked { background-color: var(--lp-primary); border-color: var(--lp-primary); }

/* ---- auth pages ---- */
.lp-auth-body { background: radial-gradient(1200px 600px at 10% -10%, rgba(1,126,255,.35), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(56,189,248,.20), transparent 55%), #071428; min-height: 100vh; }
.lp-auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lp-auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 36px 32px; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.lp-auth-logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; background: linear-gradient(135deg, #3b9bff, #22d3ee); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(1,126,255,.4); }
.lp-error-icon { font-size: 2.5rem; color: var(--lp-primary); }
.lp-error-code { font-size: 3.5rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: #cbd5e1; }

/* ---- docs ---- */
.doc-nav { position: sticky; top: 84px; }
.doc-nav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--lp-muted); font-size: .85rem; }
.doc-nav a:hover, .doc-nav a.active { background: rgba(1,126,255,.08); color: var(--lp-primary); }
pre.doc-code { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 16px; font-size: .8rem; overflow: auto; }
.method-badge { font-family: monospace; font-weight: 700; padding: .2em .5em; border-radius: 6px; font-size: .75rem; }
.method-get { background: rgba(16,185,129,.15); color: #047857; }
.method-post { background: rgba(1,126,255,.15); color: #0066d6; }

/* ---- misc ---- */
.toast { border-radius: 12px; border: none; }
.chart-box { position: relative; height: 280px; }
.list-kv { display: grid; grid-template-columns: 160px 1fr; row-gap: 8px; column-gap: 12px; font-size: .88rem; }
.list-kv dt { color: var(--lp-muted); font-weight: 500; }
.list-kv dd { margin: 0; font-weight: 500; word-break: break-word; }
@media (max-width: 575.98px) { .list-kv { grid-template-columns: 1fr; row-gap: 2px; } .list-kv dd { margin-bottom: 8px; } }
.copy-btn { cursor: pointer; }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; color: transparent !important; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.is-invalid ~ .invalid-feedback { display: block; }
label.required::after { content: " *"; color: #ef4444; }

/* ============================================================
   v2 – solid button system, custom selects, date picker, pagination
   ============================================================ */
.btn { font-weight: 600; padding: .55rem 1rem; border-radius: 10px; border-width: 1px; box-shadow: 0 1px 2px rgba(15,23,42,.06); transition: background .15s, box-shadow .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: .75rem 1.25rem; font-size: 1rem; border-radius: 12px; }
.btn-primary { --bs-btn-bg: #017eff; --bs-btn-border-color: #017eff; --bs-btn-hover-bg: #0066d6; --bs-btn-hover-border-color: #0066d6; --bs-btn-active-bg: #0052ad; --bs-btn-active-border-color: #0052ad; --bs-btn-disabled-bg: #99caff; --bs-btn-disabled-border-color: #99caff; box-shadow: 0 4px 12px rgba(1,126,255,.3); }
.btn-secondary { --bs-btn-color: #1e293b; --bs-btn-bg: #e2e8f0; --bs-btn-border-color: #cbd5e1; --bs-btn-hover-color: #0f172a; --bs-btn-hover-bg: #cbd5e1; --bs-btn-hover-border-color: #94a3b8; --bs-btn-active-color: #0f172a; --bs-btn-active-bg: #cbd5e1; --bs-btn-active-border-color: #94a3b8; --bs-btn-disabled-color: #94a3b8; --bs-btn-disabled-bg: #f1f5f9; --bs-btn-disabled-border-color: #e2e8f0; }
.btn-tonal { --bs-btn-color: #0052ad; --bs-btn-bg: #e0efff; --bs-btn-border-color: #cce5ff; --bs-btn-hover-color: #003f87; --bs-btn-hover-bg: #cce5ff; --bs-btn-hover-border-color: #99caff; --bs-btn-active-color: #003f87; --bs-btn-active-bg: #cce5ff; --bs-btn-active-border-color: #99caff; }
.btn-success { --bs-btn-bg: #059669; --bs-btn-border-color: #059669; --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; --bs-btn-active-bg: #065f46; box-shadow: 0 4px 12px rgba(5,150,105,.25); }
.btn-warning { --bs-btn-color: #fff; --bs-btn-bg: #d97706; --bs-btn-border-color: #d97706; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #b45309; --bs-btn-hover-border-color: #b45309; --bs-btn-active-color: #fff; --bs-btn-active-bg: #92400e; box-shadow: 0 4px 12px rgba(217,119,6,.25); }
.btn-danger { --bs-btn-bg: #dc2626; --bs-btn-border-color: #dc2626; --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c; --bs-btn-active-bg: #991b1b; box-shadow: 0 4px 12px rgba(220,38,38,.25); }
.btn-light { --bs-btn-color: #1e293b; --bs-btn-bg: #e2e8f0; --bs-btn-border-color: #cbd5e1; --bs-btn-hover-bg: #cbd5e1; --bs-btn-hover-border-color: #94a3b8; }
.btn-check:checked + .btn-tonal, .btn-tonal.active { background: #017eff; border-color: #017eff; color: #fff; }
.btn-icon { box-shadow: none; }
.row-actions .btn + .btn { margin-left: 4px; }
.modal-footer .btn, .lp-page-head .btn { min-width: 96px; }

/* selects: custom chevron instead of the browser default */
.form-select { -webkit-appearance: none; appearance: none; background-color: #fff; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234f46e5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right .8rem center; background-size: 14px; padding-right: 2.4rem; font-weight: 500; color: #1e293b; }
.form-select:hover { border-color: #99caff; }
.form-select-sm { padding-right: 2rem; background-position: right .6rem center; }
.form-control::placeholder { color: #94a3b8; }
input[type="number"].form-control { font-variant-numeric: tabular-nums; }

/* date pickers (flatpickr) */
.lp-date { position: relative; }
.lp-date .lp-date-input { padding-right: 2.4rem; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%234f46e5'%3e%3cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M2 2a1 1 0 0 0-1 1v1h14V3a1 1 0 0 0-1-1zm13 3H1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1z'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right .8rem center; background-size: 15px; cursor: pointer; background-color: #fff; font-weight: 500; }
.input-group .lp-date { flex: 1 1 auto; width: 1%; }
.input-group .lp-date .form-control { border-radius: 0; }
.input-group .lp-date:last-child .form-control { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.flatpickr-calendar { border-radius: 14px; box-shadow: 0 12px 40px rgba(15,23,42,.18); border: 1px solid var(--lp-border); font-family: var(--lp-font); }
.flatpickr-months .flatpickr-month, .flatpickr-current-month, .flatpickr-weekdays, span.flatpickr-weekday { background: #017eff; color: #fff; fill: #fff; }
.flatpickr-months { border-radius: 14px 14px 0 0; overflow: hidden; }
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { fill: #fff; }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: #cce5ff; }
.flatpickr-current-month .flatpickr-monthDropdown-months { background: transparent; color: #fff; font-weight: 600; }
.flatpickr-current-month .flatpickr-monthDropdown-months option { color: #0f172a; }
.flatpickr-current-month input.cur-year { color: #fff; font-weight: 600; }
span.flatpickr-weekday { color: #e0efff; font-weight: 600; }
.flatpickr-day { border-radius: 8px; font-weight: 500; color: #1e293b; }
.flatpickr-day:hover, .flatpickr-day.prevMonthDay:hover, .flatpickr-day.nextMonthDay:hover { background: #e0efff; border-color: #e0efff; }
.flatpickr-day.today { border-color: #017eff; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: #017eff; border-color: #017eff; color: #fff; box-shadow: 0 4px 10px rgba(1,126,255,.35); }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover { color: #cbd5e1; }
.flatpickr-calendar.arrowTop:before, .flatpickr-calendar.arrowTop:after { border-bottom-color: #017eff; }

/* pagination */
.pagination { gap: 4px; }
.pagination .page-item .page-link { border: 1px solid var(--lp-border); background: #fff; color: #334155; font-weight: 600; min-width: 36px; text-align: center; padding: .4rem .7rem; border-radius: 9px !important; margin: 0; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.pagination .page-item .page-link:hover { background: #e0efff; border-color: #cce5ff; color: #0052ad; }
.pagination .page-item.active .page-link { background: #017eff; border-color: #017eff; color: #fff; box-shadow: 0 4px 10px rgba(1,126,255,.3); }
.pagination .page-item.disabled .page-link { background: #f8fafc; color: #cbd5e1; border-color: #eef2f7; box-shadow: none; }
.lp-table-footer [data-role="perpage"] { border-radius: 9px; font-weight: 600; }

/* card headers without icons: slightly stronger */
.card-header { font-size: .95rem; color: #0f172a; }

/* device rows in the activation wizard */
.device-row { border: 1px solid var(--lp-border); border-radius: 14px; padding: 16px; background: #f7fbff; margin-bottom: 12px; }
.device-title { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.expiry-preview { padding: 8px 12px; border-radius: 10px; background: #eaf4ff; width: 100%; line-height: 1.25; }
.expiry-preview strong { color: #0052ad; }

/* ============================================================
   v3 – searchable selects, overflow safety, mobile
   ============================================================ */
.ts-wrapper.form-select { padding: 0; background-image: none; border: 0; }
.ts-wrapper .ts-control { border: 1px solid var(--lp-border); border-radius: 10px; padding: .5rem 2.4rem .5rem .85rem; min-height: 42px; font-weight: 500; color: #1e293b; background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234f46e5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3e%3c/svg%3e") no-repeat right .8rem center / 14px; box-shadow: none; font-size: 14px; }
.ts-wrapper.form-select-sm .ts-control { min-height: 34px; padding: .3rem 2rem .3rem .65rem; font-size: .8rem; }
.ts-wrapper.focus .ts-control { border-color: #017eff; box-shadow: 0 0 0 3px rgba(1,126,255,.15); }
.ts-wrapper .ts-control input { font-size: 14px; color: #1e293b; }
.ts-wrapper .ts-control input::placeholder, .ts-wrapper.has-items .ts-control .item { color: #1e293b; }
.ts-wrapper.single .ts-control:after { display: none; }
.ts-wrapper .ts-control, .ts-wrapper .ts-control input { cursor: pointer; }
.ts-dropdown { border: 1px solid var(--lp-border); border-radius: 12px; box-shadow: 0 12px 40px rgba(15,23,42,.18); margin-top: 6px; font-family: var(--lp-font); font-size: 14px; overflow: hidden; z-index: 1100; }
.ts-dropdown .ts-dropdown-content { padding: 6px; max-height: 280px; }
.ts-dropdown .option { padding: 8px 10px; border-radius: 8px; color: #1e293b; }
.ts-dropdown .option.active { background: #e0efff; color: #0052ad; }
.ts-dropdown .option.selected { font-weight: 600; }
.ts-dropdown .ts-sub { font-size: .75rem; color: var(--lp-muted); }
.ts-dropdown .no-results, .ts-dropdown .spinner { padding: 10px; color: var(--lp-muted); font-size: .85rem; }
.ts-dropdown .dropdown-input-wrap { padding: 6px; border-bottom: 1px solid var(--lp-border); }
.ts-dropdown .dropdown-input { border: 1px solid var(--lp-border); border-radius: 8px; padding: .4rem .6rem; font-size: 14px; }
.ts-wrapper.plugin-dropdown_input.focus.dropdown-active .ts-control { border-color: #017eff; }
.lp-table-toolbar .ts-wrapper { min-width: 160px; }
.ts-wrapper.w-auto { width: auto; }

/* overflow safety */
html { overflow-x: clip; }
.lp-shell { overflow-x: hidden; max-width: 100vw; }
.lp-main { overflow-x: hidden; min-width: 0; }
.lp-content { min-width: 0; max-width: 100%; }
.lp-content .row > * { min-width: 0; }
.card { overflow: visible; }
.card > .table-responsive, .card > .lp-table-wrap { overflow-x: auto; }
.ts-dropdown { z-index: 1060; }
.list-group-item { min-width: 0; }
.chart-box { width: 100%; min-width: 0; }
.chart-box canvas { max-width: 100%; }

/* mobile */
@media (max-width: 767.98px) {
    .lp-page-head { flex-direction: column; align-items: stretch; }
    .lp-page-head > .d-flex { width: 100%; }
    .lp-page-head > .d-flex .btn { flex: 1 1 auto; }
    .lp-page-head h2 { font-size: 1.15rem; }
    .lp-table-toolbar { padding: 12px; }
    .lp-table-toolbar > *, .lp-table-toolbar .input-group, .lp-table-toolbar .form-select, .lp-table-toolbar .ts-wrapper, .lp-table-toolbar .form-control { flex: 1 1 100% !important; width: 100% !important; max-width: none !important; min-width: 0 !important; }
    .lp-table-toolbar .input-group > .input-group-text { flex: 0 0 auto; }
    .lp-table-footer { flex-direction: column; align-items: stretch; text-align: center; }
    .lp-table-footer nav { display: flex; justify-content: center; }
    .lp-table-footer .d-flex { justify-content: center; }
    .stat-card { padding: 14px; gap: 12px; }
    .stat-card .stat-value { font-size: 1.35rem; }
    .lp-topbar-title h1 { font-size: 1rem; }
    .device-row .col-md-3, .device-row .col-md-4 { flex: 0 0 100%; max-width: 100%; }
    .modal-dialog { margin: 12px; }
    .lp-footer { flex-direction: column; gap: 4px; text-align: center; }
    .code-value { font-size: 1.3rem; }
    .lp-user-btn span.d-none { display: none !important; }
}
@media (max-width: 575.98px) {
    .lp-content { padding: 12px; }
    #stateTabs .btn { flex: 1 1 45%; }
    .btn-lg { font-size: .95rem; }
}
.lp-table-toolbar .ts-wrapper.w-auto { width: auto; min-width: 240px; }
@media (max-width: 767.98px) {
    .lp-table-toolbar .input-group { display: flex; flex-wrap: nowrap; }
    .lp-table-toolbar .input-group > .form-control, .lp-table-toolbar .input-group > .lp-date { flex: 1 1 0 !important; width: 1% !important; min-width: 0 !important; }
    .lp-table-toolbar .input-group > .input-group-text { flex: 0 0 auto !important; width: auto !important; }
}
.btn-icon i { font-size: 1.4rem; }
/* dropdown sizing: never narrower than its content */
.ts-wrapper.w-auto, .ts-wrapper.form-select-sm { width: auto; min-width: 140px; }
.lp-table-footer .ts-wrapper { min-width: 128px; }
.ts-dropdown { min-width: 160px; }
.ts-dropdown .option { white-space: nowrap; }
.ts-wrapper .ts-control .item { white-space: nowrap; }

/* secondary buttons: solid indigo tint instead of grey */
.btn-secondary { --bs-btn-color: #003f87; --bs-btn-bg: #d6eaff; --bs-btn-border-color: #b3d6ff; --bs-btn-hover-color: #002b5c; --bs-btn-hover-bg: #cce5ff; --bs-btn-hover-border-color: #99caff; --bs-btn-active-color: #002b5c; --bs-btn-active-bg: #b3d6ff; --bs-btn-active-border-color: #99caff; --bs-btn-disabled-color: #99caff; --bs-btn-disabled-bg: #eaf4ff; --bs-btn-disabled-border-color: #e0efff; box-shadow: 0 2px 8px rgba(1,126,255,.12); }
.btn-light { --bs-btn-color: #003f87; --bs-btn-bg: #d6eaff; --bs-btn-border-color: #b3d6ff; --bs-btn-hover-bg: #cce5ff; --bs-btn-hover-border-color: #99caff; }
/* stat cards: centred content */
.stat-card { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.stat-card > div { width: 100%; }

/* switches in the theme colour */
.form-check-input:checked { background-color: #017eff; border-color: #017eff; }
.form-check-input:focus { border-color: #66afff; box-shadow: 0 0 0 3px rgba(1,126,255,.2); }

/* key/value lists: values may shrink and wrap, never overflow the card */
.list-kv { grid-template-columns: 130px minmax(0, 1fr); }
.list-kv dd { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.list-kv dd .badge { white-space: normal; text-align: left; display: inline-block; max-width: 100%; line-height: 1.35; }
.list-kv dd a { overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 575.98px) { .list-kv { grid-template-columns: minmax(0, 1fr); } }

/* invalid state for custom controls */
.ts-wrapper.is-invalid .ts-control, .lp-date .lp-date-input.is-invalid { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.input-group > .btn { white-space: nowrap; }

/* business list: four row actions wrap into two tidy rows instead of widening the table */
#bizTable .row-actions { white-space: normal; }
#bizTable .act-grid { display: inline-grid; grid-template-columns: repeat(2, auto); gap: 4px; justify-items: stretch; }
#bizTable .act-grid .btn { margin: 0; min-width: 68px; }
#bizTable .table > :not(caption) > * > * { padding: .65rem .6rem; }

/* brand logo */
.lp-brand-icon { background: #fff; padding: 5px; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.lp-brand-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.lp-auth-logo { background: none; box-shadow: none; width: 76px; height: 76px; }
.lp-auth-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* business filter (Force Update, Till Ads): long names wrap onto a second line instead of being cut off */
.lp-biz-filter .ts-dropdown .option { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.lp-biz-filter .ts-control .item { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lp-biz-filter .ts-dropdown { min-width: 280px; }
