/* ============================================================
   MMV13 Mail — painel de e-mail marketing
   Estilos principais (sem dependências externas)
   ============================================================ */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: #101828;
    --muted: #667085;
    --muted-2: #98a2b3;
    --border: #e4e8f0;
    --border-soft: #eef1f6;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff4ff;
    --success: #039855;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --danger: #d92d20;
    --danger-soft: #fef3f2;
    --info: #026aa2;
    --info-soft: #f0f9ff;
    --sidebar: #0b1220;
    --sidebar-2: #0e1729;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow: 0 1px 3px rgba(16, 24, 40, .05), 0 12px 32px -16px rgba(16, 24, 40, .14);
    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--text); }
p { margin: 0; }
button { font-family: inherit; }
svg.i { flex: 0 0 auto; display: inline-block; vertical-align: -2px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0 !important; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------
   Estrutura
   ------------------------------------------------------------ */

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    background: linear-gradient(180deg, var(--sidebar-2) 0%, var(--sidebar) 60%);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform .22s ease;
    border-right: 1px solid rgba(255, 255, 255, .04);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 18px 14px;
    flex: 0 0 auto;
    min-height: 72px;
}

.brand-logo {
    max-height: 76px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
    opacity: 1;
}

.brand-logo:hover { opacity: .92; }

.public-brand-logo {
    max-height: 72px;
    max-width: 280px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8 70%);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .8);
    flex: 0 0 auto;
}

.brand-mark-lg { width: 44px; height: 44px; border-radius: 13px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand-text span { color: #7f91ab; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; margin-top: 2px; }

.sidebar-close { display: none; margin-left: auto; background: transparent; border: 0; color: #9fb0c8; cursor: pointer; padding: 4px; }

.nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 12px 18px;
    scrollbar-width: thin;
    scrollbar-color: #26344c transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #26344c; border-radius: 8px; }

.nav-section {
    padding: 16px 12px 6px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #5a6b85;
    user-select: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 9px;
    color: #a7b5ca;
    font-size: 13.2px;
    font-weight: 500;
    margin-bottom: 2px;
    position: relative;
    transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, .055); color: #eef2f8; }
.nav-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .30), rgba(37, 99, 235, .08));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .14);
}
.nav-link.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #60a5fa;
}

.nav-icon { display: inline-flex; color: currentColor; opacity: .92; }
.nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { font-size: 10.5px; font-weight: 700; background: rgba(255, 255, 255, .1); padding: 1px 7px; border-radius: 999px; }

.sidebar-foot { flex: 0 0 auto; padding: 10px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-foot .nav-link { margin-bottom: 8px; }

.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: 11px; background: rgba(255, 255, 255, .04); }
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.sidebar-user-info strong { color: #e6edf7; font-size: 12.2px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-info span { color: #7f91ab; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
.icon-btn-dark { background: rgba(255, 255, 255, .06); border-color: transparent; color: #9fb0c8; }
.icon-btn-dark:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.main-area { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 66px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.menu-toggle { display: none; background: #fff; border: 1px solid var(--border); border-radius: 9px; width: 38px; height: 38px; align-items: center; justify-content: center; color: #475467; cursor: pointer; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.8px; min-width: 0; }
.crumb-app { color: var(--muted); }
.crumb-sep { color: #cfd6e2; }
.crumb-page { color: #344054; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-divider { width: 1px; height: 28px; background: var(--border); }
.topbar-user { display: flex; align-items: center; gap: 9px; }
.topbar-user-text { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-user-text strong { font-size: 12.2px; font-weight: 650; }
.topbar-user-text span { font-size: 10.5px; color: var(--muted); }

.content { flex: 1 1 auto; width: 100%; max-width: 1480px; margin: 0 auto; padding: 26px 28px 44px; }

.app-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11.5px;
}
.app-footer a { color: var(--muted); }
.app-footer a:hover { color: var(--primary); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #cfd6e2; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(9, 14, 26, .55); z-index: 55; }

/* ------------------------------------------------------------
   Cabeçalho de página
   ------------------------------------------------------------ */

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 750; letter-spacing: -.025em; line-height: 1.2; }
.page-head .sub { color: var(--muted); font-size: 13.2px; margin-top: 5px; max-width: 720px; }
.page-head .sub strong { color: #344054; font-weight: 650; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------
   Botões
   ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: #fff;
    color: #344054;
    font-size: 13.2px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: linear-gradient(180deg, #2f6df0, var(--primary)); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.btn-primary:hover { background: linear-gradient(180deg, #2a63df, var(--primary-dark)); color: #fff; }
.btn-secondary { border-color: #d5dbe7; background: #fff; color: #344054; box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f8fafc; border-color: #c4ccdb; }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: #dbe7ff; }
.btn-soft:hover { background: #e6efff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b42318; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border-color: #fee4e2; }
.btn-danger-soft:hover { background: #fee4e2; }
.btn-ghost { background: transparent; color: #475467; }
.btn-ghost:hover { background: #f2f4f7; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.2px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: #475467;
    cursor: pointer;
    padding: 0;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: #f8fafc; color: var(--primary); border-color: #cbd5e1; }
.icon-btn.danger:hover { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }

.btn-group { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.card-head h3 { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------
   Estatísticas
   ------------------------------------------------------------ */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: 0 0 auto; }
.stat-body { min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 550; }
.stat-value { font-size: 25px; font-weight: 750; line-height: 1.15; letter-spacing: -.03em; margin-top: 1px; }
.stat-foot { margin-top: 3px; font-size: 11.2px; color: var(--muted); }
.stat.green .stat-icon { background: var(--success-soft); color: var(--success); }
.stat.amber .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat.red .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat.cyan .stat-icon { background: var(--info-soft); color: var(--info); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2-eq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }

/* ------------------------------------------------------------
   Tabelas
   ------------------------------------------------------------ */

.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.2px; }
.data thead th {
    padding: 10px 16px;
    background: #f8fafc;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data tbody td { padding: 12px 16px; border-bottom: 1px solid #f2f4f8; vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: #fafcff; }
.data td.td-actions, .data th.th-actions { text-align: right; }
.data .th-check, .data .td-check { width: 40px; padding-right: 0; }

.cell-main { font-weight: 600; color: #101828; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cell-main a { color: inherit; }
.cell-main a:hover { color: var(--primary); }
.cell-sub { font-size: 11.8px; color: var(--muted); margin-top: 2px; }
.cell-actions { display: flex; gap: 5px; justify-content: flex-end; align-items: center; }
.cell-actions form { margin: 0; }

.row-title { display: flex; align-items: center; gap: 10px; }
.row-avatar { width: 32px; height: 32px; border-radius: 50%; background: #f1f5f9; color: #475467; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; text-transform: uppercase; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search-box { position: relative; }
.search-box .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; display: flex; }
.search-box input { height: 36px; padding-left: 34px; width: 250px; border: 1px solid #d5dbe7; border-radius: 8px; font-size: 12.8px; background: #fff; }
.search-box input:focus { outline: none; border-color: #84adff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.empty-state { padding: 46px 24px; text-align: center; }
.empty-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-state h4 { font-size: 14px; margin-bottom: 4px; }
.empty-state p { color: var(--muted); font-size: 12.8px; max-width: 380px; margin: 0 auto 14px; }

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; line-height: 1.7; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-success { background: var(--success-soft); color: #027a48; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: #b42318; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #f2f4f7; color: #475467; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: #f2f4f7; color: #475467; font-size: 10.5px; font-weight: 600; }

/* ------------------------------------------------------------
   Formulários
   ------------------------------------------------------------ */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 650; color: #344054; }
.field .hint { font-size: 11.3px; color: var(--muted); line-height: 1.45; }
.field .req { color: var(--danger); }

.input, .field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"], .field input[type="url"], .field input[type="datetime-local"], .field input[type="date"], .field select, .field textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d5dbe7;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 13.2px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { height: auto; min-height: 110px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.field select, select.input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 34px;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    outline: none;
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
.field input::placeholder, .field textarea::placeholder { color: #a9b2c2; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #f8fafc; color: var(--muted); }

.input-sm { height: 34px !important; font-size: 12.5px !important; }
textarea.code {
    font-family: var(--mono);
    font-size: 12.2px;
    line-height: 1.6;
    background: #0d1526;
    color: #dbe6f5;
    border-color: #1e2b44;
    min-height: 420px;
    tab-size: 2;
}
textarea.code:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .15); }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #344054; cursor: pointer; user-select: none; }
.checkbox input[type="checkbox"], .checkbox input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; flex: 1 1 180px; background: #fff; }
.radio-card:has(input:checked) { border-color: #b7cdfd; background: #f5f9ff; }
.radio-card input { margin-top: 3px; accent-color: var(--primary); }
.radio-card strong { display: block; font-size: 12.8px; font-weight: 650; }
.radio-card span { display: block; font-size: 11.3px; color: var(--muted); margin-top: 1px; }

.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; max-height: 210px; overflow-y: auto; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fcfdff; }
.check-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 8px; background: #fff; cursor: pointer; font-size: 12.8px; min-width: 0; }
.check-item:has(input:checked) { border-color: #b7cdfd; background: #f5f9ff; }
.check-item input { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.check-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-empty { padding: 12px; font-size: 12px; color: var(--muted); }

.file-drop { border: 1.5px dashed #cfd8e6; border-radius: 12px; padding: 26px 20px; text-align: center; background: #fbfcff; cursor: pointer; transition: border-color .15s, background .15s; }
.file-drop:hover, .file-drop.dragover { border-color: #84adff; background: #f5f9ff; }
.file-drop input[type="file"] { display: none; }
.file-drop .dz-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 10px; }
.file-drop strong { display: block; font-size: 13.2px; }
.file-drop span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.file-name { margin-top: 10px; font-size: 12px; color: var(--primary); font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.8px; color: #344054; }
.switch input { display: none; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: #d5dbe7; position: relative; transition: background .15s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 56px 18px 40px; overflow-y: auto; background: rgba(9, 14, 26, .55); backdrop-filter: blur(3px); }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 560px; background: #fff; border-radius: 16px; box-shadow: 0 24px 70px -12px rgba(9, 14, 26, .45); animation: modal-in .18s ease-out; margin: auto; }
.modal.modal-lg { max-width: 780px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-close { background: #f8fafc; border: 1px solid var(--border); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: 0 0 auto; }
.modal-close:hover { color: var(--text); background: #f2f4f7; }
.modal-body { padding: 18px 22px 4px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; border-top: 1px solid var(--border-soft); margin-top: 10px; }

/* ------------------------------------------------------------
   Flash / toast
   ------------------------------------------------------------ */

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 13px; border: 1px solid transparent; }
.flash-icon { display: flex; margin-top: 1px; }
.flash-text { flex: 1 1 auto; }
.flash-close { background: transparent; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0; display: flex; }
.flash-close:hover { opacity: 1; }
.flash-success { background: var(--success-soft); border-color: #abefc6; color: #067647; }
.flash-error { background: var(--danger-soft); border-color: #fecdca; color: #b42318; }
.flash-warning { background: var(--warning-soft); border-color: #fedf89; color: var(--warning); }
.flash-info { background: var(--info-soft); border-color: #b9e6fe; color: #026aa2; }

.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { background: #101828; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 12.8px; box-shadow: 0 10px 30px -8px rgba(9,14,26,.5); display: flex; align-items: center; gap: 8px; animation: toast-in .18s ease-out; }
.toast.success { background: #054f31; }
.toast.error { background: #7a271a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Tabs
   ------------------------------------------------------------ */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer; background: transparent; border-top: 0; border-left: 0; border-right: 0; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ------------------------------------------------------------
   Progresso
   ------------------------------------------------------------ */

.progress { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #2563eb); transition: width .4s ease; }
.progress.green > span { background: linear-gradient(90deg, #12b76a, #039855); }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .progress { flex: 1 1 auto; }
.progress-label { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.mini-stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #e8edf5; font-size: 12.8px; }
.mini-stat:last-child { border-bottom: 0; }
.mini-stat span { color: var(--muted); }
.mini-stat strong { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Paginação
   ------------------------------------------------------------ */

.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-item { min-width: 32px; height: 32px; padding: 0 9px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #475467; font-size: 12.2px; font-weight: 550; }
.page-item:hover { border-color: #b7cdfd; color: var(--primary); }
.page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------
   Mídias
   ------------------------------------------------------------ */

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.media-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.media-thumb { height: 128px; background: repeating-conic-gradient(#f4f6fb 0% 25%, #fff 0% 50%) 50% / 16px 16px; display: grid; place-items: center; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: 10px 12px; border-top: 1px solid var(--border-soft); }
.media-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.media-actions { display: flex; gap: 4px; margin-top: 8px; }

/* ------------------------------------------------------------
   Importação / upload
   ------------------------------------------------------------ */

.import-box { max-width: 760px; }
.import-progress { display: none; margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcff; }
.import-progress.active { display: block; }
.import-progress .progress-label { margin-top: 8px; display: flex; justify-content: space-between; }
.import-result { margin-top: 16px; }
.import-result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.import-result-grid div { background: #f8fafc; border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px 12px; }
.import-result-grid strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.import-result-grid span { font-size: 11px; color: var(--muted); }

.tip-box { display: flex; gap: 10px; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border-soft); border-radius: 10px; font-size: 12.3px; color: var(--muted); line-height: 1.55; }
.tip-box .tip-icon { color: var(--primary); display: flex; margin-top: 1px; }

/* ------------------------------------------------------------
   Gráfico
   ------------------------------------------------------------ */

.chart-wrap { position: relative; width: 100%; height: 280px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.8px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

/* ------------------------------------------------------------
   Login
   ------------------------------------------------------------ */

body.auth-body { background: #0b1220; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-hero { padding: 52px 56px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; background: radial-gradient(1100px 520px at 15% -10%, rgba(59, 130, 246, .35), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(29, 78, 216, .32), transparent 55%), #0b1220; }
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 44px 44px; pointer-events: none; mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 85%); }
.auth-hero .brand { padding: 0; position: relative; z-index: 1; }
.auth-hero .brand-text strong { font-size: 18px; }
.hero-copy { position: relative; z-index: 1; max-width: 480px; }
.hero-copy h1 { color: #fff; font-size: 38px; line-height: 1.12; letter-spacing: -.035em; margin-bottom: 14px; }
.hero-copy h1 span { background: linear-gradient(90deg, #93c5fd, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: #9fb0c8; font-size: 14.5px; line-height: 1.65; }
.hero-features { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.hero-feature { display: flex; align-items: center; gap: 10px; color: #c7d4e6; font-size: 13px; }
.hero-feature .hf-icon { width: 26px; height: 26px; border-radius: 8px; background: rgba(96, 165, 250, .14); color: #60a5fa; display: grid; place-items: center; flex: 0 0 auto; }
.hero-foot { position: relative; z-index: 1; color: #5f718c; font-size: 11.5px; }

.auth-panel { display: grid; place-items: center; padding: 32px; background: #f4f6fb; }
.auth-card { width: 100%; max-width: 390px; background: #fff; border-radius: 18px; padding: 34px 32px 28px; box-shadow: 0 32px 80px -24px rgba(9, 14, 26, .35); border: 1px solid #e7ebf3; }
.auth-card h2 { font-size: 21px; letter-spacing: -.025em; }
.auth-card .auth-sub { color: var(--muted); font-size: 12.8px; margin-top: 5px; margin-bottom: 24px; }
.auth-card .btn { width: 100%; height: 42px; }
.auth-alt { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }
.auth-copy { margin-top: 22px; text-align: center; font-size: 10.5px; color: var(--muted); }

/* ------------------------------------------------------------
   Páginas públicas (formulário, descadastro, webview)
   ------------------------------------------------------------ */

body.public-page { background: linear-gradient(180deg, #eef4ff 0%, #f7f9fc 55%, #f4f6fb 100%); }
.public-wrap { max-width: 600px; margin: 0 auto; padding: 44px 20px; min-height: 100vh; display: flex; flex-direction: column; }
.public-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 20px; color: #1d4ed8; }
.public-brand .brand-text strong { color: #101828; font-size: 15px; }
.public-brand .brand-text span { color: var(--muted); }
.public-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 32px; }
.public-head { text-align: center; margin-bottom: 24px; }
.public-head h1 { font-size: 22px; letter-spacing: -.025em; }
.public-head p { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.55; }
.public-card .btn { width: 100%; height: 42px; }
.public-footer { margin-top: auto; padding-top: 22px; text-align: center; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; gap: 4px; }
.public-actions { display: flex; flex-direction: column; gap: 10px; }
.center-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; }
.center-icon.success { background: var(--success-soft); color: var(--success); }
.center-icon.danger { background: var(--danger-soft); color: var(--danger); }
.center-icon.info { background: var(--primary-soft); color: var(--primary); }

/* ------------------------------------------------------------
   Detalhe de campanha
   ------------------------------------------------------------ */

.campaign-head-card { background: linear-gradient(135deg, #0f1b33, #14274a); border: 0; color: #fff; border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden; }
.campaign-head-card::after { content: ""; position: absolute; right: -80px; top: -100px; width: 280px; height: 280px; border-radius: 50%; background: rgba(59, 130, 246, .22); filter: blur(10px); }
.campaign-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.campaign-head-card h2 { color: #fff; font-size: 21px; letter-spacing: -.02em; }
.campaign-head-card .subject { color: #9fb0c8; font-size: 13px; margin-top: 4px; }
.campaign-head-stats { display: flex; gap: 26px; margin-top: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.campaign-head-stats div span { display: block; color: #8fa3c0; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.campaign-head-stats div strong { font-size: 19px; font-weight: 700; color: #fff; }
.campaign-head-card .progress { background: rgba(255,255,255,.14); margin-top: 18px; position: relative; z-index: 1; }

.preview-frame { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 12.8px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 550; word-break: break-word; }

/* ------------------------------------------------------------
   Responsivo
   ------------------------------------------------------------ */

@media (max-width: 1180px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); box-shadow: 24px 0 60px -20px rgba(9, 14, 26, .5); }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .sidebar-overlay { display: block; }
    .sidebar-close { display: flex; }
    .main-area { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 0 18px; }
    .content { padding: 20px 18px 36px; }
    .app-footer { padding: 14px 18px; }
    .topbar-user-text { display: none; }
    .topbar-divider { display: none; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { min-height: 100vh; }
}

@media (max-width: 700px) {
    .stats { grid-template-columns: 1fr; }
    .grid-2-eq { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .check-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; }
    .page-head h1 { font-size: 21px; }
    .topbar-actions .btn span { display: none; }
    .topbar-actions { gap: 10px; }
    .search-box input { width: 100%; }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .import-result-grid { grid-template-columns: 1fr 1fr; }
    .detail-list { grid-template-columns: 1fr; gap: 2px; }
    .detail-list dd { margin-bottom: 8px; }
    .campaign-head-stats { gap: 18px; }
    .modal-backdrop { padding: 24px 12px; }
    .public-card { padding: 24px 20px; }
    .public-wrap { padding: 24px 14px; }
}

@media print {
    .sidebar, .topbar, .app-footer, .actions, .cell-actions { display: none !important; }
    .main-area { margin-left: 0; }
    .content { padding: 0; }
}
