:root {
    --bg-dark: #0a0e17;
    --bg-surface: #111827;
    --bg-card: #162032;
    --bg-card-hover: #1c2940;
    --border-color: #23324d;
    --border-glow: rgba(0, 240, 255, 0.2);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --cyan: #00f0ff;
    --cyan-dim: rgba(0, 240, 255, 0.12);
    --emerald: #10b981;
    --emerald-dim: rgba(16, 185, 129, 0.12);
    --amber: #f59e0b;
    --amber-dim: rgba(245, 158, 11, 0.12);
    --purple: #a855f7;
    --purple-dim: rgba(168, 85, 247, 0.12);
    --rose: #f43f5e;
    --rose-dim: rgba(244, 63, 94, 0.12);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
}

.brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--cyan);
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.brand-text {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding-left: 1.3rem;
}

.nav-menu {
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-item.active {
    color: var(--cyan);
    background: var(--cyan-dim);
    border: 1px solid rgba(0, 240, 255, 0.25);
}

.nav-item .badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.engine-indicator {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--cyan);
}

.engine-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cyan);
}

.engine-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1600px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.topbar-left h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    display: block;
}

.topbar-right {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--cyan);
    color: #050b14;
    border-color: var(--cyan);
}

.btn-primary:hover {
    background: #38f8ff;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
}

.btn-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--cyan);
}

/* Tab panes */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

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

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
    border-color: rgba(0, 240, 255, 0.3);
    transform: translateY(-2px);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.metric-icon {
    font-size: 1.2rem;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-mono);
    margin: 0.5rem 0 0.25rem;
    color: var(--text-primary);
}

.metric-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.category-bars {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cat-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.cat-bar-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.cat-progress {
    height: 8px;
    background: var(--bg-surface);
    border-radius: 999px;
    overflow: hidden;
}

.cat-fill {
    height: 100%;
    background: var(--cyan);
    border-radius: 999px;
    transition: width 0.5s ease;
}

.quick-actions .quick-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1rem;
}

/* Targets Grid */
.targets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.target-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: relative;
    transition: all 0.2s ease;
}

.target-card:hover {
    border-color: var(--border-glow);
}

.target-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.target-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.target-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-cyan { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0, 240, 255, 0.2); }
.badge-emerald { background: var(--emerald-dim); color: var(--emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-amber { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-rose { background: var(--rose-dim); color: var(--rose); border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168, 85, 247, 0.2); }

.target-url-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

.target-stats {
    display: flex;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.target-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 0.85rem;
    margin-top: auto;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 34px;
}
.slider:before {
    position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--cyan); }
input:checked + .slider:before { transform: translateX(18px); }

/* Data Tables */
.items-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.data-table th {
    background: var(--bg-surface);
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.btn-star {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
}

.btn-star.favorited {
    color: #eab308;
}

/* Filter pills & toolbar */
.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.pill:hover, .pill.active {
    background: var(--cyan-dim);
    color: var(--cyan);
    border-color: rgba(0, 240, 255, 0.3);
}

.search-box input, .input-search {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
}

.search-box input:focus, .input-search:focus {
    border-color: var(--cyan);
}

/* Playground Layout */
.playground-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--cyan);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-divider {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cyan);
    margin: 1.25rem 0 0.85rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
}

.lab-result-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.meta-chip {
    background: var(--bg-surface);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
}

.lab-output-area {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    max-height: 520px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.5rem;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.modal-lg {
    max-width: 850px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.presets-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.preset-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.15rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.preset-item:hover {
    border-color: var(--cyan);
}

.empty-state {
    padding: 2.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 200;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.25s ease-out;
}

.toast.toast-success { border-left: 4px solid var(--emerald); }
.toast.toast-error { border-left: 4px solid var(--rose); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Spinner */
.spin {
    animation: spin 1s infinite linear;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* Oportunidades (radar) */
.opps-summary { color: var(--text-secondary); font-size: 0.9rem; }
.opps-table td { vertical-align: top; }
.opp-strong { font-weight: 800; letter-spacing: 0.04em; }
.opp-deadline { font-family: var(--font-mono); font-size: 0.85rem; white-space: nowrap; }
.opp-urgent { color: var(--rose); font-weight: 700; }
.opp-value { font-family: var(--font-mono); color: var(--emerald); font-weight: 700; white-space: nowrap; }
.opp-new td { background: rgba(244, 63, 94, 0.04); }
