/* ===== Área do Cliente - UNIXBSD ===== */
:root {
    --primary-green: #00ff66;
    --card-bg: rgba(16, 24, 39, 0.75);
    --text-light: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-border: rgba(0, 255, 102, 0.25);
    --terminal-red: #ff4d4d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #050811;
    background-image: radial-gradient(circle at 20% 20%, rgba(0, 255, 102, 0.16), transparent 40%),
                       radial-gradient(circle at 80% 80%, rgba(0, 255, 102, 0.13), transparent 45%);
    color: var(--text-light);
    min-height: 100vh;
}

a { color: inherit; }

/* ---------- LOGIN ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: rgba(16, 24, 39, 0.75);
    background-image: radial-gradient(circle at 25% 15%, rgba(0, 255, 102, 0.16), transparent 45%),
                       radial-gradient(circle at 85% 90%, rgba(0, 255, 102, 0.12), transparent 50%);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    padding: 2.5rem 2.2rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.55);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.8rem;
    text-decoration: none;
    text-align: center;
}

.login-brand img {
    height: 44px;
}

.login-brand span {
    color: #00AA00;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.login-card h1 {
    font-size: 1.5rem;
    color: var(--primary-green);
    margin-bottom: 0.4rem;
}

.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.8rem;
}

.form-group {
    margin-bottom: 1.3rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(5, 8, 17, 0.85);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-group input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 255, 102, 0.12);
}

.form-group small.hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-group small.error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--terminal-red);
}

.form-error-box {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.35);
    color: #ff8080;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1.3rem;
}

.form-info-box {
    background: rgba(0, 255, 102, 0.08);
    border: 1px solid rgba(0, 255, 102, 0.3);
    color: var(--primary-green);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1.3rem;
}

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background: transparent;
    border: 2px solid var(--primary-green);
    color: var(--primary-green);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
}

.btn-submit:hover {
    background: var(--primary-green);
    color: #050811;
}

.login-back {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.login-back:hover {
    color: var(--primary-green);
}

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

.dash-sidebar {
    width: 250px;
    flex-shrink: 0;
    background-color: rgba(10, 14, 23, 0.92);
    background-image: radial-gradient(circle at 30% 15%, rgba(0, 255, 102, 0.16), transparent 45%),
                       radial-gradient(circle at 20% 90%, rgba(0, 255, 102, 0.1), transparent 50%);
    border-right: 1px solid var(--accent-border);
    padding: 1.6rem 1.2rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--accent-border);
}

.dash-brand img { height: 28px; }

.dash-brand span {
    color: #00AA00;
    font-weight: 700;
    font-size: 0.92rem;
}

.dash-client {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.dash-client strong {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.dash-nav {
    list-style: none;
    flex-grow: 1;
}

.dash-nav li { margin-bottom: 0.4rem; }

.dash-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0.8rem;
    border-radius: 6px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.dash-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }

.dash-nav a:hover {
    background: rgba(0, 255, 102, 0.08);
    color: var(--primary-green);
}

.dash-nav a.active {
    background: rgba(0, 255, 102, 0.12);
    color: var(--primary-green);
    border: 1px solid var(--accent-border);
}

.dash-nav-divider {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0 0.8rem;
    margin: 1.1rem 0 0.5rem;
    border-top: 1px solid var(--accent-border);
    padding-top: 1rem;
}

.dash-nav-external {
    flex-grow: 0;
}

.dash-nav-external a {
    position: relative;
}

.dash-nav-external .ext-icon {
    width: 13px;
    height: 13px;
    margin-left: auto;
    opacity: 0.55;
    flex-shrink: 0;
}

.dash-main {
    flex-grow: 1;
    padding: 2.4rem 3rem 6rem;
    position: relative;
    min-width: 0;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-header h1 {
    font-size: 1.7rem;
    color: var(--primary-green);
    margin-bottom: 0.3rem;
}

.dash-header p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.dash-card {
    background: var(--card-bg);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    padding: 1.8rem;
    margin-bottom: 1.5rem;
}

.dash-card h3 {
    color: var(--primary-green);
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
}

.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); }
.info-row .value { color: var(--text-light); font-weight: 500; }

table.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.dash-table th {
    text-align: left;
    color: var(--primary-green);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--accent-border);
}

table.dash-table td {
    padding: 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-light);
}

.badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-ativo { background: rgba(0, 255, 102, 0.12); color: var(--primary-green); border: 1px solid rgba(0, 255, 102, 0.3); }
.badge-pendente { background: rgba(255, 189, 46, 0.12); color: #ffbd2e; border: 1px solid rgba(255, 189, 46, 0.3); }
.badge-encerrado { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); border: 1px solid rgba(148,163,184,0.3); }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Botão Sair - canto inferior direito */
.logout-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(10, 14, 23, 0.92);
    border: 1px solid rgba(255, 77, 77, 0.4);
    border-radius: 30px;
    color: var(--terminal-red);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logout-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.35);
}

.logout-fab svg { width: 16px; height: 16px; }

/* Terminal (seção Terminal Sec) */
.terminal-window {
    background: rgba(5, 8, 17, 0.98);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    overflow: hidden;
}

.terminal-header {
    background: rgba(16, 24, 39, 0.95);
    padding: 10px 18px;
    display: flex;
    gap: 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-body {
    padding: 1.5rem;
    font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
    color: var(--primary-green);
    min-height: 260px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.9rem;
}

.terminal-body p { margin-bottom: 6px; line-height: 1.5; }

.terminal-input-line {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.terminal-prompt { color: #3b82f6; font-weight: bold; font-family: monospace; }

.terminal-input {
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: monospace;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

/* Responsivo */
@media (max-width: 900px) {
    .dash-layout { flex-direction: column; }
    .dash-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .dash-brand { margin-bottom: 0; padding-bottom: 0; border-bottom: none; margin-right: auto; }
    .dash-client { display: none; }
    .dash-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; flex-grow: 0; width: 100%; margin-top: 1rem; }
    .dash-nav li { margin-bottom: 0; }
    .dash-main { padding: 1.8rem 1.3rem 6rem; }
}

/* ===== Extensões específicas do CRM Administrativo ===== */

.admin-badge {
    display: inline-block;
    background: rgba(0, 255, 102, 0.1);
    border: 1px solid var(--accent-border);
    color: var(--primary-green);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 0.9rem;
}

/* ---------- Botões ---------- */
.btn-primary {
    display: inline-block;
    padding: 0.65rem 1.3rem;
    background: var(--primary-green);
    color: #050811;
    border: 2px solid var(--primary-green);
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.btn-secondary:hover { border-color: var(--primary-green); color: var(--primary-green); }

/* ---------- Cards de estatística (Visão Geral) ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    padding: 1.3rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-light);
}

.stat-card.stat-good .stat-value { color: var(--primary-green); }
.stat-card.stat-warn .stat-value { color: #ffbd2e; }
.stat-card.stat-muted .stat-value { color: var(--text-muted); }

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dash-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
}

/* ---------- Filtros / busca ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1.5rem;
}

.filter-bar input[type="text"] {
    flex: 1;
    min-width: 220px;
    padding: 0.6rem 0.9rem;
    background: rgba(5, 8, 17, 0.85);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.88rem;
    outline: none;
}

.filter-bar select {
    padding: 0.6rem 0.9rem;
    background: rgba(5, 8, 17, 0.85);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.88rem;
    outline: none;
}

.filter-bar input[type="text"]:focus,
.filter-bar select:focus { border-color: var(--primary-green); }

/* ---------- Formulários de cadastro ---------- */
.form-card { max-width: 760px; }

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
}

.form-row .form-group { flex: 1; min-width: 220px; }

.form-card select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(5, 8, 17, 0.85);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    color: var(--text-light);
    font-size: 0.95rem;
    outline: none;
}

.form-card select:focus { border-color: var(--primary-green); }

/* ---------- Tabela: coluna de ações ---------- */
.col-acoes { white-space: nowrap; }

.row-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

.row-actions a,
.link-btn {
    color: var(--primary-green);
    font-size: 0.82rem;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.row-actions a:hover,
.link-btn:hover { text-decoration: underline; }

.link-btn-danger { color: var(--terminal-red); }

.inline-form { display: inline; }

.row-link { color: var(--text-light); text-decoration: none; }
.row-link:hover { color: var(--primary-green); text-decoration: underline; }

/* ---------- Tags de nível de acesso (admins) ---------- */
.nivel-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 9px;
    border-radius: 20px;
    text-transform: uppercase;
}
.nivel-admin { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.nivel-superadmin { background: rgba(0, 255, 102, 0.12); color: var(--primary-green); border: 1px solid rgba(0, 255, 102, 0.3); }

/* ---------- Abas (Auditoria) ---------- */
.tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--accent-border);
}

.tabs .tab {
    padding: 0.7rem 1.1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tabs .tab.active {
    color: var(--primary-green);
    border-bottom-color: var(--primary-green);
}

.tabs .tab:hover { color: var(--text-light); }
