/* ==================================================================
   Painel Solluto - Estilos (tema clean / neutro)
   ================================================================== */

:root {
    --bg:        #fafafa;
    --surface:   #ffffff;
    --soft:      #f4f4f5;
    --border:    #ececee;
    --text:      #18181b;
    --text-2:    #3f3f46;
    --muted:     #71717a;
    --accent:    #27272a;
    --accent-2:  #09090b;
    --radius:    12px;
    --shadow:    0 1px 2px rgba(0, 0, 0, .03);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
code { background: var(--soft); color: var(--text-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--accent); color: #fff;
    font-weight: 600; font-size: 15px;
}
.brand-name { font-size: 16px; letter-spacing: -.01em; color: var(--text); }
.brand-name strong { font-weight: 600; }
.brand-lg .brand-mark { width: 38px; height: 38px; font-size: 17px; }
.brand-lg .brand-name { font-size: 18px; }

/* ---------- Botões / formulários ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: 9px; border: 0;
    font: inherit; font-weight: 500; cursor: pointer;
    transition: background .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field input {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--border); border-radius: 9px;
    font: inherit; color: var(--text); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #a1a1aa; }
.field input:focus { outline: none; border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }

.input-pass { position: relative; }
.input-pass input { padding-right: 44px; }
.toggle-pass {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: var(--muted);
    width: 32px; height: 32px; border-radius: 7px; cursor: pointer;
    display: grid; place-items: center;
}
.toggle-pass:hover { background: var(--soft); color: var(--text); }

.alert { padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 18px; border: 1px solid var(--border); background: var(--soft); color: var(--text-2); }
.alert-error { border-left: 3px solid #d4a5a5; }
.alert-ok    { border-left: 3px solid #a3c4ad; }

/* ---------- Login / instalação ---------- */
.auth { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; box-shadow: var(--shadow);
    padding: 40px 32px;
}
.auth-card .brand { margin-bottom: 32px; }
.auth-card h1 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-card > .muted { margin: 0 0 26px; font-size: 14px; }
.auth-foot { margin: 28px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

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

.sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 22px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 8px 26px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 0 10px 8px; color: #a1a1aa; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--muted); font-weight: 500; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--soft); color: var(--text); }
.nav-item.active { background: var(--soft); color: var(--text); }
.tag { margin-left: auto; white-space: nowrap; font-size: 10px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--border); color: #a1a1aa; font-weight: 500; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 32px; background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 18px; letter-spacing: -.01em; }
.topbar-title .muted { font-size: 13px; }
.menu-btn { display: none; border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 38px; height: 38px; cursor: pointer; place-items: center; color: var(--text); }
.menu-btn svg { width: 19px; height: 19px; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; flex-direction: column; line-height: 1.25; }
.user-info strong { font-size: 14px; font-weight: 500; }
.user-info small { font-size: 12px; color: var(--muted); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; flex-shrink: 0;
    background: var(--soft); color: var(--text-2);
    border: 1px solid var(--border);
    font-weight: 500; font-size: 13px;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }

.content { padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; flex: 1; max-width: 1280px; width: 100%; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }

.hero {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 24px 24px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.hero h2 { font-size: 20px; letter-spacing: -.02em; margin-bottom: 4px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.hero-meta { text-align: right; flex-shrink: 0; }
.hero-meta span { display: block; font-size: 12px; color: var(--muted); }
.hero-meta strong { font-size: 14px; font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--soft); color: var(--text-2); }
.stat-icon svg { width: 19px; height: 19px; }
.stat-label { display: block; font-size: 13px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }

.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 11px 20px; }
td { padding: 13px 20px; border-top: 1px solid var(--border); vertical-align: middle; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user strong { display: block; font-size: 14px; font-weight: 500; }
.cell-user small { display: block; font-size: 12px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #a1a1aa; }
.badge.ok::before { background: #86b39a; }

.info-list { list-style: none; margin: 0; padding: 4px 20px; }
.info-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-list li:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.info-list strong { text-align: right; font-weight: 500; word-break: break-word; }

.notice { padding: 20px; }
.notice h3 { font-size: 14px; margin-bottom: 4px; }
.notice p { margin: 0; font-size: 14px; }

.footer { padding: 18px 32px; font-size: 12px; color: #a1a1aa; }

.backdrop { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid  { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 30;
        transform: translateX(-100%); transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .2); z-index: 20; }
    .menu-btn { display: grid; }

    .topbar { padding: 12px 16px; }
    .user-info { display: none; }
    .content { padding: 20px 16px; }
    .footer { padding: 16px; }

    .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
    .hero-meta { text-align: left; }
}

@media (max-width: 520px) {
    .stats { grid-template-columns: 1fr; }
    th, td { padding: 12px 14px; }
}

/* ==================================================================
   v1.1 - Gestão de usuários, permissões e configurações
   ================================================================== */

/* ---------- Botões ---------- */
.btn svg { width: 16px; height: 16px; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }

.icon-btn {
    width: 32px; height: 32px; border-radius: 8px;
    display: inline-grid; place-items: center;
    border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--soft); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: #9f4a4a; }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; background: transparent; }

/* ---------- Formulários ---------- */
.field select, .field textarea {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--border); border-radius: 9px;
    font: inherit; color: var(--text); background: #fff;
}
.field select:focus, .field textarea:focus { outline: none; border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.field input:disabled, .field select:disabled { background: var(--soft); color: var(--muted); }
.field-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.field-head span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-head a, .auth-link a { font-size: 13px; color: var(--muted); }
.field-head a:hover, .auth-link a:hover { color: var(--text); text-decoration: underline; }
.auth-link { text-align: center; margin: 18px 0 0; }
.hint { display: block; font-size: 12px; color: var(--muted); margin: 4px 0 16px; }
.field .hint { margin-bottom: 0; }

.form-stack { display: flex; flex-direction: column; gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid.inner { gap: 0 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.card-body { padding: 20px; }
.card-body > .muted:first-child { margin-top: 0; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-2); padding: 10px 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 99px; background: #d4d4d8; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch.small { padding: 0 0 12px; font-size: 13px; margin-top: -8px; }
.switch.small input { width: 30px; height: 17px; }
.switch.small input::after { width: 13px; height: 13px; }
.switch.small input:checked::after { transform: translateX(13px); }

.radio-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.radio:hover { background: var(--bg); }
.radio:has(input:checked) { border-color: #a1a1aa; background: var(--bg); }
.radio input { margin-top: 3px; accent-color: var(--accent); }
.radio strong { display: block; font-size: 14px; font-weight: 500; }
.radio small { display: block; font-size: 12px; color: var(--muted); }

/* ---------- Alertas ---------- */
.alert-erro  { border-left: 3px solid #d4a5a5; }
.alert-aviso { border-left: 3px solid #d6c08f; }
.alert-info  { border-left: 3px solid #a1a1aa; }
.alert strong { font-weight: 600; }
.alert.mt, .mt { margin-top: 16px; }
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; color: var(--text-2); }

/* ---------- Tabelas / listas ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #a1a1aa; }
.search input { width: 100%; padding: 10px 12px 10px 36px; border: 1px solid var(--border); border-radius: 9px; font: inherit; font-size: 14px; background: #fff; }
.search input:focus { outline: none; border-color: #a1a1aa; }

th.right { text-align: right; }
.actions { display: flex; justify-content: flex-end; gap: 2px; }
.actions form { margin: 0; }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--text-2); white-space: nowrap; }
.you { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.warn { color: #a16207; font-size: 12px; }
.row-off td { opacity: .55; }
.row-off td:last-child { opacity: 1; }
.cell-mods { max-width: 260px; font-size: 13px; color: var(--text-2); }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { color: var(--text); }

.card-head p { margin: 4px 0 0; font-size: 13px; }
.card-head.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stat-icon.sm { width: 32px; height: 32px; border-radius: 8px; }
.stat-icon.sm svg { width: 16px; height: 16px; }

/* ---------- Permissões por módulo ---------- */
.check-actions { font-size: 13px; color: #a1a1aa; margin-bottom: 12px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.module-check { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.module-check:hover { background: var(--bg); }
.module-check:has(input:checked) { border-color: #a1a1aa; background: var(--bg); }
.module-check input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.module-check .stat-icon { width: 34px; height: 34px; border-radius: 8px; }
.module-check .stat-icon svg { width: 17px; height: 17px; }
.module-text { min-width: 0; }
.module-text strong { display: block; font-size: 14px; font-weight: 500; }
.module-text em { font-style: normal; color: var(--muted); font-weight: 400; font-size: 12px; }
.module-text small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.module-check.is-off { opacity: .6; }
.module-grid.is-disabled { opacity: .45; pointer-events: none; }

.module-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; }
.module-link { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; transition: background .15s; }
.module-link:hover { background: var(--bg); }
.module-link strong { display: block; font-size: 14px; font-weight: 500; }
.module-link small { display: block; font-size: 12px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 13px; color: var(--text-2); }
.chip svg { width: 14px; height: 14px; }

.grid-even { grid-template-columns: 1fr 1fr; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 14px; font-size: 14px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- SMTP ---------- */
.smtp-log { margin-top: 14px; font-size: 13px; }
.smtp-log summary { cursor: pointer; color: var(--muted); }
.smtp-log pre { background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; max-height: 260px; }
.tips { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; }
.tips strong { font-weight: 500; }
.tips ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.tips li { margin-bottom: 4px; }

.steps { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.steps li { margin-bottom: 6px; }

/* ---------- Estado vazio / acesso negado ---------- */
.empty { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; }
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: 16px; }
.empty p { margin: 0 0 12px; }

.user-chip:hover .user-info strong { text-decoration: underline; text-underline-offset: 2px; }
.sidebar .brand:hover { opacity: .85; }

@media (max-width: 1100px) {
    .grid-even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .form-grid, .radio-list, .module-links { grid-template-columns: 1fr; }
    .cell-mods { max-width: none; }
}
@media (max-width: 860px) {
    .hide-sm { display: none; }
}
