/* =====================================================================
   ParaRH - design system base (Fase 1)

   Sem Tailwind e sem build: a Hostinger nao roda Node e a CSP nao permite
   CDN. Isso e CSS escrito a mao, com tokens, para ser estendido nas fases
   seguintes.

   Direcao visual: SaaS B2B sobrio. Verde-petroleo como cor de marca, fundo
   levemente esverdeado (nao branco de consultorio, §42), numeros em fonte
   tabular porque este produto e, no fim, um painel de indicadores.
   ===================================================================== */

:root {
    /* cor */
    --ink:        #12211f;
    --ink-soft:   #3d4f4b;
    --muted:      #6b7773;
    --line:       #dfe5e2;
    --surface:    #ffffff;
    --canvas:     #f1f4f3;
    --brand:      #0f766e;
    --brand-dark: #0b5b55;
    --brand-wash: #e6f0ee;
    --danger:     #a4242f;
    --danger-wash:#fdecea;
    --warn:       #b8791b;
    --ok:         #1f7a5a;

    /* tipografia */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* espaco e forma */
    --gap:    16px;
    --gap-lg: 24px;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(18, 33, 31, .06), 0 1px 8px rgba(18, 33, 31, .04);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--canvas);
}

/* numeros sempre alinhados: o produto vive de comparar indicadores */
.card-value, .table td, code { font-variant-numeric: tabular-nums; }

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

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

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

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: var(--gap-lg) var(--gap);
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
}

.brand { display: flex; flex-direction: column; gap: 2px; }

.brand-mark {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--brand);
}

.brand-tenant, .brand-tagline {
    font-size: 12px;
    color: var(--muted);
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
    /* a "espinha" a esquerda e o detalhe da marca: some quando inativo,
       acende no item atual */
    display: block;
    padding: 8px 10px 8px 12px;
    border-left: 3px solid transparent;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14px;
}

.nav-item:hover { background: var(--canvas); color: var(--ink); }

.nav-item.is-active {
    border-left-color: var(--brand);
    background: var(--brand-wash);
    color: var(--brand-dark);
    font-weight: 600;
}

.nav-item.is-disabled { color: #9aa5a1; cursor: default; }
.nav-item.is-disabled:hover { background: none; color: #9aa5a1; }

.main { flex: 1; min-width: 0; padding: var(--gap-lg); }

.topbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--gap);
    margin-bottom: var(--gap-lg);
}

.page-title { font-size: 21px; font-weight: 650; margin: 0; }

.user-chip { text-align: right; line-height: 1.3; }
.user-name { display: block; font-size: 14px; font-weight: 600; }
.user-role { display: block; font-size: 12px; color: var(--muted); }

.content { display: flex; flex-direction: column; gap: var(--gap-lg); }

/* ---------------------------------------------------------------- cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--gap);
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--gap);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    font-weight: 600;
}

.card-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.card-value-sm { font-size: 16px; font-weight: 600; }

/* --------------------------------------------------------------- panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--gap-lg);
    box-shadow: var(--shadow);
}

.panel-title {
    font-size: 15px;
    font-weight: 650;
    margin: 0 0 12px;
}

.muted { color: var(--muted); }

.note {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--canvas);
    border-left: 3px solid var(--line);
    font-size: 13px;
    color: var(--ink-soft);
}

/* --------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    font-weight: 600;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}

.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: none; }

code {
    font-family: var(--mono);
    font-size: 12.5px;
    background: var(--canvas);
    padding: 1px 5px;
    border-radius: 3px;
}

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--brand-wash);
    color: var(--brand-dark);
}

/* --------------------------------------------------------------- estados */
.empty {
    padding: 24px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--ink-soft);
}

.empty p { margin: 0 0 6px; }

.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: var(--gap);
    border-left: 3px solid transparent;
}

.alert-success { background: var(--brand-wash); border-left-color: var(--ok); color: #14483a; }
.alert-error   { background: var(--danger-wash); border-left-color: var(--danger); color: #7d1c25; }

/* --------------------------------------------------------------- formularios */
.form { display: flex; flex-direction: column; gap: var(--gap); }

.field { display: flex; flex-direction: column; gap: 5px; }

.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.field input {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
}

.field input:focus { border-color: var(--brand); outline-offset: 0; }

.hint { font-size: 12px; color: var(--muted); }

.field-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    font-size: 13px;
}

.checkbox { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); }

.link { color: var(--brand-dark); text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }
.block-center { text-align: center; display: block; }

/* --------------------------------------------------------------- botoes */
.btn {
    font: inherit;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--surface);
    color: var(--ink);
}

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--canvas); }

.btn-block { width: 100%; }

/* --------------------------------------------------------------- guest */
body.guest {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gap);
    min-height: 100vh;
}

.guest-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--brand);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.guest-brand { margin-bottom: var(--gap-lg); }
.guest-brand .brand-mark { font-size: 22px; }

/* --------------------------------------------------------------- mobile */
@media (max-width: 760px) {
    .shell { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        align-items: center;
        gap: var(--gap);
        overflow-x: auto;
        padding: 12px var(--gap);
    }

    .nav { flex-direction: row; gap: 4px; }

    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    .nav-item.is-active { border-left: none; border-bottom-color: var(--brand); }

    .logout { margin-left: auto; }
    .main { padding: var(--gap); }
    .topbar { flex-direction: column; align-items: flex-start; gap: 4px; }
    .user-chip { text-align: left; }
}

/* --------------------------------------------------- complementos PHP */
.brand-org { font-size: 12px; color: var(--muted); }

.alert-info { background: var(--brand-wash); border-left-color: var(--brand); color: #14483a; }

.nota {
    margin: 12px 0 0;
    padding: 10px 12px;
    background: var(--canvas);
    border-left: 3px solid var(--line);
    font-size: 13px;
    color: var(--ink-soft);
}

.centro { text-align: center; }

.erro-titulo { font-size: 18px; margin: 18px 0 8px; }

.guest-card .btn { margin-top: 18px; }
