/* ============================================================
   ACTIVOSPRO - SISTEMA DE ACTIVOS FIJOS
   Tema: Light Professional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg:        #F1F5F9;
    --surface:   #FFFFFF;
    --surface2:  #F8FAFC;
    --surface3:  #F1F5F9;
    --border:    #E2E8F0;
    --border2:   #CBD5E1;
    --accent:    #2563EB;
    --accent-h:  #1D4ED8;
    --accent2:   #7C3AED;
    --success:   #059669;
    --warning:   #D97706;
    --danger:    #DC2626;
    --info:      #0891B2;
    --text:      #0F172A;
    --text-sub:  #475569;
    --text-muted:#94A3B8;
    --mono:      'JetBrains Mono', monospace;
    --sans:      'DM Sans', sans-serif;
    --radius:    10px;
    --radius-lg: 16px;
    --shadow:    0 1px 8px rgba(15,23,42,0.08);
    --shadow-lg: 0 4px 24px rgba(15,23,42,0.12);
    --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}

.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }
.logo-text span { color: var(--accent); }
.logo-version { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.sidebar-company {
    padding: 14px 20px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-sub);
}
.sidebar-company strong { display: block; color: var(--text); font-size: 13px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-group-title {
    padding: 10px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: var(--text-sub);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--accent); background: rgba(37,99,235,0.06); border-left-color: var(--accent); }
.nav-link .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-link .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 20px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
    background: var(--surface2);
}

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: white;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* TOPBAR */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 16px; font-weight: 600; color: var(--text); }
.breadcrumb { font-size: 12px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
    width: 36px; height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-sub); font-size: 16px;
    text-decoration: none; transition: all 0.2s; position: relative;
}
.topbar-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }

.alert-dot {
    position: absolute; top: -2px; right: -2px;
    width: 8px; height: 8px;
    background: var(--danger); border-radius: 50%;
    border: 2px solid var(--surface);
}

/* PAGE CONTENT */
.page-content { padding: 28px; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    background: var(--surface);
}

.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface2); }

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex; align-items: flex-start; gap: 16px;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue   { background: rgba(37,99,235,0.1); }
.stat-icon.green  { background: rgba(5,150,105,0.1); }
.stat-icon.orange { background: rgba(217,119,6,0.1); }
.stat-icon.red    { background: rgba(220,38,38,0.1); }
.stat-icon.purple { background: rgba(124,58,237,0.1); }
.stat-icon.teal   { background: rgba(8,145,178,0.1); }
.stat-icon.gray   { background: rgba(100,116,139,0.1); }

.stat-value { font-size: 26px; font-weight: 700; line-height: 1; font-family: var(--mono); color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--surface2);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
    color: var(--text);
}

tbody tr:hover { background: rgba(37,99,235,0.03); }
tbody tr:last-child td { border-bottom: none; }

.td-code  { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }
.td-name  { font-weight: 500; }
.td-money { font-family: var(--mono); font-size: 13px; text-align: right; }
.td-pct   { font-family: var(--mono); font-size: 12px; text-align: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid   { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

label { font-size: 12px; font-weight: 600; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.5px; }
label .required { color: var(--danger); }

input, select, textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input::placeholder { color: var(--text-muted); }
select option { background: var(--surface); color: var(--text); }
textarea { min-height: 100px; resize: vertical; }

.form-hint  { font-size: 11px; color: var(--text-muted); }
.form-error { font-size: 11px; color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); box-shadow: 0 2px 8px rgba(37,99,235,0.3); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #B91C1C; }

.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-warning:hover { background: #B45309; }

.btn-secondary {
    background: var(--surface);
    color: var(--text-sub);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }

.btn-ghost { background: transparent; color: var(--text-sub); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap; line-height: 1.4;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #CFFAFE; color: #155E75; }
.badge-blue    { background: #DBEAFE; color: #1E40AF; }
.badge-purple  { background: #EDE9FE; color: #5B21B6; }
.badge-gray    { background: #F1F5F9; color: #475569; border: 1px solid var(--border); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert-box {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13.5px;
    border-left: 4px solid;
    display: flex; align-items: flex-start; gap: 10px;
}
.alert-box.success { background: #F0FDF4; border-color: var(--success); color: #166534; }
.alert-box.danger  { background: #FFF1F1; border-color: var(--danger);  color: #991B1B; }
.alert-box.warning { background: #FFFBEB; border-color: var(--warning); color: #92400E; }
.alert-box.info    { background: #F0F9FF; border-color: var(--info);    color: #155E75; }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
    width: 100%; background: var(--surface3);
    border-radius: 999px; overflow: hidden;
    height: 8px;
}
.progress-bar { height: 100%; border-radius: 999px; transition: width 0.5s; }
.progress-bar.green  { background: var(--success); }
.progress-bar.yellow { background: var(--warning); }
.progress-bar.red    { background: var(--danger); }
.progress-bar.blue   { background: var(--accent); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-backdrop.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 720px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    transform: scale(0.95); transition: transform 0.2s;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.modal-backdrop.active .modal { transform: scale(1); }
.modal-lg { max-width: 960px; }
.modal-sm { max-width: 480px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
    width: 32px; height: 32px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-sub); font-size: 18px;
    transition: all 0.2s;
}
.modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }
.modal-body   { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface2); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 16px 0 0; }
.page-btn {
    width: 34px; height: 34px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; cursor: pointer; text-decoration: none;
    color: var(--text-sub); transition: all 0.2s;
}
.page-btn:hover, .page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ============================================================
   QR DISPLAY
   ============================================================ */
.qr-container {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.qr-container img { width: 160px; height: 160px; }
.qr-label { font-size: 11px; color: #333; font-weight: 600; text-align: center; max-width: 160px; }

/* ============================================================
   DEPRECIATION CHART
   ============================================================ */
.dep-bar {
    height: 12px; background: var(--surface3);
    border-radius: 999px; overflow: hidden;
    position: relative; margin: 4px 0;
}
.dep-fill {
    height: 100%; border-radius: 999px;
    transition: width 0.5s;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
}

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */
.search-bar {
    display: flex; gap: 12px; align-items: center;
    flex-wrap: wrap; margin-bottom: 20px;
}
.search-input-wrap {
    position: relative; flex: 1; min-width: 220px;
}
.search-input-wrap input { padding-left: 38px; }
.search-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 16px; pointer-events: none;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%; max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 32px; margin-bottom: 16px;
}
.login-title    { font-size: 24px; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.login-roles {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 20px;
    font-size: 12px;
}
.login-roles p { font-weight: 600; margin-bottom: 6px; color: var(--text-sub); }
.login-roles code {
    font-family: var(--mono); font-size: 11px;
    background: #DBEAFE; color: #1E40AF;
    padding: 1px 6px; border-radius: 4px;
}

/* ============================================================
   DASHBOARD SPECIFICS
   ============================================================ */
.dash-grid   { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.dash-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

.timeline-item {
    display: flex; gap: 14px; padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    width: 10px; height: 10px; border-radius: 50%;
    margin-top: 5px; flex-shrink: 0;
}
.timeline-dot.green  { background: var(--success); }
.timeline-dot.yellow { background: var(--warning); }
.timeline-dot.red    { background: var(--danger); }
.timeline-dot.blue   { background: var(--accent); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 500; color: var(--text); }
.timeline-date  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .dash-grid { grid-template-columns: 1fr; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
}

/* ============================================================
   MISC
   ============================================================ */
.divider    { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-sub   { color: var(--text-sub); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.mono   { font-family: var(--mono); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* Tooltip */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%);
    background: var(--text); color: white;
    font-size: 11px; padding: 4px 10px;
    border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
    z-index: 1000;
}
[data-tooltip]:hover::after { opacity: 1; }

/* Print */
@media print {
    .sidebar, .topbar, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    body { background: white; color: black; }
    .card { border: 1px solid #ddd; box-shadow: none; }
    table, th, td { color: black; border-color: #ddd; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
