:root {
    --primary: #123d8b;
    --primary-dark: #0b2d68;
    --primary-soft: #eaf1ff;
    --secondary: #475569;
    --success: #198754;
    --warning: #f59e0b;
    --danger: #dc3545;
    --light: #f8fafc;
    --dark: #0f172a;
    --border: #dfe7f3;
    --muted: #64748b;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(180deg, #f3f7ff 0%, #edf3fb 100%);
    color: var(--dark);
    font-family: "Segoe UI", Arial, sans-serif;
}

img {
    max-width: 100%;
    height: auto;
}

.navbar {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(18, 61, 139, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--primary) !important;
    font-size: 1.35rem;
}

.nav-link {
    font-weight: 600;
    color: var(--dark) !important;
}

.navbar .badge {
    vertical-align: middle;
}

.container {
    max-width: 1240px;
}

.app-shell {
    min-height: calc(100vh - 100px);
}

.app-sidebar {
    position: sticky;
    top: 88px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 1rem 0.8rem;
}

.sidebar-brand {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--primary);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.sidebar-link {
    display: block;
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    transition: all 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
    text-decoration: none;
}

.page-content {
    background: transparent;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, rgba(18,61,139,0.06), rgba(255,255,255,0.9));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15,23,42,0.04);
}

.page-header h1 {
    margin: 0;
    font-weight: 800;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: var(--primary-dark);
}

.card {
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    background: rgba(255,255,255,0.96);
}

.card-body {
    padding: 1.2rem 1.3rem;
}

.card-title {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
    font-weight: 700;
}

.display-6 {
    font-size: clamp(1.8rem, 2.8vw, 2.8rem);
    line-height: 1.1;
    margin-bottom: 0;
    font-weight: 800;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.camera-preview,
.camera-captured {
  width: min(100%, 360px);
  max-height: 280px;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 1px solid #dee2e6;
}

.visitor-card-photo {
  width: 120px;
  height: 140px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.visitor-list-photo {
  width: 42px;
  height: 48px;
  object-fit: cover;
  border-radius: 0.35rem;
}

.table {
    margin-bottom: 0;
    background: #fff;
}

.table thead th {
    background: var(--primary-soft);
    color: var(--dark);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td,
.table th {
    vertical-align: middle;
    padding: 0.9rem 0.8rem;
}

.badge {
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
}

.btn {
    border-radius: 10px;
    font-weight: 700;
    transition: all 0.18s ease;
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-secondary {
    border-color: #cbd5e1;
}

.form-control,
.form-select {
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.78rem 0.9rem;
    background: #fff;
    color: var(--dark);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(18, 61, 139, 0.6);
    box-shadow: 0 0 0 0.2rem rgba(18, 61, 139, 0.12);
}

.form-label {
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.form-label > .form-control,
.form-label > .form-select {
    display: block;
    margin-top: 0.35rem;
}

.required-mark {
    color: var(--danger);
    font-weight: 800;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
    background-image: none;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.12);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success);
    background-image: none;
}

.invalid-feedback {
    display: block;
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 0.35rem;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fbfdff;
}

.page-content form:not(.row):not(.d-inline) {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.35rem;
    box-shadow: var(--shadow);
}

.page-content form:not(.row):not(.d-inline) .btn {
    min-width: 110px;
}

.page-content form.d-inline {
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
}

.page-content .row > [class*="col-"] > h1 {
    color: var(--primary-dark);
    font-weight: 800;
    margin-bottom: 1rem;
}

.alert {
    border-radius: 14px;
    border: none;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
}

.public-page {
    min-height: calc(100vh - 120px);
    background: linear-gradient(180deg, #eef5ff 0%, #f9fbff 100%);
}

.public-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
    padding: 1.6rem;
}

.public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.eyebrow {
    display: inline-block;
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    margin-bottom: 0.4rem;
}

.public-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: var(--primary-dark);
    font-weight: 800;
}

.public-info {
    background: linear-gradient(180deg, rgba(18,61,139,0.06), rgba(255,255,255,0.9));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.public-info h2 {
    color: var(--primary-dark);
    font-weight: 800;
    margin-bottom: 1rem;
}

.public-info ol {
    margin-bottom: 1rem;
    padding-left: 1.2rem;
    color: var(--dark);
}

.mini-note {
    border-left: 4px solid var(--primary);
    padding: 0.8rem 0.9rem;
    background: rgba(18,61,139,0.04);
    border-radius: 0 12px 12px 0;
    color: var(--dark);
}

.status-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.3rem;
}

.status-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.small-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.reference-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.detail-photo {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eaf2ff 0%, #f7f8fc 60%, #edf5ff 100%);
}

.auth-shell {
    width: min(100%, 440px);
    padding: 1rem;
}

.auth-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.14);
    padding: 2rem 1.5rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.82rem;
}

.auth-title {
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.15rem;
}

.auth-text {
    color: var(--muted);
    margin-bottom: 1.3rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.kpi-card {
    min-height: 150px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        padding-top: 0.75rem;
    }

    .navbar-nav {
        gap: 0.15rem;
    }

    .navbar-nav .nav-item {
        width: 100%;
    }

    .navbar-nav .nav-link {
        border-radius: 8px;
        padding: 0.7rem 0.8rem;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: static;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    body {
        background: #f5f8fc;
    }

    .container {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .page-header {
        padding: 0.8rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table td,
    .table th {
        white-space: normal;
    }

    .btn {
        width: 100%;
        margin-top: 0.35rem;
    }

    .btn-group,
    .d-flex.gap-2 {
        width: 100%;
    }
}
