/* CertFlow Pro v2.0.0 - CSS Completo */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #3b82f6;
    --header-bg: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg-color); color: var(--text-color); font-size: 0.9375rem; line-height: 1.5; }
a { color: var(--primary-color); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Layout */
.main-app { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: 60px 1fr; min-height: 100vh; }

/* Header */
.header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: var(--header-bg); border-bottom: 1px solid var(--border-color); box-shadow: var(--shadow-sm); z-index: 100; position: sticky; top: 0; }
.header__left { display: flex; align-items: center; gap: 1rem; }
.header__brand { font-weight: 700; font-size: 1.1rem; color: var(--text-color); }
.header__center { flex: 1; max-width: 400px; margin: 0 2rem; }
.header__right { display: flex; align-items: center; gap: 1.5rem; }
.header__notification { position: relative; font-size: 1.2rem; cursor: pointer; }
.notification-badge { position: absolute; top: -8px; right: -10px; background: var(--danger-color); color: white; font-size: 0.65rem; padding: 1px 5px; border-radius: 10px; font-weight: 700; }
.header__user { text-align: right; line-height: 1.3; }
.header__user-name { display: block; font-weight: 600; font-size: 0.85rem; }
.header__user-role { display: block; font-size: 0.7rem; color: var(--text-secondary); }
.header__logout { color: var(--text-secondary); font-size: 0.85rem; padding: 0.4rem 0.8rem; border: 1px solid var(--border-color); border-radius: var(--radius); transition: var(--transition); }
.header__logout:hover { background: var(--danger-color); color: white; border-color: var(--danger-color); }
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* Quick Search */
.quick-search { display: flex; position: relative; }
.quick-search__input { width: 100%; padding: 0.5rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius); font-size: 0.85rem; background: var(--bg-color); transition: var(--transition); }
.quick-search__input:focus { outline: none; border-color: var(--primary-color); background: white; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.quick-search__btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 0.9rem; }

/* Sidebar */
.sidebar { grid-row: 2; background: var(--sidebar-bg); padding: 1.5rem 0; overflow-y: auto; position: sticky; top: 60px; height: calc(100vh - 60px); }
.sidebar__header { padding: 0 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 1rem; }
.sidebar__title { color: white; font-size: 1rem; font-weight: 700; }
.sidebar__version { color: var(--text-light); font-size: 0.7rem; }
.nav-menu { display: flex; flex-direction: column; }
.nav-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem; color: var(--sidebar-text); font-size: 0.85rem; transition: var(--transition); border-left: 3px solid transparent; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-link--active { background: rgba(59,130,246,0.15); color: white; border-left-color: var(--sidebar-active); font-weight: 600; }
.nav-link__icon { width: 20px; text-align: center; font-size: 1rem; }
.nav-separator { padding: 1rem 1.25rem 0.4rem; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); font-weight: 600; }
.nav-separator span { opacity: 0.7; }

/* Main Content */
.main-content { grid-row: 2; padding: 1.5rem 2rem; overflow-y: auto; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.content-header h1 { font-size: 1.5rem; font-weight: 700; }

/* Cards */
.card { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); margin-bottom: 1.5rem; transition: var(--transition); }
.card:hover { box-shadow: var(--shadow-md); }
.card__header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; gap: 0.75rem; }
.card__header h2, .card__header h3 { font-size: 1rem; font-weight: 600; }
.card__body { padding: 1.5rem; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card__icon { font-size: 2rem; }
.stat-card__content h3 { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-card__content p { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.15rem; }
.stat-card--success { border-left: 4px solid var(--success-color); }
.stat-card--warning { border-left: 4px solid var(--warning-color); }
.stat-card--danger { border-left: 4px solid var(--danger-color); }

/* Dashboard Two Col */
.dashboard-two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.quick-action-btn { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1rem; background: var(--bg-color); border-radius: var(--radius); transition: var(--transition); text-align: center; color: var(--text-color); font-size: 0.8rem; font-weight: 500; }
.quick-action-btn:hover { background: rgba(59,130,246,0.1); color: var(--primary-color); transform: translateY(-2px); }
.quick-action-btn__icon { font-size: 1.5rem; }

/* Agenda Item */
.agenda-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); }
.agenda-item:last-child { border-bottom: none; }
.agenda-item__date { text-align: center; min-width: 50px; }
.agenda-item__date strong { display: block; font-size: 0.85rem; }
.agenda-item__date small { color: var(--text-secondary); font-size: 0.7rem; }
.agenda-item__content { flex: 1; }
.agenda-item__content strong { font-size: 0.85rem; }
.agenda-item__content small { color: var(--text-secondary); }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table th { font-weight: 600; color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; background: var(--bg-color); }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(59,130,246,0.04); }
.table--compact th, .table--compact td { padding: 0.5rem 0.75rem; }

/* Row colors */
.row-ok { background: rgba(16,185,129,0.04); }
.row-attention { background: rgba(245,158,11,0.06); }
.row-warning { background: rgba(245,158,11,0.12); }
.row-urgent { background: rgba(239,68,68,0.1); }
.row-expired { background: rgba(239,68,68,0.06); opacity: 0.7; }
.row-danger { background: rgba(239,68,68,0.1); }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge--primary { background: rgba(59,130,246,0.1); color: #2563eb; }
.badge--success { background: rgba(16,185,129,0.1); color: #059669; }
.badge--warning { background: rgba(245,158,11,0.1); color: #d97706; }
.badge--danger { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge--default { background: var(--bg-color); color: var(--text-secondary); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border: 1px solid transparent; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: var(--transition); text-decoration: none; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn--primary { background: var(--primary-color); color: white; }
.btn--primary:hover { background: var(--primary-dark); color: white; }
.btn--outline { background: transparent; border-color: var(--border-color); color: var(--text-color); }
.btn--outline:hover { border-color: var(--primary-color); color: var(--primary-color); background: rgba(59,130,246,0.04); }
.btn--sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn--full-width { width: 100%; }
.action-buttons { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* WhatsApp Button */
.whatsapp-btn { background: #25d366; color: white !important; border-color: #25d366; }
.whatsapp-btn:hover { background: #128c7e; border-color: #128c7e; color: white !important; }
.whatsapp-btn-inline { display: inline-flex; align-items: center; padding: 0.1rem 0.3rem; background: #25d366; color: white !important; border-radius: 4px; font-size: 0.7rem; margin-left: 0.35rem; transition: var(--transition); }
.whatsapp-btn-inline:hover { background: #128c7e; color: white !important; }

/* Forms */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.form-group { margin-bottom: 0.75rem; }
.form-label { display: block; margin-bottom: 0.35rem; font-weight: 500; font-size: 0.85rem; color: var(--text-color); }
.form-label.required::after { content: ' *'; color: var(--danger-color); }
.form-control { width: 100%; padding: 0.55rem 0.85rem; border: 1px solid var(--border-color); border-radius: var(--radius); font-size: 0.85rem; transition: var(--transition); background: white; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
select.form-control { appearance: auto; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }

/* Filters / Search */
.search-form, .filter-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.search-form .form-control, .filter-form .form-control { max-width: 200px; padding: 0.4rem 0.75rem; }

/* Alerts */
.alert { padding: 0.85rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: 0.85rem; font-weight: 500; }
.alert--success { background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.alert--error { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }
.alert--warning { background: rgba(245,158,11,0.1); color: #d97706; border: 1px solid rgba(245,158,11,0.2); }

/* Client Info Grid */
.client-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.info-item label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 0.2rem; }
.info-item span { font-size: 0.9rem; }
.notes-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.notes-section h4 { margin-bottom: 0.5rem; }

/* Contacts */
.contacts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.contact-card { padding: 1rem; background: var(--bg-color); border-radius: var(--radius); border: 1px solid var(--border-color); font-size: 0.85rem; }

/* Activity / Timeline */
.activity-list { display: flex; flex-direction: column; }
.activity-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); }
.activity-item:last-child { border-bottom: none; }
.activity-item__content p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.15rem; }
.activity-item__content small { color: var(--text-light); font-size: 0.75rem; }
.history-timeline { display: flex; flex-direction: column; gap: 0.5rem; }
.timeline-item { display: flex; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.timeline-item:last-child { border-bottom: none; }
.timeline-item__date { min-width: 120px; color: var(--text-secondary); font-size: 0.8rem; }
.timeline-item__content p { color: var(--text-secondary); font-size: 0.85rem; }
.timeline-item__content small { color: var(--text-light); }

/* Calendar */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border-color); border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; }
.calendar-header { background: var(--sidebar-bg); color: white; padding: 0.5rem; text-align: center; font-size: 0.75rem; font-weight: 600; }
.calendar-day { background: white; min-height: 80px; padding: 0.35rem; font-size: 0.8rem; position: relative; }
.calendar-day--empty { background: var(--bg-color); }
.calendar-day--today { background: rgba(59,130,246,0.06); }
.calendar-day--today .calendar-day__number { background: var(--primary-color); color: white; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.calendar-day__number { font-weight: 600; font-size: 0.8rem; color: var(--text-color); }
.calendar-event { cursor: default; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.pagination__info { font-size: 0.85rem; color: var(--text-secondary); }

/* Settings */
.settings-section { margin-bottom: 1.5rem; }
.settings-section .card__body { padding: 1.5rem; }

/* Text helpers */
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.empty-state { text-align: center; padding: 2rem; color: var(--text-secondary); font-size: 0.9rem; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a5f 0%, #3b82f6 50%, #6366f1 100%); padding: 2rem; }
.login-container { width: 100%; max-width: 420px; }
.login-card { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.login-card .card__body { padding: 2.5rem; }
.login-logo { text-align: center; margin-bottom: 0.5rem; }
.login-logo__icon { font-size: 3rem; margin-bottom: 0.5rem; }
.login-title { font-size: 1.5rem; font-weight: 700; color: var(--text-color); }
.login-form .form-group { margin-bottom: 1rem; }
.login-form .btn { margin-top: 0.5rem; padding: 0.75rem; font-size: 1rem; }
.system-info { text-align: center; margin-top: 1rem; }

/* Print */
@media print { .no-print { display: none !important; } .sidebar, .header { display: none !important; } .main-app { display: block; } .main-content { padding: 0; } }

/* Responsive */
@media (max-width: 768px) {
    .main-app { grid-template-columns: 1fr; }
    .sidebar { display: none; position: fixed; top: 60px; left: 0; width: 250px; height: calc(100vh - 60px); z-index: 999; }
    .sidebar--active { display: block; }
    .sidebar-toggle { display: block; }
    .header__center { display: none; }
    .dashboard-two-col, .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .content-header { flex-direction: column; align-items: flex-start; }
    .filter-form { flex-direction: column; width: 100%; }
    .filter-form .form-control { max-width: 100%; }
    .calendar-day { min-height: 50px; }
}