/* CenterYou CRM — Main Stylesheet */
:root {
  --primary: #0f3460;
  --primary-light: #1a4f8a;
  --accent: #e94560;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0ea5e9;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --sidebar-w: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* SIDEBAR */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--primary); display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo-text { font-size: 22px; font-weight: 700; color: #fff; }
.logo-text span { color: #e94560; }
.sidebar-logo small { display: block; color: #a8c0de; font-size: 11px; margin-top: 2px; }
.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-links li a {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px;
  color: #a8c0de; text-decoration: none; font-size: 14px; font-weight: 500;
  transition: all 0.2s; border-left: 3px solid transparent;
}
.nav-links li a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.nav-links li a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-links li a.active { color: #fff; background: rgba(255,255,255,0.12); border-left-color: #e94560; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn { display: flex; align-items: center; gap: 8px; color: #a8c0de; text-decoration: none; font-size: 13px; }
.logout-btn:hover { color: #fff; }
.logout-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); padding: 28px 32px; min-height: 100vh; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* CARDS */
.card { background: var(--card-bg); border-radius: 12px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { font-size: 16px; font-weight: 600; }
.link-sm { font-size: 13px; color: var(--primary); text-decoration: none; }
.link-sm:hover { text-decoration: underline; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: 12px; padding: 18px 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.stat-card-danger { border-left: 4px solid var(--danger); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* TWO COL */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all 0.2s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); background: #f8fafc; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1da851; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 5px; text-decoration: none; transition: background 0.15s; }
.btn-icon:hover { background: var(--bg); }

/* TABLES */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--border); background: #f8fafc; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-hover tr:hover td { background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }
.actions-cell { white-space: nowrap; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: capitalize; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-lg { font-size: 13px; padding: 4px 14px; }

/* FORMS */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
}
.form-section { margin-bottom: 24px; }
.form-section h3 { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* SEARCH */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 13px; }
.select-sm { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 13px; }

/* TABS */
.tab-filters { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-btn { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* INVOICE */
.invoice-item-row { display: grid; grid-template-columns: 1fr 80px 120px 80px 30px; gap: 8px; align-items: center; margin-bottom: 8px; }
.invoice-item-row input { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 13px; }
.item-total { font-weight: 600; text-align: right; color: var(--primary); }
.totals-block { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.totals-block .form-group { min-width: 120px; }
.total-display { display: flex; flex-direction: column; gap: 4px; margin-left: auto; text-align: right; }
.service-quick-add { background: #f8fafc; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.tag-btn { background: #dbeafe; color: #1e40af; border: none; padding: 4px 10px; border-radius: 99px; font-size: 12px; cursor: pointer; margin: 3px; }
.tag-btn:hover { background: #bfdbfe; }

/* INVOICE PREVIEW */
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--primary); }
.inv-brand { font-size: 24px; font-weight: 800; color: var(--primary); }
.inv-meta p { font-size: 13px; margin: 3px 0; }
.inv-parties { margin-bottom: 20px; }
.inv-parties h4 { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.inv-totals { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.inv-total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.inv-total-final { font-size: 16px; font-weight: 700; color: var(--primary); border-top: 2px solid var(--primary); margin-top: 8px; padding-top: 8px; }

/* INFO TABLE */
.info-table { width: 100%; font-size: 13px; }
.info-table tr td:first-child { font-weight: 600; color: var(--text-muted); width: 35%; padding: 6px 0; }
.info-table tr td { padding: 6px 0; border-bottom: 1px solid var(--bg); vertical-align: top; }

/* NOTES BOX */
.notes-box { background: #fffbeb; border-left: 3px solid var(--warning); padding: 10px 14px; border-radius: 0 6px 6px 0; margin-top: 14px; font-size: 13px; color: #92400e; }

/* PAYMENT ROW */
.payment-row { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.payment-row:last-child { border-bottom: none; }
.payment-row small { color: var(--text-muted); }

/* TIMELINE */
.timeline { padding-left: 16px; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline-item:last-child { border-bottom: none; }
.timeline-type { background: #dbeafe; color: #1e40af; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; height: fit-content; white-space: nowrap; }
.timeline-content p { color: var(--text-muted); margin: 4px 0 0; }
.timeline-content small { color: #94a3b8; }

/* QUICK ACTIONS */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-action-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--text); transition: all 0.2s; }
.quick-action-btn:hover { border-color: var(--primary); background: #dbeafe; color: var(--primary); }

/* INLINE FORM */
.inline-form { background: #f8fafc; border: 1.5px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.hidden { display: none !important; }

/* MODAL */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-content { background: #fff; border-radius: 12px; padding: 28px; max-width: 420px; width: 90%; }
.modal-content h3 { margin-bottom: 18px; font-size: 17px; }

/* ALERTS */
.alert { padding: 10px 14px; border-radius: 7px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* EMPTY STATE */
.empty-state { text-align: center; color: var(--text-muted); padding: 28px 0; font-size: 13px; }

/* LOGIN PAGE */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f3460, #1a4f8a); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 28px; font-weight: 800; color: var(--primary); }
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-footer { text-align: center; color: #94a3b8; font-size: 11px; margin-top: 20px; }

/* RESPONSIVE */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .invoice-item-row { grid-template-columns: 1fr 60px 100px 60px 24px; }
}
