@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Paleta oficial Librelato (mesmas cores do site principal em /style.css). */
    --primary: #008bd2;
    --primary-dark: #012340;
    --primary-soft: #e3f4fc;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --success: #16a34a;
    --success-soft: #e9f9ee;
    --border: #e2ebf0;
    --bg: #f4f8fa;
    --surface: #ffffff;
    --text: #0c2233;
    --muted: #5c7383;
    --radius: 14px;
    --radius-sm: 9px;
    --page-gutter: 32px;
    --shadow-sm: 0 1px 2px rgba(1, 35, 64, .05);
    --shadow-md: 0 8px 24px rgba(1, 35, 64, .09);
}

/* Trava o espaco da barra de rolagem: evita que o layout inteiro "pule"
   para os lados quando o conteudo de uma aba e mais alto/baixo que outra
   e a barra de rolagem aparece/some. */
html { overflow-y: scroll; scrollbar-gutter: stable; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Margem padronizada: mesmo respiro em todas as telas do admin. */
/* margin nao usa "0 auto": um container centralizado flutua mais pra
   direita quanto mais larga a janela do navegador, entao a mesma pagina
   parece ter margens diferentes so por causa do tamanho da janela. Aqui
   o conteudo sempre comeca na mesma distancia fixa da barra lateral. */
.container { max-width: 1100px; margin: 0; padding: var(--page-gutter) var(--page-gutter) 90px; }
.container.narrow { max-width: 520px; }
/* Usado quando so um card precisa ser mais estreito, sem mudar a margem
   externa da pagina (que fica igual em todas as telas do admin). */
.narrow-card-wrap { max-width: 480px; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* ---- App shell / Sidebar: so icone, com balao de dica no hover ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 72px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 0; gap: 6px;
    position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-logo { width: 36px; height: 36px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; color: #fff; }
.sidebar-logo svg { width: 20px; height: 20px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.sidebar-link {
    position: relative;
    width: 44px; height: 44px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.68);
    transition: background .15s ease, color .15s ease;
}
.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-link:hover, .sidebar-link:focus-visible { background: rgba(255,255,255,.15); color: #fff; }
.sidebar-link.active { background: #fff; color: var(--primary); box-shadow: 0 8px 18px rgba(0,0,0,.18); }
.sidebar-logout { margin-top: auto; color: rgba(255,255,255,.68); }
.sidebar-logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Balaozinho de dica, aparece a direita do icone no hover/foco. */
.sidebar-tooltip {
    position: absolute; left: calc(100% + 12px); top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: #1f1f2e; color: #fff; font-size: 0.78rem; font-weight: 600; white-space: nowrap;
    padding: 6px 11px; border-radius: 8px;
    opacity: 0; pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 50;
}
.sidebar-tooltip::before {
    content: ""; position: absolute; right: 100%; top: 50%; transform: translateY(-50%);
    border: 5px solid transparent; border-right-color: #1f1f2e;
}
.sidebar-link:hover .sidebar-tooltip, .sidebar-link:focus-visible .sidebar-tooltip {
    opacity: 1; transform: translateY(-50%) translateX(0);
}

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

/* ---- Busca (contextual, dentro do conteudo da pagina, nao no topo) ---- */
.dashboard-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 9px 14px; max-width: 280px; box-shadow: var(--shadow-sm);
}
.dashboard-search svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.dashboard-search input { border: none; outline: none; font-size: 0.87rem; width: 100%; font-family: inherit; background: transparent; color: var(--text); }

/* ---- Banner de boas-vindas ---- */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 22px; padding: 30px 34px; margin-bottom: 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.welcome-text h1 { margin: 0 0 6px; font-size: 1.45rem; color: #fff; letter-spacing: -.01em; }
.welcome-text p { margin: 0 0 14px; color: #cfeaf7; font-size: 0.92rem; }
.welcome-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.welcome-stat { font-size: 0.85rem; font-weight: 600; color: #fff; }
.btn-banner {
    background: linear-gradient(120deg, var(--primary-dark), var(--primary), #00c2ff, var(--primary-dark));
    background-size: 300% 300%;
    border: none; color: #fff; white-space: nowrap;
    animation: plasma-flow 9s ease infinite;
}
.section-heading { font-size: 1.1rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }

/* ---- Cards coloridos de formulario (dashboard) ---- */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.device-tile {
    border-radius: 20px; padding: 20px; color: #fff; box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .3s ease;
}
.device-tile:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(0,139,210,.28), 0 0 26px rgba(0,194,255,.2); }
.tile-violet { background: linear-gradient(135deg, #012340, #0057a8); }
.tile-amber { background: linear-gradient(135deg, #f5a524, #ffc85c); }
.tile-coral { background: linear-gradient(135deg, #ff7452, #ff9b7b); }
.tile-sky { background: linear-gradient(135deg, #008bd2, #4fc3f7); }
.tile-mint { background: linear-gradient(135deg, #2fbf8f, #6ee7b7); }

.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.device-tile h3 { margin: 0 0 4px; font-size: 1.05rem; }
.device-tile h3 a { color: #fff; }
.tile-meta { margin: 0 0 12px; font-size: 0.82rem; color: rgba(255,255,255,.85); }
.device-tile .form-card-status { background: rgba(255,255,255,.24); color: #fff; }
.device-tile .form-card-link input { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: rgba(255,255,255,.92); }
.device-tile .form-card-actions .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
/* Escurece no hover em vez de clarear: em tiles de cor clara (amber, mint),
   clarear ainda mais deixava o botao quase branco em cima de fundo quase
   branco, com texto branco por cima — sumia. Escurecer sempre da contraste,
   nao importa a cor do tile. */
.device-tile .form-card-actions .btn:hover { background: rgba(0,0,0,.22); border-color: rgba(255,255,255,.4); }
.device-tile .form-card-actions .btn-danger { background: rgba(0,0,0,.18); border-color: rgba(255,255,255,.28); color: #fff; }
.device-tile .form-card-actions .btn-danger:hover { background: rgba(0,0,0,.38); }

/* ---- Toggle (switch) ---- */
.tile-top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn-trash {
    display: flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    padding: 0; border: none; border-radius: 7px; background: rgba(255,255,255,.16); color: #fff;
    cursor: pointer; flex-shrink: 0;
}
.icon-btn-trash svg { width: 15px; height: 15px; }
.icon-btn-trash:hover { background: rgba(0,0,0,.32); }

.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute; inset: 0; background: rgba(255,255,255,.3); border-radius: 999px;
    cursor: pointer; transition: background .2s ease;
}
.toggle-slider::before {
    content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .2s ease; box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: rgba(255,255,255,.92); animation: plasma-pulse 3s ease infinite; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--primary-dark); }
.toggle-switch input:disabled + .toggle-slider { cursor: not-allowed; opacity: .5; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 0.9rem; font-weight: 500; cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
    font-family: inherit;
}
/* Hover com tom da marca em vez de "quase branco" (baixo contraste). */
.btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn:active { transform: translateY(1px); }
/* Efeito "plasma": gradiente animado que flui devagar e acelera/brilha no hover. */
@keyframes plasma-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes plasma-pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(0, 139, 210, .35), 0 0 0 rgba(0, 194, 255, 0); }
    50% { box-shadow: 0 6px 22px rgba(0, 139, 210, .5), 0 0 22px rgba(0, 194, 255, .35); }
}

.btn-primary {
    background: linear-gradient(120deg, #008bd2, #00c2ff, var(--primary-dark), #008bd2);
    background-size: 300% 300%;
    border: none; color: #fff; font-weight: 600;
    animation: plasma-flow 9s ease infinite, plasma-pulse 3.5s ease infinite;
}
/* Redeclara o gradiente no hover: ".btn:hover" tem a mesma especificidade
   (uma classe + :hover) e vem depois no cascade, entao sem isso ele
   sobrescrevia so a propriedade "background" com um azul bem claro,
   deixando o botao quase branco (texto branco em cima de fundo quase
   branco = invisivel). */
.btn-primary:hover {
    background: linear-gradient(120deg, #008bd2, #00c2ff, var(--primary-dark), #008bd2);
    background-size: 300% 300%;
    animation-duration: 3s, 1.4s; filter: brightness(1.1); color: #fff;
}

/* .btn-banner precisa vir depois de .btn-primary: os dois tem a mesma
   especificidade (uma classe cada), entao sem isso .btn-primary
   sobrescrevia o gradiente do botao do banner de boas-vindas. */
.btn-primary.btn-banner {
    background: linear-gradient(120deg, var(--primary-dark), var(--primary), #00c2ff, var(--primary-dark));
    background-size: 300% 300%;
}
/* Mesma logica do hover acima, mas para o botao do banner (2 classes +
   :hover, especificidade maior que ".btn:hover" de proposito). */
.btn-primary.btn-banner:hover {
    background: linear-gradient(120deg, var(--primary-dark), var(--primary), #00c2ff, var(--primary-dark));
    background-size: 300% 300%;
    animation-duration: 3s; filter: brightness(1.15); color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary, .btn-banner, .toggle-switch input:checked + .toggle-slider { animation: none !important; }
}
.btn-danger { color: var(--danger); border-color: #f5c9c9; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-outline { background: var(--surface); border: 1.5px dashed #cfcfe0; color: var(--muted); font-weight: 500; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

.icon-btn {
    border: none; background: transparent; cursor: pointer; color: var(--muted);
    font-size: 1rem; line-height: 1; padding: 5px 9px; border-radius: 7px;
}
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* ---- Login ---- */
/* Mesmo estilo de fundo (gradiente + brilhos radiais) do site principal
   da Librelato em /style.css, para o login parecer parte da mesma marca. */
.login-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
    background:
        radial-gradient(circle at 18% 20%, rgba(0, 139, 210, .28), transparent 32%),
        radial-gradient(circle at 82% 12%, rgba(0, 194, 255, .18), transparent 26%),
        linear-gradient(150deg, var(--primary-dark) 0%, #021a2b 100%);
}
.login-card {
    background: var(--surface); padding: 40px 36px; border-radius: 20px; width: 100%; max-width: 380px;
    box-shadow: 0 30px 70px rgba(1, 35, 64, .4);
}
.login-logo {
    width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 6px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex; align-items: center; justify-content: center; color: #fff;
    box-shadow: 0 10px 24px rgba(0, 139, 210, .35);
}
.login-logo svg { width: 26px; height: 26px; }
.login-card h1 { font-size: 1.25rem; margin: 0 0 4px; letter-spacing: -.01em; text-align: center; }
.login-card > p.muted { text-align: center; }

/* ---- Forms ---- */
.form-vertical { display: flex; flex-direction: column; gap: 16px; }
.form-vertical label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; color: var(--text); }
.form-vertical input[type=text], .form-vertical input[type=password], .form-vertical input[type=url],
.form-vertical input[type=datetime-local], .form-vertical textarea, .form-vertical select {
    font-weight: 400; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.92rem; font-family: inherit; background: var(--surface); color: var(--text);
}
.form-vertical input:focus, .form-vertical textarea:focus, .form-vertical select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-vertical input[type=color] { height: 42px; padding: 4px; cursor: pointer; }
.form-vertical input[type=range] { accent-color: var(--primary); }

/* ---- Mini editor de texto rico (descricao do formulario) ---- */
.rte-toolbar { display: flex; gap: 4px; margin-bottom: -1px; }
.rte-btn {
    display: flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    border: 1px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0;
    background: var(--bg); color: var(--text); font-size: 0.85rem; font-family: inherit; cursor: pointer;
}
.rte-btn:hover { background: var(--primary-soft); color: var(--primary); }
.rte-editor {
    min-height: 90px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
    font-size: 0.92rem; font-weight: 400; background: var(--surface); color: var(--text); line-height: 1.5;
}
.rte-editor:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rte-editor p { margin: 0 0 8px; }
.rte-editor ul, .rte-editor ol { margin: 0 0 8px; padding-left: 20px; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.checkbox-row.small { font-weight: 400 !important; font-size: 0.85rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > * { min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 0.88rem; }
.alert-error { background: var(--danger-soft); color: #a11; }
.alert-success { background: var(--success-soft); color: #146c2e; }

/* ---- Page header ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 22px; flex-wrap: wrap; }
.page-header h1 { margin: 4px 0 0; font-size: 1.5rem; letter-spacing: -.01em; }
.page-header-actions { display: flex; align-items: center; gap: 12px; }
.back-link { display: inline-flex; margin-bottom: 10px; font-size: 0.84rem; padding: 8px 14px; }

/* ---- Forms grid (dashboard) ---- */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.form-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease;
}
.form-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.form-card h3 { margin: 10px 0 4px; font-size: 1.05rem; letter-spacing: -.01em; }
.form-card h3 a { color: var(--text); }
.form-card-status { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 4px 10px; border-radius: 20px; }
.status-draft { background: #f0f0f5; color: #666; }
.status-published { background: var(--success-soft); color: #1a7f3a; }
.status-closed { background: var(--danger-soft); color: #a11; }
.form-card-link input { width: 100%; padding: 7px 9px; font-size: 0.76rem; border: 1px solid var(--border); border-radius: 7px; margin: 10px 0; color: var(--muted); background: var(--bg); }
.form-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.form-card-actions form { display: inline; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); background: var(--surface); border: 1.5px dashed var(--border); border-radius: var(--radius); }

/* ---- Modal ---- */
.modal { border: none; border-radius: 18px; padding: 0; box-shadow: var(--shadow-md); }
.modal::backdrop { background: rgba(20, 20, 43, .35); backdrop-filter: blur(2px); }
.modal .card, .modal form { border: none; }
.modal form { padding: 26px; min-width: 340px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Modal largo (tabela interativa de convidados): conteudo nao fica
   dentro de um <form>, entao o padding e definido por secao. */
.modal-wide { width: min(760px, 92vw); }
.modal-wide .card { padding: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 0; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-table-wrap { margin: 14px 20px 0; max-height: 55vh; overflow: auto; }
.modal-wide .modal-actions { padding: 16px 20px 20px; margin-top: 0; }
#recipientsModalEmpty { margin: 14px 20px 0; }

/* ---- Link box ---- */
.link-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.link-box label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .03em; }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row input { flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; background: var(--bg); }
.link-row input[name="label"] { background: var(--surface); }
.link-channel-label { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; min-width: 90px; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { background: none; border: none; padding: 11px 18px; cursor: pointer; font-size: 0.92rem; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; font-family: inherit; margin-bottom: -1px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.hidden { display: none !important; }
.tab-panel.hidden { display: none; }

/* ---- Aparencia: blocos de secao ---- */
.section-block { margin-bottom: 26px; }
.section-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.section-hint { font-size: 0.83rem; color: var(--muted); margin: 0 0 12px; }
.image-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.image-card-title { font-weight: 600; font-size: 0.88rem; }
.image-card-actions { display: flex; gap: 8px; align-items: center; }

/* Estiliza o botao nativo de "Escolher arquivo" para seguir o mesmo
   visual dos demais botoes do painel, em vez do botao cru do navegador
   (afeta todo input de upload: logo, favicon, capa, fundo, fonte). */
input[type="file"] { font-size: 0.82rem; color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button {
    margin-right: 10px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease;
}
input[type="file"]::file-selector-button:hover { background: var(--primary-dark); }
.overlay-label { display: flex; flex-direction: column; gap: 6px; font-size: 0.83rem; font-weight: 500; color: var(--muted); margin-top: 4px; }
.overlay-label input[type=range] { width: 100%; }


/* ---- Construtor de perguntas ---- */
.question-list-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.question-list-actions .btn-block { flex: 1; min-width: 200px; }
.preset-insert-row { display: flex; gap: 8px; align-items: center; }
.preset-insert-row select { padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-family: inherit; background: var(--surface); }
.question-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.question-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.question-card.dragging { opacity: 0.5; }
.question-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; }
.q-title { flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; font-family: inherit; }
.q-title:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.q-type { padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.83rem; font-family: inherit; background: var(--surface); }
.q-description { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 10px; resize: vertical; font-family: inherit; }
.q-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.q-options.hidden, .q-add-option.hidden, .q-unique-wrap.hidden { display: none; }
.option-row { display: flex; align-items: center; gap: 6px; }
.option-input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 0.88rem; font-family: inherit; }
.question-card-foot { display: flex; gap: 22px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 10px; }

.preview-img { display: block; max-width: 100%; max-height: 130px; border-radius: 10px; margin-bottom: 4px; border: 1px solid var(--border); object-fit: cover; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.responses-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.responses-table th, .responses-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.responses-table th { background: var(--bg); position: sticky; top: 0; font-weight: 600; }
.responses-table tbody tr:hover { background: var(--bg); }

.responses-table .th-sort-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none; padding: 0; margin: 0;
    font: inherit; font-weight: 600; color: inherit; cursor: pointer; white-space: nowrap;
}
.responses-table .th-sort-btn:hover { color: var(--theme-color, #008bd2); }
.responses-table .sort-arrow { font-size: 0.65rem; color: var(--theme-color, #008bd2); }
.responses-table .filter-row th { background: var(--surface); padding: 6px 10px; }
.responses-table .col-filter-input {
    width: 100%; min-width: 90px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px;
    font-size: 0.78rem; font-weight: 400; color: var(--text); background: var(--bg);
}
.responses-table .col-filter-input:focus { outline: 2px solid var(--theme-color, #008bd2); outline-offset: 1px; }

/* ---- Metricas / graficos ---- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.chart-card { min-width: 0; padding: 16px; }
.chart-card .section-title { margin-bottom: 10px; font-size: 0.85rem; }
.chart-canvas-wrap { position: relative; height: 170px; }

/* ---- Filtro de datas das metricas ---- */
.metrics-filter { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.metrics-filter label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.metrics-filter input[type="date"] {
    border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); padding: 7px 10px; font-size: 0.85rem; color: var(--text);
}

/* ---- Resumo de convidados (sempre visivel, mesmo zerado) ---- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 24px; }
.stat-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 12px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--border); min-width: 0;
}
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.stat-label { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 2px; line-height: 1.25; }
.stat-tile.stat-ok { border-left-color: var(--success); }
.stat-tile.stat-warn { border-left-color: var(--danger); }
.stat-tile.stat-info { border-left-color: var(--primary); }

.stat-tile-actions { display: flex; gap: 6px; margin-top: 8px; }
.stat-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; padding: 0; border-radius: 6px;
    border: 1px solid var(--border); background: var(--bg); color: var(--muted);
    font-size: 0.72rem; line-height: 1; text-decoration: none; cursor: pointer;
}
.stat-icon-btn:hover { background: var(--theme-color, #008bd2); color: #fff; border-color: var(--theme-color, #008bd2); }

@media (max-width: 400px) {
    .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Lista de convidados ---- */
.recipients-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 20px; }
.recipients-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.recipients-list li { padding: 9px 4px; border-bottom: 1px solid var(--border); font-size: 0.85rem; display: flex; justify-content: space-between; gap: 10px; }
.recipients-list li:last-child { border-bottom: none; }
.recipients-list .recipient-date { color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.recipients-count { font-size: 0.78rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; margin-left: 6px; }
.recipients-count.ok { background: var(--success-soft); color: #1a7f3a; }
.recipients-count.warn { background: var(--danger-soft); color: #a11; }
.recipients-count.info { background: var(--primary-soft); color: var(--primary); }
