/* Genesys Dashboard - Copyright (c) Genesys Emulator */
:root {
    --bg: #08111f;
    --panel: #0c1828;
    --panel-2: #12243a;
    --panel-3: #0a1424;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f4f8fc;
    --text-dim: #8fa3b8;
    --accent: #0e6fff;
    --accent-2: #0959cc;
    --accent-soft: rgba(14, 111, 255, 0.14);
    --cyan: #33c7ff;
    --online: #4caf6d;
    --offline: #e5534b;
    --warning: #e2a23a;
    --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", -apple-system, "Inter", Arial, sans-serif;
    font-size: 14px;
}

a { color: var(--cyan); }
.hidden { display: none !important; }
code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12px; }

/* ---- Campos e botões ---- */
input, select, textarea {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.35;
    font-family: inherit;
    width: 100%;
    min-width: 0;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="color"] { padding: 2px; height: 36px; cursor: pointer; }
input[type="file"] { padding: 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }

button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 9px 18px;
    font-weight: 650;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 8px 20px -10px rgba(14, 111, 255, .5);
    transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    white-space: nowrap;
}
button:hover { background: var(--accent-2); transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: default; transform: none; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
button.secondary:hover { border-color: var(--accent); color: var(--cyan); background: var(--panel-2); }
button.danger { background: var(--offline); box-shadow: none; }
button.danger:hover { filter: brightness(1.1); background: var(--offline); }
button.link-btn { background: transparent; color: var(--text-dim); padding: 4px 8px; font-weight: 500; box-shadow: none; }
button.link-btn:hover { color: var(--text); background: transparent; transform: none; }
button.small { padding: 5px 11px; font-size: 12px; }

.error { color: var(--offline); font-size: 13px; }
.status { color: var(--text-dim); font-size: 13px; }
.status.ok { color: var(--online); }
.status.err { color: var(--offline); }
.hint { color: var(--text-dim); font-size: 13px; line-height: 1.55; max-width: 720px; }
.muted { color: var(--text-dim); }

/* ---- Telas centralizadas (login/status) ---- */
.center-screen { min-height: calc(100vh - 48px); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-card .login-logo { width: 160px; align-self: center; margin-bottom: 4px; }
.login-card .sub { margin: 0 0 6px; color: var(--text-dim); font-size: 13px; text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-dim); }
.login-card h2 { margin: 0; font-size: 18px; text-align: center; }

/* ---- Rodapé com versão ---- */
.app-footer {
    padding: 14px 22px;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    border-top: 1px solid var(--border);
}
.app-footer strong { color: var(--text); font-weight: 600; }

/* ---- Barra superior ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 22px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.topbar .brand img { height: 22px; }
.topbar .brand .sub { color: var(--text-dim); font-weight: 400; font-size: 13px; }
.topbar .who { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }

.update-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 9px 16px;
    background: rgba(226, 162, 58, .12);
    border-bottom: 1px solid rgba(226, 162, 58, .35);
    color: var(--warning);
    font-size: 13px;
}

/* ---- Painel com menu lateral ---- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.shell { display: flex; flex: 1; min-height: 0; }
.sidebar-nav {
    width: 230px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.nav-group { margin-top: 14px; }
.nav-group-title { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); padding: 0 10px 6px; }
.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text-dim);
    border: none;
    border-radius: 8px;
    padding: 9px 10px;
    font-weight: 500;
    font-size: 13px;
    box-shadow: none;
}
.nav-item.active { background: var(--panel-2); color: var(--cyan); }
.nav-item:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.04); transform: none; }
.nav-badge { font-size: 10px; font-weight: 600; color: var(--text-dim); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.nav-badge.is-set { color: var(--online); border-color: var(--online); }
.nav-badge.is-warn { color: var(--warning); border-color: var(--warning); }
.nav-badge:empty { display: none; }

.content { padding: 24px; flex: 1; min-width: 0; overflow-y: auto; }
.content-inner { max-width: 980px; }
.content h2 { margin: 0 0 6px; color: var(--text); font-size: 20px; }
.content h3 { margin: 22px 0 10px; font-size: 15px; color: var(--cyan); }
.content .lead { margin: 0 0 18px; color: var(--text-dim); font-size: 13px; line-height: 1.55; max-width: 760px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Formulários em grade ---- */
.grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}
.grid-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.grid-form label.checkbox { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.grid-form .span-2 { grid-column: 1 / -1; }
.grid-form .section-title {
    grid-column: 1 / -1;
    margin: 6px 0 -2px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--cyan);
}
.grid-form .section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.field-hint { font-size: 11px; color: var(--text-dim); line-height: 1.45; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-row { display: flex; gap: 8px; }
.upload-row input { flex: 1; }
.config-subview { display: contents; }
.config-subview.hidden { display: none; }
.options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 16px; }

/* ---- Tabelas ---- */
.table-wrap { overflow-x: auto; margin-bottom: 18px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.data-table th { color: var(--text-dim); font-weight: 500; background: var(--panel-2); }
.data-table tr:last-child td { border-bottom: none; }
.data-table td.actions-cell { white-space: nowrap; }
.data-table td.actions-cell button { margin-right: 6px; }
.data-table .empty { color: var(--text-dim); text-align: center; padding: 18px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill-online { background: rgba(76,175,109,.16); color: var(--online); }
.pill-offline { background: rgba(229,83,75,.16); color: var(--offline); }
.pill-warn { background: rgba(226,162,58,.16); color: var(--warning); }
.pill-info { background: var(--accent-soft); color: var(--cyan); }

.row { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); min-width: 180px; }

/* ---- Cartões (visão geral, designs) ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    color: var(--text);
    box-shadow: none;
    font-weight: 400;
    white-space: normal;
}
button.card:hover { border-color: var(--accent); background: var(--panel); transform: none; }
.card-title { font-size: 13px; font-weight: 650; }
.card-value { font-size: 12px; color: var(--text-dim); }
.card-value.ok { color: var(--online); }
.card-value.warn { color: var(--warning); }

.box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}
.box-highlight { border-color: rgba(14,111,255,.45); background: linear-gradient(180deg, rgba(14,111,255,.08), var(--panel)); }

/* ---- Métricas ---- */
.metric-tiles { display: flex; gap: 14px; margin: 0 0 16px; flex-wrap: wrap; }
.metric-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 22px; min-width: 150px; }
.metric-tile-value { font-size: 28px; font-weight: 700; color: var(--cyan); }
.metric-tile-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.metric-chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.metric-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.metric-bar-fill { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.metric-bar-count, .metric-bar-day { font-size: 10px; color: var(--text-dim); }

/* ---- Passo a passo ---- */
.setup-wrap { max-width: 1100px; margin: 0 auto; padding: 26px 20px 30px; }
.setup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.setup-head .brand { display: flex; align-items: center; gap: 12px; }
.setup-head .brand img { height: 26px; }
.setup-head h1 { margin: 0; font-size: 18px; }
.stepper { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.step-chip {
    flex: 1 1 120px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    min-width: 0;
}
.step-chip .num {
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--panel-2); border: 1px solid var(--border-strong); font-size: 11px; flex-shrink: 0;
}
.step-chip .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-chip.done { color: var(--online); }
.step-chip.done .num { background: rgba(76,175,109,.18); border-color: var(--online); }
.step-chip.current { color: var(--text); border-color: var(--accent); background: linear-gradient(180deg, rgba(14,111,255,.14), var(--panel)); }
.step-chip.current .num { background: var(--accent); border-color: var(--accent); color: #fff; }
button.step-chip { cursor: pointer; box-shadow: none; }
button.step-chip:hover { transform: none; border-color: var(--accent); background: var(--panel); }

.setup-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.setup-card h2 { margin: 0 0 6px; font-size: 20px; }
.setup-card .lead { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; line-height: 1.6; max-width: 760px; }
.setup-card .grid-form { background: transparent; border: none; padding: 0; margin: 0 0 8px; }
.setup-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.setup-nav .right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }

/* Escolha de template */
.visual-layout { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 18px; align-items: start; }
.template-list { display: flex; flex-direction: column; gap: 10px; }
.template-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    text-align: left;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    box-shadow: none;
    font-weight: 400;
    white-space: normal;
}
.template-option:hover { transform: none; border-color: var(--border-strong); background: var(--panel-2); }
.template-option.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.template-option .name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.template-option .desc { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.preview-stage { background: #05090f; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; position: relative; }
.preview-stage .preview-scale { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.preview-stage iframe { border: none; display: block; background: transparent; pointer-events: none; }
.preview-caption { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

/* Updates */
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); margin-bottom: 10px; cursor: pointer; }
.choice.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice input { margin-top: 3px; }
.choice .title { font-weight: 650; }
.choice .desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.choice-body { margin: -2px 0 12px 32px; }

/* Chave */
.key-box { width: 100%; min-height: 96px; font-family: Consolas, "Courier New", monospace; font-size: 12px; word-break: break-all; }
.steps-list { margin: 10px 0 0; padding-left: 20px; color: var(--text-dim); line-height: 1.7; font-size: 13px; }
.steps-list strong { color: var(--text); }
.notice { border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5; margin: 12px 0; }
.notice-warn { background: rgba(226,162,58,.1); border: 1px solid rgba(226,162,58,.35); color: #f1c27a; }
.notice-ok { background: rgba(76,175,109,.1); border: 1px solid rgba(76,175,109,.35); color: #9ad9ae; }
.notice-info { background: var(--accent-soft); border: 1px solid rgba(14,111,255,.35); color: #a9cbff; }

/* Requisitos (instalador) */
.req-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.req-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); }
.req-list .icon { width: 18px; flex-shrink: 0; text-align: center; font-weight: 700; }
.req-list .ok .icon { color: var(--online); }
.req-list .fail .icon { color: var(--offline); }
.req-list .warn .icon { color: var(--warning); }
.req-list .detail { display: block; color: var(--text-dim); font-size: 12px; margin-top: 2px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2,6,12,.72); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 18px; }
.modal { width: 100%; max-width: 760px; max-height: calc(100vh - 36px); overflow: auto; background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; }
.modal h3 { margin: 0 0 8px; color: var(--text); }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar-nav { width: 100%; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
    .nav-group { margin-top: 0; display: contents; }
    .nav-group-title { display: none; }
    .nav-item { width: auto; }
    .visual-layout { grid-template-columns: 1fr; }
    .grid-form { grid-template-columns: 1fr; }
    .options-grid { grid-template-columns: 1fr 1fr; }
}

/* Tutorial da aba Proteção: blocos de código copiáveis. */
.code-block {
    display: block;
    white-space: pre;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border, #2a2f3a);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 6px 0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text, #e6e6e6);
}
