:root {
    --primary: #1a73e8;
    --primary-dark: #1558b0;
    --bg-main: #f8f9fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #e8f0fe;
    --bg-subtle: #f8f9fa;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --sidebar-width: 280px;
    --header-height: 64px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] {
    --primary: #5b9cf6;
    --primary-dark: #7db4fd;
    --bg-main: #1a1a2e;
    --bg-sidebar: #16213e;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-hover: #263451;
    --bg-subtle: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    /* App shell handles scrolling */
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-logo {
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    text-decoration: none;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.nav-label {
    display: inline-block;
}

.brand-mark {
    background: linear-gradient(135deg, #000 0%, #2a2a2a 100%);
    color: #fff;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.25rem;
    white-space: nowrap;
}

.brand-badge {
    background: #1a73e8;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.nav-group {
    margin-bottom: 0.25rem;
}

.nav-group summary {
    list-style: none;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary:hover {
    background: var(--bg-hover);
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.pdf-group .nav-icon {
    color: #f7931e;
}

.imagem-group .nav-icon {
    color: #a855f7;
}

.video-group .nav-icon {
    color: #3b82f6;
}

.audio-group .nav-icon {
    color: #06b6d4;
}

.texto-group .nav-icon {
    color: #10b981;
}

.ia-group .nav-icon {
    color: #ef4444;
}

.util-group .nav-icon {
    color: #6366f1;
}

.nav-group-links {
    margin-top: 0.25rem;
    padding-left: 1rem;
}

.nav-link {
    display: block;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.nav-link.active {
    background: var(--bg-hover);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.55rem 1.25rem;
    border-top: 1px solid var(--border);
}

.sidebar-footer .status-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-footer .status-dot {
    width: 8px;
    height: 8px;
    background: #16a34a;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulseDot 2s ease-in-out infinite;
}

.sidebar-footer .status-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-footer .status-sub {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* MAIN CONTENT */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-input {
    min-width: 260px;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.content-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.tool-view {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-section {
    margin-bottom: 1.25rem;
}

.dashboard-section h3 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    height: 130px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}

.tool-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.tool-card-title {
    font-weight: 700;
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-header-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.tool-header-section h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-weight: 800;
}

.tool-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.tool-workspace {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 4rem;
}

.tool-info-section {
    background: var(--bg-hover);
    padding: 2rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.tool-info-section h2 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.tool-info-section p {
    color: var(--text-primary);
    line-height: 1.6;
}

/* TOOL SPECIFIC COMPONENTS */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-subtle);
}

.upload-area:hover,
.upload-area.highlight {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.upload-icon {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-area h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.file-list-container {
    margin-top: 2rem;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0 2rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.drag-handle {
    cursor: move;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #fee2e2;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.hidden {
    display: none !important;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-input);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

/* STATIC PAGES (Sobre, Privacidade, FAQ) */
.static-page-content {
    max-width: 800px;
    margin: 0 auto;
}

.static-page-content section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.25rem;
}

.static-page-content section h2 {
    color: var(--primary-dark);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.static-page-content section p {
    color: var(--text-primary);
    line-height: 1.7;
}

.static-page-content section ul {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.static-page-content section ul li {
    padding: 0.4rem 0;
    padding-left: 1.25rem;
    position: relative;
    color: var(--text-primary);
    line-height: 1.6;
}

.static-page-content section ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
}

.faq-item h3 {
    color: var(--primary-dark);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== BLOG ===== */
.blog-index { max-width: 900px; margin: 0 auto; }
.blog-category-section { margin-bottom: 2rem; }
.blog-category-section h2 { font-size: 1.1rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.75rem; }
.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.blog-card { display: flex; flex-direction: column; padding: 1.25rem 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); text-decoration: none; color: var(--text-primary); transition: box-shadow 0.2s, transform 0.2s; }
.blog-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.blog-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text-primary); }
.blog-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.blog-card-cta { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-top: 0.75rem; }

.blog-article section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 2rem; margin-bottom: 1.25rem; }
.blog-article section h2 { color: var(--primary-dark); font-size: 1.25rem; margin-bottom: 0.75rem; }
.blog-article section p { color: var(--text-primary); line-height: 1.7; margin-bottom: 0.75rem; }
.blog-article section p:last-child { margin-bottom: 0; }
.blog-article section ol, .blog-article section ul { padding-left: 1.5rem; margin: 0.75rem 0; }
.blog-article section ol li, .blog-article section ul li { padding: 0.35rem 0; line-height: 1.6; color: var(--text-primary); }

.blog-cta-section { text-align: center; background: var(--bg-hover) !important; border-left: 4px solid var(--primary) !important; }
.blog-cta-btn { display: inline-block; margin-top: 0.75rem; padding: 0.75rem 2rem; text-decoration: none; }

.blog-related { background: transparent !important; border: none !important; padding: 0 !important; margin-top: 2rem !important; }
.blog-related h2 { margin-bottom: 1rem; }
.blog-related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.blog-related-card { display: block; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); text-decoration: none; transition: box-shadow 0.2s; }
.blog-related-card:hover { box-shadow: var(--shadow); }
.blog-related-card h4 { font-size: 0.9rem; color: var(--primary); margin-bottom: 0.3rem; }
.blog-related-card p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

.blog-nav-bottom { margin-top: 2rem; padding: 1rem 0; }
.blog-nav-bottom a { color: var(--primary); text-decoration: none; font-weight: 600; }

.blog-nav-group { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.blog-link { display: flex !important; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; font-weight: 600; }
.blog-icon { font-size: 1.2rem; }

@media (max-width: 968px) {
    .blog-grid { grid-template-columns: 1fr; }
    .blog-related-grid { grid-template-columns: 1fr; }
    .blog-article section { padding: 1rem; }
    .blog-card { padding: 0.75rem 1rem; }
}

/* FOOTER */
.footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 0.5rem;
}

/* MOBILE NAVIGATION */
.app-shell.sidebar-open .sidebar {
    display: flex;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 280px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

/* MOBILE */
@media (max-width: 968px) {

    /* --- Layout base --- */
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .footer {
        display: none;
    }

    /* --- Top bar compacto --- */
    .top-bar {
        padding: 0 0.75rem;
        height: 52px;
        gap: 0.5rem;
    }

    .top-bar-left {
        gap: 0.5rem;
    }

    #currentPageTitle {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }

    .search-input {
        min-width: 0;
        width: 100%;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .theme-toggle {
        display: none;
    }

    /* --- Content container: menos padding --- */
    .content-container {
        padding: 0.75rem;
        overflow-x: hidden;
    }

    /* --- Tool view --- */
    .tool-view {
        max-width: 100%;
    }

    /* --- Header da ferramenta --- */
    .tool-header-section {
        margin-bottom: 1rem;
        padding: 0 0.25rem;
    }

    .tool-header-section h1 {
        font-size: 1.4rem;
        line-height: 1.2;
        margin-bottom: 0.4rem;
    }

    .tool-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    /* --- Workspace compacto --- */
    .tool-workspace {
        padding: 0.75rem;
        margin-bottom: 1.5rem;
        border-radius: 8px;
    }

    /* --- Upload area --- */
    .upload-area {
        padding: 1.5rem 1rem;
    }

    .upload-area h3 {
        font-size: 1rem;
    }

    .upload-area p {
        font-size: 0.8rem;
    }

    /* --- Info section --- */
    .tool-info-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .tool-info-section h2 {
        font-size: 1.1rem;
    }

    .tool-info-section p {
        font-size: 0.85rem;
    }

    /* --- Dashboard grid --- */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .tool-card {
        padding: 0.75rem;
    }

    .tool-card-title {
        font-size: 0.95rem;
    }

    .tool-card-desc {
        font-size: 0.8rem;
    }

    .dashboard-section h3 {
        font-size: 0.85rem;
    }

    /* --- Botoes --- */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* --- File list --- */
    .file-item {
        padding: 0.6rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .file-info {
        gap: 0.5rem;
        min-width: 0;
        flex: 1;
    }

    .file-name {
        font-size: 0.85rem;
        word-break: break-all;
    }

    /* ============================================
       GLOBAL GRID FIX — Forcar coluna unica
       Sobrescreve TODOS os grids inline dos tools
       ============================================ */
    .tool-workspace [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Grids com classe propria tambem */
    .tool-workspace .grid-2,
    .tool-workspace .grid-3,
    .tool-workspace .split-view,
    .tool-workspace .side-by-side {
        grid-template-columns: 1fr !important;
    }

    /* --- Videos e imagens --- */
    .tool-workspace video,
    .tool-workspace canvas {
        max-height: 250px !important;
        width: 100% !important;
    }

    .tool-workspace img {
        max-height: 300px;
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    /* --- Inputs e selects --- */
    .tool-workspace input[type="text"],
    .tool-workspace input[type="number"],
    .tool-workspace input[type="url"],
    .tool-workspace input[type="email"],
    .tool-workspace input[type="date"],
    .tool-workspace textarea,
    .tool-workspace select {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px !important; /* evita zoom no iOS */
        box-sizing: border-box;
    }

    /* --- Containers inline com padding excessivo --- */
    .tool-workspace .card,
    .tool-workspace [style*="padding: 2rem"],
    .tool-workspace [style*="padding:2rem"] {
        padding: 0.75rem !important;
    }

    /* --- Gaps excessivos nos grids --- */
    .tool-workspace [style*="gap: 2rem"],
    .tool-workspace [style*="gap:2rem"] {
        gap: 0.75rem !important;
    }

    .tool-workspace [style*="gap: 1.5rem"],
    .tool-workspace [style*="gap:1.5rem"] {
        gap: 0.6rem !important;
    }

    /* --- Larguras fixas perigosas --- */
    .tool-workspace [style*="width: 300px"],
    .tool-workspace [style*="width:300px"],
    .tool-workspace [style*="min-width: 300px"],
    .tool-workspace [style*="min-width:300px"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* --- Flex wrap para botoes de acao --- */
    .tool-workspace [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    /* --- Form selects --- */
    .form-select {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }

    /* --- Range inputs --- */
    .tool-workspace input[type="range"] {
        width: 100% !important;
    }

    /* ============================================
       PENTE FINO — Overflow horizontal e edge cases
       ============================================ */

    /* Seguranca anti-scroll horizontal */
    html, body {
        overflow-x: hidden !important;
    }

    /* Larguras fixas pequenas (calculadora-regra3 etc) */
    .tool-workspace [style*="width: 100px"],
    .tool-workspace [style*="width:100px"] {
        width: 80px !important;
    }

    /* Flex containers genericos — forcar wrap */
    .tool-workspace > div[style*="display: flex"],
    .tool-workspace div > div[style*="display: flex"],
    .tool-workspace .card > div[style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* Flex rows com space-between — empilhar no mobile */
    .tool-workspace [style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    /* Margins inline excessivos */
    .tool-workspace [style*="margin-bottom: 2rem"],
    .tool-workspace [style*="margin-bottom:2rem"] {
        margin-bottom: 1rem !important;
    }

    .tool-workspace [style*="margin-left: 0.5rem"],
    .tool-workspace [style*="margin-left:0.5rem"],
    .tool-workspace [style*="margin-left: 1rem"],
    .tool-workspace [style*="margin-left:1rem"] {
        margin-left: 0 !important;
    }

    /* Botoes lado a lado em text-align center — empilhar */
    .tool-workspace [style*="text-align: center"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: center !important;
    }

    /* Max-width cards — expandir 100% no mobile */
    .tool-workspace .card,
    .tool-workspace [style*="max-width: 800px"],
    .tool-workspace [style*="max-width:800px"],
    .tool-workspace [style*="max-width: 600px"],
    .tool-workspace [style*="max-width:600px"] {
        max-width: 100% !important;
    }

    /* Textareas altura minima legivel */
    .tool-workspace textarea {
        min-height: 120px;
    }

    /* Tabelas responsivas */
    .tool-workspace table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.8rem;
    }

    /* Font-size gigantes inline */
    .tool-workspace [style*="font-size: 2rem"],
    .tool-workspace [style*="font-size:2rem"] {
        font-size: 1.4rem !important;
    }

    .tool-workspace [style*="font-size: 1.5rem"],
    .tool-workspace [style*="font-size:1.5rem"] {
        font-size: 1.1rem !important;
    }

    .tool-workspace [style*="font-size: 1.2rem"],
    .tool-workspace [style*="font-size:1.2rem"] {
        font-size: 1rem !important;
    }

    /* Padding 1.5rem inline — reduzir */
    .tool-workspace [style*="padding: 1.5rem"],
    .tool-workspace [style*="padding:1.5rem"] {
        padding: 0.75rem !important;
    }

    /* Margin 2rem inline — reduzir */
    .tool-workspace [style*="margin: 0 auto"] {
        margin: 0 !important;
    }

    /* Aspect ratio containers — limitar altura */
    .tool-workspace [style*="aspect-ratio"] {
        max-height: 250px;
    }

    /* ============================================
       MOBILE HOME — Sidebar como pagina principal
       ============================================ */
    .app-shell.mobile-home .main-content {
        display: none;
    }

    .app-shell.mobile-home .sidebar {
        display: flex;
        position: relative;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 100vh;
        border-right: none;
    }

    .app-shell.mobile-home .sidebar-logo {
        justify-content: center;
    }

    .app-shell.mobile-home .brand-badge {
        display: none;
    }

    .app-shell.mobile-home .sidebar-footer {
        display: none;
    }

    .app-shell.mobile-home .sidebar-nav {
        flex: 1;
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
    }

    .app-shell.mobile-home .nav-group summary {
        justify-content: flex-start;
        padding: 0.9rem 1rem;
    }

    .app-shell.mobile-home .nav-label {
        display: inline-block;
    }

    .app-shell.mobile-home .nav-group-links {
        padding-left: 0.5rem;
    }
}

/* MOBILE PEQUENO (celulares < 480px) */
@media (max-width: 480px) {
    .content-container {
        padding: 0.4rem;
    }

    .tool-workspace {
        padding: 0.4rem;
        border-radius: 6px;
    }

    .tool-header-section {
        margin-bottom: 0.6rem;
    }

    .tool-header-section h1 {
        font-size: 1.1rem;
    }

    .tool-description {
        font-size: 0.8rem;
    }

    .upload-area {
        padding: 1rem 0.6rem;
    }

    .upload-area h3 {
        font-size: 0.9rem;
    }

    .top-bar {
        padding: 0 0.4rem;
        height: 46px;
    }

    #currentPageTitle {
        max-width: 90px;
        font-size: 0.8rem;
    }

    /* Inputs da calculadora-regra3 ainda menores */
    .tool-workspace [style*="width: 100px"],
    .tool-workspace [style*="width:100px"] {
        width: 70px !important;
        padding: 0.5rem !important;
        font-size: 0.95rem !important;
    }

    /* Botoes ainda mais compactos */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Cards sem padding excessivo */
    .tool-workspace .card,
    .tool-workspace [style*="padding: 2rem"],
    .tool-workspace [style*="padding:2rem"] {
        padding: 0.5rem !important;
    }

    /* Gaps minimos */
    .tool-workspace [style*="gap: 2rem"],
    .tool-workspace [style*="gap:2rem"],
    .tool-workspace [style*="gap: 1.5rem"],
    .tool-workspace [style*="gap:1.5rem"],
    .tool-workspace [style*="gap: 1rem"],
    .tool-workspace [style*="gap:1rem"] {
        gap: 0.5rem !important;
    }
}

/* ===== FULLSCREEN TOOL MODE (FastCut Pro) ===== */
body.fullscreen-tool .sidebar,
body.fullscreen-tool .top-bar,
body.fullscreen-tool .footer,
body.fullscreen-tool .tool-header-section,
body.fullscreen-tool .tool-info-section {
    display: none !important;
}

body.fullscreen-tool .app-shell {
    grid-template-columns: 1fr !important;
}

body.fullscreen-tool .main-content {
    overflow: visible !important;
}

body.fullscreen-tool .content-container {
    padding: 0 !important;
    overflow: visible !important;
    height: 100vh !important;
}

body.fullscreen-tool .tool-view {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100vh !important;
}

body.fullscreen-tool .tool-workspace {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.fullscreen-tool {
    overflow: hidden !important;
    background: #0a0e14 !important;
}

body.fullscreen-tool #fastcut-wrapper,
body.fullscreen-tool #fastcut-wrapper #editor-shell {
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
}

/* Back button floating over FastCut Pro */
.fastcut-back-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fastcut-back-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Mobile notice for FastCut Pro */
.fastcut-mobile-notice {
    display: none;
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #ffc107;
}

@media (max-width: 968px) {
    .fastcut-mobile-notice {
        display: block;
    }
}

/* ===== DARK MODE — Override inline styles in tools ===== */
[data-theme="dark"] .tool-workspace .card,
[data-theme="dark"] .tool-workspace [style*="background: #fff"],
[data-theme="dark"] .tool-workspace [style*="background:#fff"],
[data-theme="dark"] .tool-workspace [style*="background: white"],
[data-theme="dark"] .tool-workspace [style*="background:white"] {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .tool-workspace [style*="background: #f8f9fa"],
[data-theme="dark"] .tool-workspace [style*="background:#f8f9fa"] {
    background: var(--bg-subtle) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .tool-workspace input[type="text"],
[data-theme="dark"] .tool-workspace input[type="number"],
[data-theme="dark"] .tool-workspace input[type="url"],
[data-theme="dark"] .tool-workspace input[type="email"],
[data-theme="dark"] .tool-workspace input[type="date"],
[data-theme="dark"] .tool-workspace textarea,
[data-theme="dark"] .tool-workspace select {
    background: var(--bg-subtle) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .tool-workspace label,
[data-theme="dark"] .tool-workspace span,
[data-theme="dark"] .tool-workspace p,
[data-theme="dark"] .tool-workspace h3,
[data-theme="dark"] .tool-workspace h4 {
    color: var(--text-primary);
}

[data-theme="dark"] .tool-workspace [style*="color: var(--text-secondary)"],
[data-theme="dark"] .tool-workspace [style*="color:var(--text-secondary)"] {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .tool-workspace .btn-outline {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .tool-workspace [style*="border: 1px solid var(--border)"],
[data-theme="dark"] .tool-workspace [style*="border:1px solid var(--border)"] {
    border-color: var(--border) !important;
}

[data-theme="dark"] .tool-workspace [style*="box-shadow"] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Dark mode for result-panel inside tools */
[data-theme="dark"] .result-panel {
    background: var(--bg-card) !important;
    border-color: var(--border) !important;
}

/* Dark mode for placeholder card (404) */
[data-theme="dark"] .placeholder-card {
    color: var(--text-primary);
}
