:root {
    --brand: #1b4b6b;
    --brand-dark: #123549;
    --accent: #d68a1c;
    --bg: #f4f6f8;
    --card: #ffffff;
    --border: #d9e0e6;
    --text: #23313f;
    --text-muted: #62727f;
    --danger: #b3261e;
    --success: #1e7d3d;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--brand); }

.topbar {
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.topbar .brand img { height: 36px; background: #fff; border-radius: 4px; padding: 2px; }

.topbar nav a {
    color: #eaf1f6;
    text-decoration: none;
    margin-left: 1.25rem;
    font-size: 0.92rem;
}

.topbar nav a:hover { text-decoration: underline; }

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

h1, h2, h3 { color: var(--brand-dark); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; }

.grid { display: grid; gap: 0.9rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

.field { margin-bottom: 0.8rem; }

.btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; background: #fafbfc; }

.points-table input { padding: 0.35rem 0.4rem; font-size: 0.85rem; }

.flash {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash.error { background: #fbe9e7; color: var(--danger); border: 1px solid #f3c1bb; }
.flash.success { background: #e8f5e9; color: var(--success); border: 1px solid #b9dfc0; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge.rascunho { background: #fdecc8; color: #8a5a00; }
.badge.emitido { background: #d9ecdc; color: var(--success); }
.badge.aprovado { background: #d9ecdc; color: var(--success); }
.badge.reprovado { background: #fbe9e7; color: var(--danger); }

.actions-row { display: flex; gap: 0.6rem; margin-top: 1rem; }

.text-muted { color: var(--text-muted); font-size: 0.85rem; }

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-card img { height: 60px; margin-bottom: 1rem; }

.ac-wrapper { position: relative; }
.ac-box {
    display: none;
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.ac-item { padding: 0.5rem 0.7rem; cursor: pointer; font-size: 0.88rem; border-bottom: 1px solid var(--border); }
.ac-item:hover { background: var(--bg); }
.ac-empty { padding: 0.6rem 0.7rem; font-size: 0.85rem; color: var(--text-muted); }

.points-table th, .points-table td { padding: 0.35rem; }
.points-table input { width: 90px; }
.points-table .nominal-input { width: 80px; }
.remove-point { color: var(--danger); cursor: pointer; font-size: 0.85rem; background: none; border: none; }
.standards-list label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--text); margin-bottom: 0.3rem; }
.standards-list input[type=checkbox] { width: auto; }
