/* ============================================================
   InstaCheck — Design System (editorial · profissional)
   Base: shadcn/ui · Inter · roxo Soft House como accent restrito
   ============================================================ */

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

:root {
    /* Paleta primária — roxo Soft House (usar com moderação) */
    --primary:          #6A2AC5;
    --primary-hover:    #5A22A5;
    --primary-active:   #4A1B85;
    --primary-fg:       #FFFFFF;
    --primary-50:       #F5F0FE;
    --primary-100:      #E9DDFC;
    --primary-200:      #D4BAF9;
    --primary-600:      #6A2AC5;
    --primary-700:      #5A22A5;
    --primary-900:      #2E1057;

    /* Neutros (zinc-inspired) */
    --bg:               #FAFAFA;
    --surface:          #FFFFFF;
    --surface-hover:    #F4F4F5;
    --muted:            #F4F4F5;
    --muted-fg:         #71717A;

    --fg:               #09090B;
    --fg-secondary:     #3F3F46;
    --fg-tertiary:      #71717A;
    --fg-placeholder:   #A1A1AA;

    --border:           #E4E4E7;
    --border-strong:    #D4D4D8;
    --input:            #E4E4E7;
    --ring:             rgba(106, 42, 197, 0.20);

    /* Semânticos */
    --success:          #16A34A;
    --success-bg:       #F0FDF4;
    --success-border:   #BBF7D0;
    --warning:          #CA8A04;
    --warning-bg:       #FEFCE8;
    --warning-border:   #FEF08A;
    --destructive:      #DC2626;
    --destructive-bg:   #FEF2F2;
    --destructive-border:#FECACA;
    --destructive-fg:   #FFFFFF;

    /* Espaçamento (múltiplos de 4) */
    --radius-sm:        4px;
    --radius:           6px;
    --radius-md:        8px;
    --radius-lg:        10px;

    /* Sombras discretas */
    --shadow-xs:        0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm:        0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --shadow-md:        0 4px 12px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg:        0 12px 32px -8px rgba(0, 0, 0, 0.10), 0 4px 8px -4px rgba(0, 0, 0, 0.05);

    /* Layout */
    --header-h:         56px;
    --bottom-nav-h:     60px;
    --sidebar-w:        240px;
    --content-max:      1200px;
}

/* ============ Base ============ */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.005em;
    overflow-x: hidden;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary); }

img, svg { display: block; max-width: 100%; }

/* Tipografia */
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.02em; color: var(--fg); line-height: 1.25; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
p { color: var(--fg-secondary); }

code {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px; background: var(--muted); padding: 2px 6px;
    border-radius: var(--radius-sm); color: var(--fg-secondary);
}

/* ============ Brand ============ */
.brand-mark {
    background: var(--surface);
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    width: 44px; height: 44px;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-mark.sm { width: 36px; height: 36px; border-radius: var(--radius); }
.brand-mark.md { width: 80px; height: 80px; border-radius: 12px; }
.brand-mark.lg { width: 160px; height: 160px; border-radius: 20px; }
.brand-mark.xl { width: 200px; height: 200px; border-radius: 24px; }

.brand-name {
    font-weight: 700;
    color: var(--fg);
    font-size: 17px;
    letter-spacing: -0.02em;
    line-height: 1;
}
.brand-name.lg { font-size: 24px; letter-spacing: -0.03em; }
.brand-sub { font-size: 12px; color: var(--fg-tertiary); font-weight: 400; margin-top: 3px; letter-spacing: 0; }

/* ============================================================
   LANDING (editorial)
   ============================================================ */
.landing { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }
.landing-brand {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 32px;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--border);
}

.hero-editorial {
    padding: 40px 0 56px;
    text-align: left;
    max-width: 720px;
}
.hero-editorial .eyebrow {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-50);
    color: var(--primary-700);
    font-size: 12px;
    font-weight: 500;
    border-radius: 999px;
    letter-spacing: 0;
    margin-bottom: 20px;
    border: 1px solid var(--primary-100);
}
.hero-editorial h1 {
    font-size: 40px; line-height: 1.1; margin-bottom: 20px; font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--fg);
}
.hero-editorial h1 .accent { color: var(--primary); }
.hero-editorial p.lead {
    font-size: 17px; color: var(--fg-secondary); max-width: 620px;
    margin-bottom: 32px; line-height: 1.55;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (min-width: 720px) {
    .landing { padding: 40px 32px 100px; }
    .hero-editorial { padding: 56px 0 80px; }
    .hero-editorial h1 { font-size: 52px; }
    .hero-editorial p.lead { font-size: 18px; }
}

.editorial-section { padding: 40px 0; }
.editorial-section + .editorial-section { border-top: 1px solid var(--border); }
.editorial-section .section-lead {
    display: grid; grid-template-columns: 1fr; gap: 20px;
    margin-bottom: 32px;
}
@media (min-width: 720px) {
    .editorial-section { padding: 64px 0; }
    .editorial-section .section-lead { grid-template-columns: 240px 1fr; gap: 48px; }
}
.section-eyebrow {
    font-size: 12px; color: var(--fg-tertiary); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;
}
.section-heading { font-size: 24px; margin-bottom: 10px; letter-spacing: -0.025em; }
.section-lead-text { color: var(--fg-secondary); font-size: 15px; max-width: 480px; }

.cat-list {
    display: grid; grid-template-columns: 1fr; gap: 0;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--surface); overflow: hidden;
}
@media (min-width: 600px) { .cat-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cat-list { grid-template-columns: repeat(3, 1fr); } }

.cat-item {
    padding: 24px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.cat-item:last-child { border-bottom: none; }
@media (min-width: 600px) {
    .cat-item:nth-child(2n) { border-right: none; }
    .cat-item:nth-last-child(-n+2) { border-bottom: none; }
}
@media (min-width: 900px) {
    .cat-item:nth-child(2n) { border-right: 1px solid var(--border); }
    .cat-item:nth-child(3n) { border-right: none; }
    .cat-item:nth-last-child(-n+3) { border-bottom: none; }
}
.cat-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: var(--radius-sm);
    background: var(--primary-50); color: var(--primary);
    font-size: 12px; font-weight: 600; margin-bottom: 12px;
}
.cat-item strong { display: block; font-size: 15px; margin-bottom: 4px; color: var(--fg); font-weight: 600; }
.cat-item p { color: var(--fg-tertiary); font-size: 13px; line-height: 1.5; }

.footer-editorial {
    border-top: 1px solid var(--border);
    padding: 32px 0 24px;
    color: var(--fg-tertiary); font-size: 13px;
}
.footer-editorial .row {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
}

/* ============================================================
   AUTH
   ============================================================ */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 32px 20px; background: var(--bg);
}
.auth-box { width: 100%; max-width: 400px; }
.auth-hero { text-align: center; margin-bottom: 32px; }
.auth-hero .brand-mark {
    margin: 0 auto 20px;
    box-shadow: var(--shadow-md);
}
.auth-hero .title {
    font-size: 24px; font-weight: 700; letter-spacing: -0.025em;
    color: var(--fg); margin-bottom: 6px; line-height: 1.2;
}
.auth-hero .sub { color: var(--fg-tertiary); font-size: 14px; }

.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px 24px;
    box-shadow: var(--shadow-xs);
}
.auth-card .role-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--muted); color: var(--fg-secondary);
    font-size: 12px; font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.auth-card .role-tag.admin { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.auth-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.auth-card .sub { color: var(--fg-tertiary); font-size: 13px; margin-bottom: 20px; }
.auth-card .switch {
    text-align: center; font-size: 13px; margin-top: 20px;
    color: var(--fg-tertiary);
    padding-top: 16px; border-top: 1px solid var(--border);
}
.auth-card .switch a { color: var(--primary); font-weight: 500; }

@media (min-width: 720px) {
    .auth-hero .brand-mark { width: 180px; height: 180px; }
    .auth-hero .title { font-size: 28px; }
    .auth-card { padding: 36px 32px; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout { display: flex; min-height: 100vh; flex-direction: column; }

/* Mobile bottom nav */
.sidebar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex; align-items: stretch;
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar .brand { display: none; }
.sidebar .nav {
    display: flex; flex-direction: row; width: 100%;
    justify-content: space-around; gap: 0;
    min-width: max-content;
}
.sidebar .nav-link {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 8px 12px; gap: 3px;
    color: var(--fg-tertiary); font-size: 10px; font-weight: 500;
    text-decoration: none; letter-spacing: 0;
    min-width: 60px;
    transition: color 0.15s;
}
.sidebar .nav-link .ico { font-size: 20px; line-height: 1; }
.sidebar .nav-link.active { color: var(--primary); }
.sidebar .nav-link:hover { color: var(--fg); }
.sidebar .nav-link.active:hover { color: var(--primary); }

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

.topbar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    position: sticky; top: 0; z-index: 30;
    min-height: var(--header-h);
}
.topbar .mobile-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar .mobile-brand .brand-mark { width: 36px; height: 36px; border-radius: 8px; }
.topbar .mobile-brand .brand-name { font-size: 16px; }
.topbar h1 {
    font-size: 14px; font-weight: 600; color: var(--fg);
    flex: 1; text-align: center;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    letter-spacing: -0.005em;
}
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar .user { display: none; }
.topbar .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
}
.topbar .logout-btn {
    color: var(--fg-tertiary);
}
.topbar .logout-btn:hover { color: var(--destructive); background: var(--destructive-bg); }
@media (max-width: 899px) {
    .topbar .logout-label { display: none; }
    .topbar .logout-btn::before { content: '↩'; font-size: 16px; }
}

.content {
    padding: 20px 16px calc(var(--bottom-nav-h) + 24px);
    flex: 1;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* Desktop sidebar */
@media (min-width: 900px) {
    .layout { flex-direction: row; }

    .sidebar {
        position: sticky; top: 0; left: 0; right: auto; bottom: auto;
        width: var(--sidebar-w); height: 100vh;
        background: var(--surface);
        border-right: 1px solid var(--border); border-top: none;
        display: flex; flex-direction: column; align-items: stretch;
        padding: 20px 12px 16px;
        flex-shrink: 0;
        overflow: hidden;
    }
    .sidebar .brand {
        display: flex; align-items: center; gap: 12px;
        padding: 0 8px 20px;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--border);
    }
    .sidebar .brand .brand-mark { width: 48px; height: 48px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
    .sidebar .nav { flex-direction: column; gap: 1px; padding-top: 4px; overflow: visible; min-width: 0; }
    .sidebar .nav-link {
        flex: none; flex-direction: row;
        justify-content: flex-start; align-items: center;
        gap: 12px; padding: 8px 12px; border-radius: var(--radius);
        font-size: 14px; font-weight: 500;
        color: var(--fg-secondary);
        min-width: 0;
    }
    .sidebar .nav-link .ico { font-size: 18px; width: 20px; text-align: center; line-height: 1; }
    .sidebar .nav-link:hover { background: var(--muted); color: var(--fg); }
    .sidebar .nav-link.active {
        color: var(--primary); background: var(--primary-50);
        font-weight: 600;
    }
    .sidebar-section {
        padding: 12px 12px 6px; font-size: 11px; color: var(--fg-tertiary);
        font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
    }

    .topbar { padding: 14px 32px; min-height: 60px; }
    .topbar .mobile-brand { display: none; }
    .topbar h1 { text-align: left; font-size: 18px; letter-spacing: -0.015em; }
    .topbar .user { display: inline; color: var(--fg-secondary); font-size: 13px; font-weight: 500; }

    .content {
        padding: 32px;
        max-width: var(--content-max);
    }
}

/* ============================================================
   FORMS (shadcn-inspired)
   ============================================================ */
label {
    display: block; margin-bottom: 6px;
    font-size: 13px; color: var(--fg); font-weight: 500;
    letter-spacing: -0.005em;
}
label.optional::after { content: ' (opcional)'; color: var(--fg-tertiary); font-weight: 400; font-size: 12px; }

/* Pega TODOS os inputs textuais — inclusive os sem type explícito */
input:not([type=file]):not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=range]):not([type=color]):not([type=image]):not([type=reset]),
textarea, select {
    display: block;
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    background: var(--surface); color: var(--fg);
    border: 1px solid var(--input); border-radius: var(--radius);
    font-size: 14px; font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin: 0;
}
input::placeholder, textarea::placeholder { color: var(--fg-placeholder); opacity: 1; }
input[type=file] {
    padding: 8px 12px; height: auto; font-size: 13px;
    display: block; width: 100%;
    background: var(--surface); border: 1px solid var(--input);
    border-radius: var(--radius); font-family: inherit;
}
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 36px; cursor: pointer;
}
textarea {
    min-height: 96px; height: auto; padding: 10px 12px;
    resize: vertical; line-height: 1.5;
}
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; background: var(--muted); }

/* Autofill do Chrome — força cores/altura consistentes */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--surface) inset !important;
    -webkit-text-fill-color: var(--fg) !important;
    caret-color: var(--fg);
    transition: background-color 5000s ease-in-out 0s;
}

/* Firefox: remove estilo de required nativo */
input:required, textarea:required { box-shadow: none; }
input:invalid { box-shadow: none; }

.form-group { margin-bottom: 16px; }
.form-hint { font-size: 12px; color: var(--fg-tertiary); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--destructive); margin-top: 6px; }

.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--border); }
.form-actions .btn { flex: 1; }
.form-section { margin-bottom: 24px; }
.form-section-title {
    font-size: 13px; font-weight: 600; color: var(--fg);
    margin-bottom: 4px; letter-spacing: -0.005em;
}
.form-section-desc {
    font-size: 13px; color: var(--fg-tertiary);
    margin-bottom: 16px;
}
.form-section + .form-section {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

@media (min-width: 720px) {
    .form-row { grid-template-columns: 1fr 1fr; }
    .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
    .form-actions .btn { flex: none; }
}

.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-secondary); font-size: 14px; cursor: pointer; }
.checkbox-inline input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* ============================================================
   BUTTONS (shadcn-inspired)
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 16px;
    height: 36px;
    background: var(--primary); color: var(--primary-fg);
    border: 1px solid transparent; border-radius: var(--radius);
    font-weight: 500; font-size: 14px;
    cursor: pointer; font-family: inherit;
    line-height: 1;
    letter-spacing: -0.005em;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    text-align: center;
}
.btn:hover { background: var(--primary-hover); color: var(--primary-fg); text-decoration: none; }
.btn:active { background: var(--primary-active); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

.btn-outline {
    background: transparent; color: var(--fg);
    border-color: var(--input);
}
.btn-outline:hover { background: var(--muted); color: var(--fg); border-color: var(--border-strong); }

.btn-ghost {
    background: transparent; color: var(--fg-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--muted); color: var(--fg); }

.btn-secondary {
    background: var(--muted); color: var(--fg);
    border-color: transparent;
}
.btn-secondary:hover { background: var(--surface-hover); color: var(--fg); }

.btn-destructive {
    background: var(--destructive); color: var(--destructive-fg);
}
.btn-destructive:hover { background: #B91C1C; color: var(--destructive-fg); }

.btn-link {
    background: none; border: none; color: var(--primary);
    cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 500;
    padding: 4px 8px; border-radius: var(--radius-sm);
    text-decoration: none;
}
.btn-link:hover { background: var(--primary-50); text-decoration: none; }
.btn-link.destructive { color: var(--destructive); }
.btn-link.destructive:hover { background: var(--destructive-bg); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px; border-radius: var(--radius-md);
    margin-bottom: 20px; font-size: 14px; border: 1px solid;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-ok  { background: var(--success-bg); border-color: var(--success-border); color: #15803D; }
.alert-bad { background: var(--destructive-bg); border-color: var(--destructive-border); color: #B91C1C; }
.alert-warn{ background: var(--warning-bg); border-color: var(--warning-border); color: #A16207; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 20px;
    box-shadow: var(--shadow-xs);
}
.card-header {
    padding-bottom: 16px; margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; letter-spacing: -0.005em; }
.card-desc { font-size: 13px; color: var(--fg-tertiary); }

@media (min-width: 900px) { .card { padding: 24px; } }

/* ============================================================
   PAGE HEAD
   ============================================================ */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 20px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-head > div:first-child { min-width: 0; flex: 1; }
.page-head .title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--fg); margin-top: 2px; }
.page-head .lead { color: var(--fg-tertiary); font-size: 13px; margin-bottom: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
@media (min-width: 900px) {
    .page-head .title { font-size: 26px; }
}

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px; margin-bottom: 24px;
}
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 16px;
}
.stat-label {
    font-size: 12px; color: var(--fg-tertiary); font-weight: 500;
    letter-spacing: -0.005em;
}
.stat-value {
    font-size: 24px; font-weight: 600; margin-top: 6px;
    color: var(--fg); letter-spacing: -0.03em; line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat-value.ok   { color: var(--success); }
.stat-value.warn { color: var(--warning); }
.stat-value.bad  { color: var(--destructive); }
.stat-value.brand { color: var(--primary); }
.stat-value .divisor { font-size: 14px; color: var(--fg-tertiary); font-weight: 500; }

@media (min-width: 720px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
    .stat { padding: 20px; }
    .stat-value { font-size: 28px; }
}
@media (min-width: 900px) {
    .stat-value { font-size: 30px; }
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
    font-size: 15px; font-weight: 600; color: var(--fg);
    margin: 32px 0 12px;
    display: flex; align-items: center; justify-content: space-between;
    letter-spacing: -0.005em;
    gap: 12px;
}
.section-title > span:first-child { flex: 1; }
.section-title a { font-size: 13px; color: var(--primary); font-weight: 500; flex-shrink: 0; }
.section-title a:hover { text-decoration: underline; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); overflow: hidden;
}
.table-wrap .th-bar {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px;
}
.table-wrap .th-bar strong { font-size: 14px; font-weight: 600; }
table.data { width: 100%; font-size: 13px; border-collapse: collapse; }
table.data thead { background: var(--bg); }
table.data th {
    text-align: left; padding: 10px 16px;
    font-size: 12px; color: var(--fg-tertiary); font-weight: 500;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.005em;
    white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg); }

@media (max-width: 899px) {
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.data { min-width: 640px; }
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: var(--radius);
    font-size: 12px; font-weight: 500; white-space: nowrap;
    letter-spacing: -0.005em;
    line-height: 1.4;
    border: 1px solid transparent;
}
.badge-ok    { background: var(--success-bg); color: #15803D; border-color: var(--success-border); }
.badge-warn  { background: var(--warning-bg); color: #A16207; border-color: var(--warning-border); }
.badge-bad   { background: var(--destructive-bg); color: #B91C1C; border-color: var(--destructive-border); }
.badge-muted { background: var(--muted); color: var(--fg-secondary); border-color: var(--border); }
.badge-brand { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; }

/* ============================================================
   FEED (Instagram grid)
   ============================================================ */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--radius-md); overflow: hidden; }
.post-card {
    background: var(--muted); overflow: hidden; position: relative;
    aspect-ratio: 1; cursor: pointer;
    transition: transform 0.15s;
    display: block;
}
.post-card:hover .post-overlay { opacity: 1; }
.post-card:active { transform: scale(0.99); }
.post-card .post-img {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.post-card .post-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-card .post-overlay {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0; transition: opacity 0.15s;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: 13px;
}
.post-card .post-status-corner {
    position: absolute; top: 6px; right: 6px;
    padding: 3px 8px; border-radius: var(--radius);
    font-size: 11px; font-weight: 600;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(4px);
    color: var(--fg-secondary);
}
.post-card.status-approved .post-status-corner { color: #15803D; }
.post-card.status-warning  .post-status-corner { color: #A16207; }
.post-card.status-rejected .post-status-corner { background: var(--destructive); color: #fff; }
.post-card.status-pending  .post-status-corner { color: var(--fg-tertiary); }

/* Grid detalhado */
.posts-grid-detailed { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 500px) {
    .posts-grid-detailed { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
}
.posts-grid-detailed .post-card {
    aspect-ratio: auto;
    border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
    background: var(--surface);
    cursor: default;
}
.posts-grid-detailed .post-card:hover { transform: none; }
.posts-grid-detailed .post-card .post-img { aspect-ratio: 1; }
.posts-grid-detailed .post-card .post-body { padding: 12px; }
.posts-grid-detailed .post-card .caption {
    font-size: 13px; color: var(--fg);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin: 6px 0; line-height: 1.5;
}
.posts-grid-detailed .post-card .meta {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--fg-tertiary);
    padding-top: 8px; border-top: 1px solid var(--border); margin-top: 10px;
}

/* Post detail */
.post-detail {
    display: grid; grid-template-columns: 1fr;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); overflow: hidden;
}
.post-detail .post-img-full {
    background: #000; display: flex; align-items: center; justify-content: center;
}
.post-detail .post-img-full img { width: 100%; height: auto; display: block; max-height: 500px; object-fit: contain; }
.post-detail .post-side { padding: 20px; overflow-y: auto; }
.post-detail .post-side .head {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.post-detail .caption-text {
    padding: 14px 0; border-bottom: 1px solid var(--border);
    white-space: pre-wrap; font-size: 14px; line-height: 1.6;
}
@media (min-width: 900px) {
    .post-detail { grid-template-columns: 1fr 380px; max-width: 1100px; }
    .post-detail .post-img-full img { max-height: 720px; }
    .post-detail .post-side { padding: 24px; }
}

/* Sugestões */
.suggestions-box {
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-md); padding: 16px; margin: 16px 0;
}
.suggestions-box .head {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600; color: var(--primary-700);
    margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em;
}
.suggestions-box ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.suggestions-box li {
    font-size: 13px; color: var(--fg); line-height: 1.55;
    padding-left: 16px; position: relative;
}
.suggestions-box li::before {
    content: '→'; position: absolute; left: 0; top: 0;
    color: var(--primary); font-weight: 600;
}

.analysis-detail {
    padding: 14px 0;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    border-bottom: 1px solid var(--border);
}
.analysis-detail:last-child { border-bottom: none; }
.analysis-detail .info { flex: 1; min-width: 0; }
.analysis-detail .info strong { font-size: 14px; font-weight: 600; }
.analysis-detail .info .note { font-size: 13px; color: var(--fg-tertiary); margin-top: 4px; line-height: 1.5; }
.analysis-detail .info .fix {
    font-size: 12px; color: var(--primary-700); margin-top: 8px; font-weight: 500;
    padding: 6px 10px; background: var(--primary-50);
    border-radius: var(--radius); display: inline-block;
    border: 1px solid var(--primary-100);
}

/* Filters */
.filters {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px; margin-bottom: 20px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end;
}
.filters .btn { grid-column: 1 / -1; }
@media (min-width: 720px) {
    .filters { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .filters .btn { grid-column: auto; }
}

/* Empty state */
.empty {
    padding: 60px 20px; text-align: center; color: var(--fg-tertiary);
    background: var(--surface); border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}
.empty h3 { font-weight: 600; font-size: 16px; margin: 4px 0 8px; color: var(--fg); }
.empty p { font-size: 14px; margin-bottom: 20px; color: var(--fg-tertiary); }
.empty .btn { display: inline-flex; }
.empty .icon-wrapper {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--muted); color: var(--fg-tertiary);
    margin-bottom: 16px; font-size: 22px;
}

details summary { cursor: pointer; color: var(--primary); font-size: 12px; font-weight: 500; user-select: none; }
details pre { margin-top: 8px; font-size: 12px; color: var(--fg-secondary); white-space: pre-wrap; }

/* IG accounts */
.ig-account {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-md); gap: 12px;
}
.ig-account .username-block { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.ig-account .avatar-ring {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center; padding: 2px;
    flex-shrink: 0;
}
.ig-account .avatar-ring .inner {
    width: 100%; height: 100%; border-radius: 50%;
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: var(--fg); font-size: 13px;
}
.ig-account .username { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-account .meta { font-size: 12px; color: var(--fg-tertiary); }

.connect-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 20px; margin-bottom: 24px;
}
.connect-card .title-row {
    display: flex; align-items: start; justify-content: space-between;
    gap: 14px; margin-bottom: 16px; flex-wrap: wrap;
}
.connect-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.connect-card p { color: var(--fg-tertiary); font-size: 13px; }

/* Action list */
.action-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.action-item {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 16px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); gap: 16px;
    flex-wrap: wrap;
}
.action-item .info { flex: 1; min-width: 220px; }
.action-item .info strong { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.action-item .info span { font-size: 13px; color: var(--fg-tertiary); line-height: 1.4; }
.action-item form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-item form input,
.action-item form select {
    height: 36px; font-size: 13px; width: auto;
}
.action-item form input { width: 200px; max-width: 100%; }
@media (max-width: 599px) {
    .action-item { flex-direction: column; align-items: stretch; }
    .action-item form { width: 100%; }
    .action-item form input,
    .action-item form select { flex: 1; min-width: 0; width: auto; }
}

/* Info grid */
.info-grid {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 0; margin-bottom: 20px;
    overflow: hidden;
}
.info-row {
    display: grid; grid-template-columns: 1fr; gap: 4px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--fg-tertiary); font-weight: 500; }
.info-value { font-size: 14px; color: var(--fg); font-weight: 500; }
@media (min-width: 720px) {
    .info-row { grid-template-columns: 200px 1fr; align-items: center; padding: 14px 24px; }
}

/* ============================================================
   TOAST + MODAL
   ============================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 12px; left: 12px;
    z-index: 9999;
    display: flex; flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px 12px 14px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}
.toast.leaving { animation: toast-out 0.2s ease forwards; }
.toast .toast-icon {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0; font-weight: 700;
}
.toast.toast-ok  .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.toast-bad .toast-icon { background: var(--destructive-bg); color: var(--destructive); }
.toast.toast-warn .toast-icon { background: var(--warning-bg); color: var(--warning); }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-weight: 600; font-size: 13px; color: var(--fg); margin-bottom: 1px; }
.toast .toast-msg { font-size: 13px; color: var(--fg-secondary); line-height: 1.4; }
.toast .toast-close {
    background: none; border: none; color: var(--fg-tertiary);
    font-size: 18px; cursor: pointer; padding: 0 4px;
    align-self: flex-start; line-height: 1;
    font-family: inherit;
}
.toast .toast-close:hover { color: var(--fg); }
.toast .toast-bar {
    position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
    background: transparent;
}
.toast .toast-bar::before {
    content: ''; display: block; height: 100%;
    background: var(--primary);
    animation: toast-bar 4.5s linear forwards;
}
.toast.toast-ok  .toast-bar::before { background: var(--success); }
.toast.toast-bad .toast-bar::before { background: var(--destructive); }
.toast.toast-warn .toast-bar::before { background: var(--warning); }

@keyframes toast-in {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out { to { opacity: 0; } }
@keyframes toast-bar {
    from { width: 100%; }
    to   { width: 0%; }
}
@media (min-width: 720px) {
    .toast-container { top: 20px; right: 20px; left: auto; max-width: 400px; width: 100%; }
}

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 16px; z-index: 999;
    animation: fade-in 0.15s ease;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 440px; width: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid var(--border);
}
.modal-head { padding: 20px 20px 12px; }
.modal-head h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.modal-head p { font-size: 13px; color: var(--fg-tertiary); line-height: 1.5; }
.modal-body { padding: 0 20px 16px; }
.modal-footer {
    padding: 12px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
    from { transform: scale(0.98); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.err-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px; text-align: center;
}
