@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-primary-dark: #2456a8;
    --app-sidebar: #12161f;
    --app-sidebar-hover: rgba(255, 255, 255, 0.06);
    --app-sidebar-active-text: #fff;
    --app-sidebar-active-bg: linear-gradient(135deg, #3b82f6 0%, #2456a8 100%);
    --app-topbar: #ffffff;
    --app-bg: #f4f6fb;
    --app-card-border: #e8ecf5;
    --app-text: #2b2f45;
    --app-muted: #8a93ab;
    --app-shadow: 0 2px 6px rgba(20, 40, 80, 0.05), 0 1px 2px rgba(20, 40, 80, 0.03);
    --app-shadow-lg: 0 12px 40px rgba(20, 40, 80, 0.13);
    --app-radius: 18px;
    --app-radius-sm: 12px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    background: var(--app-bg);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c9cfe0; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- TOPBAR ---------- */
.app-navbar {
    background: var(--app-topbar);
    backdrop-filter: blur(12px);
    min-height: 68px;
    border-bottom: 1px solid var(--app-card-border);
    box-shadow: var(--app-shadow);
    padding-top: 0;
}
.navbar-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.2rem; color: var(--app-text); }
.brand-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(59,130,246,.35);
}
.navbar-brand .brand-logo { height: 40px; max-width: 180px; object-fit: contain; }
.navbar-brand .brand-name { letter-spacing: -0.02em; white-space: nowrap; }
.company-badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--bs-primary);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
}
.global-search { max-width: 300px; }

/* ---------- SIDEBAR ---------- */
.app-sidebar-wrapper {
    position: fixed;
    top: 68px;
    bottom: 0;
    left: 0;
    width: 250px;
    overflow-y: auto;
    background: linear-gradient(180deg, #151a24 0%, #10141d 100%);
    z-index: 1020;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.app-sidebar-wrapper::-webkit-scrollbar { width: 6px; }
.app-sidebar-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.app-sidebar-inner { min-height: 100%; }

.app-nav { min-height: 100%; padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.app-nav-section {
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 800;
    padding: 8px 10px 3px;
}
.app-nav-section-toggle {
    cursor: pointer;
    user-select: none;
    padding: 10px 10px 3px;
    transition: color 0.14s;
}
.app-nav-section-toggle:hover { color: rgba(255,255,255,0.7); }
.app-nav-section-toggle .section-caret {
    font-size: 0.7rem;
    transition: transform 0.18s;
    opacity: 0.6;
}
.app-nav-section-toggle.open .section-caret { transform: rotate(90deg); }
.app-nav-items { display: none; }
.app-nav-items.open { display: block; }
.app-nav-link {
    color: rgba(255, 255, 255, 0.72) !important;
    border-radius: 8px;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 9px;
    display: flex;
    align-items: center;
    gap: 9px;
    line-height: 1.2;
    transition: background 0.14s, color 0.14s;
}
.app-nav-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; color: rgba(255, 255, 255, 0.5); }
.app-nav-link:hover { color: #fff !important; background: var(--app-sidebar-hover); }
.app-nav-link:hover i { color: #fff; }
.app-nav-link.active,
.app-nav-link.active i { color: #fff !important; }
.app-nav-link.active { background: var(--app-sidebar-active-bg); box-shadow: 0 5px 16px rgba(59, 130, 246, 0.4); }
.app-nav-link .badge { margin-left: auto; }

.app-sidebar-offcanvas { background: linear-gradient(180deg, #151a24 0%, #10141d 100%); }
.app-sidebar-offcanvas .app-nav-link { color: rgba(255,255,255,.72) !important; }
.app-sidebar-offcanvas .app-nav-section { color: rgba(255,255,255,.4) !important; }

.app-nav-footer { color: rgba(255,255,255,.32); font-size: .75rem; padding: 20px 12px 8px; margin-top: auto; }

/* ---------- MAIN ---------- */
.app-main { margin-left: 250px; min-height: calc(100vh - 68px); padding-bottom: 40px; }
.app-body { padding-top: 68px; }
.app-footer {
    margin-left: 268px;
    padding: 16px 0;
    border-top: 1px solid var(--app-card-border);
    background: #fff;
}

@media (max-width: 991.98px) {
    .app-main, .app-footer { margin-left: 0; }
    .app-sidebar-wrapper { display: none; }
}

/* ---------- PAGE HEADER ---------- */
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 24px; }
.page-header h4 { margin: 0; font-weight: 800; letter-spacing: -0.02em; font-size: 1.5rem; }
.page-header .subtitle { color: var(--app-muted); font-size: 0.9rem; margin-top: 3px; }

/* ---------- CARDS ---------- */
.app-card {
    border: 1px solid var(--app-card-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    background: #fff;
}
.app-card-hover:hover { box-shadow: var(--app-shadow-lg); transform: translateY(-3px); }
.app-card .card-header {
    background: #fff;
    border-bottom: 1px solid var(--app-card-border);
    border-radius: var(--app-radius) var(--app-radius) 0 0 !important;
    padding: 16px 20px;
}
.app-card .card-body { padding: 20px; }
.app-card .card-body.p-0 .table th:first-child { padding-left: 20px; }
.app-card .card-body.p-0 .table td:first-child { padding-left: 20px; }

/* ---------- STAT CARDS ---------- */
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,.08), transparent 70%);
}
.stat-card .stat-icon {
    width: 54px; height: 54px;
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.stat-card .stat-label { color: var(--app-muted); font-size: 0.82rem; font-weight: 600; margin-top: 3px; }

/* ---------- SOFT COLORS ---------- */
.bg-primary-soft { background: rgba(59,130,246,.12) !important; color: #2d7be4 !important; }
.bg-success-soft { background: rgba(40,167,69,.13) !important; color: #1f9d50 !important; }
.bg-info-soft    { background: rgba(23,162,184,.13) !important; color: #0e9aab !important; }
.bg-warning-soft { background: rgba(255,193,7,.18) !important; color: #b57e00 !important; }
.bg-danger-soft  { background: rgba(220,53,69,.12) !important; color: #d9233a !important; }
.bg-secondary-soft { background: rgba(108,117,125,.13) !important; color: #5b6370 !important; }
.bg-dark-soft    { background: rgba(52,58,64,.13) !important; color: #343a40 !important; }
.bg-gradient-primary { background: var(--app-sidebar-active-bg); }

.text-primary { color: var(--bs-primary) !important; }

/* ---------- BOTÕES ---------- */
.btn { border-radius: 11px; font-weight: 600; font-size: 0.92rem; padding: 0.5rem 1rem; }
.btn-sm { border-radius: 9px; padding: 0.38rem 0.75rem; font-size: 0.82rem; }
.btn-lg { border-radius: 13px; }
.btn-gradient {
    background: linear-gradient(135deg, #3b82f6, #2456a8) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 5px 16px rgba(59,130,246,.35);
}
.btn-gradient:hover { filter: brightness(1.07); color: #fff !important; }
.btn-primary {
    --bs-btn-bg: #3b82f6;
    --bs-btn-border-color: #3b82f6;
    --bs-btn-hover-bg: #2d6fd9;
    --bs-btn-hover-border-color: #2d6fd9;
    --bs-btn-active-bg: #2456a8;
    --bs-btn-active-border-color: #2456a8;
}
.btn-outline-primary {
    --bs-btn-color: #3b82f6;
    --bs-btn-border-color: #3b82f6;
    --bs-btn-hover-bg: #3b82f6;
    --bs-btn-hover-border-color: #3b82f6;
}

/* ---------- FORM ---------- */
.form-control, .form-select {
    border-radius: 0.6rem;
    border: 1px solid #dfe4f0;
    font-size: 0.94rem;
    padding: 0.55rem 0.85rem;
    background-color: #fbfcfe;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
    height: auto;
    min-height: 44px;
}
.form-control:hover, .form-select:hover { border-color: #c3cde0; background-color: #fff; }
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    background-color: #fff;
    box-shadow: 0 0 0 0.22rem rgba(59,130,246,.12);
}
.form-control:disabled, .form-select:disabled { background-color: #eef1f7; opacity: .9; }
.form-control.is-invalid, .form-select.is-invalid { border-color: #dc3545; box-shadow: 0 0 0 .22rem rgba(220,53,69,.1); }
.form-label { font-weight: 700; font-size: 0.85rem; color: #454b6b; margin-bottom: 6px; }
.form-control-sm, .form-select-sm { border-radius: 0.5rem; min-height: 38px; padding: 0.4rem 0.7rem; font-size: 0.88rem; }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(59,130,246,.15); }
.form-check-input:checked { background-color: #3b82f6; border-color: #3b82f6; }
.form-check-input[type="color"] { border: 1px solid #dfe4f0; border-radius: .45rem; padding: 2px; min-height: 38px; }
.input-group-text { border-radius: 0.6rem 0 0 0.6rem; background: #f3f5fa; border: 1px solid #dfe4f0; color: #6b7488; }
.input-group .form-control { border-radius: 0 0.6rem 0.6rem 0; }
/* busca global */
.global-search { background-color: #f3f5fa; border: 1px solid #e6eaf2; border-radius: 30px; }
.global-search:focus { background-color: #fff; border-radius: 30px; }

/* ---------- TABELAS ---------- */
.table { --bs-table-hover-bg: rgba(59,130,246,.05); }
.table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted);
    font-weight: 800;
    border-bottom-width: 1px;
    padding: 13px 16px;
    white-space: nowrap;
}
.table tbody td { padding: 13px 16px; vertical-align: middle; }
.table-light, .table-light td, .table-light th { background-color: #f7f8fd !important; }

/* ---------- BADGES ---------- */
.badge { font-weight: 700; border-radius: 7px; padding: 5px 10px; font-size: 0.75rem; }
.badge.bg-soft-primary { background: rgba(59,130,246,.13) !important; color: #2d7be4 !important; }
.badge.bg-soft-success { background: rgba(40,167,69,.15) !important; color: #1f9d50 !important; }
.badge.bg-soft-danger  { background: rgba(220,53,69,.13) !important; color: #d9233a !important; }
.badge.bg-soft-warning { background: rgba(255,193,7,.2) !important; color: #b57e00 !important; }
.badge.bg-soft-info    { background: rgba(23,162,184,.15) !important; color: #0e9aab !important; }
.badge.bg-soft-secondary { background: rgba(108,117,125,.15) !important; color: #5b6370 !important; }
.badge.bg-soft-dark    { background: rgba(52,58,64,.15) !important; color: #343a40 !important; }

/* ---------- NAV PILLS / TABS ---------- */
.nav-pills .nav-link { border-radius: 10px; font-weight: 700; font-size: 0.86rem; color: var(--app-muted); padding: 8px 18px; }
.nav-pills .nav-link.active { background: var(--app-sidebar-active-bg); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.nav-tabs .nav-link { color: var(--app-muted); font-weight: 700; }
.nav-tabs .nav-link.active { color: var(--bs-primary); }

/* ---------- ALERTS ---------- */
.alert { border-radius: 13px; border: 0; }
.alert-success { background: rgba(40,167,69,.1); color: #1a8743; }
.alert-danger  { background: rgba(220,53,69,.09); color: #c81f35; }
.alert-warning { background: rgba(255,193,7,.15); color: #a26b00; }
.alert-info    { background: rgba(23,162,184,.12); color: #0c8698; }

/* ---------- LISTAS ---------- */
.list-group-item { border-color: var(--app-card-border); }

/* ---------- TIMELINE ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: linear-gradient(180deg, #d7ddef, #eef1f8);
}
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bs-primary);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px rgba(59,130,246,.25);
}
.timeline-date { font-size: .75rem; font-weight: 700; color: var(--app-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- KANBAN ---------- */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col {
    min-width: 250px;
    max-width: 280px;
    flex: 1;
    background: #eef1f8;
    border-radius: 14px;
    padding: 10px;
    max-height: 80vh;
    overflow-y: auto;
}
.kanban-col-header { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.kanban-col-header .count { background: #fff; border-radius: 30px; padding: 1px 9px; font-size: .75rem; color: var(--app-muted); }
.kanban-card {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: var(--app-shadow);
    cursor: grab;
    border-left: 4px solid var(--bs-primary);
}
.kanban-card:hover { box-shadow: var(--app-shadow-lg); }
.kanban-card .k-title { font-weight: 700; }
.kanban-card .k-sub { font-size: .8rem; color: var(--app-muted); }
.kanban-card.dragging { opacity: .45; transform: rotate(2deg); }
.kanban-col-body { min-height: 40px; }
.kanban-col.drop-over { outline: 2px dashed var(--bs-primary); background: rgba(59,130,246,.06); }
.kanban-col.drop-over .kanban-col-body { outline: none; }

/* ---------- EMPTY STATE ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--app-muted); }
.empty-state i { font-size: 3rem; opacity: .4; display: block; margin-bottom: 12px; }

/* ---------- LOGIN ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(900px 500px at 15% 10%, rgba(59,130,246,.5) 0%, transparent 55%),
        radial-gradient(800px 600px at 85% 90%, rgba(36,86,168,.5) 0%, transparent 55%),
        #10141d;
    padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; text-align: center; }
.login-brand { margin-bottom: 28px; }
.login-logo {
    width: 76px; height: 76px;
    border-radius: 22px;
    background: linear-gradient(135deg, #3b82f6, #2456a8);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2.4rem;
    box-shadow: 0 12px 30px rgba(59,130,246,.4);
    margin-bottom: 14px;
}
.login-brand h1 { color: #fff; font-weight: 800; letter-spacing: -0.03em; font-size: 1.9rem; margin: 0; }
.login-brand p { font-size: .9rem; margin-top: 4px; }
.login-card {
    background: #fff;
    border: 0;
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(0,0,0,.5);
    padding: 32px 30px;
    text-align: left;
}
.login-wrap .btn-primary { width: 100%; padding: .7rem; font-size: 1rem; border-radius: 12px; }
.login-foot { margin-top: 22px; font-size: .8rem; }

/* ---------- MISC ---------- */
.text-muted { color: var(--app-muted) !important; }
h1,h2,h3,h4,h5,h6 { letter-spacing: -0.02em; }
code { background: #f1f1f6; border-radius: 6px; padding: 2px 6px; font-size: .85em; }
.dropdown-menu { border-radius: 13px; box-shadow: var(--app-shadow-lg); border-color: var(--app-card-border); padding: 8px; }
.dropdown-item { border-radius: 8px; padding: 9px 12px; font-weight: 500; font-size: 0.9rem; }
.dropdown-item:hover, .dropdown-item:focus { background: rgba(59,130,246,.08); }
.modal-content { border: 0; border-radius: var(--app-radius); box-shadow: var(--app-shadow-lg); }

/* ---------- RESPONSIVO (mobile) ---------- */
@media (max-width: 575.98px) {
    .page-header h4 { font-size: 1.2rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
}