@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root,
html[data-theme="light"] {
    color-scheme: light;
    --bg-main: #f4f8fc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: #dce6f0;
    --text-main: #162536;
    --text-muted: #6f8092;
    --primary: #078bd3;
    --primary-hover: #006fae;
    --primary-soft: #e8f5fc;
    --primary-border: #b9e1f6;
    --surface-soft: #f7fafc;
    --surface-raised: #ffffff;
    --surface-hover: #f0f7fc;
    --success: #10a575;
    --success-bg: #e9f8f2;
    --danger: #df4c5c;
    --danger-bg: #fdefef;
    --warning: #d99222;
    --warning-bg: #fff6e5;
    --shadow: 0 12px 35px rgba(36, 77, 111, 0.08);
    --shadow-strong: 0 22px 55px rgba(31, 73, 108, 0.14);
    --sidebar-shadow: 14px 0 40px rgba(54, 91, 122, 0.05);
    --input-bg: #ffffff;
    --plate-shadow: 0 6px 14px rgba(30, 52, 72, 0.14);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg-main: #070b11;
    --bg-card: #111720;
    --bg-sidebar: #0b1017;
    --border-color: #252f3d;
    --text-main: #f2f6fa;
    --text-muted: #8d9aaa;
    --primary: #159ede;
    --primary-hover: #31b2ec;
    --primary-soft: #0c2b3d;
    --primary-border: #164f6c;
    --surface-soft: #0d131b;
    --surface-raised: #151c26;
    --surface-hover: #172331;
    --success: #32c892;
    --success-bg: #102b24;
    --danger: #ff6876;
    --danger-bg: #32191f;
    --warning: #f3b84d;
    --warning-bg: #302516;
    --shadow: 0 16px 35px rgba(0, 0, 0, 0.25);
    --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.42);
    --sidebar-shadow: 14px 0 45px rgba(0, 0, 0, 0.28);
    --input-bg: #0b1118;
    --plate-shadow: 0 7px 18px rgba(0, 0, 0, 0.35);
}

* {
    scrollbar-color: var(--border-color) transparent;
}

html {
    background: var(--bg-main);
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 72% -12%, rgba(7, 139, 211, 0.10), transparent 32%),
        linear-gradient(135deg, rgba(7, 139, 211, 0.025) 25%, transparent 25%);
    background-size: auto, 32px 32px;
    color: var(--text-main);
    transition: background-color 0.25s ease, color 0.25s ease;
}

html[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at 76% -8%, rgba(21, 158, 222, 0.12), transparent 34%),
        radial-gradient(circle at 12% 100%, rgba(21, 158, 222, 0.04), transparent 32%);
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-container {
    min-height: 100vh;
}

.sidebar {
    width: 286px;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 24px 20px 18px;
    background: color-mix(in srgb, var(--bg-sidebar) 96%, transparent);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--sidebar-shadow);
    backdrop-filter: blur(18px);
    z-index: 40;
}

.sidebar-top,
.sidebar-bottom {
    display: flex;
    flex-direction: column;
}

.sidebar-top {
    flex: 1;
    min-height: 0;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 22px;
    padding: 5px 7px;
    min-height: 62px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 15px;
}

.brand-logo {
    display: block;
    width: 142px;
    height: 53px;
    object-fit: contain;
    object-position: left center;
    border-radius: 10px;
    transition: filter 0.25s ease;
}

html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .login-brand img,
html[data-theme="dark"] .login-mobile-logo {
    filter: invert(1) hue-rotate(180deg) brightness(1.08) saturate(1.08);
    mix-blend-mode: screen;
}

.brand-product {
    padding: 5px 7px;
    border-radius: 7px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--primary-border);
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.sidebar-context {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    padding: 13px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--surface-soft);
}

.context-dot {
    width: 9px;
    height: 9px;
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
}

.sidebar-context div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-context strong {
    color: var(--text-main);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-context span:last-child {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.65rem;
}

.nav-menu {
    gap: 7px;
}

.nav-section-label {
    margin: 0 12px 6px;
    color: color-mix(in srgb, var(--text-muted) 72%, transparent);
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.nav-item {
    position: relative;
    min-height: 48px;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 650;
}

.nav-item::after {
    content: '';
    position: absolute;
    right: 12px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: transparent;
}

.nav-item:hover {
    color: var(--primary);
    background: var(--surface-hover);
    border-color: var(--border-color);
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, #0792db, #0579bd);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 11px 24px rgba(7, 139, 211, 0.23);
}

.nav-item.active::after {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.nav-icon {
    width: 22px;
    height: 22px;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

.nav-item.active .nav-icon {
    color: #ffffff;
}

.system-status-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 14px;
    color: var(--text-main);
    background: var(--success-bg);
    border: 1px solid color-mix(in srgb, var(--success) 26%, var(--border-color));
}

.system-status-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: var(--success);
    background: color-mix(in srgb, var(--success) 12%, var(--bg-card));
}

.system-status-icon svg {
    width: 18px;
    height: 18px;
}

.system-status-card div {
    display: flex;
    flex-direction: column;
}

.system-status-card strong {
    font-size: 0.71rem;
}

.system-status-card div span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.6rem;
}

.dot {
    background: var(--success);
}

.dot.pulse {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 65%, transparent);
}

.user-profile {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 11px;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border-color);
}

.user-info {
    min-width: 0;
    flex: 1;
    gap: 9px;
}

.user-avatar,
.resident-avatar {
    background: linear-gradient(135deg, var(--primary), #2bb6ef);
    border: 0;
    color: #ffffff;
    box-shadow: 0 7px 16px rgba(7, 139, 211, 0.2);
}

.user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
}

.user-copy {
    min-width: 0;
}

.user-name {
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--text-muted);
}

.logout-form {
    width: auto;
}

.btn-logout {
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 11px;
    color: var(--danger);
    background: var(--danger-bg);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

.sidebar-footer {
    margin-top: 10px;
    padding: 10px 4px 0;
    border-top: 0;
    color: var(--text-muted);
    font-size: 0.61rem;
    letter-spacing: 0.03em;
}

.sidebar-footer span {
    margin-left: auto;
}

.main-content {
    min-width: 0;
    height: 100vh;
    padding: 0;
    overflow-y: auto;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 25;
    min-height: 112px;
    margin: 0;
    padding: 22px 30px;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-main) 88%, transparent);
    backdrop-filter: blur(18px);
}

.header-leading,
.header-actions {
    display: flex;
    align-items: center;
}

.header-leading {
    min-width: 0;
    gap: 14px;
}

.header-actions {
    gap: 10px;
}

.page-heading {
    min-width: 0;
}

.page-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--primary);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.main-header h1 {
    color: var(--text-main);
    font-size: clamp(1.45rem, 2.1vw, 1.95rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.page-heading p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.system-time {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 126px;
    padding: 9px 12px;
    border-radius: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    font-family: inherit;
}

.system-time svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.system-time div {
    display: flex;
    flex-direction: column;
}

.system-time span {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
}

.system-time strong {
    color: var(--text-main);
    font-size: 0.78rem;
}

.theme-toggle,
.mobile-menu-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover,
.mobile-menu-button:hover {
    color: var(--primary);
    border-color: var(--primary-border);
    transform: translateY(-2px);
}

.theme-icon,
.mobile-menu-button svg {
    width: 19px;
    height: 19px;
}

.theme-icon-sun,
.mobile-menu-button {
    display: none;
}

html[data-theme="dark"] .theme-icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-icon-sun {
    display: block;
    color: #ffd36a;
}

.content-body {
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    padding: 28px 30px 42px;
}

.content-body > * {
    animation: odyosi-rise 0.42s ease both;
}

.content-body > *:nth-child(2) {
    animation-delay: 0.05s;
}

@keyframes odyosi-rise {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.messages-container {
    margin-bottom: 18px;
}

.alert {
    gap: 11px;
    justify-content: flex-start;
    min-height: 52px;
    padding: 12px 14px;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.alert-icon {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    border-radius: 9px;
    background: color-mix(in srgb, currentColor 11%, transparent);
}

.alert-icon svg {
    width: 15px;
    height: 15px;
}

.alert-text {
    flex: 1;
    font-size: 0.78rem;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.alert-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.alert-error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    min-height: 122px;
    padding: 19px;
    gap: 14px;
    border-radius: 18px;
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow);
}

.stat-card::after {
    top: auto;
    right: auto;
    bottom: 16px;
    left: 0;
    width: 3px;
    height: calc(100% - 32px);
    border-radius: 0 4px 4px 0;
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-border);
    box-shadow: var(--shadow-strong);
}

.accent-blue { --accent: var(--primary); }
.accent-green { --accent: var(--success); }
.accent-amber { --accent: var(--warning); }
.accent-red { --accent: var(--danger); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
}

.stat-icon svg {
    width: 23px;
    height: 23px;
}

.icon-blue,
.icon-indigo { color: var(--primary); background: var(--primary-soft); }
.icon-green { color: var(--success); background: var(--success-bg); }
.icon-amber { color: var(--warning); background: var(--warning-bg); }
.icon-red { color: var(--danger); background: var(--danger-bg); }

.stat-details h3 {
    color: var(--text-muted);
    font-size: 0.67rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.055em;
}

.stat-value {
    color: var(--text-main);
    font-size: 1.78rem;
    font-weight: 800;
}

.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.panel-card {
    border-radius: 19px;
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow);
}

.success-border,
.danger-border {
    border-top-width: 1px;
}

.panel-header {
    min-height: 67px;
    padding: 15px 18px;
    gap: 10px;
    background: var(--surface-soft);
    border-color: var(--border-color);
}

.panel-header h2 {
    color: var(--text-main);
    font-size: 0.94rem;
    font-weight: 750;
    letter-spacing: -0.015em;
}

.status-dot {
    width: 8px;
    height: 8px;
}

.dot-success { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 14%, transparent); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 13%, transparent); }
.dot-warning { background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 13%, transparent); }

.badge,
.health-pill,
.camera-state-badge,
.direction-badge {
    border-radius: 999px;
    font-weight: 750;
}

.badge.success,
.health-pill-success,
.state-healthy,
.direction-badge.success {
    color: var(--success);
    background: var(--success-bg);
    border-color: color-mix(in srgb, var(--success) 28%, transparent);
}

.badge.danger,
.health-pill-danger,
.state-offline,
.direction-badge.danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

.health-pill-warning,
.state-warning {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: color-mix(in srgb, var(--warning) 28%, transparent);
}

.panel-body {
    padding: 18px;
}

.panel-body::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.logs-list,
.residents-list {
    gap: 11px;
}

.log-card,
.resident-card,
.guest-item,
.onsite-card,
.camera-health-card {
    background: var(--surface-soft);
    border-color: var(--border-color);
}

.log-card {
    min-height: 83px;
    padding: 13px;
    border-radius: 14px;
}

.log-card:hover,
.resident-card:hover {
    background: var(--surface-hover);
    border-color: var(--primary-border);
}

.log-card.registered { border-left-color: var(--success); }
.log-card.unregistered { border-left-color: var(--danger); }

.owner-name,
.camera-health-title,
.camera-metric strong,
.resident-name,
.resident-meta strong,
.owner-text {
    color: var(--text-main);
}

.warning-text { color: var(--danger); }

.tr-plate {
    border-width: 2px;
    border-color: #1d2730;
    box-shadow: var(--plate-shadow);
}

.tr-plate-blue {
    background: #078bd3;
}

.photo-thumb {
    border-color: var(--border-color);
    box-shadow: var(--shadow);
}

.camera-health-panel {
    margin-top: 18px;
}

.camera-health-card {
    border-left-width: 3px;
    border-radius: 14px;
}

.camera-metric {
    background: var(--input-bg);
    border-color: var(--border-color);
}

.camera-health-note,
.camera-health-subtitle,
.time-stamp,
.no-plates,
.form-help,
.date-text {
    color: var(--text-muted);
}

.critical-alert-strip {
    border-radius: 18px;
    color: #ffffff;
    background: linear-gradient(135deg, #d93e50, #a92035);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 18px 35px rgba(201, 42, 62, 0.18);
}

.critical-alert-card {
    background: rgba(255, 255, 255, 0.1);
}

.critical-alert-strip .warning-text {
    color: #ffffff;
}

.critical-alert-strip .time-stamp {
    color: rgba(255, 255, 255, 0.78);
}

.critical-alert-strip .badge.danger,
.critical-alert-strip .direction-badge.danger {
    color: #ffffff;
    background: rgba(87, 8, 20, 0.42);
    border-color: rgba(255, 255, 255, 0.2);
}

.onsite-panel {
    margin-top: 18px;
}

.onsite-alert,
.blacklist-item {
    background: var(--danger-bg);
    border-color: color-mix(in srgb, var(--danger) 32%, transparent);
}

.manage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.left-column {
    display: contents;
}

.resident-form-panel,
.table-panel {
    grid-column: 1 / -1;
}

.resident-form-panel .custom-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resident-form-panel .btn-block {
    grid-column: 1 / -1;
}

.access-form-panel {
    height: 100%;
}

.access-form-panel > .panel-body {
    display: flex;
    flex-direction: column;
}

.access-form-panel .custom-form {
    min-height: 292px;
}

.access-form-panel .custom-form .btn-block {
    margin-top: auto;
}

.table-panel {
    max-height: calc(100vh - 168px);
}

.search-header-block {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    padding: 16px 18px;
}

.filter-form {
    flex-wrap: nowrap;
}

.filter-input {
    min-width: 0;
}

.table-panel > .panel-body {
    min-height: 0;
}

.license-panel {
    border-color: var(--primary-border);
}

.custom-form {
    gap: 15px;
}

.form-group {
    gap: 7px;
}

.form-group label {
    color: var(--text-main);
    font-size: 0.72rem;
    font-weight: 700;
}

.form-group input,
.form-group select,
.filter-input,
.plate-input,
.search-input-wrapper {
    color: var(--text-main);
    background: var(--input-bg);
    border-color: var(--border-color);
    border-radius: 11px;
    color-scheme: inherit;
}

.form-group input,
.form-group select {
    min-height: 45px;
    padding: 10px 12px;
    font-size: 0.81rem;
}

.form-group input:focus,
.form-group select:focus,
.filter-input:focus,
.plate-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}

.form-group input::placeholder,
.filter-input::placeholder,
.plate-input::placeholder {
    color: color-mix(in srgb, var(--text-muted) 68%, transparent);
}

.form-group input:disabled {
    color: var(--text-muted);
    background: var(--surface-soft);
}

.license-feature-grid {
    gap: 8px;
}

.license-toggle {
    padding: 10px;
    border-radius: 11px;
    background: var(--surface-soft);
    border-color: var(--border-color);
}

.license-toggle input,
.form-check input {
    accent-color: var(--primary);
}

.btn {
    min-height: 43px;
    padding: 10px 16px;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 750;
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #0793da, #0578b9);
    box-shadow: 0 9px 20px rgba(7, 139, 211, 0.18);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #057dbd, #046ca8);
    transform: translateY(-1px);
}

.btn-secondary {
    color: var(--text-main);
    background: var(--surface-soft);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary-border);
}

.btn-danger {
    background: linear-gradient(135deg, #e95161, #c83245);
}

.filter-input {
    min-height: 42px;
}

.btn-clear-search,
.btn-delete,
.icon-btn-danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.resident-card {
    padding: 16px;
    border-radius: 15px;
}

.resident-top {
    border-color: var(--border-color);
}

.resident-avatar {
    width: 43px;
    height: 43px;
}

.resident-name {
    font-size: 0.93rem;
}

.btn-edit {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary-border);
}

.btn-edit:hover {
    color: #ffffff;
    background: var(--primary);
}

.btn-toggle.on,
.limit-badge {
    color: var(--success);
    background: var(--success-bg);
    border-color: color-mix(in srgb, var(--success) 32%, transparent);
}

.btn-toggle.off {
    color: var(--text-muted);
    background: var(--surface-soft);
    border-color: var(--border-color);
}

.limit-badge.full {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: color-mix(in srgb, var(--warning) 32%, transparent);
}

.icon-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-color);
}

.guest-list {
    border-color: var(--border-color);
}

.guest-until {
    color: var(--warning);
}

.blacklist-label {
    color: var(--danger);
}

.site-count-badge {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: var(--primary-border);
}

.report-filter-card,
.reports-grid {
    max-height: none;
}

.report-table-row,
.report-row {
    border-color: var(--border-color);
}

.report-table-head {
    color: var(--text-muted);
    background: var(--surface-soft);
}

.report-table-row:hover {
    background: var(--surface-hover);
}

.custom-table th,
.custom-table td {
    border-color: var(--border-color);
}

.custom-table tbody tr:hover {
    background: var(--surface-hover);
}

.modal {
    background: rgba(5, 12, 20, 0.66);
    backdrop-filter: blur(7px);
}

.modal-content {
    border-color: var(--border-color);
    box-shadow: var(--shadow-strong);
}

.modal-close {
    color: var(--text-muted);
}

.sidebar-backdrop {
    display: none;
}

/* Login */
.login-page {
    min-height: 100vh;
    background: var(--bg-main);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(500px, 1.05fr);
    min-height: 100vh;
}

.login-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 48px;
    overflow: hidden;
    color: #ffffff;
    background: linear-gradient(145deg, #038dd4 0%, #0879bc 48%, #055d95 100%);
}

.login-showcase::before,
.login-showcase::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.login-showcase::before {
    width: 520px;
    height: 520px;
    top: -220px;
    right: -210px;
    box-shadow: 0 0 0 74px rgba(255, 255, 255, 0.035), 0 0 0 148px rgba(255, 255, 255, 0.025);
}

.login-showcase::after {
    width: 360px;
    height: 360px;
    bottom: -210px;
    left: -160px;
    box-shadow: 0 0 0 58px rgba(255, 255, 255, 0.035);
}

.login-brand,
.login-showcase-content,
.login-showcase-footer {
    position: relative;
    z-index: 1;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 66px;
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 16px 34px rgba(0, 47, 78, 0.18);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

html[data-theme="dark"] .login-brand {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    mix-blend-mode: screen;
}

.login-brand img {
    width: 156px;
    height: auto;
    transition: filter 0.25s ease;
}

.login-showcase-content {
    max-width: 530px;
}

.login-showcase-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 19px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.login-showcase-kicker::before {
    content: '';
    width: 28px;
    height: 2px;
    background: #ffffff;
}

.login-showcase h1 {
    max-width: 560px;
    font-size: clamp(2.5rem, 4.5vw, 4.8rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.055em;
}

.login-showcase p {
    max-width: 475px;
    margin-top: 22px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.94rem;
    line-height: 1.75;
}

.login-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.login-feature {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.68rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.login-feature svg {
    width: 14px;
    height: 14px;
}

.login-showcase-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.67rem;
}

.login-showcase-footer .dot {
    background: #8fffd8;
}

.login-form-side {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 48px;
    background:
        radial-gradient(circle at 100% 0, rgba(7, 139, 211, 0.09), transparent 30%),
        var(--bg-main);
}

.login-theme-toggle {
    position: absolute;
    top: 28px;
    right: 30px;
}

.login-card {
    width: min(100%, 470px);
    padding: 38px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    text-align: left;
    background: var(--bg-card);
    box-shadow: var(--shadow-strong);
}

.login-mobile-logo {
    display: none;
    transition: filter 0.25s ease;
}

.login-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 15px;
    padding: 6px 9px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid var(--primary-border);
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.login-header-badge svg {
    width: 13px;
    height: 13px;
}

.login-header h1 {
    color: var(--text-main);
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.login-header p {
    margin: 8px 0 28px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.login-form {
    gap: 17px;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap > svg {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 1;
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    transform: translateY(-50%);
}

.login-input-wrap input {
    width: 100%;
    padding-left: 43px;
}

.btn-login {
    min-height: 51px;
    margin-top: 5px;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 19px;
    padding: 12px 13px;
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    border-radius: 13px;
    color: var(--danger);
    background: var(--danger-bg);
    font-size: 0.74rem;
    font-weight: 650;
}

.error-message svg {
    width: 16px;
    height: 16px;
}

.login-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 25px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.63rem;
}

@media (max-width: 1180px) {
    .sidebar { width: 256px; }
    .main-header { padding-inline: 24px; }
    .content-body { padding-inline: 24px; }
    .brand-logo { width: 128px; }
    .login-showcase { padding: 40px; }
}

@media (max-width: 960px) {
    .app-container { flex-direction: row; }
    .mobile-menu-button { display: grid; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(286px, 86vw);
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        overflow-y: auto;
        transform: translateX(-104%);
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .sidebar-top,
    .sidebar-bottom { width: 100%; }
    .nav-menu {
        width: 100%;
        flex-direction: column;
        flex-grow: 1;
        align-items: stretch;
        gap: 6px;
    }
    .nav-link { width: 100%; }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(4, 11, 18, 0.56);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
    .main-content { width: 100%; }
    .dashboard-grid,
    .manage-grid { grid-template-columns: 1fr; }
    .resident-form-panel,
    .table-panel { grid-column: 1; }
    .table-panel { max-height: none; }
    .panel-card { max-height: none; }
    .login-shell { grid-template-columns: 0.8fr 1.2fr; }
    .login-showcase { padding: 34px; }
    .login-form-side { padding: 34px; }
}

@media (max-width: 760px) {
    .main-header { min-height: 98px; padding: 18px; }
    .page-heading p { display: none; }
    .system-time { display: none; }
    .content-body { padding: 20px 18px 34px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card { min-height: 112px; padding: 15px; }
    .stat-value { font-size: 1.55rem; }
    .stat-icon { width: 42px; height: 42px; }
    .camera-health-grid { grid-template-columns: 1fr; }
    .login-shell { display: block; }
    .login-showcase { display: none; }
    .login-form-side { min-height: 100vh; padding: 84px 18px 32px; }
    .login-mobile-logo {
        display: block;
        width: 132px;
        height: auto;
        margin-bottom: 26px;
        border-radius: 10px;
    }
    .login-card { padding: 28px 23px; }
}

@media (max-width: 560px) {
    .main-header h1 { font-size: 1.3rem; }
    .page-eyebrow { font-size: 0.54rem; }
    .theme-toggle,
    .mobile-menu-button { width: 41px; height: 41px; flex-basis: 41px; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 99px; }
    .panel-header { padding: 13px 14px; }
    .panel-body { padding: 14px; }
    .log-card { align-items: flex-start; flex-wrap: wrap; }
    .log-info { width: 100%; align-items: flex-start; }
    .camera-health-metrics { grid-template-columns: 1fr; }
    .resident-top { flex-direction: column; }
    .resident-actions { justify-content: flex-start; }
    .resident-identity,
    .resident-identity > div:last-child { min-width: 0; width: 100%; }
    .resident-meta {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .inline-add-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
        margin-left: 0;
    }
    .plate-input { flex: 1; width: auto; }
    .filter-form,
    .report-filter-form { align-items: stretch; flex-direction: column; }
    .filter-form { flex-wrap: wrap; gap: 10px; }
    .filter-input {
        flex: 0 0 43px;
        width: 100%;
        height: 43px;
    }
    .btn-filter { width: 100%; }
    .btn-add-plate { white-space: nowrap; }
    .license-feature-grid { grid-template-columns: 1fr; }
    .resident-form-panel .custom-form { grid-template-columns: 1fr; }
    .resident-form-panel .btn-block { grid-column: 1; }
    .access-form-panel .custom-form { min-height: 0; }
    .critical-alert-card,
    .report-row,
    .report-table-row { grid-template-columns: 1fr; }
    .photo-thumb { width: 100%; height: 150px; }
    .login-form-side { align-items: start; }
    .login-card { border-radius: 21px; }
    .login-header h1 { font-size: 1.55rem; }
    .login-footer { flex-direction: column; gap: 5px; }
}

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