/**
 * Critical CSS for login / lock-screen / forgot-password first paint.
 * Decorative auth styles live in crm-theme.css (compiled from scss/_auth.scss).
 * Full Bootstrap loads asynchronously.
 */
:root,
[data-bs-theme="light"] {
    --crm-color-primary: #2563eb;
    --crm-color-primary-hover: #1d4ed8;
    --crm-color-primary-rgb: 37, 99, 235;
    --bs-blue: var(--crm-color-primary);
    --bs-primary: var(--crm-color-primary);
    --bs-primary-rgb: var(--crm-color-primary-rgb);
    --bs-secondary: #64748b;
    --bs-success: #16a34a;
    --bs-info: #0ea5e9;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #f1f5f9;
    --bs-dark: #0f172a;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: 0.875rem;
    --bs-body-line-height: 1.5;
    --bs-body-color: #0f172a;
    --bs-body-bg: #fff;
    --bs-border-color: #e2e8f0;
    --bs-border-radius: 0.375rem;
    --bs-link-color: var(--crm-color-primary);
    --bs-link-hover-color: var(--crm-color-primary-hover);
}

[data-bs-theme="dark"] {
    --bs-body-color: #e8ecf4;
    --bs-body-bg: #1a1d21;
    --bs-border-color: #313533;
    --bs-link-color: #60a5fa;
    --bs-link-hover-color: #93c5fd;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: var(--bs-body-font-family);
    font-size: var(--bs-body-font-size);
    line-height: var(--bs-body-line-height);
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    -webkit-text-size-adjust: 100%;
}

a {
    color: var(--bs-link-color);
    text-decoration: none;
}

a:hover {
    color: var(--bs-link-hover-color);
}

img {
    vertical-align: middle;
}

h5,
h4,
h2 {
    margin-top: 0;
    font-weight: 600;
    line-height: 1.2;
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

label {
    display: inline-block;
}

button,
input {
    font: inherit;
    margin: 0;
}

.container-fluid {
    width: 100%;
    padding-right: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    padding-left: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    margin-right: auto;
    margin-left: auto;
}

.p-0 { padding: 0 !important; }
.p-4 { padding: 1.5rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-md-5 { padding-top: 1.5rem !important; }

.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
    margin-left: calc(-0.5 * var(--bs-gutter-x));
}

.row > * {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    margin-top: var(--bs-gutter-y);
}

.g-0,
.row.g-0 {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
}

.col { flex: 1 0 0; }

@media (min-width: 768px) {
    .col-md-5 { flex: 0 0 auto; width: 41.66666667%; }
    .col-md-6 { flex: 0 0 auto; width: 50%; }
    .col-md-7 { flex: 0 0 auto; width: 58.33333333%; }
    .d-md-flex { display: flex !important; }
    .d-none.d-md-flex { display: flex !important; }
    .mb-md-5 { margin-bottom: 3rem !important; }
    .p-sm-5 { padding: 3rem !important; }
    .pt-md-5 { padding-top: 3rem !important; }
    .mt-md-5 { margin-top: 3rem !important; }
}

@media (min-width: 992px) {
    .col-lg-4 { flex: 0 0 auto; width: 33.33333333%; }
    .col-lg-5 { flex: 0 0 auto; width: 41.66666667%; }
    .col-lg-7 { flex: 0 0 auto; width: 58.33333333%; }
    .col-lg-8 { flex: 0 0 auto; width: 66.66666667%; }
}

@media (min-width: 1400px) {
    .col-xxl-3 { flex: 0 0 auto; width: 25%; }
    .col-xxl-4 { flex: 0 0 auto; width: 33.33333333%; }
    .col-xxl-8 { flex: 0 0 auto; width: 66.66666667%; }
    .col-xxl-9 { flex: 0 0 auto; width: 75%; }
}

.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-none { display: none !important; }
.d-grid { display: grid !important; }
.flex-column { flex-direction: column !important; }
.flex-grow-1 { flex: 1 1 auto !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-self-center { align-self: center !important; }
.justify-content-center { justify-content: center !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.top-0 { top: 0 !important; }
.end-0 { right: 0 !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.min-vh-100 { min-height: 100vh !important; }
.ms-auto { margin-left: auto !important; }
.ms-0 { margin-left: 0 !important; }
.me-1 { margin-right: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.my-auto { margin-top: auto !important; margin-bottom: auto !important; }
.text-center { text-align: center !important; }
.text-muted { color: #64748b !important; }
.text-primary { color: var(--bs-primary) !important; }
.fw-semibold { font-weight: 600 !important; }
.small { font-size: 0.875em !important; }
.font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important; }
.rounded-circle { border-radius: 50% !important; }
.shadow-none { box-shadow: none !important; }
.bg-primary { background-color: var(--bs-primary) !important; }
.bg-white { background-color: #fff !important; }
.bg-opacity-25 { --bs-bg-opacity: 0.25; }
.bg-white.bg-opacity-25 { background-color: rgba(255, 255, 255, 0.25) !important; }
.text-white { color: #fff !important; }
.lead { font-size: 1.125rem; font-weight: 300; }
.display-6 { font-size: calc(1.275rem + 0.3vw); font-weight: 600; }
.opacity-90 { opacity: 0.9 !important; }
.z-1 { z-index: 1 !important; }
.gap-2 { gap: 0.5rem !important; }

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.47rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    outline: 0;
    border-color: rgba(var(--crm-color-primary-rgb), 0.5);
    box-shadow: 0 0 0 0.2rem rgba(var(--crm-color-primary-rgb), 0.2);
}

.form-check {
    display: block;
    min-height: 1.3125rem;
    padding-left: 1.75em;
    margin-bottom: 0.125rem;
}

.form-check-input {
    float: left;
    width: 1.125em;
    height: 1.125em;
    margin-top: 0.1875em;
    margin-left: -1.75em;
    vertical-align: top;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25em;
}

.form-check-label {
    cursor: pointer;
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group > .btn {
    position: relative;
    z-index: 2;
}

.btn {
    display: inline-block;
    padding: 0.47rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    background-color: transparent;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    color: #fff;
    background-color: var(--crm-color-primary-hover);
    border-color: var(--crm-color-primary-hover);
}

.btn-light {
    color: #0f172a;
    background-color: var(--bs-light);
    border-color: var(--bs-light);
}

.btn-outline-secondary {
    color: var(--bs-secondary);
    border-color: var(--bs-border-color);
}

.btn-lg {
    padding: 0.625rem 1rem;
    font-size: 1rem;
}

.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    border: 0;
    border-radius: 0.375rem;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    opacity: 0.5;
    cursor: pointer;
}

.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
}

.alert-info {
    color: #0369a1;
    background-color: #e0f2fe;
    border-color: #bae6fd;
}

.alert-success {
    color: #166534;
    background-color: #dcfce7;
    border-color: #bbf7d0;
}

.alert-danger {
    color: #991b1b;
    background-color: #fee2e2;
    border-color: #fecaca;
}

.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 1.125rem 1rem;
}

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    border-radius: 0.375rem;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1.25rem;
}

.p-md-5 { padding: 1.5rem !important; }

@media (min-width: 768px) {
    .p-md-5 { padding: 3rem !important; }
    .px-xl-5 { padding-left: 3rem !important; padding-right: 3rem !important; }
}

[data-bs-theme="dark"] .text-muted { color: #94a3b8 !important; }
[data-bs-theme="dark"] .form-control {
    color: var(--bs-body-color);
    background-color: #262a2f;
    border-color: #313533;
}
[data-bs-theme="dark"] .btn-light {
    color: #e8ecf4;
    background-color: #313533;
    border-color: #313533;
}
[data-bs-theme="dark"] .alert-info {
    color: #7dd3fc;
    background-color: #082f49;
    border-color: #0c4a6e;
}
[data-bs-theme="dark"] .alert-success {
    color: #86efac;
    background-color: #052e16;
    border-color: #14532d;
}
[data-bs-theme="dark"] .alert-danger {
    color: #fca5a5;
    background-color: #450a0a;
    border-color: #7f1d1d;
}
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
[data-bs-theme="dark"] .card {
    background-color: #212529;
    border-color: #313533;
}
