/* Knowpill Legal Hub — extracted from legal.html */

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

        :root {
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --primary-light: #60A5FA;
            --secondary: #00D9B8;
            --dark: #0F0F1E;
            --text: #1A1A2E;
            --text-light: #6B7280;
            --bg: #FFFFFF;
            --bg-alt: #FFF5F8;
            --border: #FFE5EE;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
            line-height: 1.6;
            color: var(--text);
            background: var(--bg);
        }

        header {
            position: fixed;
            top: 0;
            width: 100%;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            z-index: 1000;
            border-bottom: 1px solid var(--border);
        }

        .nav-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 1.2rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            transition: all 0.3s;
            text-decoration: none;
        }

        .logo img {
            height: 40px;
            width: auto;
            transition: all 0.3s ease;
        }

        .logo:hover img {
            filter: drop-shadow(0 4px 12px rgba(255, 107, 157, 0.4));
        }

        .logo-text {
            font-size: 1.6rem;
            font-weight: 900;
            background: linear-gradient(135deg, var(--primary), var(--primary-light));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        nav {
            display: flex;
            gap: 2rem;
            align-items: center;
        }

        nav a {
            text-decoration: none;
            color: var(--text);
            font-weight: 500;
            transition: color 0.3s;
        }

        nav a:hover {
            color: var(--primary);
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--primary), var(--primary-light));
            color: white !important;
            padding: 0.75rem 2rem;
            border-radius: 12px;
            text-decoration: none;
            font-weight: 600;
            transition: transform 0.3s, box-shadow 0.3s;
            box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 25px rgba(255, 107, 157, 0.4);
        }

        .theme-toggle {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--bg-alt);
            border: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s;
            font-size: 1.2rem;
            margin-left: 1rem;
        }

        .theme-toggle:hover {
            background: var(--primary);
            color: white;
            transform: scale(1.1);
        }

        .legal-hero {
            padding: 140px 2rem 80px;
            background: linear-gradient(135deg, #E8E9FE 0%, #D8D9FE 100%);
            position: relative;
            overflow: hidden;
        }

        .legal-hero::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -20%;
            width: 800px;
            height: 800px;
            background: radial-gradient(circle, rgba(255, 107, 157, 0.1) 0%, transparent 70%);
            border-radius: 50%;
        }

        .hero-container {
            max-width: 1200px;
            margin: 0 auto;
            text-align: center;
            position: relative;
            z-index: 1;
        }

        .legal-badge {
            display: inline-block;
            background: rgba(255, 107, 157, 0.15);
            color: var(--primary);
            padding: 0.5rem 1.5rem;
            border-radius: 50px;
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 1.5rem;
        }

        h1 {
            font-size: 3.5rem;
            font-weight: 800;
            line-height: 1.2;
            margin-bottom: 1.5rem;
            color: var(--text);
        }

        .hero-subtitle {
            font-size: 1.3rem;
            color: var(--text-light);
            max-width: 800px;
            margin: 0 auto;
            line-height: 1.8;
        }

        .legal-section {
            padding: 100px 2rem;
            background: white;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
        }

        .section-title {
            font-size: 2.5rem;
            font-weight: 800;
            text-align: center;
            margin-bottom: 3rem;
            color: var(--text);
        }

        .legal-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
            gap: 2rem;
            margin-bottom: 3rem;
        }

        .legal-card {
            background: var(--bg-alt);
            padding: 2.5rem;
            border-radius: 20px;
            border-left: 4px solid var(--primary);
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .legal-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 100%;
            background: linear-gradient(135deg, rgba(255, 107, 157, 0.05) 0%, transparent 100%);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .legal-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 20px 40px rgba(255, 107, 157, 0.15);
        }

        .legal-card:hover::before {
            opacity: 1;
        }

        .legal-card-icon {
            font-size: 3rem;
            margin-bottom: 1.5rem;
            display: block;
            position: relative;
            z-index: 1;
        }

        .legal-card h3 {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 1rem;
            position: relative;
            z-index: 1;
        }

        .legal-card p {
            font-size: 1rem;
            color: var(--text-light);
            line-height: 1.6;
            position: relative;
            z-index: 1;
        }

        .footer-section {
            padding: 60px 2rem;
            background: linear-gradient(135deg, var(--dark) 0%, #1A1A3E 100%);
            color: white;
            text-align: center;
        }

        .footer-content {
            max-width: 900px;
            margin: 0 auto;
        }

        .footer-title {
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 1.5rem;
        }

        .footer-text {
            font-size: 1rem;
            opacity: 0.9;
            margin-bottom: 2rem;
            line-height: 1.8;
        }

        .footer-links {
            display: flex;
            justify-content: center;
            gap: 2rem;
            flex-wrap: wrap;
            margin-bottom: 2rem;
        }

        .footer-links a {
            color: white;
            text-decoration: none;
            font-weight: 600;
            opacity: 0.9;
            transition: all 0.3s ease;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.1);
        }

        .footer-links a:hover {
            opacity: 1;
            background: rgba(255, 255, 255, 0.2);
            transform: translateY(-2px);
        }

        .copyright {
            font-size: 0.9rem;
            opacity: 0.7;
            margin-top: 2rem;
            padding-top: 2rem;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        /* ── Modal Markdown ── */
        .md-modal {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.85);
            z-index: 9999;
            padding: 20px;
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to   { opacity: 1; }
        }

        .md-modal.active {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .md-modal-content {
            background: white;
            border-radius: 20px;
            width: 100%;
            max-width: 860px;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            overflow: hidden;
        }

        @keyframes slideUp {
            from { transform: translateY(50px); opacity: 0; }
            to   { transform: translateY(0);    opacity: 1; }
        }

        .md-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1.5rem 2rem;
            border-bottom: 2px solid var(--border);
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
            flex-shrink: 0;
        }

        .md-modal-header h2 {
            margin: 0;
            font-size: 1.5rem;
            font-weight: 700;
            color: white;
        }

        .md-modal-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            font-size: 2rem;
            cursor: pointer;
            color: white;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            transition: all 0.3s ease;
            backdrop-filter: blur(10px);
        }

        .md-modal-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: rotate(90deg);
        }

        .md-modal-body {
            flex: 1;
            overflow-y: auto;
            padding: 2.5rem 3rem;
            background: #f9fafb;
        }

        .md-modal-body::-webkit-scrollbar { width: 4px; }
        .md-modal-body::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 99px;
        }

        /* Estado: carregando */
        .md-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 16px;
            min-height: 200px;
            color: var(--text-light);
            font-size: 14px;
        }

        .md-spinner {
            width: 28px;
            height: 28px;
            border: 3px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: md-spin 0.7s linear infinite;
        }

        @keyframes md-spin { to { transform: rotate(360deg); } }

        /* Estado: erro */
        .md-error {
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 12px;
            min-height: 200px;
            color: var(--text-light);
            font-size: 14px;
        }

        .md-error-icon { font-size: 36px; }

        .md-retry {
            padding: 8px 20px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: white;
            cursor: pointer;
            font-size: 13px;
            color: var(--primary);
            font-weight: 600;
            transition: background 0.15s;
        }

        .md-retry:hover { background: var(--bg-alt); }

        /* ── Conteúdo Markdown renderizado ── */
        .md-article {
            display: none;
            max-width: 72ch;
            margin: 0 auto;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
            color: var(--text);
            line-height: 1.75;
            font-size: 15px;
        }

        .md-article h1 { font-size: 28px; font-weight: 800; margin: 0 0 8px; line-height: 1.25; color: var(--text); }
        .md-article h2 {
            font-size: 19px; font-weight: 700; margin: 36px 0 12px;
            padding-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text);
        }
        .md-article h3 { font-size: 15px; font-weight: 700; margin: 24px 0 8px; color: var(--text); }
        .md-article h4, .md-article h5, .md-article h6 { font-size: 14px; font-weight: 600; margin: 20px 0 6px; color: var(--text-light); }
        .md-article p  { margin: 0 0 16px; }
        .md-article a  { color: var(--primary); text-decoration: none; font-weight: 500; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
        .md-article a:hover { border-bottom-color: var(--primary); }
        .md-article ul, .md-article ol { margin: 0 0 16px; padding-left: 24px; }
        .md-article li { margin-bottom: 6px; }
        .md-article blockquote {
            margin: 20px 0; padding: 14px 18px;
            border-left: 3px solid var(--primary);
            background: rgba(37, 99, 235, 0.05);
            border-radius: 0 8px 8px 0;
            color: var(--text-light); font-style: italic;
        }
        .md-article hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
        .md-article img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); margin: 16px 0; display: block; }
        .md-article table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
        .md-article th { text-align: left; font-weight: 700; padding: 10px 14px; background: #f1f5f9; border: 1px solid var(--border); }
        .md-article td { padding: 9px 14px; border: 1px solid var(--border); color: var(--text-light); }
        .md-article tr:hover td { background: rgba(37, 99, 235, 0.03); }
        .md-article code {
            background: #f1f5f9; border: 1px solid var(--border);
            border-radius: 4px; padding: 1px 6px; font-size: 0.875em;
            font-family: 'SF Mono','Fira Code', monospace; color: #e11d48;
        }
        .md-article pre {
            background: #1e1e2e; border-radius: 8px; padding: 20px;
            overflow-x: auto; margin: 20px 0; font-size: 13px; line-height: 1.6;
        }
        .md-article pre code {
            font-family: 'SF Mono','Fira Code', monospace; color: #cdd6f4;
            background: none; border: none; padding: 0; font-size: inherit;
        }

        /* TOC */
        .md-toc {
            background: white;
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 16px 18px;
            margin: 20px 0 32px;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 2px;
            min-width: 200px;
        }
        .md-toc-title {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-light);
            margin-bottom: 8px;
            width: 100%;
            text-align: left;
        }
        .md-toc-link {
            font-size: 13px;
            color: var(--text-light);
            text-decoration: none;
            padding: 3px 0;
            text-align: left;
            width: 100%;
            transition: color 0.12s;
            border: none !important;
        }
        .md-toc-link:hover { color: var(--primary); }
        .md-toc-sub {
            padding-left: 14px;
            font-size: 12px;
            text-align: left;
        }

        /* Anchor links */
        .md-anchor { opacity: 0; margin-left: 8px; font-size: 0.8em; color: var(--text-light); text-decoration: none; border: none !important; transition: opacity 0.15s; }
        .md-article h1:hover .md-anchor,
        .md-article h2:hover .md-anchor,
        .md-article h3:hover .md-anchor { opacity: 1; }

        @media (max-width: 768px) {
            h1 { font-size: 2.5rem; }
            .section-title { font-size: 2rem; }
            nav { display: none; }
            .legal-grid { grid-template-columns: 1fr; }
            .md-modal-content { max-height: 95vh; border-radius: 16px; }
            .md-modal-header  { padding: 1.25rem 1.5rem; }
            .md-modal-header h2 { font-size: 1.25rem; }
            .md-modal-body    { padding: 1.5rem; }
        }


/* Dark mode for legal hub */
html[data-theme="dark"] {
  color-scheme: dark;
  --primary: #60A5FA;
  --primary-dark: #3B82F6;
  --primary-light: #93C5FD;
  --dark: #0a0e1a;
  --text: #f1f5f9;
  --text-light: #94a3b8;
  --bg: #0a0e1a;
  --bg-alt: #141b2d;
  --border: rgba(148,163,184,.16);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] header {
  background: rgba(10,14,26,.95) !important;
  border-bottom-color: var(--border) !important;
}
html[data-theme="dark"] .legal-hero {
  background: linear-gradient(135deg, #0a0e1a 0%, #141b2d 100%);
}
html[data-theme="dark"] .legal-card {
  background: var(--bg-alt);
  border-color: var(--border);
}
html[data-theme="dark"] .md-modal-content {
  background: var(--bg-alt);
  color: var(--text);
}
html[data-theme="dark"] .md-modal-body {
  background: #0f1524;
}
html[data-theme="dark"] .footer-section {
  background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
}
