/* ============================================================
   Avalia+ — Sistema de Avaliação de Desempenho
   Paleta: Ink (#1C2541), Slate (#3A4A6B), Sand (#F6F3EC),
           Amber (#E0A458), Sage (#7FA98C), Coral (#D9695F)
   Tipografia: "Fraunces" (display) + "Inter" (corpo/UI)
   ============================================================ */

:root {
    --ink: #1C2541;
    --slate: #3A4A6B;
    --slate-soft: #6E7DA0;
    --sand: #F6F3EC;
    --sand-deep: #ECE6D9;
    --amber: #E0A458;
    --amber-deep: #C9893E;
    --sage: #7FA98C;
    --coral: #D9695F;
    --line: #DDD6C8;
    --white: #FFFFFF;

    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(28,37,65,0.06);
    --shadow-md: 0 4px 16px rgba(28,37,65,0.08);
    --shadow-lg: 0 12px 32px rgba(28,37,65,0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: var(--sand);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0 0 0.4em 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

a { color: var(--slate); text-decoration: none; }
a:hover { color: var(--ink); }

p { line-height: 1.6; }

/* ---------- Layout ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--ink);
    color: var(--sand);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar .brand {
    padding: 28px 24px 20px;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--sand);
    border-bottom: 1px solid rgba(246,243,236,0.1);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.sidebar .brand .plus {
    color: var(--amber);
    font-size: 1.6rem;
    line-height: 1;
}

.sidebar nav {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.sidebar .nav-eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--slate-soft);
    padding: 16px 12px 6px;
}

.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: rgba(246,243,236,0.82);
    font-size: 0.92rem;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.sidebar a.nav-link:hover {
    background: rgba(246,243,236,0.06);
    color: var(--sand);
}

.sidebar a.nav-link.active {
    background: var(--slate);
    color: var(--white);
    font-weight: 600;
}

.sidebar .nav-link .ico {
    width: 18px;
    text-align: center;
    font-style: normal;
}

.sidebar .user-box {
    padding: 16px 20px;
    border-top: 1px solid rgba(246,243,236,0.1);
    font-size: 0.85rem;
}

.sidebar .user-box .nome {
    font-weight: 600;
    color: var(--white);
    display: block;
    margin-bottom: 2px;
}

.sidebar .user-box .cargo {
    color: var(--slate-soft);
    display: block;
    margin-bottom: 10px;
}

.sidebar .user-box a {
    color: var(--amber);
    font-size: 0.82rem;
    font-weight: 600;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px 40px 60px;
    width: calc(100% - 240px);
}

.topbar-mobile {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: var(--ink);
    color: var(--sand);
    padding: 14px 20px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-mobile .brand {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
}

.topbar-mobile .menu-btn {
    background: none;
    border: 1px solid rgba(246,243,236,0.3);
    color: var(--sand);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.page-header {
    margin-bottom: 28px;
}

.page-header .eyebrow {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--slate-soft);
    font-weight: 600;
    margin-bottom: 6px;
}

.page-header p.lead {
    color: var(--slate);
    max-width: 640px;
    margin: 6px 0 0;
}

/* ---------- Cards ---------- */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-title h3 { margin: 0; }

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Stat cards ---------- */

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-soft);
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.stat-card .stat-value .unit {
    font-size: 1rem;
    color: var(--slate-soft);
    font-family: var(--font-body);
    font-weight: 500;
}

.stat-card.accent-amber { border-left: 4px solid var(--amber); }
.stat-card.accent-sage { border-left: 4px solid var(--sage); }
.stat-card.accent-coral { border-left: 4px solid var(--coral); }
.stat-card.accent-slate { border-left: 4px solid var(--slate); }

/* ---------- Performance gauge (signature element) ---------- */

.gauge-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
}

.gauge {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
}

.gauge svg { transform: rotate(-90deg); }

.gauge .gauge-bg {
    fill: none;
    stroke: var(--sand-deep);
    stroke-width: 10;
}

.gauge .gauge-value {
    fill: none;
    stroke: var(--amber);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.gauge .gauge-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-family: var(--font-display);
}

.gauge .gauge-label .num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    display: block;
}

.gauge .gauge-label .max {
    font-size: 0.7rem;
    color: var(--slate-soft);
    font-family: var(--font-body);
}

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table th {
    text-align: left;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-soft);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--sand); }

.table-wrap { overflow-x: auto; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-amber { background: rgba(224,164,88,0.16); color: var(--amber-deep); }
.badge-sage { background: rgba(127,169,140,0.18); color: #4F7A60; }
.badge-coral { background: rgba(217,105,95,0.14); color: var(--coral); }
.badge-slate { background: rgba(58,74,107,0.1); color: var(--slate); }
.badge-ink { background: rgba(28,37,65,0.08); color: var(--ink); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--ink);
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }

.btn-amber { background: var(--amber); color: var(--ink); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: var(--sand); }
.btn-coral { background: var(--coral); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.92rem;
    background: var(--white);
    color: var(--ink);
}

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

textarea { resize: vertical; min-height: 90px; }

.field { margin-bottom: 18px; }

.field-hint {
    font-size: 0.8rem;
    color: var(--slate-soft);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ---------- Rating scale ---------- */

.rating-scale {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rating-scale label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-display);
    margin: 0;
    transition: all 0.12s;
}

.rating-scale input { display: none; }

.rating-scale input:checked + label,
.rating-scale label:has(input:checked) {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}

.rating-scale .opt { position: relative; }
.rating-scale .opt input:checked ~ label { background: var(--ink); color: var(--white); }

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(224,164,88,0.18), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(127,169,140,0.14), transparent 40%);
    padding: 20px;
}

.login-card {
    background: var(--sand);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
}

.login-card .brand {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.login-card .brand .plus { color: var(--amber); }

.login-card .tagline {
    color: var(--slate);
    font-size: 0.92rem;
    margin-bottom: 28px;
}

.login-card .credenciais-demo {
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--slate);
    line-height: 1.7;
}

.login-card .credenciais-demo strong { color: var(--ink); }

/* ---------- Alerts ---------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-error { background: rgba(217,105,95,0.1); color: #A4453D; border-color: rgba(217,105,95,0.25); }
.alert-success { background: rgba(127,169,140,0.14); color: #41614F; border-color: rgba(127,169,140,0.3); }
.alert-info { background: rgba(58,74,107,0.08); color: var(--slate); border-color: rgba(58,74,107,0.18); }

/* ---------- Progress bar ---------- */

.progress {
    height: 8px;
    background: var(--sand-deep);
    border-radius: 999px;
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    background: var(--amber);
    border-radius: 999px;
}

/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--slate-soft);
}

.empty-state h3 { color: var(--slate); margin-bottom: 6px; }

/* ---------- AI analysis box ---------- */

.ia-box {
    background: var(--ink);
    color: var(--sand);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
}

.ia-box .ia-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(224,164,88,0.2);
    color: var(--amber);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.ia-box p {
    color: rgba(246,243,236,0.9);
    font-size: 0.92rem;
    white-space: pre-line;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .sidebar {
        transform: translateX(-100%);
        width: 78%;
        max-width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding: 20px 16px 48px; }
    .topbar-mobile { display: flex; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    h1 { font-size: 1.5rem; }
    .gauge-wrap { flex-direction: column; align-items: flex-start; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28,37,65,0.5);
    z-index: 95;
}

.sidebar-overlay.open { display: block; }
