:root {
    --td-primary: #1e3a5f;
    --td-accent: #2563eb;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f4f6f9;
    min-height: 100vh;
}

.navbar.bg-primary {
    background: linear-gradient(135deg, var(--td-primary), var(--td-accent)) !important;
}

.min-vh-100-login {
    min-height: calc(100vh - 80px);
}

.login-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--td-primary), var(--td-accent));
    border-radius: 50%;
    color: #fff;
    font-size: 2rem;
}

.card {
    border-radius: 12px;
}

.stat-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.table-responsive {
    border-radius: 12px;
    overflow: hidden;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--td-accent);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.btn-primary {
    background: var(--td-accent);
    border-color: var(--td-accent);
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.jalali-date {
    direction: ltr;
    text-align: right;
}

.datepicker-container {
    z-index: 1060 !important;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 576px) {
    .page-header h1 {
        font-size: 1.25rem;
    }

    .table td, .table th {
        font-size: 0.875rem;
    }
}

.feedback-page {
    background: linear-gradient(180deg, #eef4ff 0%, #f4f6f9 100%);
    min-height: 100vh;
}

.feedback-wrap {
    min-height: 100vh;
}

.feedback-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--td-primary), var(--td-accent));
    border-radius: 50%;
    color: #fff;
    font-size: 2rem;
}

.feedback-stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 0.5rem;
}

.feedback-star {
    border: none;
    background: transparent;
    font-size: 2rem;
    color: #cbd5e1;
    padding: 0.25rem;
    transition: color 0.15s, transform 0.15s;
}

.feedback-star:hover,
.feedback-star.active {
    color: #f59e0b;
    transform: scale(1.08);
}

.feedback-info-message {
    line-height: 1.9;
    color: #334155;
    font-family: Vazirmatn, Tahoma, sans-serif;
}

.feedback-info-message img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

.feedback-info-message a {
    color: #0d6efd;
    text-decoration: underline;
}

.note-editor.note-frame {
    direction: rtl;
    text-align: right;
}

.note-editor .note-editing-area .note-editable {
    direction: rtl;
    text-align: right;
    font-family: Vazirmatn, Tahoma, sans-serif;
}

.site-footer {
    background: #fff;
    line-height: 1.8;
}

.site-footer-title {
    color: #475569;
    font-weight: 600;
}

.site-footer-copy {
    color: #94a3b8;
    font-size: 0.8125rem;
}

.site-footer-credits {
    color: #64748b;
    font-size: 0.8125rem;
}

.site-footer-sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}

@media (max-width: 576px) {
    .site-footer-sep {
        display: block;
        visibility: hidden;
        height: 0;
        margin: 0;
    }
}

.navbar .dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 220px;
}

.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--td-primary);
}

.navbar .dropdown-item i {
    margin-left: 0.35rem;
}

.navbar-dark .nav-link.dropdown-toggle.active {
    color: #fff;
}

.mobile-ownership-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.mobile-ownership-owner {
    background-color: #198754;
    box-shadow: 0 0 0 1px rgba(25, 135, 84, 0.25);
}

.mobile-ownership-non-owner {
    background-color: #dc3545;
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.25);
}

.mobile-ownership-skipped {
    background-color: #adb5bd;
}

.mobile-ownership-na {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
}

.mobile-ownership-unknown {
    background-color: #6c757d;
    opacity: 0.55;
}

.office-map {
    height: 320px;
    width: 100%;
    z-index: 1;
}

.visit-attendance-cell .fw-medium {
    line-height: 1.3;
}

.service-callback-badge {
    position: relative;
    top: -1px;
    font-size: 0.7rem;
    min-width: 1.15rem;
    padding: 0.25em 0.45em;
    vertical-align: middle;
}

.service-callback-badge-pulse {
    animation: service-callback-pulse 1.4s ease-in-out infinite;
}

@keyframes service-callback-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.55); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
}

.watch-alert-toast {
    min-width: min(92vw, 420px);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.35), 0 12px 30px rgba(0, 0, 0, 0.25);
    animation: watch-alert-shake 0.45s ease-in-out 2;
}

@keyframes watch-alert-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

body.watch-alert-flash {
    animation: watch-alert-bg 0.5s ease-in-out 3;
}

@keyframes watch-alert-bg {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(220, 53, 69, 0); }
    50% { box-shadow: inset 0 0 0 6px rgba(220, 53, 69, 0.55); }
}

/* مراجعه‌کننده قبلی — فیلدهای بارگذاری‌شده */
.visitor-field-autofilled {
    font-weight: 700 !important;
    color: #084298 !important;
    background-color: #e7f1ff !important;
    border-color: #6ea8fe !important;
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.25);
}

.visitor-gender-autofilled .btn-outline-primary {
    font-weight: 700;
}

.visitor-gender-autofilled .btn-check:checked + .btn-outline-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.quick-picks {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 0.85rem;
}

.quick-picks-sidebar {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.quick-picks-sidebar .card-body {
    max-height: calc(100vh - 140px);
    overflow: auto;
}

@media (min-width: 992px) {
    .quick-picks-sidebar {
        position: sticky;
        top: 1rem;
    }
}

.quick-sidebar-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.45rem;
}

.quick-pick-stack {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.quick-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.quick-pick-card {
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 10px;
    padding: 0.65rem 0.7rem;
    text-align: right;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.quick-pick-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.quick-pick-card.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.quick-pick-title {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    line-height: 1.35;
}

.quick-pick-meta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #64748b;
}

@media (max-width: 991.98px) {
    .quick-picks-sidebar .card-body {
        max-height: none;
    }

    .quick-pick-stack {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .quick-pick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Desk service messengers (QR / public forms) */
.desk-messengers-box {
    border: 1px solid #dbe3ef;
    border-radius: 0.85rem;
    background: #fff;
    padding: 0.9rem 1rem;
}

.desk-messengers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.65rem;
}

.desk-messenger-chip {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: #f8fafc;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.desk-messenger-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
    color: inherit;
}

.desk-messenger-chip-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.desk-messenger-chip-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.desk-messenger-chip-text strong {
    font-size: 0.92rem;
}

.desk-messenger-chip-text small {
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.desk-msg-icon--bale .desk-messenger-chip-icon { background: #00a3e0; }
.desk-msg-icon--eitaa .desk-messenger-chip-icon { background: #f57c00; }
.desk-msg-icon--telegram .desk-messenger-chip-icon { background: #229ed9; }
.desk-msg-icon--whatsapp .desk-messenger-chip-icon { background: #25d366; }
.desk-msg-icon--email .desk-messenger-chip-icon { background: #64748b; }
.desk-msg-icon--phone .desk-messenger-chip-icon { background: #0f766e; }
.desk-msg-icon--other .desk-messenger-chip-icon { background: #475569; }

.desk-public-footer {
    background: transparent;
}

.desk-public-footer-inner,
.desk-public-footer-preview {
    line-height: 1.7;
}

.desk-public-footer-inner p,
.desk-public-footer-preview p {
    margin-bottom: 0.35rem;
}

.desk-public-footer-inner p:last-child,
.desk-public-footer-preview p:last-child {
    margin-bottom: 0;
}

.desk-public-footer-inner img,
.desk-public-footer-preview img {
    max-width: 100%;
    height: auto;
}
