/* ===================================================================
   AUDITARE ECD — Design System
   =================================================================== */

/* --- Variables --- */
:root {
    --primary: #1a56db;
    --primary-hover: #1244b8;
    --primary-light: #e8eefb;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }
.page-content { flex: 1; padding: 2rem 0 3rem; }

/* --- Topbar --- */
.topbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
    letter-spacing: -.02em;
}
.topbar-brand:hover { text-decoration: none; color: var(--primary); }
.topbar-brand svg { flex-shrink: 0; }
.topbar-nav { display: flex; align-items: center; gap: .25rem; }
.topbar-nav a {
    padding: .45rem .85rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--gray-600);
    border-radius: 6px;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.topbar-nav a:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.topbar-nav a.active { background: var(--primary-light); color: var(--primary); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    font-size: .875rem;
    font-weight: 600;
    font-family: var(--font);
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, box-shadow .15s, transform .1s;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }

/* --- Cards --- */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--gray-800); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { background: var(--gray-50); }
th {
    padding: .65rem .75rem;
    font-weight: 600;
    color: var(--gray-600);
    text-align: left;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--gray-200);
}
td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: capitalize;
}
.badge-ok { background: var(--success-light); color: var(--success); }
.badge-processing { background: var(--warning-light); color: var(--warning); }
.badge-error { background: var(--danger-light); color: var(--danger); }
.badge-alta { background: var(--danger-light); color: var(--danger); }
.badge-media { background: var(--warning-light); color: var(--warning); }
.badge-baixa { background: var(--primary-light); color: var(--primary); }

/* --- Disclaimer --- */
.disclaimer {
    background: var(--warning-light);
    border: 1px solid #fde68a;
    padding: .65rem 1rem;
    font-size: .8rem;
    color: #92400e;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* --- Headings --- */
h1 { font-size: 1.75rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; font-weight: 700; color: var(--gray-800); margin-bottom: .75rem; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--gray-700); margin-bottom: .5rem; }
.section-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); margin: 2rem 0 .75rem; padding-bottom: .4rem; border-bottom: 2px solid var(--primary-light); }

/* --- Score --- */
.score-display {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 700;
}
.score-baixo { background: var(--success-light); color: var(--success); }
.score-atencao { background: var(--warning-light); color: var(--warning); }
.score-alto { background: var(--danger-light); color: var(--danger); }
.score-number { font-size: 2rem; font-weight: 800; line-height: 1; }

/* --- Upload area --- */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-area svg { margin: 0 auto .75rem; color: var(--gray-400); }
.upload-area p { color: var(--gray-500); font-size: .9rem; }
.upload-area .file-name { font-weight: 600; color: var(--gray-800); margin-top: .5rem; }

/* --- Progress bar --- */
.progress-wrap {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 999px;
    overflow: hidden;
    margin-top: .75rem;
    display: none;
}
.progress-wrap.active { display: block; }
.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .3s ease;
    width: 0%;
}
.upload-status {
    font-size: .85rem;
    margin-top: .5rem;
    min-height: 1.3rem;
    color: var(--gray-600);
}
.upload-status.error { color: var(--danger); }
.upload-status.success { color: var(--success); }

/* --- Hero / Landing --- */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}
.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -.03em;
    line-height: 1.15;
    margin-bottom: 1rem;
}
.hero .lead {
    font-size: 1.15rem;
    color: var(--gray-500);
    max-width: 620px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}
.hero-cta { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}
.feature-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: box-shadow .2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
    font-size: 1.2rem;
}
.feature-icon.blue { background: var(--primary-light); color: var(--primary); }
.feature-icon.green { background: var(--success-light); color: var(--success); }
.feature-icon.orange { background: var(--warning-light); color: var(--warning); }
.feature-icon.red { background: var(--danger-light); color: var(--danger); }
.feature-card h3 { font-size: .95rem; margin-bottom: .3rem; }
.feature-card p { font-size: .85rem; color: var(--gray-500); line-height: 1.5; }

/* --- Login --- */
.login-box {
    max-width: 400px;
    margin: 3rem auto;
    text-align: center;
}
.login-box h2 { margin-bottom: .5rem; }
.login-box p { color: var(--gray-500); margin-bottom: 1.5rem; }
.login-box .btn { width: 100%; justify-content: center; padding: .7rem 1.25rem; font-size: 1rem; }

/* --- IA Explanation --- */
.explicacao-ia {
    background: var(--gray-50);
    border-left: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: .9rem;
    color: var(--gray-700);
    margin-bottom: 1.5rem;
}

/* --- Details / Mapeamento --- */
details.mapeamento-conta {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    background: white;
}
details.mapeamento-conta summary {
    padding: .75rem 1rem;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: background .15s;
}
details.mapeamento-conta summary:hover { background: var(--gray-50); }
details.mapeamento-conta[open] summary { border-bottom: 1px solid var(--gray-100); }
details.mapeamento-conta .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
}

/* --- Filter select --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}
.filter-bar label { font-size: .85rem; font-weight: 500; color: var(--gray-600); }
.filter-bar select {
    padding: .4rem .75rem;
    font-size: .85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
}

/* --- Actions row --- */
.actions-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}
.actions-row form { display: inline; }

/* --- Footer --- */
.footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 1.25rem 0;
    text-align: center;
    font-size: .8rem;
    color: var(--gray-400);
    margin-top: auto;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--gray-400);
}
.empty-state svg { margin: 0 auto .75rem; }
.empty-state p { font-size: .9rem; }

/* --- Utility --- */
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .features-grid { grid-template-columns: 1fr; }
    details.mapeamento-conta .detail-grid { grid-template-columns: 1fr; }
    .topbar-inner { height: auto; flex-wrap: wrap; padding: .5rem 0; gap: .5rem; }
    .topbar-nav { gap: 0; }
}
