:root {
    --kh-primary: #2f8f84;
    --kh-primary-dark: #236b62;
    --kh-primary-soft: #d9f0ec;
    --kh-accent: #f08c5b;
    --kh-accent-soft: #ffe8d8;
    --kh-info-soft: #dff1fb;
    --kh-success-soft: #dff5e8;
    --kh-warning-soft: #fff1d6;
    --kh-danger-soft: #fde4e4;
    --kh-bg: #edf3f7;
    --kh-bg-accent: #e4eef5;
    --kh-surface: #f8fbfd;
    --kh-surface-strong: #ffffff;
    --kh-sidebar: linear-gradient(180deg, #c8ddd9 0%, #bfd0df 100%);
    --kh-text: #1f2d3a;
    --kh-muted: #5d6f80;
    --kh-border: #c9d7e3;
    --kh-shadow: 0 12px 28px rgba(31, 45, 58, 0.08);
    --kh-radius: 18px;
    --kh-radius-sm: 12px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(180deg, var(--kh-bg) 0%, var(--kh-bg-accent) 100%);
    color: var(--kh-text);
    font-family: Inter, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
}

.guest-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(47, 143, 132, 0.22), transparent 30%),
        radial-gradient(circle at bottom right, rgba(240, 140, 91, 0.18), transparent 26%),
        linear-gradient(180deg, #f2f8fb 0%, #e7f0f7 100%);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar-panel {
    width: 280px;
    background: var(--kh-sidebar);
    color: var(--kh-text);
    padding: 1.25rem;
    border-right: 1px solid var(--kh-border);
    box-shadow: 4px 0 24px rgba(31, 45, 58, 0.05);
}

.content-panel {
    flex: 1;
    min-width: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sidebar-brand-icon,
.app-brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--kh-primary), var(--kh-primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 18px rgba(47, 143, 132, 0.24);
    object-fit: contain;
    padding: 0.35rem;
}

.app-brand-logo-sm {
    width: 38px;
    height: 38px;
}

.app-brand-logo-md {
    width: 46px;
    height: 46px;
}

.app-brand-logo-lg {
    width: 88px;
    height: 88px;
    border-radius: 20px;
}

img.app-brand-logo {
    background: #fff;
}

.auth-brand-logo {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    margin: 0 auto 1rem;
    display: block;
    object-fit: contain;
    padding: 0.5rem;
    background: linear-gradient(135deg, var(--kh-primary), var(--kh-primary-dark));
    box-shadow: 0 10px 24px rgba(47, 143, 132, 0.24);
}

.auth-brand-badge {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--kh-primary), var(--kh-primary-dark));
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    box-shadow: 0 10px 24px rgba(47, 143, 132, 0.24);
}

.sidebar-brand small {
    color: #4f6475;
}

.sidebar-nav {
    border: 1px solid rgba(31, 45, 58, 0.12);
    border-radius: var(--kh-radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.28);
}

.sidebar-nav .nav-link {
    color: #4f6475;
    border-radius: 0;
    padding: 0.82rem 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0;
    font-weight: 600;
    transition: all 0.18s ease;
    border-bottom: 1px solid rgba(31, 45, 58, 0.1);
}

.sidebar-nav .nav-link:last-child {
    border-bottom: none;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
}

.sidebar-nav .nav-link:hover {
    color: var(--kh-primary-dark);
    background: rgba(35, 107, 98, 0.14);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--kh-primary), var(--kh-primary-dark));
    box-shadow: 0 8px 18px rgba(47, 143, 132, 0.22);
}

.topbar {
    background: rgba(248, 251, 253, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--kh-border);
    padding: 0.95rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.55rem 0.35rem 0.35rem;
    border-radius: 999px;
    background: #eef6fa;
    border: 1px solid var(--kh-border);
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--kh-primary-soft);
    color: var(--kh-primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
}

.subscription-remaining-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.subscription-remaining-mini i {
    font-size: 0.72rem;
}

.subscription-remaining {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    border: 1px solid transparent;
    min-width: 220px;
}

.subscription-remaining-compact {
    min-width: auto;
    padding: 0.5rem 0.75rem;
}

.subscription-remaining i {
    font-size: 1.15rem;
}

.subscription-remaining-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    opacity: 0.85;
}

.subscription-remaining-value {
    font-weight: 700;
    line-height: 1.2;
}

.subscription-remaining-meta {
    font-size: 0.78rem;
    opacity: 0.85;
}

.subscription-remaining-success {
    background: var(--kh-success-soft);
    border-color: #b9e4c8;
    color: #1f6a43;
}

.subscription-remaining-warning {
    background: var(--kh-warning-soft);
    border-color: #f2d39b;
    color: #8a5a12;
}

.subscription-remaining-danger {
    background: var(--kh-danger-soft);
    border-color: #efb7b7;
    color: #9a2f2f;
}

.subscription-remaining-info {
    background: var(--kh-info-soft);
    border-color: #b7d9ef;
    color: #245f86;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--kh-primary-soft);
    color: var(--kh-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card {
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius);
    box-shadow: var(--kh-shadow);
    background: var(--kh-surface-strong);
}

.card-header {
    background: linear-gradient(180deg, #f7fbfe 0%, #f1f7fb 100%);
    border-bottom: 1px solid var(--kh-border);
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(232, 245, 250, 0.95));
}

.stat-card-primary .stat-icon-primary {
    background: var(--kh-primary-soft);
    color: var(--kh-primary-dark);
}

.stat-card-accent .stat-icon-accent {
    background: var(--kh-accent-soft);
    color: #b85f2d;
}

.stat-card-info .stat-icon-info {
    background: var(--kh-info-soft);
    color: #245f86;
}

.stat-card-success .stat-icon-success {
    background: var(--kh-success-soft);
    color: #1f6a43;
}

.app-branding-preview {
    background: linear-gradient(135deg, #eef7f6, #eef4fb);
    border-radius: 16px;
    border: 1px dashed var(--kh-border);
}

.table > :not(caption) > * > * {
    vertical-align: middle;
    border-color: var(--kh-border);
}

.table thead th {
    color: var(--kh-muted);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #edf4fa;
}

.table tbody tr.service-row-pending > * {
    background-color: #f3f5f8 !important;
}

.table tbody tr.service-row-scheduled > * {
    background-color: #e8f4fc !important;
}

.table tbody tr.service-row-in-progress > * {
    background-color: #e7f1ff !important;
}

.table tbody tr.service-row-waiting-parts > * {
    background-color: #fff4df !important;
}

.table tbody tr.service-row-completed > * {
    background-color: #e7f8ee !important;
}

.table tbody tr.service-row-delivered > * {
    background-color: #e4edf5 !important;
}

.table tbody tr.service-row-cancelled > * {
    background-color: #fdebec !important;
}

.auth-card {
    max-width: 460px;
    margin: 5vh auto 0;
    border: 1px solid var(--kh-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--kh-shadow);
    background: var(--kh-surface-strong);
}

.form-section-title {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kh-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

.form-control,
.form-select {
    border-radius: var(--kh-radius-sm);
    border-color: var(--kh-border);
    padding: 0.72rem 0.9rem;
    background: #fbfdff;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(47, 143, 132, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(47, 143, 132, 0.14);
    background: #fff;
}

.btn {
    border-radius: var(--kh-radius-sm);
    font-weight: 600;
    padding: 0.62rem 1rem;
}

.btn-primary {
    --bs-btn-bg: var(--kh-primary);
    --bs-btn-border-color: var(--kh-primary);
    --bs-btn-hover-bg: var(--kh-primary-dark);
    --bs-btn-hover-border-color: var(--kh-primary-dark);
    --bs-btn-active-bg: var(--kh-primary-dark);
    --bs-btn-active-border-color: var(--kh-primary-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--kh-primary-dark);
    --bs-btn-border-color: rgba(47, 143, 132, 0.45);
    --bs-btn-hover-bg: var(--kh-primary-soft);
    --bs-btn-hover-border-color: var(--kh-primary);
    --bs-btn-hover-color: var(--kh-primary-dark);
}

.badge-soft {
    padding: 0.5rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
}

.nav-tabs .nav-link {
    color: var(--kh-muted);
    font-weight: 600;
}

.nav-tabs .nav-link.active {
    color: var(--kh-primary-dark);
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 42px;
    border-radius: var(--kh-radius-sm);
    border-color: var(--kh-border);
    background: #fbfdff;
}

.alert {
    border: 0;
    border-radius: var(--kh-radius-sm);
}

.page-header-title {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--kh-text);
}

.text-secondary {
    color: var(--kh-muted) !important;
}

.content-panel main.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 992px) {
    .content-panel main.container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar-panel {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--kh-border);
        box-shadow: none;
    }

    .topbar {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .subscription-remaining {
        width: 100%;
    }
}

.technician-mobile-body {
    background: var(--kh-bg);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

.technician-mobile-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--kh-surface-strong);
    border-bottom: 1px solid var(--kh-border);
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-top));
    box-shadow: 0 4px 16px rgba(31, 45, 58, 0.06);
}

.technician-mobile-brand {
    font-weight: 700;
    color: var(--kh-primary-dark);
}

.technician-mobile-subtitle {
    font-size: 0.875rem;
    color: var(--kh-muted);
}

.technician-mobile-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem;
}

.technician-tabs .nav-link {
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.55rem 1rem;
}

.technician-job-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.technician-job-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--kh-surface-strong);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius-sm);
    padding: 1rem;
    box-shadow: var(--kh-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.technician-job-card:active {
    transform: scale(0.99);
}

.technician-job-customer {
    font-weight: 600;
}

.technician-detail-card {
    background: var(--kh-surface-strong);
    border: 1px solid var(--kh-border);
    border-radius: var(--kh-radius-sm);
    padding: 1rem;
    box-shadow: var(--kh-shadow);
}

.technician-detail-row {
    margin-bottom: 1rem;
}

.technician-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--kh-muted);
}

.whatsapp-float {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 10px 24px rgba(37, 211, 102, 0.35);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.whatsapp-float:hover {
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 14px 28px rgba(37, 211, 102, 0.45);
}

.site-contact-card {
    border-radius: var(--kh-radius-sm);
}

.legal-content {
    line-height: 1.8;
}

.empty-state-icon {
    font-size: 2.5rem;
    color: var(--kh-muted);
    opacity: 0.55;
}
