:root {
    --navy: #0b1f3a;
    --blue: #1565c0;
    --soft: #f4f7fb;
    --ink: #1d2a3a;
}

body {
    background: var(--soft);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* NAVBAR & BRANDING */
.navbar {
    background: linear-gradient(100deg, #071b35, #1565c0) !important;
    min-height: 68px;
}

.navbar-brand {
    letter-spacing: .3px;
}

.app-nav {
    background: linear-gradient(100deg, #071b35, #1768b7) !important;
    min-height: 72px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-weight: 800;
}

.brand-lockup small {
    display: block;
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #b7d6f4;
}

.brand-mark,
.login-logo {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #fff;
    color: #0d559d;
    font-weight: 900;
}

.app-links {
    gap: .25rem;
}

.app-links a {
    display: block;
    padding: .5rem .65rem;
    color: #cfe5f9;
    text-decoration: none;
    font-size: .92rem;
    border-radius: 8px;
}

.app-links a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.nav-notification {
    position: relative;
    color: #fff;
    text-decoration: none;
    font-size: 1.05rem;
    padding: .5rem;
}

.nav-notification span {
    position: absolute;
    right: 0;
    top: 0;
    background: #ffcd3c;
    color: #13263e;
    border-radius: 10px;
    font-size: .65rem;
    padding: 1px 5px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: .55rem;
    border: 0;
    background: transparent;
    color: #fff;
    padding: .3rem;
}

.user-label {
    text-align: left;
    line-height: 1.1;
}

.user-label strong,
.user-label small {
    display: block;
}

.user-label small {
    color: #bddbf3;
    font-size: .7rem;
}

/* CARDS & UI BASE */
.card {
    border: 1px solid #e6edf5;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(26, 52, 84, .06) !important;
}

.card-header,
.card-footer {
    background: #fff;
    border-color: #edf1f5;
}

.btn {
    border-radius: 9px;
    font-weight: 600;
}

.btn-primary {
    background: #1565c0;
    border-color: #1565c0;
}

.btn-primary:hover {
    background: #0d4f9d;
}

.form-control,
.form-select {
    border-radius: 9px;
    border-color: #d9e2ec;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(21, 101, 192, .12);
    border-color: #70a6e8;
}

.metric {
    position: relative;
    overflow: hidden;
}

.metric:after {
    content: '';
    position: absolute;
    right: -24px;
    bottom: -32px;
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: rgba(21, 101, 192, .08);
}

.metric .display-6 {
    position: relative;
    z-index: 1;
}

.table>thead th {
    font-size: .73rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #66768a;
    border-bottom-width: 1px;
}

.table>tbody>tr {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: #f0f6ff;
}

.badge {
    font-weight: 600;
    padding: .43em .7em;
    border-radius: 20px;
}

/* AVATAR & PERFIL */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #d9edff;
    color: #10568f;
    display: grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 800;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xl {
    width: 90px;
    height: 90px;
    font-size: 2rem;
}

.profile-summary {
    background: linear-gradient(140deg, #fff, #eef7ff);
}

.theme-choice {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.theme-choice label {
    cursor: pointer;
}

.theme-choice input {
    position: absolute;
    opacity: 0;
}

.theme-choice span {
    display: block;
    border: 2px solid #dbe5f0;
    border-radius: 12px;
    padding: 1rem;
}

.theme-choice input:checked+span {
    border-color: #1565c0;
    background: #eef6ff;
}

.theme-choice small {
    display: block;
    color: #6b7d90;
    margin-top: .2rem;
}

/* LOGIN */
.login-bg {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top right, #298ad5, #071b35 70%);
}

.login-card {
    width: min(430px, 92vw);
    border: 0;
}

.login-logo {
    width: 48px;
    height: 48px;
    margin: auto;
    font-size: 1.4rem;
    background: #e9f3ff;
}

/* HERO DASHBOARD & FAQ */
.dashboard-hero {
    background: linear-gradient(110deg, #0b2342, #176dc3);
    color: white;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
}

.action-group {
    white-space: nowrap;
}

.faq-hero {
    background: radial-gradient(circle at 85% 15%, #2d91da, #132f55 58%);
    border-radius: 20px;
    color: #fff;
    padding: 2.4rem;
}

.faq-card {
    transition: transform .18s, box-shadow .18s;
    height: 100%;
}

.faq-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(20, 62, 109, .14) !important;
}

.faq-title {
    color: #102d52;
    text-decoration: none;
}

.faq-title:hover {
    color: #1565c0;
}

.faq-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #e9f3ff;
    color: #1565c0;
    font-size: 1.2rem;
}

.faq-body {
    white-space: pre-line;
    line-height: 1.75;
}

.faq-filter {
    position: sticky;
    top: 1rem;
}

.faq-empty {
    padding: 4rem 1rem;
    text-align: center;
    color: #728197;
}

.tag-search {
    padding: .25rem 0;
}

.tag-selected {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.tag-chip {
    border: 0;
    background: #e7f2ff;
    color: #0759a4;
    border-radius: 999px;
    padding: .32rem .65rem;
    font-size: .82rem;
    font-weight: 600;
}

.tag-result {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid #e2eaf3;
    background: #fff;
    border-radius: 8px;
    padding: .55rem .75rem;
    margin-bottom: .35rem;
    color: #34465a;
}

.tag-result:hover {
    background: #eef6ff;
    border-color: #8ebae8;
    color: #0759a4;
}

.faq-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 160px));
    gap: 14px;
    margin-top: 1.5rem;
}

.faq-gallery figure {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e3ebf4;
    background: #fff;
}

.faq-gallery img {
    width: 160px;
    height: 160px;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    transition: transform .2s;
}

.faq-gallery figure:hover img {
    transform: scale(1.05);
}

.faq-gallery figcaption {
    padding: .55rem .7rem;
    font-size: .75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.faq-image-input {
    border: 1px dashed #9fc5ed;
    border-radius: 12px;
    padding: 1rem;
    background: #f7fbff;
}

.faq-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(4, 18, 35, .91);
    display: grid;
    place-items: center;
    padding: 2rem;
}

.faq-lightbox img {
    max-width: min(100%, 1100px);
    max-height: 78vh;
    border-radius: 12px;
    box-shadow: 0 18px 55px #000;
}

.faq-lightbox button {
    position: absolute;
    border: 0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    background: #fff;
    color: #0b3564;
    font-size: 1.5rem;
}

.faq-lightbox .close {
    top: 22px;
    right: 22px;
}

.faq-lightbox .prev {
    left: 22px;
    top: 50%;
}

.faq-lightbox .next {
    right: 22px;
    top: 50%;
}

.faq-lightbox p {
    color: #fff;
    margin: .8rem 0 0;
    text-align: center;
}

.faq-filter-search {
    margin: .7rem 0 1rem;
}

.faq-filter a[data-hidden="true"] {
    display: none !important;
}

.required:after {
    content: ' *';
    color: #dc3545;
}

.ts-control {
    border-radius: 9px !important;
    border-color: #d9e2ec !important;
}

.import-card {
    max-width: 760px;
    margin: auto;
}

.import-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    background: #e8f3ff;
    color: #1264ad;
    border-radius: 16px;
    font-size: 1.8rem;
}

.import-drop {
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 2px dashed #9ec7ed;
    border-radius: 14px;
    padding: 1.35rem;
    cursor: pointer;
    background: #f8fbff;
}

.import-drop input {
    max-width: 220px;
}

.import-drop small {
    display: block;
    color: #6a7e91;
    margin-top: .2rem;
}

/* EQUIPAMENTOS & CHAMADOS */
.equipment-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    height: 100%;
    transition: .2s;
}

.equipment-card:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
    transform: translateY(-2px);
}

.equipment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.equipment-header i {
    font-size: 28px;
    color: #2563eb;
}

.equipment-name {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.equipment-model {
    font-size: 13px;
    color: #64748b;
}

.equipment-body {
    display: grid;
    gap: 12px;
}

.equipment-body div {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
}

.equipment-body span {
    display: block;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
}

.equipment-body strong {
    display: block;
    color: #1e293b;
    margin-top: 4px;
}

.equipment-small {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.equipment-small .equipment-name {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 10px;
}

.equipment-small .equipment-name i {
    color: #2563eb;
    margin-right: 6px;
}

.equipment-line {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding-top: 5px;
}

.equipment-line span {
    color: #64748b;
}

.equipment-line strong {
    color: #1e293b;
}

.problem-box,
.problem {
    background: #f8fafc;
    border-left: 4px solid #2563eb;
    padding: 18px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    color: #334155;
}

.tags-container,
.tag-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modern-tag,
.ticket-tag {
    padding: 7px 14px;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

/* TIMELINE */
.timeline {
    position: relative;
    padding-left: 25px;
    border-left: 2px solid #dbe8f7;
    margin-left: .45rem;
}

.timeline:before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 15px;
    padding-bottom: 1.2rem;
}

.timeline-item:before {
    content: '';
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #1565c0;
    left: -1.77rem;
    top: .32rem;
    box-shadow: 0 0 0 4px #eaf3ff;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #bfdbfe;
}

.timeline-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

.timeline-top {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.timeline-top span {
    color: #64748b;
    font-size: 12px;
}

.timeline-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #2563eb;
    margin-top: 5px;
}

.timeline-text {
    font-size: 13px;
    color: #334155;
    margin-top: 8px;
}


/* ==========================================================================
   SUPORTE COMPLETO AO MODO ESCURO (THEME-DARK)
   ========================================================================== */

.theme-dark {
    --soft: #101923;
    --ink: #e7eef7;
    background: #101923;
    color: #e7eef7;
}

.theme-dark .card,
.theme-dark .card-header,
.theme-dark .card-footer,
.theme-dark .table {
    background: #162231;
    color: #e7eef7;
    border-color: #283a4c;
}

.theme-dark .text-muted,
.theme-dark .table>thead th {
    color: #a8b7c8 !important;
}

.theme-dark .form-control,
.theme-dark .form-select {
    background: #0f1a26;
    color: #e7eef7;
    border-color: #34485d;
}

.theme-dark .table-hover tbody tr:hover {
    background: #1e3042;
}

.theme-dark .bg-light {
    background: #1b2a3b !important;
    color: #e7eef7;
}

.theme-dark .theme-choice input:checked+span {
    background: #1d3450;
}

.theme-dark .profile-summary {
    background: linear-gradient(140deg, #1a2b3d, #142235);
}

.theme-dark .faq-title {
    color: #eaf4ff;
}

.theme-dark .faq-title:hover,
.theme-dark a:not(.app-links a):not(.btn) {
    color: #67b6ff;
}

.theme-dark .faq-card {
    background: #162231;
}

.theme-dark .faq-card p {
    color: #c1d0df !important;
}

.theme-dark .faq-hero .form-control {
    background: #fff;
    color: #172536;
    border-color: #fff;
}

.theme-dark .faq-hero .form-control::placeholder {
    color: #6d7c8e;
    opacity: 1;
}

.theme-dark .faq-filter a {
    color: #8ecbff;
}

.theme-dark .faq-filter .form-control {
    background: #101d2b;
    color: #eef6ff;
}

.theme-dark .faq-filter .form-control::placeholder {
    color: #8296aa;
}

.theme-dark .faq-icon {
    background: #dceeff;
    color: #1262aa;
}

.theme-dark .badge {
    filter: saturate(.9) brightness(1.12);
}

.theme-dark .pagination .page-link {
    background: #162231;
    border-color: #34485d;
    color: #9ed3ff;
}

.theme-dark .pagination .active .page-link {
    background: #1565c0;
    color: #fff;
}

.theme-dark .dropdown-menu {
    background: #1b2a3b;
    border-color: #34485d;
}

.theme-dark .dropdown-item {
    color: #e8f1fa;
}

.theme-dark .dropdown-item:hover {
    background: #29425c;
    color: #fff;
}

.theme-dark .dropdown-divider {
    border-color: #364a5f;
}

.theme-dark .alert-info {
    background: #153b59;
    border-color: #205a84;
    color: #d8efff;
}

.theme-dark .alert {
    color: #ecf5ff;
}

.theme-dark .tag-result {
    background: #1b2a3b;
    color: #e7f1fb;
    border-color: #38516a;
}

.theme-dark .tag-result:hover {
    background: #25425e;
    color: #fff;
}

.theme-dark .tag-chip {
    background: #254b70;
    color: #dcefff;
}

.theme-dark .faq-gallery figure {
    background: #1b2a3b;
    border-color: #34506b;
}

.theme-dark .faq-gallery figcaption {
    color: #b7c9da;
}

.theme-dark .metric:after {
    background: rgba(93, 177, 255, .12);
}

.theme-dark .dashboard-hero,
.theme-dark .faq-hero {
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}

.theme-dark .btn-outline-secondary {
    border-color: #667f97;
    color: #d8e6f5;
}

.theme-dark .btn-outline-secondary:hover {
    background: #314b64;
    color: #fff;
}

.theme-dark textarea.form-control,
.theme-dark input.form-control,
.theme-dark select.form-select {
    background: #142231 !important;
    color: #edf6ff !important;
    border-color: #38516a !important;
}

.theme-dark input.form-control::placeholder,
.theme-dark textarea.form-control::placeholder {
    color: #91a5ba !important;
    opacity: 1;
}

.theme-dark input:-webkit-autofill,
.theme-dark input:-webkit-autofill:hover,
.theme-dark input:-webkit-autofill:focus {
    -webkit-text-fill-color: #edf6ff !important;
    -webkit-box-shadow: 0 0 0 1000px #142231 inset !important;
}

/* COMPONENTES DE SELEÇÃO E BUSCA */
.theme-dark .ts-control,
.theme-dark .ts-wrapper.multi .ts-control {
    background: #142231 !important;
    border-color: #38516a !important;
    color: #edf6ff !important;
}

.theme-dark .ts-control input,
.theme-dark .ts-control>input {
    color: #edf6ff !important;
}

.theme-dark .ts-dropdown {
    background: #1b2a3b !important;
    border-color: #38516a !important;
    color: #edf6ff !important;
}

.theme-dark .ts-dropdown .option {
    color: #edf6ff !important;
}

.theme-dark .ts-dropdown .active {
    background: #29445f !important;
}

.theme-dark .ts-wrapper.multi .ts-control>div {
    background: #27557e !important;
    color: #f2f8ff !important;
}

.theme-dark .import-drop {
    background: #142231;
    border-color: #3f739e;
}

.theme-dark .import-drop small {
    color: #aabccc;
}

.theme-dark .alert-light {
    background: #1b2a3b;
    color: #dbe9f5;
    border-color: #38516a;
}

/* MODO ESCURO COMPLEMENTAR PARA EQUIPAMENTOS, TIMELINE E PROBLEMAS */
.theme-dark .equipment-card,
.theme-dark .equipment-small {
    background: #162231;
    border-color: #283a4c;
}

.theme-dark .equipment-name,
.theme-dark .equipment-body strong,
.theme-dark .equipment-line strong {
    color: #e7eef7;
}

.theme-dark .equipment-model,
.theme-dark .equipment-body span,
.theme-dark .equipment-line span,
.theme-dark .timeline-top span {
    color: #94a3b8;
}

.theme-dark .equipment-body div,
.theme-dark .problem-box,
.theme-dark .problem,
.theme-dark .timeline-box {
    background: #101d2b;
    border-color: #283a4c;
    color: #cbd5e1;
}

.theme-dark .timeline:before {
    background: #283a4c;
}

.theme-dark .timeline-marker {
    border-color: #162231;
    box-shadow: 0 0 0 2px #1d4ed8;
}

.theme-dark .timeline-text {
    color: #cbd5e1;
}