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

/* =====================================================================
   SISTEMA PIPA — Refined Design System
   Brand: #0a3a62 · #45ba6b · #19a6b8
   ===================================================================== */

:root {
    --brand:       #0a3a62;
    --brand-dark:  #072c4c;
    --brand-deep:  #051e34;
    --brand-light: #0d4a7d;
    --green:       #45ba6b;
    --green-dark:  #3aa35d;
    --teal:        #19a6b8;
    --teal-dark:   #138d9c;

    --white:    #ffffff;
    --gray-50:  #f8fafb;
    --gray-100: #f1f4f8;
    --gray-150: #e8ecf1;
    --gray-200: #dce1e8;
    --gray-300: #c4cbd6;
    --gray-400: #8d97a5;
    --gray-500: #6b7687;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #0d1117;

    --status-warn:    #e6a817;
    --status-warn-bg: #fdf8ec;
    --status-warn-tx: #7c5700;
    --status-info:    var(--teal);
    --status-info-bg: #edf8fa;
    --status-info-tx: #0b7d8c;
    --status-ok:      var(--green);
    --status-ok-bg:   #eef8f1;
    --status-ok-tx:   #1d6b37;
    --status-err:     #d14150;
    --status-err-bg:  #fdf0f1;
    --status-err-tx:  #8c1823;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-pill: 100px;
    --ease: cubic-bezier(.16,1,.3,1);
}

/* === RESET === */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
::selection { background: rgba(25,166,184,.15); color: var(--brand); }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1,h2,h3,h4,h5,h6 {
    font-weight: 700;
    letter-spacing: -.025em;
    color: var(--gray-900);
    margin-bottom: .5rem;
    line-height: 1.3;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: none; border-top: 1px solid var(--gray-150); margin: 20px 0; }
small { font-size: 13px; }
strong { font-weight: 600; }

/* === ANIMATION === */
@keyframes enter { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

/* =============== NAVBAR =============== */
.navbar {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(10,58,98,.3);
    border: none;
}

.navbar .container-fluid {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    color: #fff !important;
}

.navbar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.navbar-brand-title { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: .02em; }
.navbar-brand-subtitle { font-size: 11px; font-weight: 600; color: var(--teal); }

.navbar-collapse {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.navbar-nav.me-auto { margin-right: auto; margin-left: 32px; }
.nav-item { list-style: none; }

.nav-link {
    color: rgba(255,255,255,.7) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-link:hover { 
    color: #fff !important; 
    background: rgba(255,255,255,.1); 
}
.nav-link.active { 
    color: #fff !important; 
    background: var(--teal); 
    box-shadow: 0 2px 10px rgba(25,166,184,.4);
}

.navbar-toggler {
    display: none;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    font-size: 1rem;
    transition: background .15s ease;
}
.navbar-toggler:hover { background: rgba(255,255,255,.2); }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-toggle::after { content: ' ▾'; font-size: .6rem; opacity: .7; }
.dropdown-menu {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--white); border: 2px solid var(--teal);
    border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(0,0,0,.15);
    padding: 6px; min-width: 180px; z-index: 1000;
}
.dropdown-menu.show { display: block; animation: enter .15s var(--ease); }
.dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; color: var(--gray-700);
    border-radius: 6px; transition: all .1s; font-weight: 600; font-size: 13px;
    text-decoration: none !important;
}
.dropdown-item:hover { background: var(--teal); color: #fff; }
.dropdown-divider { height: 1px; background: var(--gray-150); margin: 4px 0; border: none; }

/* =============== LAYOUT =============== */
.container-fluid {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px;
}

/* =============== CARDS =============== */
.card {
    background: var(--white);
    border: none;
    border-radius: var(--r-md);
    margin-bottom: 16px;
    overflow: hidden;
    
    box-shadow: 0 4px 12px rgba(10,58,98,.06);
}

.card-header {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 700;
    color: var(--brand);
    border-bottom: 2px solid var(--gray-100);
    background: var(--white);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.card-header i { color: var(--teal); font-size: 16px; }
.card-header.bg-light   { background: var(--gray-50); }
.card-header.bg-info    { background: var(--status-info-bg); color: var(--status-info-tx); border-color: rgba(25,166,184,.12); }
.card-header.bg-warning { background: var(--status-warn-bg); color: var(--status-warn-tx); border-color: rgba(230,168,23,.12); }
.card-header.bg-danger  { background: var(--status-err-bg); color: var(--status-err-tx); border-color: rgba(209,65,80,.12); }
.card-header.text-white { color: inherit; }
.card-header.text-dark  { color: var(--gray-900); }

.card-body { padding: 16px; }
.border-danger { border-color: rgba(209,65,80,.2) !important; }

/* =============== STAT CARDS =============== */
.stats-card {
    background: var(--white);
    border: none;
    border-radius: var(--r-md);
    transition: transform .25s ease, box-shadow .25s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(10,58,98,.08);
}

/* Colored Bottom accent strip */
.stats-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: var(--brand);
}
.stats-card.warning::after { background: var(--status-warn); }
.stats-card.success::after { background: var(--green); }
.stats-card.info::after    { background: var(--teal); }

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(10,58,98,.12);
}

.stats-card .card-body { padding: 24px; }

.stats-card h6 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--brand);
    margin-bottom: 8px;
}
.stats-card h2 {
    font-size: 36px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -.03em;
    line-height: 1;
    margin: 0;
}

/* =============== TABLES =============== */
.table-responsive { overflow-x: auto; width: 100%; }

.table { width: 100%; border-collapse: collapse; }

.table thead th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
    background: var(--brand-light);
    text-transform: uppercase;
    letter-spacing: .05em;
    border: none;
    text-align: left;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    font-weight: 500;
}

.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

.selectable-row { cursor: pointer; }
.selectable-row.selected { background: rgba(25,166,184,.05) !important; }
.selectable-row.hidden { display: none; }

/* =============== BADGES =============== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}
.badge-warning, .bg-warning { background: var(--status-warn-bg) !important; color: var(--status-warn-tx) !important; }
.badge-info,    .bg-info    { background: var(--status-info-bg) !important; color: var(--status-info-tx) !important; }
.badge-success, .bg-success { background: var(--status-ok-bg) !important;  color: var(--status-ok-tx) !important; }
.badge-danger,  .bg-danger:not(.card-header) { background: var(--status-err-bg) !important; color: var(--status-err-tx) !important; }
.bg-primary    { background: var(--brand) !important; color: #fff !important; border-radius: 4px; }
.bg-secondary  { background: var(--gray-100) !important; color: var(--gray-500) !important; }
.bg-light      { background: var(--gray-100) !important; }
.text-dark     { color: var(--gray-800) !important; }
.text-white    { color: #fff !important; }

/* =============== BUTTONS =============== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none !important;
    white-space: nowrap;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.btn:active { transform: scale(.97); }

.btn-primary { 
    background: var(--teal); 
    color: #fff; 
    box-shadow: 0 4px 12px rgba(25,166,184,.3);
}
.btn-primary:hover { 
    background: var(--teal-dark); 
    box-shadow: 0 6px 16px rgba(25,166,184,.4);
    transform: translateY(-2px);
}

.btn-secondary { background: var(--gray-150); color: var(--brand); font-weight: 700; }
.btn-secondary:hover { background: var(--gray-200); color: var(--brand-dark); }

.btn-success { background: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(69,186,107,.3); }
.btn-success:hover { background: var(--green-dark); transform: translateY(-2px); }

.btn-info { background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(25,166,184,.3); }
.btn-info:hover { background: var(--teal-dark); transform: translateY(-2px); }

.btn-danger { background: var(--status-err); color: #fff; box-shadow: 0 4px 12px rgba(209,65,80,.3); }
.btn-danger:hover { background: #b83542; transform: translateY(-2px); }

.btn-outline-primary {
    background: transparent; color: var(--brand); border: 2px solid var(--brand);
}
.btn-outline-primary:hover { background: var(--brand); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 6px; }

/* =============== FORMS =============== */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--gray-700);
}

.form-control, .form-select, textarea.form-control {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-800);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control::placeholder { color: var(--gray-300); }
.form-control:focus, .form-select:focus, textarea.form-control:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(25,166,184,.1);
}
.form-check-input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--teal); }
.form-check-label { cursor: pointer; font-weight: 500; }

.input-group { display: flex; }
.input-group .form-control { border-radius: 0 6px 6px 0; }
.input-group-text {
    display: flex; align-items: center; padding: 0 10px;
    background: var(--gray-50); border: 1px solid var(--gray-200); border-right: none;
    border-radius: 6px 0 0 6px; color: var(--gray-400); font-size: 13px;
}

/* =============== ALERTS =============== */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    border-left: 3px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: enter .2s var(--ease);
}
.alert-success { background: var(--status-ok-bg);   color: var(--status-ok-tx);   border-left-color: var(--green); }
.alert-danger  { background: var(--status-err-bg);  color: var(--status-err-tx);  border-left-color: var(--status-err); }
.alert-warning { background: var(--status-warn-bg); color: var(--status-warn-tx); border-left-color: var(--status-warn); }
.alert-info    { background: var(--status-info-bg); color: var(--status-info-tx); border-left-color: var(--teal); }

.alert-dismissible .btn-close {
    position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
    background: none; border: none; font-size: 0; cursor: pointer;
    color: inherit; opacity: .35; padding: 2px; line-height: 1;
    width: 18px; height: 18px;
}
.alert-dismissible .btn-close::after { content: '✕'; font-size: 12px; }
.alert-dismissible .btn-close:hover { opacity: .7; }

/* =============== LOGIN =============== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-deep);
    background-image:
        radial-gradient(ellipse at 20% 80%, rgba(25,166,184,.3) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(69,186,107,.25) 0%, transparent 60%);
}
.login-card {
    max-width: 420px;
    width: 100%;
    position: relative;
    z-index: 10;
    animation: enter .5s var(--ease);
}
.login-card .card {
    border: none;
    box-shadow: 0 24px 60px rgba(0,0,0,.4);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}
.login-logo {
    max-width: 200px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.p-5 { padding: 32px; }

/* =============== TIMELINE =============== */
.timeline .mb-3.pb-3.border-bottom {
    padding-left: 14px;
    position: relative;
}
.timeline .mb-3.pb-3.border-bottom::before {
    content: '';
    position: absolute;
    left: 0; top: 7px;
    width: 5px; height: 5px;
    background: var(--teal);
    border-radius: 50%;
}

/* =============== GRID =============== */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.col, .col-12 { padding: 0 8px; width: 100%; }
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { padding: 0 8px; width: 100%; }

@media (min-width: 768px) {
    .col-md-3 { width: 25%; }
    .col-md-4 { width: 33.333%; }
    .col-md-5 { width: 41.667%; }
    .col-md-6 { width: 50%; }
    .col-md-8 { width: 66.667%; }
    .col-md-9 { width: 75%; }
    .col-md-10 { width: 83.333%; }
    .col-md-11 { width: 91.667%; }
    .col-md-12 { width: 100%; }
}

/* =============== UTILITIES =============== */
.text-muted   { color: var(--gray-400) !important; }
.text-warning { color: var(--status-warn) !important; }
.text-info    { color: var(--teal) !important; }
.text-success { color: var(--green) !important; }
.text-danger  { color: var(--status-err) !important; }
.text-center  { text-align: center; }

.mb-2{margin-bottom:6px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:16px}
.mt-2{margin-top:6px} .mt-3{margin-top:12px} .mt-4{margin-top:16px}
.me-1{margin-right:4px} .me-2{margin-right:6px}
.ms-2{margin-left:6px} .ms-3{margin-left:12px}
.pb-3{padding-bottom:12px} .py-2{padding-top:6px;padding-bottom:6px}
.g-3>*{margin-bottom:10px}

.d-flex{display:flex} .flex-wrap{flex-wrap:wrap} .flex-row{flex-direction:row}
.justify-content-between{justify-content:space-between}
.justify-content-center{justify-content:center}
.align-items-center{align-items:center}
.align-items-end{align-items:flex-end}
.gap-2{gap:6px}
.w-100{width:100%}
.border-bottom{border-bottom:1px solid var(--gray-150)}
.opacity-75{opacity:.75}
.fade.show{animation:fadeIn .2s ease}

/* =============== RESPONSIVE =============== */
@media(max-width:991px){
    .navbar-toggler{display:block}
    .navbar-collapse,.collapse.navbar-collapse{
        display:none;flex-direction:column;width:100%;
        margin-top:8px;background:var(--white);
        padding:12px;border-radius:12px;
        box-shadow: 0 4px 16px rgba(0,0,0,.08);
        border: 1px solid var(--gray-200);
    }
    .navbar-collapse.show,.collapse.navbar-collapse.show{display:flex}
    .navbar-nav{flex-direction:column;width:100%;gap:1px}
    .navbar-nav.me-auto{margin-left:0}
    .nav-link{width:100%;text-align:left}
    .dropdown-menu{position:static;box-shadow:none;background:transparent;border:none}
    .dropdown-item{color:var(--gray-700)}
    .dropdown-item:hover{background:var(--gray-50);color:var(--brand)}
}
@media(max-width:768px){
    .container-fluid{padding:14px 10px}
    .card-body{padding:12px}
    .card-header{padding:10px 12px;font-size:12px}
    h2{font-size:18px}
    .stats-card h2{font-size:24px}
    .d-flex.gap-2{flex-direction:column;width:100%}
    .d-flex.gap-2 .btn{width:100%}
}
@media(max-width:576px){
    .login-container{padding:10px}
    .login-logo{max-width:140px}
    .col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-8{width:100%!important}
}

/* =============== ICONS =============== */
.fa-home::before,.fas.fa-home::before{content:'🏠 '}
.fa-list::before,.fas.fa-list::before{content:'📋 '}
.fa-users::before,.fas.fa-users::before{content:'👥 '}
.fa-plug::before{content:'🔌 '}
.fa-user-circle::before,.fas.fa-user-circle::before{content:'👤 '}
.fa-user::before,.fas.fa-user::before{content:'👤 '}
.fa-user-plus::before{content:'➕ '}
.fa-sign-out-alt::before{content:'🚪 '}
.fa-tachometer-alt::before{content:'📊 '}
.fa-clock::before,.fas.fa-clock::before{content:'⏱ '}
.fa-hourglass-half::before{content:'⌛ '}
.fa-check-circle::before,.fas.fa-check-circle::before{content:'✅ '}
.fa-filter::before,.fas.fa-filter::before{content:'🔍 '}
.fa-search::before,.fas.fa-search::before{content:'🔍 '}
.fa-times::before,.fas.fa-times::before{content:'✕ '}
.fa-times-circle::before{content:'⛔ '}
.fa-eye::before,.fas.fa-eye::before{content:'→ '}
.fa-info-circle::before,.fas.fa-info-circle::before{content:'ℹ️ '}
.fa-file-alt::before,.fas.fa-file-alt::before{content:'📄 '}
.fa-arrow-left::before,.fas.fa-arrow-left::before{content:'← '}
.fa-check::before,.fas.fa-check::before{content:'✓ '}
.fa-check-double::before,.fas.fa-check-double::before{content:'✓✓ '}
.fa-history::before,.fas.fa-history::before{content:'🕐 '}
.fa-edit::before,.fas.fa-edit::before{content:'✏️ '}
.fa-trash::before,.fas.fa-trash::before{content:'🗑 '}
.fa-plus::before,.fas.fa-plus::before{content:'+ '}
.fa-download::before,.fas.fa-download::before{content:'⬇ '}
.fa-save::before,.fas.fa-save::before{content:'💾 '}
.fa-key::before,.fas.fa-key::before{content:'🔑 '}
.fa-lock::before,.fas.fa-lock::before{content:'🔒 '}
.fa-sign-in-alt::before{content:'→ '}
.fa-tint::before,.fas.fa-tint::before{content:'💧 '}
.fa-tasks::before,.fas.fa-tasks::before{content:'📝 '}
.fa-clipboard-list::before,.fas.fa-clipboard-list::before{content:'📋 '}
.fa-check-square::before,.fas.fa-check-square::before{content:'☑ '}
.fa-square::before,.fas.fa-square::before{content:'☐ '}
.fa-exclamation-circle::before,.fas.fa-exclamation-circle::before{content:'⚠ '}
.fa-3x{font-size:1.8rem}

/* Aumentando tamanho da logo na navbar */
.navbar-brand img {
    height: 50px !important;
    max-height: 55px;
    width: auto;
}




