:root {
    --sidebar-width: 260px;
    --primary: #0020c2;
    --primary-dark: #001280;
    --accent: #ff0000;
    --accent-dark: #cc0000;
    --cyan: #00d2ff;
    --background: #f8fafc;
    --sidebar: #050b18;
    --sidebar-hover: #101d36;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--background);
    color: var(--text);
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-dark);
    --bs-btn-hover-border-color: var(--accent-dark);
    --bs-btn-active-bg: var(--accent-dark);
    --bs-btn-active-border-color: var(--accent-dark);
    border-radius: 4px;
    font-weight: 700;
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    border-radius: 4px;
    font-weight: 600;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar);
    color: white;
    z-index: 1000;
    border-right: 1px solid rgba(0, 210, 255, 0.2);
    box-shadow: 10px 0 30px rgba(5, 11, 24, 0.16);
    transition: transform 0.25s ease;
}

.sidebar-brand {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: #060c19;
    color: white;
    border-bottom: 1px solid rgba(0, 210, 255, 0.22);
    font-family: "Orbitron", sans-serif;
    font-size: 0.88rem;
    letter-spacing: 0.025em;
}

.sidebar-brand small {
    color: #94a3b8;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    margin-right: 12px;
    object-fit: contain;
    flex-shrink: 0;
    padding: 5px;
    border-radius: 6px;
    background: white;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.18);
}

.sidebar-navigation {
    padding: 18px 14px;
}

.sidebar-navigation a,
.sidebar-navigation .nav-disabled {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    padding: 12px 14px;
    border-radius: 9px;
    color: #cbd5e1;
    text-decoration: none;
    transition: 0.2s;
}

.module-placeholder {
    max-width: 760px;
    padding: 48px;
    text-align: center;
}

.module-placeholder-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
    border-radius: 20px;
    color: var(--primary);
    background: #eef2ff;
    font-size: 2rem;
}

.email-message {
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    background: #f8fafc;
}

.email-message-outbound {
    border-left-color: #078760;
    background: #f2fbf7;
}

.email-message p:last-child {
    margin-bottom: 0;
}

.inbox-subject {
    max-width: 360px;
    vertical-align: middle;
}

.login-logo {
    display: block;
    width: 104px;
    height: 96px;
    margin-right: auto;
    margin-left: auto;
    object-fit: contain;
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: #eef2ff;
    font-size: 1.35rem;
}

.human-verification {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}

.captcha-image {
    border: 1px solid #d8dee9;
    border-radius: 10px;
    object-fit: cover;
}

.human-verification-trap {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.sidebar-navigation i {
    width: 20px;
    font-size: 1.05rem;
    text-align: center;
}

.sidebar-navigation a:hover,
.sidebar-navigation a.active {
    color: white;
    background: var(--sidebar-hover);
}

.sidebar-navigation a.active {
    color: var(--cyan);
    box-shadow: inset 3px 0 var(--accent);
}

.sidebar-navigation .nav-disabled {
    color: #64748b;
    cursor: not-allowed;
}

.nav-disabled > span {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
}

.nav-disabled small {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.app-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.app-header {
    height: 72px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    background: #060c19;
    border-bottom: 1px solid rgba(0, 210, 255, 0.2);
    box-shadow: 0 2px 10px rgba(5, 11, 24, 0.18);
    position: sticky;
    top: 0;
    z-index: 900;
}

.app-header strong {
    color: white;
    font-family: "Orbitron", sans-serif;
    letter-spacing: 0.025em;
}

.app-header .text-secondary {
    color: #cbd5e1 !important;
}

.app-header .btn-outline-secondary {
    color: white;
    border-color: #64748b;
}

.app-header .btn-outline-secondary:hover {
    color: #050b18;
    background: var(--cyan);
    border-color: var(--cyan);
}

.app-main {
    padding: 30px;
}

.page-title-row h1,
.app-main > .row h1 {
    color: var(--primary);
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
}

.stat-card {
    position: relative;
    overflow: hidden;
    height: 100%;
    padding: 24px;
    border: 0;
    color: white;
    border-radius: 8px;
    background: #060c19;
    box-shadow: 0 8px 20px rgba(5, 11, 24, 0.12);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-top: 4px solid var(--primary);
}

.stat-label {
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-value {
    margin-top: 8px;
    font-size: 2rem;
    line-height: 1;
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
}

.technician-alert-count {
    animation: technician-alert-blink 1.2s steps(1, end) infinite;
}

@keyframes technician-alert-blink {
    0%,
    49% {
        color: #dc2626;
    }

    50%,
    100% {
        color: #111827;
    }
}

@media (prefers-reduced-motion: reduce) {
    .technician-alert-count {
        color: #dc2626;
        animation: none;
    }
}

.ticket-row-high > td,
.ticket-row-high > td a:not(.btn) {
    animation: ticket-high-blink 1.2s steps(1, end) infinite;
}

.ticket-row-critical {
    --bs-table-bg: #dc3545;
    --bs-table-hover-bg: #c92f3d;
    --bs-table-border-color: #b92d3a;
}

.ticket-row-critical > td,
.ticket-row-critical > td a:not(.btn) {
    animation: ticket-critical-blink 1.2s steps(1, end) infinite;
}

@keyframes ticket-high-blink {
    0%,
    49% {
        color: #dc2626;
    }

    50%,
    100% {
        color: #111827;
    }
}

@keyframes ticket-critical-blink {
    0%,
    49% {
        color: #fff;
    }

    50%,
    100% {
        color: #111827;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ticket-row-high > td,
    .ticket-row-high > td a:not(.btn) {
        color: #dc2626;
        animation: none;
    }

    .ticket-row-critical > td,
    .ticket-row-critical > td a:not(.btn) {
        color: #fff;
        animation: none;
    }
}

.stat-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 1.15rem;
}

.stat-card-primary .stat-icon {
    color: var(--cyan);
    background: rgba(0, 210, 255, 0.12);
}

.stat-card-success .stat-icon {
    color: #078760;
    background: #e7f8f1;
}

.stat-card-success {
    border-top-color: #00d084;
}

.stat-card-danger .stat-icon {
    color: #dc3545;
    background: #fcebed;
}

.stat-card-danger {
    border-top-color: var(--accent);
}

.stat-card-warning .stat-icon {
    color: #b77900;
    background: #fff4d6;
}

.stat-card-warning {
    border-top-color: #f5a524;
}

.stat-card-technician .stat-icon {
    color: var(--cyan);
    background: rgba(0, 210, 255, 0.12);
}

.stat-card-technician {
    border-top-color: var(--cyan);
    color: #111827;
    background: white;
}

.stat-card-technician .stat-label {
    color: var(--muted);
}

.content-card {
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
}

.content-card.card-body {
    overflow: visible;
}

.table > :not(caption) > * > * {
    padding: 14px 16px;
}

.table thead th {
    color: var(--muted);
    color: #dbeafe;
    background: #060c19;
    border-bottom-color: var(--border);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.status-badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-new {
    color: #3157d5;
    background: #eef2ff;
}

.status-in_progress {
    color: #086fa1;
    background: #e8f6fc;
}

.status-waiting {
    color: #986700;
    background: #fff3cd;
}

.status-waiting_technician {
    color: #6d28d9;
    background: #f1eafe;
}

.status-resolved {
    color: #087653;
    background: #ddf7ec;
}

.status-closed {
    color: #596273;
    background: #e9edf3;
}

.priority-badge {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 600;
}

.priority-critical {
    color: #c92a3a;
}

.priority-none {
    color: #64748b;
}

.priority-high {
    color: #d16800;
}

.priority-normal {
    color: #3157d5;
}

.priority-low {
    color: #64748b;
}

.card-header {
    border-color: var(--border);
    color: var(--primary);
    font-weight: 650;
}

dl dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: uppercase;
}

dl dd {
    margin-bottom: 1rem;
}

.form-control,
.form-select {
    border-color: #d8dee9;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 32, 194, 0.14);
}

.app-public {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(0, 32, 194, 0.28), transparent 32rem),
        radial-gradient(circle at 90% 90%, rgba(0, 210, 255, 0.12), transparent 28rem),
        #050b18;
}

.app-public main > .text-center h1 {
    color: white;
    font-family: "Orbitron", sans-serif;
    font-weight: 800;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

.app-public main > .text-center .text-secondary {
    color: #cbd5e1 !important;
}

.app-public .card {
    border-top: 4px solid var(--primary) !important;
    border-radius: 8px !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24) !important;
}

.app-public .card h2,
.app-public .card h3 {
    color: var(--primary);
}

.app-public .login-logo {
    width: 126px;
    height: 108px;
    padding: 8px 14px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 0 18px rgba(0, 210, 255, 0.26);
}

.feature-icon {
    color: var(--primary);
    background: #e8edff;
    border-radius: 8px;
}

.mobile-menu-button {
    display: none;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 950;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.55);
}

.pwa-install-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1100;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
}

@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.is-visible {
        display: block;
    }

    .app-content {
        margin-left: 0;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
    }

    .app-main {
        padding: 20px;
    }
}

@media (max-width: 575px) {
    .pwa-install-button {
        right: 14px;
        bottom: 14px;
    }

    .app-header {
        height: 64px;
        padding: 0 16px;
    }

    .app-main {
        padding: 18px 14px;
    }

    .page-title-row {
        align-items: stretch !important;
        flex-direction: column;
        gap: 14px;
    }

    .page-title-row > .btn,
    .page-title-row > .d-flex {
        width: 100%;
    }

    .page-title-row > .d-flex .btn {
        flex: 1;
    }

    .user-name {
        display: none;
    }

    .logout-label {
        display: none;
    }

    .stat-card {
        padding: 20px;
    }
}

.language-switcher {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.7);
}

.language-switcher a {
    min-width: 28px;
    padding: 3px 6px;
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
}

.language-switcher a:hover,
.language-switcher a:focus-visible {
    color: white;
    background: rgba(255, 255, 255, 0.12);
}

.language-switcher a.active {
    color: white;
    background: var(--primary);
}

.language-switcher-public {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 1050;
    box-shadow: 0 4px 14px rgba(5, 11, 24, 0.16);
}

.password-change-card input[type="password"] {
    display: block;
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background: white;
}

.password-change-card input[type="password"]:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 32, 194, 0.15);
}

@media (max-width: 767px) {
    .password-change-label {
        display: none;
    }
}

.work-log-entry { padding: 1rem 0; border-bottom: 1px solid #e5e7eb; }
.work-log-entry:last-child { border-bottom: 0; }
.work-log-form .btn-check-group { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; list-style: none; }
.work-log-form .btn-check-group li { margin: 0; }
.work-log-form .btn-check-group label { display: inline-block; padding: .45rem .75rem; border: 1px solid #cbd5e1; border-radius: .5rem; cursor: pointer; background: #fff; }
.work-log-form .btn-check-group input { margin-right: .35rem; }
.work-log-form .btn-check-group label:has(input:checked) { color: #fff; border-color: var(--primary); background: var(--primary); }
