/* SCAD - Cards, KPIs, badges, chips, buttons, inputs */
/* ═══════════════════════════════════════════════════════════════
   SCAD · COMPONENTES (cards, KPIs, badges, pills, buttons)
   ═══════════════════════════════════════════════════════════════ */

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh-sm);
    padding: 22px;
    margin-bottom: 18px;
    transition: background .35s, border-color .35s, box-shadow .35s;
}

.card-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.card-t {
    font-size: 13px;
    font-weight: 800;
    color: var(--txt2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-t i { color: var(--g); }

/* ── KPIs ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.kpi {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: var(--tr);
    container-type: inline-size;
}

.kpi::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity .25s;
}

.kpi:hover {
    transform: translateY(-3px);
    box-shadow: var(--sh);
    border-color: rgba(0, 132, 61, .22);
}

.kpi:hover::before { opacity: 1; }

.kpi:nth-child(1)::before { background: linear-gradient(90deg, var(--blue), #5b8def); }
.kpi:nth-child(2)::before { background: linear-gradient(90deg, var(--g), #46c878); }
.kpi:nth-child(3)::before { background: linear-gradient(90deg, var(--amber), #e8b04a); }
.kpi:nth-child(4)::before { background: linear-gradient(90deg, var(--red), #e8706b); }

.kpi-top {
    padding: 17px 19px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.kpi-ic {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.kpi-ic.blue { background: var(--blue-l); color: var(--blue); }
.kpi-ic.green { background: var(--g100); color: var(--g); }
.kpi-ic.amber { background: var(--amber-l); color: var(--amber); }
.kpi-ic.red { background: var(--red-l); color: var(--red); }

.kpi-l {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--txt3);
    margin-bottom: 7px;
}

.kpi-v {
    font-family: var(--disp);
    font-size: clamp(12px, 7cqi, 1.3rem);
    font-weight: 800;
    letter-spacing: -.4px;
    line-height: 1.15;
    white-space: nowrap;
}

.kpi-v.green { color: var(--g); }
.kpi-v.amber { color: var(--amber); }
.kpi-v.red { color: var(--red); }
.kpi-v.blue { color: var(--blue); }

.kpi-bot {
    padding: 9px 19px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi-d {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 20px;
}

.kpi-d.green { background: var(--g100); color: var(--g3); }
.kpi-d.amber { background: var(--amber-l); color: var(--amber); }
.kpi-d.red { background: var(--red-l); color: var(--red); }
.kpi-d.blue { background: var(--blue-l); color: var(--blue); }

.kpi-s { font-size: 11px; color: var(--txt3); }

.prog {
    background: var(--line);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    margin-top: 9px;
}

.prog > i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--g), #46c878);
    transition: width .7s ease;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.badge.ok { background: var(--g100); color: var(--g3); }
.badge.ok::before { background: var(--g); }

.badge.warn { background: var(--amber-l); color: var(--amber); }
.badge.warn::before { background: var(--amber); }

.badge.late { background: var(--red-l); color: var(--red); }
.badge.late::before { background: var(--red); }

.badge.crit {
    background: rgba(207, 63, 57, .12);
    color: var(--red);
    border: 1px solid rgba(207, 63, 57, .22);
}

.badge.crit::before { display: none; }
.badge.crit i { font-size: 9px; }

/* ── Pills ── */
.pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: var(--tr);
}

.pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pill.loading { background: var(--line-soft); color: var(--txt3); border-color: var(--line); }
.pill.loading .dot { background: var(--txt3); }

.pill.ok { background: var(--g100); color: var(--g2); border-color: rgba(0, 132, 61, .3); }
.pill.ok .dot { background: var(--g); box-shadow: 0 0 0 3px rgba(0, 132, 61, .2); }

.pill.warn { background: var(--amber-l); color: var(--amber); border-color: rgba(201, 130, 10, .3); }
.pill.warn .dot { background: var(--amber); }

.pill.err { background: var(--red-l); color: var(--red); border-color: rgba(207, 63, 57, .3); }
.pill.err .dot { background: var(--red); }

/* ── Buttons ── */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--txt2);
    border-radius: var(--rs);
    padding: 8px 14px;
    font-family: var(--body);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--tr);
}

.btn-ghost:hover {
    background: var(--red-l);
    color: var(--red);
    border-color: rgba(207, 63, 57, .3);
}

/* ── Chips ── */
.chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip-f {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--txt2);
    transition: var(--tr);
}

.chip-f:hover {
    border-color: var(--g);
    color: var(--g);
}

.chip-f.on {
    background: linear-gradient(135deg, var(--g), var(--g2));
    color: #fff;
    border-color: var(--g);
    box-shadow: var(--sh-g);
}

/* ── Empty state ── */
.empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--txt3);
}

.empty i {
    font-size: 2rem;
    opacity: .3;
    display: block;
    margin-bottom: 10px;
}

/* ── Responsividade ── */
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .card-h { margin-bottom: 12px; }
    .kpi-top { padding: 14px 15px 10px; }
    .kpi-bot { padding: 8px 15px; }
}