:root {
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --secondary: #e2e8f0;
    --text-main: #1e293b;
    --text-light: #64748b;
    --bg-page: #f8fafc;
    --bg-sidebar: #1e293b;
    /* Slate 800 */
    --border: #e2e8f0;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    /* Tailwind handles height/overflow for the shell */
}

/* App Layout Grid */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Sidebar */
.app-sidebar {
    background: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 2rem;
    gap: 2rem;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-menu {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    flex: 1;
    align-items: center;
}

/* Menu lateral compacto (app logada) */
.app-side-menu .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
}

.app-side-menu .nav-item {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.app-side-menu .nav-item.active {
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.app-side-menu .nav-item .material-symbols-outlined {
    font-size: 1.25rem;
    width: 1.25rem;
    flex-shrink: 0;
}

.nav-item {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: grid;
    place-items: center;
    font-weight: bold;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.user-info .role {
    font-size: 0.7rem;
}

/* Main Content */
.app-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
}



.content-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-page);
}

/* Views */
.view-section {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

/* View: Upload */
.upload-container {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.drop-zone {
    width: 100%;
    max-width: 600px;
    height: 400px;
    border: 3px dashed var(--secondary);
    border-radius: 24px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transition: all 0.2s;
}

.drop-zone.highlight {
    border-color: var(--primary);
    background: #eef2ff;
    transform: scale(1.02);
}

.drop-zone .icon-lg {
    font-size: 5rem;
    color: var(--primary);
    opacity: 0.2;
}

.drop-zone h3 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.drop-zone p {
    color: var(--text-light);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

/* View: Workspace */
.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    height: 100%;
}

.viewer-panel {
    background: #334155;
    /* Dark background for viewer */
    border-radius: var(--radius);
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.document-viewer {
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-height: max-content;
    width: max-content;
    transform-origin: top center;
}

.properties-panel {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.data-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f9fafb;
}

.panel-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Data Items */
.data-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: 0.2s;
}

.data-item:hover {
    border-color: var(--primary);
}

.item-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.delete-item-btn {
    border: none;
    background: none;
    color: #ef4444;
    cursor: pointer;
    font-weight: bold;
}

.item-value-input {
    width: 100%;
    padding: 0.4rem;
    font-size: 0.85rem;
    border: 1px solid var(--secondary);
    border-radius: 6px;
    font-family: inherit;
}

.item-value-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Documents List Grid */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Document List Item Styles */
.doc-list-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    min-height: 120px;
}

.doc-list-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
}

.doc-info {
    overflow: hidden;
}

.doc-name {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.doc-rename-input {
    width: 100%;
    padding: 4px;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--primary);
    border-radius: 4px;
    outline: none;
}

.doc-date {
    font-size: 0.75rem;
    color: var(--text-light);
}

.doc-actions {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.doc-list-item:hover .doc-actions {
    opacity: 1;
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-sm:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Popover ao selecionar texto no documento */
.selection-field-popover {
    position: absolute;
    z-index: 1100;
    min-width: 260px;
    max-width: 320px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
    animation: fadeIn 0.15s ease-out;
}

.selection-field-popover-title {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary, #2b8cee);
}

.selection-field-preview-wrap {
    margin: 0 0 10px;
    font-size: 0.75rem;
    color: var(--text-light, #64748b);
    line-height: 1.4;
}

.selection-field-preview {
    display: block;
    margin-top: 4px;
    padding: 6px 8px;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #334155;
    word-break: break-word;
    max-height: 4.5em;
    overflow: hidden;
}

.selection-field-popover .item-value-input {
    width: 100%;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.selection-field-popover-actions {
    display: flex;
    gap: 8px;
}

.selection-field-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* Word: permitir seleção no preview */
.document-viewer .docx-wrapper,
.document-viewer .docx-wrapper section,
.document-viewer .docx-wrapper p,
.document-viewer .docx-wrapper span,
.document-viewer .docx-wrapper td,
.document-viewer .docx-wrapper th {
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text;
}

.highlight-rect {
    position: absolute;
    /* Styles handled by JS mostly now */
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        display: none;
        /* Mobile menu needed but sticking to requested desktop redesign first */
    }

    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity 0.2s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid var(--border);
}

/* ==========================================
   ADMIN PANEL STYLES
   ========================================== */

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-icon span {
    font-size: 28px;
    vertical-align: middle;
}

.stat-icon.bg-indigo {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.stat-icon.bg-green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.bg-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-info h3 {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

.control-panel {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.admin-table-container {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 3rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.925rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background-color 0.15s;
}

.admin-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges styling */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-admin {
    background-color: #e0e7ff;
    color: #4338ca;
}

.badge-user {
    background-color: #f1f5f9;
    color: #475569;
}

.badge-active {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Action Buttons */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.825rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    min-width: 95px;
    text-decoration: none;
}

.btn-action-primary {
    background-color: var(--primary);
    color: white;
}

.btn-action-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-action-success {
    background-color: #10b981;
    color: white;
}

.btn-action-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-action-danger {
    background-color: transparent;
    border-color: #f87171;
    color: #ef4444;
}

.btn-action-danger:hover {
    background-color: #fef2f2;
    border-color: #ef4444;
}

.btn-action-disabled {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================
   TEMPLATE LIBRARY STYLES
   ========================================== */

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.template-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.template-card:hover {
    transform: translateY(-2px);
}

.use-template-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Badge variants for template categories */
.badge-profession {
    background-color: #eef2ff;
    color: #4338ca;
}

.badge-category {
    background-color: #f0fdf4;
    color: #166534;
}

.badge-category-psicologo {
    background-color: #fdf2f8;
    color: #9d174d;
}

.badge-category-contador {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-category-advogado {
    background-color: #ede9fe;
    color: #5b21b6;
}

.badge-category-medico {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Library filter bar */
.library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.library-filters .filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

.library-filters .filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.library-filters .filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Template empty state */
.templates-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.templates-empty .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.templates-empty h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.templates-empty p {
    font-size: 0.925rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Templates preview section */
.templates-preview-section {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.templates-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* Config workspace indicator */
.config-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Admin template form */
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .template-grid {
        grid-template-columns: 1fr;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .library-filters {
        flex-direction: column;
        align-items: stretch;
    }
}

/* === Credits system === */
.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    border-radius: 9999px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.credits-badge:hover {
    background: #e0e7ff;
}

.credits-badge.credits-low {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.credits-badge-icon {
    font-size: 1.1rem;
}

.plans-page {
    background: var(--bg-page);
    min-height: 100vh;
}

.plans-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.plans-header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.plans-header-inner h1 {
    flex: 1;
}

.plans-logout,
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: inherit;
}

.plans-logout:hover,
.btn-logout:hover {
    background: #fee2e2;
}

.nav-item-logout {
    border: none;
    background: none;
    font-family: inherit;
}

.plans-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.plans-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.plans-balance-card {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.25);
}

.plans-balance-card.credits-low {
    background: linear-gradient(135deg, #f97316, #ea580c);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.25);
}

.plans-balance-label {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.plans-balance-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.plans-balance-sub {
    opacity: 0.85;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

.plans-reload-btn {
    background: white !important;
    color: #4f46e5 !important;
}

.plans-section h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.plans-section-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.package-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.package-card h3 {
    font-size: 1rem;
    font-weight: 700;
}

.package-credits {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.package-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.package-period {
    font-size: 0.8rem;
    color: var(--text-light);
}

.package-buy-btn {
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
}

.plans-sub-active-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: white;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 1.25rem;
}

.plans-sub-active-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.plans-transactions {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.tx-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.tx-row:last-child {
    border-bottom: none;
}

.tx-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tx-icon.tx-positive {
    background: #dcfce7;
    color: #16a34a;
}

.tx-icon.tx-negative {
    background: #fee2e2;
    color: #dc2626;
}

.tx-info {
    flex: 1;
    min-width: 0;
}

.tx-desc {
    font-weight: 600;
    font-size: 0.9rem;
}

.tx-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.tx-amount {
    font-weight: 800;
    font-size: 1rem;
}

.tx-positive {
    color: #16a34a;
}

.tx-negative {
    color: #dc2626;
}

.tx-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.tx-badge-grant { background: #dbeafe; color: #1d4ed8; }
.tx-badge-purchase { background: #d1fae5; color: #047857; }
.tx-badge-subscription { background: #ede9fe; color: #6d28d9; }
.tx-badge-debit { background: #fee2e2; color: #b91c1c; }

.plans-loading, .plans-empty {
    color: var(--text-light);
    padding: 1.5rem;
    text-align: center;
}

.admin-credits-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-credits-tab {
    text-align: left;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-light);
}

.admin-credits-tab:hover {
    background: #f1f5f9;
}

.admin-credits-tab.active {
    background: #eef2ff;
    color: var(--primary);
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
}

/* Auth — Google login */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f3f4f6;
    padding: 1.5rem;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.security-notice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: #166534;
    line-height: 1.5;
}

.security-notice .material-icons-round {
    font-size: 1.5rem;
    color: #16a34a;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.auth-legacy-note {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: white;
    color: #3c4043;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-google:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-google svg {
    flex-shrink: 0;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 2.75rem;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-light);
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    line-height: 1;
}

.toggle-password .material-icons-round {
    font-size: 1.25rem;
}

/* LGPD / Legal */
.legal-page {
    background: var(--bg-page);
    min-height: 100vh;
}

.legal-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.legal-header h1 {
    font-size: 1.75rem;
    color: var(--text-main);
    margin: 0.5rem 0;
}

.legal-back {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.legal-meta {
    color: var(--text-light);
    font-size: 0.9rem;
}

.legal-section {
    margin-top: 1.5rem;
}

.legal-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.legal-section p {
    color: var(--text-light);
    line-height: 1.7;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.legal-table th,
.legal-table td {
    border: 1px solid var(--border);
    padding: 0.6rem 0.75rem;
    text-align: left;
}

.legal-list {
    padding-left: 1.25rem;
    color: var(--text-light);
    line-height: 1.7;
}

.lgpd-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.lgpd-banner-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.lgpd-banner a {
    color: #93c5fd;
}

.lgpd-banner-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
}

.consent-checkbox {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 1rem 0;
    cursor: pointer;
}

.consent-checkbox input {
    margin-top: 0.2rem;
}

.consent-checkbox a {
    color: var(--primary);
}

.auth-legal-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.auth-legal-links a {
    color: var(--text-light);
}

.btn-google:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lgpd-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.lgpd-panel-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lgpd-panel-brand h1 {
    font-size: 1.25rem;
}

.lgpd-panel-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lgpd-panel-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

.lgpd-intro {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.lgpd-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.lgpd-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.lgpd-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lgpd-form input {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.lgpd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.lgpd-details p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.lgpd-links {
    display: flex;
    gap: 1rem;
}

.lgpd-links a {
    color: var(--primary);
}

.lgpd-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lgpd-filters input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.lgpd-table-wrap {
    overflow-x: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger-outline {
    border-color: #dc2626;
    color: #dc2626;
}

.consent-modal-text {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.5rem;
    text-align: left;
}

.consent-modal-label {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-top: 1rem;
    cursor: pointer;
}

.consent-modal-label input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.consent-modal-label a {
    color: var(--primary);
}

/* Referral system */
.auth-referral-notice {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}

.referral-link-box {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.referral-link-input {
    flex: 1;
    min-width: 200px;
}

.referral-share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.referral-share-buttons .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.referral-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.referral-stat-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.referral-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

.referral-stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.plans-tx-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.plans-tx-item:last-child {
    border-bottom: none;
}

.plans-tx-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.plans-tx-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.plans-tx-amount.positive {
    color: #16a34a;
    font-weight: 700;
}

.referral-status {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.referral-status-completed {
    background: #dcfce7;
    color: #16a34a;
}

.referral-status-pending {
    background: #fef9c3;
    color: #a16207;
}

.referral-status-rejected {
    background: #fee2e2;
    color: #dc2626;
}

.referral-reason {
    color: #dc2626;
    font-size: 0.75rem;
}

.plans-loading,
.plans-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light);
}