/* ==========================================================================
   HBI Licenciamento — design system
   Paleta: teal profundo -> slate -> índigo -> ameixa, tipografia
   Plus Jakarta Sans (títulos/marca) + Inter (corpo/UI)
   ========================================================================== */

:root {
    /* Paleta de marca */
    --teal-900: #006466;
    --teal-700: #0B525B;
    --slate-900: #1B3A4B;
    --indigo-950: #272640;
    --plum-900: #3E1F47;

    /* Papéis semânticos */
    --primary: var(--teal-900);
    --primary-hover: #014547;
    --primary-soft: #E1F1F0;
    --primary-soft-strong: #C7E6E4;

    --sidebar-grad: linear-gradient(165deg, var(--teal-700) 0%, var(--slate-900) 42%, var(--indigo-950) 72%, var(--plum-900) 100%);
    --brand-grad: linear-gradient(135deg, var(--teal-900), var(--plum-900));

    --bg: #F3F6F8;
    --surface: #FFFFFF;
    --surface-alt: #F8FAFB;
    --border: #E5EAEF;
    --border-soft: #EEF2F5;

    --text: #16212B;
    --text-soft: #5B6B7A;
    --text-faint: #93A2AF;
    --text-on-dark: #E9F2F1;
    --text-on-dark-soft: #A9C3C0;

    --success: #15803D;
    --success-soft: #E1F5E8;
    --warning: #B45309;
    --warning-soft: #FBF0DC;
    --danger: #B42318;
    --danger-soft: #FBE7E5;
    --neutral-soft: #EEF1F3;
    --neutral-text: #5B6B7A;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(20, 33, 43, 0.06);
    --shadow-md: 0 6px 20px rgba(20, 33, 43, 0.08);
    --shadow-lg: 0 24px 60px rgba(27, 58, 75, 0.22);
}

* { box-sizing: border-box; }

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

h1, h2, h3, .brand-name { font-family: "Plus Jakarta Sans", "Inter", sans-serif; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { line-height: 1.55; }
code {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 0.85em;
}

a { color: inherit; }

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

.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: var(--sidebar-grad);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    padding: 26px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 28px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.22);
    display: flex; align-items: center; justify-content: center;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 800; font-size: 1.05rem; color: #fff;
    flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 1rem; font-weight: 800; color: #fff; }
.brand-sub { font-size: 0.72rem; color: var(--text-on-dark-soft); font-weight: 500; }

.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-section-label {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: rgba(233,242,241,0.45); font-weight: 700;
    padding: 16px 12px 6px;
}
.sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    color: var(--text-on-dark-soft);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar nav a.active {
    background: #fff;
    color: var(--indigo-950);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.sidebar nav a.active svg { opacity: 1; }

.sidebar-footer {
    padding: 14px 12px 4px;
    border-top: 1px solid rgba(255,255,255,0.14);
    margin-top: 12px;
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 34px; height: 34px; border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: #fff; flex-shrink: 0;
}
.sidebar-footer .user-info { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-footer .user { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .role { font-size: 0.72rem; color: var(--text-on-dark-soft); text-transform: capitalize; }
.sidebar-footer a.logout {
    color: var(--text-on-dark-soft);
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    text-decoration: none; flex-shrink: 0;
}
.sidebar-footer a.logout:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-footer a.logout svg { width: 17px; height: 17px; }

.content { flex: 1; padding: 30px 40px 60px; max-width: 1180px; }

.topbar {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 22px;
}
.topbar .greeting { font-size: 0.85rem; color: var(--text-faint); }
.topbar .greeting strong { color: var(--text-soft); font-weight: 600; }

/* ---------- flashes ---------- */
.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flashes-standalone { max-width: 420px; margin: 24px auto 0; }
.flash {
    padding: 11px 15px; border-radius: var(--radius-md); font-size: 0.88rem;
    display: flex; align-items: center; gap: 8px; font-weight: 500;
}
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-danger { background: var(--danger-soft); color: var(--danger); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.4rem; margin: 0; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: var(--surface-alt); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border: none;
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--primary-hover); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1c13; }
.btn-sm { padding: 6px 13px; font-size: 0.78rem; }

/* ---------- badges ---------- */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 11px; border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
}
.badge-trial, .badge-pendente { background: var(--warning-soft); color: var(--warning); }
.badge-ativo, .badge-aprovado { background: var(--success-soft); color: var(--success); }
.badge-suspenso, .badge-inadimplente, .badge-recusado, .badge-estornado { background: var(--danger-soft); color: var(--danger); }
.badge-cancelado { background: var(--neutral-soft); color: var(--neutral-text); }

/* ---------- forms ---------- */
form.form-box { max-width: 520px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 6px; font-size: 0.8rem; color: var(--text-soft); font-weight: 600; }
input, select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal-900);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
input::placeholder { color: var(--text-faint); }

/* ---------- login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.login-shell {
    display: flex;
    width: 100%;
    max-width: 860px;
    min-height: 520px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.login-brand-panel {
    flex: 1;
    background: var(--sidebar-grad);
    color: #fff;
    padding: 44px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}
.login-brand-panel .brand-mark { width: 46px; height: 46px; font-size: 1.25rem; border-radius: 14px; }
.login-brand-panel .tagline { font-size: 1.3rem; font-weight: 700; font-family: "Plus Jakarta Sans", sans-serif; line-height: 1.35; max-width: 300px; }
.login-brand-panel .tagline-sub { font-size: 0.85rem; color: var(--text-on-dark-soft); margin-top: 10px; max-width: 280px; line-height: 1.5; }
.login-brand-panel .deco-dots {
    position: absolute; right: -20px; bottom: -20px; opacity: 0.18;
    width: 160px; height: 160px;
    background-image: radial-gradient(rgba(255,255,255,0.9) 1.5px, transparent 1.5px);
    background-size: 14px 14px;
}
.login-card {
    flex: 1.1;
    background: var(--surface);
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-card p { color: var(--text-soft); font-size: 0.86rem; margin-top: 0; margin-bottom: 24px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 0.92rem; }

@media (max-width: 720px) {
    .login-shell { flex-direction: column; max-width: 420px; }
    .login-brand-panel { padding: 32px 28px; }
    .login-card { padding: 36px 28px; }
}

/* ---------- stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.stat-icon {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon-teal { background: #E1F1F0; color: var(--teal-900); }
.stat-icon-slate { background: #E7ECF0; color: var(--slate-900); }
.stat-icon-indigo { background: #E9E8F1; color: var(--indigo-950); }
.stat-icon-plum { background: #F2E6F0; color: var(--plum-900); }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); font-family: "Plus Jakarta Sans", sans-serif; line-height: 1.2; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-soft); margin-top: 2px; }

.empty { color: var(--text-faint); padding: 34px 0; text-align: center; font-size: 0.9rem; }
