/* ═══════════════════════════════════════════════
   VoxCamRecorder — Light Theme
   Clean corporate SaaS / analytics dashboard
═══════════════════════════════════════════════ */

:root {
    --bg-primary: #eef2f6;
    --bg-secondary: #e3eaf2;
    --bg-card: #f9fbfe;
    --bg-nav: #f5f8fc;
    --text-primary: #223244;
    --text-secondary: #6f7f91;
    --accent: #3f6fe0;
    --accent-hover: #315dc4;
    --border: #d6e0ea;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #f0ad4e;
}

/* ── Base ──────────────────────────────────── */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    background:
        radial-gradient(1200px 600px at -10% -20%, #f8fbff 0%, transparent 60%),
        radial-gradient(900px 500px at 110% -10%, #eaf1ff 0%, transparent 55%),
        var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 {
    color: #17314d;
    letter-spacing: -0.02em;
}

p {
    color: var(--text-secondary);
}

/* ── Focus styles ─────────────────────────── */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem rgba(74, 108, 247, 0.25), 0 0 0 0.25rem rgba(74, 108, 247, 0.15);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--text-secondary);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ── App shell (sidebar) ──────────────────── */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    transition: grid-template-columns 0.22s ease;
}

@media (max-width: 1199.98px) {
    .app-shell {
        grid-template-columns: 220px 1fr;
    }
}

.app-shell.app-shell-no-sidebar {
    grid-template-columns: 1fr;
}

.app-sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 28%),
        linear-gradient(180deg, #d8e5f5 0%, #c9d9ee 100%);
    border-right: 1px solid #b7cbe4;
    padding: 1rem 0.85rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.22s ease, opacity 0.22s ease;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.45), 14px 0 32px rgba(39, 65, 94, 0.08);
}

.sidebar-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    min-width: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    text-decoration: none;
    color: #1d3551;
    font-weight: 700;
    letter-spacing: 0.2px;
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(113, 140, 173, 0.2);
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-brand-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-text strong {
    color: #1b2c47;
    font-size: 15px;
    letter-spacing: 0.4px;
}

.sidebar-brand-text span {
    display: block;
    color: #4a6076;
    font-size: 11px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-mark {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    flex: 0 0 auto;
}

.sidebar-brand:hover {
    background-color: rgba(255, 255, 255, 0.52);
    color: #15293f;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.55rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.24);
    border: 1px solid rgba(111, 136, 168, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.sidebar-group-title {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0.2rem 0.45rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4c6481;
}

.sidebar-collapsible {
    margin: 0;
}

.sidebar-collapsible summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.sidebar-collapsible summary::-webkit-details-marker {
    display: none;
}

.sidebar-collapsible > summary::after {
    content: "▸";
    float: right;
    margin-left: auto;
    color: #4c6481;
    font-size: 0.72rem;
    margin-top: 0.2rem;
}

.sidebar-collapsible[open] > summary::after {
    content: "▾";
}

.sidebar-submenu {
    margin-top: 0.24rem;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.sidebar-submenu-nested {
    margin-top: 0.18rem;
    margin-left: 0.55rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(112, 142, 177, 0.28);
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0.6rem 0.72rem;
    border-radius: 12px;
    color: #1f3650;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.sidebar-link-sub {
    min-height: 38px;
    padding-left: 1.2rem;
    font-size: 0.93rem;
    color: #29425d;
}

.sidebar-link-sub2 {
    min-height: 34px;
    padding-left: 1rem;
    font-size: 0.9rem;
    color: #3a5270;
}

.sidebar-collapsible-nested > summary::after {
    font-size: 0.68rem;
    margin-top: 0.28rem;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.6);
    border-color: rgba(112, 142, 177, 0.42);
    color: #16314d;
    transform: translateX(1px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.88) 0%, rgba(236, 243, 255, 0.95) 100%);
    border-color: rgba(85, 123, 172, 0.48);
    color: #11263d;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(63, 111, 224, 0.12);
}

.sidebar-toggle-btn {
    border: 1px solid #a9bfdc;
    background: rgba(237, 244, 252, 0.88);
    color: #27415e;
    border-radius: 10px;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    line-height: 1;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background-color: rgba(74, 108, 247, 0.1);
}

.sidebar-toggle-icon {
    width: 15px;
    height: 15px;
    transition: transform 0.22s ease;
}

.sidebar-search-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.sidebar-search-btn {
    border: 1px solid #a9bfdc;
    background: rgba(237, 244, 252, 0.88);
    color: #27415e;
    border-radius: 10px;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-search-btn svg {
    width: 15px;
    height: 15px;
}

.sidebar-search-btn:hover {
    background-color: rgba(74, 108, 247, 0.1);
}

.sidebar-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-width 0.18s ease, opacity 0.18s ease;
}

.sidebar-search-row.sidebar-search-active .sidebar-search-wrap {
    max-width: 220px;
    opacity: 1;
    pointer-events: auto;
}

.sidebar-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid #a9bfdc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    color: #223244;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.sidebar-search-input:focus {
    outline: none;
    border-color: #3f6fe0;
    box-shadow: 0 0 0 0.15rem rgba(63, 111, 224, 0.2);
}

.sidebar-search-clear {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: #6f7f91;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.35rem;
}

.sidebar-search-clear:hover {
    color: #27415e;
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-right: 0.55rem;
}

.sidebar-icon svg {
    width: 100%;
    height: 100%;
}

.sidebar-label {
    flex: 1 1 auto;
    min-width: 0;
}

.sidebar-nav.sidebar-searching .sidebar-search-hidden {
    display: none;
}

.sidebar-show-btn {
    display: none;
    position: fixed;
    left: 10px;
    top: 10px;
    z-index: 1080;
    border: 1px solid #b6c9e4;
    background: #f0f5fc;
    color: #243f5b;
    border-radius: 8px;
    padding: 0.35rem 0.6rem;
    font-size: 0.86rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.sidebar-show-btn:hover {
    background-color: #e3ecf8;
}

.sidebar-backdrop {
    display: none;
}

body.sidebar-hidden:not(.sidebar-compact) .app-shell {
    grid-template-columns: 64px 1fr;
}

body.sidebar-hidden:not(.sidebar-compact) .app-sidebar {
    transform: none;
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

body.sidebar-hidden.sidebar-search-expanded:not(.sidebar-compact) .app-shell {
    grid-template-columns: 260px 1fr;
}

body.sidebar-hidden.sidebar-search-expanded:not(.sidebar-compact) .app-sidebar {
    overflow-y: auto;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-top-row {
    flex-direction: column;
    gap: 0.5rem;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-brand-group {
    order: 2;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-brand-text {
    display: none;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-toggle-btn {
    order: 1;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-toggle-icon {
    transform: scaleX(-1);
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-search-row {
    justify-content: center;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-search-wrap {
    display: none;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-link .sidebar-label,
body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible > summary .sidebar-label {
    display: none;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible > .sidebar-submenu {
    display: none;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-link,
body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible > summary {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    position: relative;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-icon {
    margin-right: 0;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible > summary::after {
    content: "\203A";
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    float: none;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible {
    position: relative;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible:hover > .sidebar-submenu,
body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible:focus-within > .sidebar-submenu,
body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible.sidebar-flyout-open > .sidebar-submenu {
    display: flex;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 220px;
    margin-top: 0;
    background: #f7faff;
    border: 1px solid #b7cbe4;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(39, 65, 94, 0.18);
    padding: 0.5rem;
    z-index: 1075;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-nav > .sidebar-collapsible > .sidebar-submenu .sidebar-label {
    display: inline;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-user {
    position: relative;
    padding: 0.5rem 0;
    display: flex;
    justify-content: center;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-user::before {
    content: attr(data-initial);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(63, 111, 224, 0.16);
    color: #1f3650;
    font-weight: 700;
    font-size: 0.85rem;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-user .sidebar-auth {
    display: none;
    position: absolute;
    left: 100%;
    bottom: 0;
    min-width: 180px;
    background: #f7faff;
    border: 1px solid #b7cbe4;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(39, 65, 94, 0.18);
    padding: 0.5rem;
    z-index: 1075;
    margin: 0;
}

body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-user:hover .sidebar-auth,
body.sidebar-hidden:not(.sidebar-compact):not(.sidebar-search-expanded) .sidebar-user:focus-within .sidebar-auth {
    display: block;
}

.sidebar-user {
    margin-top: auto;
    border-top: 1px solid #b9cce4;
    padding-top: 0.85rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.18) 100%);
}

.sidebar-auth {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-auth-item {
    margin-bottom: 0.35rem;
}

.sidebar-auth-link,
.sidebar-auth-user {
    display: block;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    text-decoration: none;
}

.sidebar-auth-link:hover {
    background-color: rgba(74, 108, 247, 0.1);
}

.sidebar-auth-user {
    color: var(--text-primary);
    font-weight: 600;
}

.app-main-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 1rem;
}

.main-top-strip {
    padding: 0.75rem 1rem 0.15rem;
}

.main-brand-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.2px;
    border-radius: 0;
    border: 1px solid rgba(121, 143, 171, 0.18);
    background: rgba(255, 255, 255, 0.54);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 22px rgba(34, 58, 90, 0.06);
}

body.sidebar-hidden .main-brand-inline {
    padding-left: 84px;
}

.store-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(121, 143, 171, 0.18);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    box-shadow: 0 10px 26px rgba(34, 58, 90, 0.05);
}

.store-switcher-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #53708f;
}

.store-switcher-select {
    max-width: 340px;
}

.portal-strip-wrap {
    padding-top: 0.7rem !important;
    padding-bottom: 1rem !important;
}

.portal-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(121, 143, 171, 0.16);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 249, 253, 0.88));
    box-shadow: 0 10px 24px rgba(34, 58, 90, 0.04);
}

.portal-strip-title {
    color: #1f3045;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.portal-strip-form {
    margin: 0;
    min-width: 240px;
    max-width: 320px;
}

.portal-strip-select {
    min-width: 240px;
    border-radius: 14px;
    border-color: rgba(121, 143, 171, 0.18);
    background-color: rgba(255, 255, 255, 0.96);
    box-shadow: none;
}

.portal-strip-select:focus {
    border-color: rgba(48, 96, 200, 0.34);
    box-shadow: 0 0 0 0.2rem rgba(48, 96, 200, 0.1);
}

.page-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.page-container {
    position: relative;
    flex: 1;
}

.page-container > *:first-child {
    margin-top: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(121, 143, 171, 0.2);
    border-radius: 22px;
    background:
        radial-gradient(130% 140% at 0% 0%, rgba(84, 128, 223, 0.16) 0%, rgba(84, 128, 223, 0) 48%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(246, 250, 255, 0.96) 100%);
    box-shadow: 0 18px 42px rgba(33, 58, 89, 0.08);
}

.page-header h1,
.page-header h2,
.page-header h3 {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.page-header p {
    margin: 0.35rem 0 0;
    max-width: 52rem;
    line-height: 1.6;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.section-title {
    margin: 1.4rem 0 0.9rem;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #536f8d;
}

body.sidebar-compact .app-shell {
    grid-template-columns: 1fr;
}

body.sidebar-compact .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1070;
    width: min(280px, 86vw);
    max-width: 86vw;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    border-right: 1px solid #b8cbe4;
}

body.sidebar-compact.sidebar-compact-open .app-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-compact.sidebar-compact-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1065;
    background: rgba(23, 35, 52, 0.34);
    border: 0;
    padding: 0;
}

body.sidebar-compact .sidebar-show-btn {
    display: inline-flex;
    align-items: center;
}

body.sidebar-compact .main-brand-inline {
    padding-left: 84px;
}

/* ── Footer ───────────────────────────────── */
.footer-custom {
    background-color: rgba(245, 249, 253, 0.75);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    padding: 0.5rem 0;
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-custom a { color: var(--accent); }

/* ── Cards ────────────────────────────────── */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 14px 32px rgba(30, 58, 93, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 16px 34px rgba(30, 58, 93, 0.11);
}

.card-header {
    background:
        linear-gradient(180deg, rgba(247, 250, 254, 0.98) 0%, rgba(239, 245, 251, 0.98) 100%);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.15rem;
}

.card-title { color: var(--text-primary); }
.card-text { color: var(--text-secondary); }

.card-body {
    padding: 1.15rem;
}

/* ── Tables ───────────────────────────────── */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(63, 111, 224, 0.04);
    --bs-table-hover-bg: rgba(63, 111, 224, 0.08);
    margin-bottom: 0;
}

.table-dark {
    --bs-table-bg: #eaf0f7;
    --bs-table-color: var(--text-primary);
}

.table-responsive {
    border: 1px solid rgba(121, 143, 171, 0.16);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 26px rgba(34, 58, 90, 0.05);
}

.table > :not(caption) > * > * {
    padding: 0.92rem 0.95rem;
    border-bottom-color: rgba(119, 143, 172, 0.12);
}

.table thead th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #587390;
    background: rgba(237, 243, 250, 0.9);
}

/* ── Forms ────────────────────────────────── */
.form-control, .form-select {
    background-color: #f6f9fd;
    border-color: var(--border);
    color: var(--text-primary);
    border-radius: 12px;
    min-height: 44px;
    padding: 0.7rem 0.9rem;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff;
    border-color: var(--accent);
    color: var(--text-primary);
}

.form-label { color: var(--text-secondary); }
.form-text { color: #708093; }

/* ── Buttons ──────────────────────────────── */
.btn {
    border-radius: 12px;
    min-height: 42px;
    padding: 0.65rem 1rem;
    font-weight: 600;
}

.btn-sm {
    min-height: 34px;
    padding: 0.4rem 0.75rem;
    border-radius: 10px;
}

.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 10px 22px rgba(63, 111, 224, 0.16);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline-primary:hover {
    background-color: var(--accent);
    color: #fff;
}

.btn-outline-secondary {
    border-color: #c7d2e0;
    color: #4f6377;
}

.btn-outline-secondary:hover {
    background-color: #e5ecf4;
    border-color: #b8c7d8;
    color: #2f4358;
}

/* ── Alerts ───────────────────────────────── */
.alert-info {
    background-color: rgba(74, 108, 247, 0.08);
    border-color: rgba(74, 108, 247, 0.18);
    color: #3455c6;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.18);
    color: #b02a37;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.18);
    color: #1a7f37;
}

.alert {
    border-radius: 16px;
    padding: 0.95rem 1rem;
    box-shadow: 0 10px 22px rgba(33, 58, 89, 0.05);
}

.nav-tabs {
    gap: 0.55rem;
    border-bottom: 0;
}

.nav-tabs .nav-link {
    border: 1px solid rgba(119, 143, 172, 0.18);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.68);
    color: #516c88;
    font-weight: 600;
    padding: 0.75rem 1rem;
    box-shadow: 0 8px 20px rgba(34, 58, 90, 0.04);
}

.nav-tabs .nav-link.active,
.nav-tabs .show > .nav-link {
    color: #18314d;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(235, 243, 255, 0.98) 100%);
    border-color: rgba(84, 123, 172, 0.32);
}

.tab-content {
    margin-top: 1rem;
}

/* ── Progress bars ────────────────────────── */
.progress {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
}

/* ── DVR Full-page mode ───────────────────── */
body.dvr-full-page {
    height: 100vh;
    overflow: hidden;
    margin-bottom: 0;
}

body.dvr-full-page .app-shell { height: 100vh; }
body.dvr-full-page .app-main-wrap { min-height: 0; }
body.dvr-full-page .dvr-page-wrap { flex: 1; min-height: 0; overflow: hidden; padding: 0 12px; }
body.dvr-full-page .dvr-page-wrap > main { flex: 1; min-height: 0; padding-bottom: 0 !important; overflow: hidden; }
body.dvr-full-page .portal-strip-wrap { padding-bottom: 1.15rem !important; }

@media (max-width: 767.98px) {
    .main-top-strip {
        padding: 0.65rem 0.85rem 0.1rem;
    }

    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar-show-btn {
        top: 8px;
        left: 8px;
        min-height: 40px;
    }

    .portal-strip {
        flex-direction: column;
        align-items: stretch;
        padding: 0.8rem 0.9rem;
    }

    .portal-strip-form,
    .portal-strip-select {
        min-width: 0;
        width: 100%;
        max-width: none;
    }

    body.sidebar-hidden .main-brand-inline {
        padding-left: 82px;
    }

    .page-header {
        padding: 1rem;
        border-radius: 18px;
    }

    .store-switcher {
        width: 100%;
        align-items: stretch;
    }

    .store-switcher-select {
        max-width: none;
        width: 100%;
    }

    .sidebar-brand {
        width: 56px;
        height: 56px;
    }

    .sidebar-link,
    .sidebar-auth-link,
    .sidebar-auth-user,
    .sidebar-toggle-btn {
        min-height: 40px;
    }

    body.sidebar-compact .app-sidebar {
        width: min(300px, calc(100vw - 16px));
        max-width: calc(100vw - 16px);
        height: 100dvh;
    }

    body.dvr-full-page {
        height: auto;
        overflow: auto;
    }

    body.dvr-full-page .app-shell {
        height: auto;
    }
}

/* ── Monitor grid ─────────────────────────── */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 10px;
}

/* Layout presets — colunas + linhas preenchem a tela inteira */
.monitor-grid.grid-1  { grid-template-columns: repeat(1, 1fr); grid-template-rows: repeat(1, 1fr); }
.monitor-grid.grid-4  { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.monitor-grid.grid-9  { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.monitor-grid.grid-16 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }
.monitor-grid.grid-36 { grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr); }
.monitor-grid.grid-64 { grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }

@media (max-width: 575.98px) {
    .monitor-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .monitor-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cam-frame {
    position: relative;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-height: 0;
}

.cam-frame video {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.cam-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.8rem;
    pointer-events: none;
    cursor: default !important;
}

.cam-frame:hover {
    transform: scale(1.01);
}

.cam-frame canvas {
    width: 100%;
    height: auto;
    display: block;
}

.cam-frame canvas.error {
    opacity: 0.3;
}

#fullscreenImg {
    max-width: 100%;
    max-height: calc(100vh - 48px);
    width: auto;
    height: auto;
    display: block;
}

.cam-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

/* ── Recording dot ────────────────────────── */
.rec-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.rec-on {
    background: var(--danger);
    animation: blink 1s infinite;
}

.rec-off {
    background: #6c757d;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── Status dots ──────────────────────────── */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
}

.dot-green {
    background-color: var(--success);
    animation: pulse-green 1.5s infinite;
}

.dot-red { background-color: var(--danger); }
.dot-yellow { background-color: var(--warning); }
.dot-gray { background-color: #6c757d; }

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

/* ── Camera card (Status page) ────────────── */
.cam-card {
    transition: transform 0.2s ease;
}

.cam-card:hover {
    transform: translateY(-2px);
}

/* ── Monitor toolbar ──────────────────────── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

/* Layout selector buttons */
.layout-btns {
    display: flex;
    gap: 4px;
}

.layout-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid #555;
    background: #2a2a2a;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.layout-btn:hover {
    background: #3a3a3a;
    border-color: #888;
    color: #fff;
}

.layout-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Modal fullscreen ─────────────────────── */
.modal-fullscreen .modal-content {
    background-color: #000;
}

.modal-fullscreen .modal-header {
    background-color: var(--bg-nav);
    border-bottom: 1px solid var(--border);
}

.modal-fullscreen .modal-body {
    padding: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-fullscreen .modal-body img {
    max-width: 100%;
    max-height: 90vh;
}

/* ── Animations ───────────────────────────── */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* ── Login card ───────────────────────────── */
.login-card {
    max-width: 400px;
    margin: 0 auto;
    border-radius: 22px;
    overflow: hidden;
}

.login-card .card-body {
    background: linear-gradient(180deg, #fbfdff 0%, #f3f7fc 100%);
    padding: 1.75rem !important;
}

/* ── Dashboard cards ──────────────────────── */
.dashboard-card .card-body {
    text-align: center;
}

.dashboard-card .card-title {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ── Home ─────────────────────────────────── */
.home-page {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    padding-bottom: 0.75rem;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
    gap: 1rem;
    align-items: stretch;
}

.home-hero-copy,
.home-hero-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(126, 150, 181, 0.24);
    border-radius: 24px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(90, 129, 226, 0.16) 0%, rgba(90, 129, 226, 0) 45%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(244, 248, 253, 0.96) 100%);
    box-shadow: 0 18px 40px rgba(40, 66, 98, 0.08);
}

.home-hero-copy {
    padding: 1.6rem 1.7rem;
}

.home-hero-copy h1 {
    margin: 0.2rem 0 0.7rem;
    font-size: clamp(1.9rem, 3.4vw, 3rem);
    line-height: 0.98;
    color: #16314d;
}

.home-hero-copy p {
    max-width: 44rem;
    margin: 0;
    font-size: 1rem;
    line-height: 1.65;
    color: #58708a;
}

.home-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #456384;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.home-hero-panel {
    padding: 1.35rem;
}

.home-hero-panel-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    font-weight: 800;
    color: #486786;
    margin-bottom: 0.9rem;
}

.home-hero-shortcuts {
    display: grid;
    gap: 0.75rem;
}

.home-shortcut-card {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(115, 144, 178, 0.2);
    background: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    color: #1b3450;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.home-shortcut-card strong {
    font-size: 1rem;
}

.home-shortcut-card span {
    color: #607891;
    line-height: 1.45;
}

.home-shortcut-card:hover {
    transform: translateY(-2px);
    border-color: rgba(81, 119, 168, 0.34);
    box-shadow: 0 12px 24px rgba(56, 86, 122, 0.1);
    color: #152c46;
}

.home-section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    padding: 0 0.2rem;
}

.home-section-header h2 {
    margin: 0.2rem 0 0;
    font-size: clamp(1.3rem, 2.2vw, 2rem);
    color: #17314d;
}

.home-section-header p {
    max-width: 38rem;
    margin: 0;
    color: #667d95;
    line-height: 1.55;
}

.home-card-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.home-action-card {
    grid-column: span 4;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 1.25rem;
    border-radius: 20px;
    border: 1px solid rgba(118, 143, 174, 0.2);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(245, 248, 252, 0.96) 100%);
    box-shadow: 0 16px 36px rgba(35, 61, 91, 0.08);
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.home-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(35, 61, 91, 0.12);
    border-color: rgba(77, 117, 168, 0.35);
}

.home-action-card h3 {
    margin: 0 0 0.55rem;
    color: #18314d;
    font-size: 1.28rem;
}

.home-action-card p {
    margin: 0;
    color: #61788f;
    line-height: 1.55;
}

.home-action-kicker {
    margin-bottom: 0.85rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #4a6886;
}

.home-action-link {
    margin-top: auto;
    padding-top: 1.25rem;
    font-weight: 700;
    color: #2f5fd0;
}

.home-action-card-featured {
    grid-column: span 8;
    background:
        radial-gradient(120% 120% at 100% 0%, rgba(63, 111, 224, 0.2) 0%, rgba(63, 111, 224, 0) 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(240, 246, 255, 0.98) 100%);
}

@media (max-width: 1199.98px) {
    .home-action-card,
    .home-action-card-featured {
        grid-column: span 6;
    }
}

@media (max-width: 991.98px) {
    .home-hero {
        grid-template-columns: 1fr;
    }

    .home-section-header {
        flex-direction: column;
        align-items: start;
    }
}

@media (max-width: 767.98px) {
    .home-hero-copy,
    .home-hero-panel,
    .home-action-card {
        padding: 1.1rem;
        border-radius: 18px;
    }

    .home-card-grid {
        grid-template-columns: 1fr;
    }

    .home-action-card,
    .home-action-card-featured {
        grid-column: auto;
        min-height: unset;
    }
}

/* ── Responsive utilities ─────────────────── */
@media (max-width: 575.98px) {
    h3, .h3 { font-size: 1.3rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar > div { justify-content: space-between; display: flex; }
}

/* ── Scrollbar (webkit) ───────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #c8ced6; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8b2be; }

/* ── Misc ─────────────────────────────────── */
.text-muted { color: var(--text-secondary) !important; }

.badge.bg-dark {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

hr { border-color: var(--border); }

/* ===== Sino de notificacoes (saude das cameras) ===== */
.vox-notif-bell { background: transparent; border: none; cursor: pointer; padding: 6px; border-radius: 8px; display: inline-flex; align-items: center; position: relative; }
.vox-notif-bell:hover { background: rgba(27, 44, 71, 0.08); }
.vox-notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; background: #e03131; color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.vox-notif-read { opacity: 0.55; }
.vox-notif-ico { font-size: 14px; line-height: 1.5; flex-shrink: 0; }
.vox-notif-time { font-size: 11px; color: #98a2b3; margin-top: 3px; }

.vox-notif-panel { position: fixed; width: 340px; max-width: 92vw; background: #fff; border-radius: 10px; box-shadow: 0 10px 34px rgba(16, 34, 63, 0.22); border: 1px solid #e6ebf2; z-index: 99999; overflow: hidden; }
.vox-notif-panel-head { background: linear-gradient(90deg, #1b2c47, #26456f); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; padding: 12px 16px; }
.vox-notif-panel-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.vox-notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #f0f3f8; cursor: pointer; transition: background .12s; }
.vox-notif-item:hover { background: #f5f7fb; }
.vox-notif-item:last-child { border-bottom: none; }
.vox-notif-body { flex: 1; min-width: 0; }
.vox-notif-title { font-size: 13px; font-weight: 600; color: #1b2c47; }
.vox-notif-msg { font-size: 12px; color: #667085; margin-top: 1px; word-break: break-word; }
.vox-notif-empty-li { padding: 14px 16px; font-size: 12px; color: #98a2b3; text-align: center; list-style: none; }
.vox-notif-err { color: #e03131; }
.vox-notif-empty { padding: 34px 16px; text-align: center; color: #9aa7b8; font-size: 13px; list-style: none; }
.vox-notif-empty-ico { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; background: #e9f0f9; color: #3060c8; font-size: 24px; display: flex; align-items: center; justify-content: center; }
.vox-notif-panel-foot { display: flex; border-top: 1px solid #e6ebf2; }
.vox-notif-foot-btn { flex: 1; text-align: center; padding: 11px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.4px; color: #5a6b82; background: #f7f9fc; border: none; cursor: pointer; text-decoration: none; transition: background .12s; }
.vox-notif-foot-btn:hover { background: #eef2f7; color: #3060c8; }
.vox-notif-foot-btn-dark { background: #8a97a8; color: #fff; }
.vox-notif-foot-btn-dark:hover { background: #6b7889; color: #fff; }

/* ══════════════════════════════════════════════════════════════ */
/* Espaçamentos reduzidos para Ao Vivo e Gravações              */
/* ══════════════════════════════════════════════════════════════ */

/* Página de Gravações — remover espaço do page-header */
.recordings-page {
    margin-bottom: 0 !important;
    padding: 0.5rem 0.75rem !important;
}

/* Página Ao Vivo — remover espaços adicionais */
.live-page {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
