/* =========================================================
   FOUNDATIONAL STYLES & VARIABLES
========================================================= */
:root {
    --primary: #0f172a;
    --danger: #c53030;
    --success: #15803d;
    --bg-color: #f4f7f6;
    --text-main: #1e293b;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    margin: 0;
    padding: 20px 12px 150px;
}

.container {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================================================
   MAIN CARD & HERO HEADER
========================================================= */
.card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.hero {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.company-title {
    margin: 15px 0;
    font-size: 24px;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
}

.alert-count-pill {
    display: inline-block;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.chip {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    display: inline-block;
}

.meta-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.address-line {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

/* =========================================================
   ALERTS & INCIDENTS
========================================================= */
.alert-entry {
    padding: 18px 18px 16px;
    margin-bottom: 12px;
    border-top: 1px solid #eef2f6;
}

.section-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: #5f7693;
}

.violation-box {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.violation-reason {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
}

.incident-box {
    background: #f8fafc;
    border: 1px solid #e5ebf2;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.incident-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #3c5374;
    white-space: pre-wrap;
}

.footer-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.meta-card {
    background: #f8fafc;
    border: 1px solid #e5ebf2;
    border-radius: 14px;
    padding: 12px 14px;
}

.label {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    color: #6a7d96;
    margin-bottom: 4px;
}

.value {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
}

/* =========================================================
   FMCSA SNAPSHOT
========================================================= */
.fmcsa-box {
    margin: 0 18px 14px;
    background: #f8fafc;
    border: 1px solid #e5ebf2;
    border-radius: 14px;
    padding: 16px 14px 14px;
}

.fmcsa-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    max-width: 860px;
    margin: 10px auto 0;
    align-items: stretch;
}

.fmcsa-box .section-title {
    display: block;
    text-align: left;
    max-width: 860px;
    margin: 0 auto 8px;
}

.fmcsa-item {
    background: #fff;
    border: 1px solid #e5ebf2;
    border-radius: 12px;
    padding: 14px 12px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.fmcsa-item .k {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #6a7d96;
    margin-bottom: 5px;
    line-height: 1.5;
}

.fmcsa-item .v {
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    color: #0f172a;
    text-align: center;
    word-break: break-word;
}

.fmcsa-item .v.good { color: #15803d; }
.fmcsa-item .v.bad { color: #c53030; }
.fmcsa-item .v.class-broker { color: #15803d; }
.fmcsa-item .v.class-inactive { color: #c53030; }
.fmcsa-item .v.compact { font-size: 12px; }

/* =========================================================
   API UPDATE UI & TABLES
========================================================= */
.api-btn {
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}

.api-btn:hover {
    background: #1e293b;
}

.api-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.comparison-table {
    width: 100%;
    font-size: 12px;
    text-align: left;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5ebf2;
}

.comparison-table th,
.comparison-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5ebf2;
}

.comparison-table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 10px;
}

.profile-action-row {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: #fff;
}

.profile-action-row a {
    flex: 1;
    color: #fff;
    text-decoration: none;
    text-align: center;
    padding: 15px;
    border-radius: 12px;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 13px;
}

/* =========================================================
   MOBILE RESPONSIVE
========================================================= */
@media (max-width:640px) {
    .alert-entry {
        padding: 16px 14px 14px;
        margin-bottom: 10px;
    }

    .violation-box {
        padding: 12px 14px;
    }

    .violation-reason {
        font-size: 16px;
    }

    .incident-box {
        padding: 12px 14px;
    }

    .incident-text {
        font-size: 13px;
        line-height: 1.45;
    }

    .footer-meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .meta-card {
        padding: 10px 12px;
    }

    .fmcsa-grid {
        grid-template-columns: 1fr;
    }

    .profile-action-row {
        flex-direction: column;
    }
}