/* ============================================================
   EML CRM — Global Stylesheet
   Design: Red accent (#e31b23), Inter font, rounded cards
   ============================================================ */

/* RESET */
* {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
   font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
   background: #eef0f4;
   height: 100vh;
   display: flex;
   padding: 0;
   margin: 0;
   overflow: hidden;
}

body.login-page,
body.login-body {
   background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
   justify-content: center;
   align-items: center;
   padding: 20px;
   overflow: auto;
}

.app-container {
   width: 100%;
   height: 100vh;
   background: #fff;
   display: flex;
   overflow: hidden;
   transition: all .2s ease;
}

/* SIDEBAR */
.sidebar {
   background: #fff;
   color: #2b2b2b;
   display: flex;
   flex-direction: column;
   transition: width .25s cubic-bezier(.2, 0, 0, 1);
   height: 100%;
   overflow-y: auto;
   overflow-x: hidden;
   border-right: 1px solid #f0f0f0;
   box-shadow: 4px 0 20px rgba(0, 0, 0, .01);
}

.sidebar.full {
   width: 280px;
}

.sidebar.min {
   width: 96px;
}

.sidebar.hide {
   width: 0;
   padding: 0;
   opacity: 0;
   pointer-events: none;
}

.sidebar-inner {
   padding: 24px 18px;
   display: flex;
   flex-direction: column;
   height: 100%;
   white-space: nowrap;
   gap: 4px;
}

.sidebar.hide .sidebar-inner {
   display: none;
}

.logo-area {
   display: flex;
   align-items: center;
   gap: 12px;
   margin-bottom: 42px;
   padding-left: 8px;
}

.logo-icon {
   background: #e31b23;
   width: 44px;
   height: 44px;
   border-radius: 16px;
   display: flex;
   align-items: center;
   justify-content: center;
   color: #fff;
   font-size: 26px;
   flex-shrink: 0;
}

.logo-text {
   font-weight: 700;
   font-size: 1.5rem;
   letter-spacing: -.7px;
   color: #1e1e1e;
}

.min .logo-text,
.min .user-info span,
.min .nav-label,
.min .plan-badge {
   opacity: 0;
   width: 0;
   display: inline-block;
   overflow: hidden;
}

/* NAV */
.nav-item {
   display: flex;
   align-items: center;
   gap: 18px;
   padding: 14px 18px;
   margin: 6px 0;
   border-radius: 20px;
   transition: all .15s;
   color: #4e4e4e;
   cursor: pointer;
   font-weight: 500;
   text-decoration: none;
}

.nav-item i,
.nav-item .ph {
   font-size: 1.7rem;
   width: 30px;
   text-align: center;
   flex-shrink: 0;
}

.nav-item.active {
   background: #e31b23;
   color: #fff;
   box-shadow: 0 8px 18px -6px rgba(227, 27, 35, .4);
}

.nav-item.active .nav-label {
   color: #fff;
   font-weight: 500;
}

.nav-item:hover:not(.active) {
   background: #fff1f0;
   color: #b11a1a;
}

.nav-label {
   font-size: 1.05rem;
   font-weight: 500;
   transition: opacity .2s;
}

.user-section {
   margin-top: auto;
   border-top: 1px solid #efefef;
   padding-top: 26px;
}

.user-info {
   display: flex;
   align-items: center;
   gap: 14px;
   padding: 8px;
}

.avatar {
   width: 54px;
   height: 54px;
   background: #e31b23;
   border-radius: 20px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 600;
   font-size: 1.4rem;
   color: #fff;
   flex-shrink: 0;
}

.avatar-sm {
   width: 40px;
   height: 40px;
   border-radius: 14px;
   font-size: 1rem;
}

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

.user-name {
   font-weight: 700;
   color: #232323;
   font-size: 1.1rem;
}

.user-role {
   font-size: .85rem;
   color: #888;
}

.plan-badge {
   background: #fef1f0;
   color: #b11a1a;
   padding: 8px 14px;
   border-radius: 40px;
   font-size: .85rem;
   margin: 16px 8px 0;
   text-align: center;
   font-weight: 600;
   border: 1px solid #ffdad7;
}

/* MAIN CONTENT */
.main-content {
   flex: 1;
   background: #fff;
   display: flex;
   flex-direction: column;
   overflow-y: auto;
}

.header {
   background: rgba(255, 255, 255, .98);
   backdrop-filter: blur(12px);
   -webkit-backdrop-filter: blur(12px);
   padding: 14px 30px;
   display: flex;
   align-items: center;
   justify-content: space-between;
   border-bottom: 1px solid #e8e8e8;
   flex-wrap: wrap;
   gap: 12px;
   flex-shrink: 0;
   min-height: 72px;
   box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.header-left {
   display: flex;
   align-items: center;
   gap: 20px;
}

.menu-toggle {
   background: #fef5f5;
   border: none;
   font-size: 2.2rem;
   color: #e31b23;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   width: 52px;
   height: 52px;
   border-radius: 20px;
   transition: .2s;
}

.menu-toggle:hover {
   background: #ffe3e2;
}

.page-title {
   font-size: 1.5rem;
   font-weight: 700;
   color: #1d1d1d;
   letter-spacing: -.5px;
}

/* Header user block */
.header-user {
   display: flex;
   align-items: center;
   gap: 10px;
   padding: 6px 14px 6px 6px;
   background: #fafafa;
   border-radius: 40px;
   border: 1px solid #f0f0f0;
   cursor: default;
}

.header-avatar {
   width: 36px;
   height: 36px;
   border-radius: 50%;
   background: linear-gradient(135deg, #e31b23, #ff4757);
   color: #fff;
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 700;
   font-size: .8rem;
   flex-shrink: 0;
}

.header-user-info {
   display: flex;
   flex-direction: column;
   line-height: 1.3;
}

.header-user-name {
   font-weight: 600;
   font-size: .85rem;
   color: #1d1d1d;
}

.header-user-org {
   font-size: .72rem;
   color: #999;
   font-weight: 500;
}

.header-icon-logout {
   border-color: transparent;
   color: #aaa;
}

.header-icon-logout:hover {
   background: #fce4ec;
   border-color: #fce4ec;
   color: #c62828;
}

.header-btn {
   display: flex;
   align-items: center;
   justify-content: center;
   width: 42px;
   height: 42px;
   border-radius: 50%;
   color: #666;
   text-decoration: none;
   transition: .15s;
   font-size: 1.3rem;
}

.header-btn:hover {
   background: #fef1f0;
   color: #e31b23;
}

.header-right {
   display: flex;
   align-items: center;
   gap: 20px;
}

.search-box {
   background: #f7f7f7;
   border-radius: 48px;
   padding: 12px 22px;
   display: flex;
   align-items: center;
   gap: 10px;
   border: 1px solid #eee;
}

.search-box i {
   color: #e31b23;
   font-size: 1.3rem;
}

.search-box input {
   border: none;
   background: transparent;
   outline: none;
   font-size: 1rem;
   width: 220px;
}

.header-icon {
   background: #fff;
   width: 42px;
   height: 42px;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   border: 1px solid #f0f0f0;
   color: #666;
   font-size: 1.2rem;
   cursor: pointer;
   transition: .15s;
   text-decoration: none;
}

.header-icon:hover {
   background: #fef1f0;
   border-color: #fddcda;
   color: #e31b23;
}

/* DASHBOARD */
.dashboard-content {
   padding: 30px 30px 40px;
   overflow-y: auto;
   background: #fafafa;
   flex: 1;
}

.stats-row {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 24px;
   margin-bottom: 36px;
}

.stat-card {
   background: #fff;
   border-radius: 30px;
   padding: 26px 24px;
   box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .04);
   border: 1px solid #fff;
   display: flex;
   align-items: center;
   gap: 20px;
   transition: .15s;
}

.stat-card:hover {
   transform: translateY(-2px);
   box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .08);
}

.stat-icon {
   width: 64px;
   height: 64px;
   background: #ffeae9;
   border-radius: 24px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 2.2rem;
   color: #e31b23;
}

.stat-content h4 {
   color: #6b6b6b;
   font-weight: 500;
   font-size: 1rem;
   letter-spacing: .3px;
}

.stat-content .value {
   font-size: 2.4rem;
   font-weight: 700;
   color: #222;
   line-height: 1.2;
}

.stat-trend {
   color: #e31b23;
   font-weight: 600;
   font-size: .95rem;
}

.charts-row {
   display: grid;
   grid-template-columns: 2fr 1fr;
   gap: 26px;
   margin-bottom: 36px;
}

.card {
   background: #fff;
   border-radius: 32px;
   padding: 24px 26px;
   box-shadow: 0 15px 30px -12px rgba(0, 0, 0, .05);
   border: 1px solid #f1f1f1;
}

.card-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 22px;
   font-weight: 600;
   color: #333;
   font-size: 1.25rem;
}

/* LEAD ITEMS */
.lead-item {
   display: flex;
   align-items: center;
   justify-content: space-between;
   padding: 16px 0;
   border-bottom: 1px solid #f4f4f4;
}

.lead-item:last-child {
   border: none;
}

.lead-info {
   display: flex;
   align-items: center;
   gap: 18px;
}

.lead-avatar {
   width: 52px;
   height: 52px;
   border-radius: 20px;
   background: #e31b23;
   color: #fff;
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 600;
   font-size: 1.2rem;
}

.lead-name {
   font-weight: 700;
   color: #1f1f1f;
}

.lead-property {
   font-size: .9rem;
   color: #8f8f8f;
}

.lead-value {
   font-weight: 700;
   color: #e31b23;
}

/* PROPERTIES */
.properties-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
   gap: 24px;
   margin-top: 22px;
}

.property-card {
   background: #fff;
   border-radius: 30px;
   overflow: hidden;
   box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .04);
   border: 1px solid #f6f6f6;
   transition: .15s;
}

.property-card:hover {
   border-color: #e31b23;
   transform: translateY(-2px);
}

.property-img {
   height: 150px;
   background: #eaeef3;
   display: flex;
   align-items: center;
   justify-content: center;
   color: #e31b23;
   font-size: 2.8rem;
}

.property-detail {
   padding: 20px;
}

.property-title {
   font-weight: 700;
   font-size: 1.1rem;
}

.property-price {
   color: #e31b23;
   font-weight: 800;
   margin-top: 8px;
}

/* ============================================================
   TABLE STYLES
   ============================================================ */
.data-table-wrapper {
   overflow-x: auto;
   border-radius: 24px;
   background: #fff;
   box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .04);
   border: 1px solid #f1f1f1;
}

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

.data-table thead {
   background: #fafafa;
}

.data-table th {
   padding: 16px 20px;
   text-align: left;
   font-weight: 600;
   color: #666;
   font-size: .9rem;
   text-transform: uppercase;
   letter-spacing: .5px;
   border-bottom: 2px solid #f0f0f0;
   white-space: nowrap;
}

.data-table td {
   padding: 16px 20px;
   border-bottom: 1px solid #f5f5f5;
   color: #333;
   font-size: .95rem;
}

.data-table tbody tr {
   transition: background .1s;
}

.data-table tbody tr:hover {
   background: #fff8f7;
}

.data-table tbody tr:last-child td {
   border-bottom: none;
}

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
   display: inline-block;
   padding: 6px 14px;
   border-radius: 30px;
   font-size: .8rem;
   font-weight: 600;
   letter-spacing: .3px;
}

.badge-new {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-contacted {
   background: #fff3e0;
   color: #e65100;
}

.badge-qualified {
   background: #e8f5e9;
   color: #2e7d32;
}

.badge-proposal {
   background: #f3e5f5;
   color: #7b1fa2;
}

.badge-negotiation {
   background: #fff8e1;
   color: #f57f17;
}

.badge-won {
   background: #e8f5e9;
   color: #1b5e20;
}

.badge-lost {
   background: #fce4ec;
   color: #c62828;
}

.badge-available {
   background: #e8f5e9;
   color: #2e7d32;
}

.badge-under_contract {
   background: #fff3e0;
   color: #e65100;
}

.badge-sold {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-rented {
   background: #f3e5f5;
   color: #7b1fa2;
}

.badge-prospecting {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-qualification {
   background: #fff3e0;
   color: #e65100;
}

.badge-closed_won {
   background: #e8f5e9;
   color: #1b5e20;
}

.badge-closed_lost {
   background: #fce4ec;
   color: #c62828;
}

.badge-low {
   background: #e8f5e9;
   color: #2e7d32;
}

.badge-medium {
   background: #fff3e0;
   color: #e65100;
}

.badge-high {
   background: #fff8e1;
   color: #f57f17;
}

.badge-urgent {
   background: #fce4ec;
   color: #c62828;
}

.badge-pending {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-in_progress {
   background: #fff3e0;
   color: #e65100;
}

.badge-completed {
   background: #e8f5e9;
   color: #1b5e20;
}

.badge-cancelled {
   background: #f5f5f5;
   color: #757575;
}

.badge-admin {
   background: #fce4ec;
   color: #c62828;
}

.badge-manager {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-agent {
   background: #e8f5e9;
   color: #2e7d32;
}

.badge-active {
   background: #e8f5e9;
   color: #1b5e20;
}

.badge-inactive {
   background: #f5f5f5;
   color: #757575;
}

.badge-buyer {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-seller {
   background: #fff3e0;
   color: #e65100;
}

.badge-tenant {
   background: #f3e5f5;
   color: #7b1fa2;
}

.badge-landlord {
   background: #e8f5e9;
   color: #2e7d32;
}

.badge-investor {
   background: #fff8e1;
   color: #f57f17;
}

.badge-other {
   background: #f5f5f5;
   color: #757575;
}

.badge-residential {
   background: #e3f2fd;
   color: #1565c0;
}

.badge-commercial {
   background: #fff3e0;
   color: #e65100;
}

.badge-land {
   background: #e8f5e9;
   color: #2e7d32;
}

.badge-industrial {
   background: #f5f5f5;
   color: #757575;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
   display: inline-flex;
   align-items: center;
   gap: 8px;
   padding: 12px 24px;
   border: none;
   border-radius: 16px;
   font-size: .95rem;
   font-weight: 600;
   cursor: pointer;
   transition: all .15s;
   text-decoration: none;
}

.btn-primary {
   background: #e31b23;
   color: #fff;
   box-shadow: 0 6px 16px -4px rgba(227, 27, 35, .3);
}

.btn-primary:hover {
   background: #c4161d;
   box-shadow: 0 8px 20px -4px rgba(227, 27, 35, .4);
   transform: translateY(-1px);
}

.btn-secondary {
   background: #f7f7f7;
   color: #333;
   border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
   background: #eee;
}

.btn-danger {
   background: #fce4ec;
   color: #c62828;
}

.btn-danger:hover {
   background: #f8bbd0;
}

.btn-sm {
   padding: 8px 16px;
   font-size: .85rem;
   border-radius: 12px;
}

.btn-icon {
   width: 40px;
   height: 40px;
   padding: 0;
   border-radius: 14px;
   display: flex;
   align-items: center;
   justify-content: center;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: rgba(0, 0, 0, .5);
   backdrop-filter: blur(4px);
   z-index: 1000;
   display: none;
   align-items: center;
   justify-content: center;
   padding: 20px;
}

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

.modal {
   background: #fff;
   border-radius: 32px;
   width: 100%;
   max-width: 640px;
   max-height: 90vh;
   overflow-y: auto;
   box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .3);
   animation: modalIn .25s ease;
}

@keyframes modalIn {
   from {
      opacity: 0;
      transform: translateY(40px) scale(.96);
   }

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

.modal-header {
   padding: 28px 30px 0;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.modal-header h2 {
   font-size: 1.5rem;
   font-weight: 700;
   color: #1d1d1d;
}

.modal-close {
   width: 44px;
   height: 44px;
   border: none;
   background: #f5f5f5;
   border-radius: 16px;
   font-size: 1.4rem;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   color: #666;
   transition: .15s;
}

.modal-close:hover {
   background: #ffeae9;
   color: #e31b23;
}

.modal-body {
   padding: 24px 30px 30px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
   margin-bottom: 20px;
}

.form-label {
   display: block;
   font-weight: 600;
   color: #444;
   margin-bottom: 8px;
   font-size: .9rem;
}

.form-control {
   width: 100%;
   padding: 14px 18px;
   border: 2px solid #eee;
   border-radius: 16px;
   font-size: 1rem;
   transition: border-color .15s;
   background: #fafafa;
}

.form-control:focus {
   outline: none;
   border-color: #e31b23;
   background: #fff;
}

select.form-control {
   appearance: none;
   background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: right 16px center;
   padding-right: 40px;
}

textarea.form-control {
   resize: vertical;
   min-height: 100px;
}

.form-row {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 16px;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
   display: flex;
   justify-content: space-between;
   align-items: center;
   flex-wrap: wrap;
   gap: 16px;
   margin-bottom: 28px;
}

.toolbar-left {
   display: flex;
   align-items: center;
   gap: 12px;
   flex-wrap: wrap;
}

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

.filter-select {
   padding: 10px 16px;
   border: 2px solid #eee;
   border-radius: 14px;
   font-size: .9rem;
   background: #fff;
   cursor: pointer;
   appearance: none;
   background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: right 12px center;
   padding-right: 32px;
}

.filter-select:focus {
   outline: none;
   border-color: #e31b23;
}

.search-input {
   padding: 10px 16px;
   border: 2px solid #eee;
   border-radius: 14px;
   font-size: .9rem;
   width: 240px;
   background: #fff;
}

.search-input:focus {
   outline: none;
   border-color: #e31b23;
}

/* ============================================================
   KANBAN / PIPELINE
   ============================================================ */
.pipeline-container {
   display: flex;
   gap: 20px;
   overflow-x: auto;
   padding-bottom: 20px;
}

.pipeline-column {
   min-width: 280px;
   flex: 1;
   background: #fafafa;
   border-radius: 24px;
   padding: 20px;
}

.pipeline-column-header {
   font-weight: 700;
   font-size: 1.1rem;
   color: #333;
   margin-bottom: 16px;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

.pipeline-count {
   background: #e31b23;
   color: #fff;
   width: 28px;
   height: 28px;
   border-radius: 10px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: .8rem;
   font-weight: 700;
}

.pipeline-card {
   background: #fff;
   border-radius: 20px;
   padding: 18px;
   margin-bottom: 12px;
   box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .04);
   border: 1px solid #f0f0f0;
   cursor: pointer;
   transition: .15s;
}

.pipeline-card:hover {
   border-color: #e31b23;
   transform: translateY(-1px);
}

.pipeline-card-title {
   font-weight: 700;
   color: #1d1d1d;
   margin-bottom: 8px;
}

.pipeline-card-meta {
   font-size: .85rem;
   color: #888;
   display: flex;
   gap: 12px;
   align-items: center;
}

.pipeline-card-value {
   font-weight: 700;
   color: #e31b23;
   font-size: 1.1rem;
   margin-top: 10px;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
   display: flex;
   gap: 4px;
   background: #f5f5f5;
   border-radius: 18px;
   padding: 4px;
   margin-bottom: 24px;
   width: fit-content;
}

.tab {
   padding: 10px 20px;
   border-radius: 14px;
   cursor: pointer;
   font-weight: 500;
   font-size: .9rem;
   color: #666;
   transition: .15s;
   border: none;
   background: transparent;
}

.tab.active {
   background: #e31b23;
   color: #fff;
   box-shadow: 0 4px 12px -3px rgba(227, 27, 35, .3);
}

.tab:hover:not(.active) {
   color: #e31b23;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
   position: fixed;
   top: 24px;
   right: 24px;
   z-index: 2000;
   display: flex;
   flex-direction: column;
   gap: 12px;
}

.toast {
   padding: 16px 24px;
   border-radius: 18px;
   color: #fff;
   font-weight: 600;
   font-size: .95rem;
   box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .2);
   animation: toastIn .3s ease;
   display: flex;
   align-items: center;
   gap: 10px;
}

.toast-success {
   background: #2e7d32;
}

.toast-error {
   background: #c62828;
}

.toast-info {
   background: #1565c0;
}

@keyframes toastIn {
   from {
      opacity: 0;
      transform: translateX(40px);
   }

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

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
   width: 100%;
   max-width: 440px;
}

.login-card {
   background: rgba(255, 255, 255, .95);
   backdrop-filter: blur(20px);
   border-radius: 36px;
   padding: 48px 40px;
   box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .4);
}

.login-logo {
   text-align: center;
   margin-bottom: 36px;
}

.login-logo .logo-icon {
   margin: 0 auto 16px;
   width: 64px;
   height: 64px;
   font-size: 2rem;
   border-radius: 22px;
}

.login-logo h1 {
   font-size: 2rem;
   font-weight: 700;
   color: #1d1d1d;
   letter-spacing: -.5px;
}

.login-logo p {
   color: #888;
   margin-top: 6px;
   font-size: .95rem;
}

.login-error {
   background: #fce4ec;
   color: #c62828;
   padding: 14px 18px;
   border-radius: 14px;
   margin-bottom: 20px;
   font-weight: 500;
   font-size: .9rem;
   display: flex;
   align-items: center;
   gap: 8px;
}

.login-btn {
   width: 100%;
   padding: 16px;
   font-size: 1.1rem;
   margin-top: 8px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
   text-align: center;
   padding: 60px 20px;
   color: #888;
}

.empty-state i {
   font-size: 4rem;
   color: #ddd;
   margin-bottom: 16px;
   display: block;
}

.empty-state h3 {
   font-weight: 700;
   color: #aaa;
   margin-bottom: 8px;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-card {
   background: #fff;
   border-radius: 30px;
   padding: 36px;
   box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .04);
   border: 1px solid #f1f1f1;
   max-width: 700px;
}

.settings-card h2 {
   font-size: 1.4rem;
   font-weight: 700;
   color: #1d1d1d;
   margin-bottom: 28px;
   padding-bottom: 16px;
   border-bottom: 2px solid #f0f0f0;
}

/* ============================================================
   USER CARDS GRID
   ============================================================ */
.users-grid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
   gap: 24px;
}

.user-card {
   background: #fff;
   border-radius: 28px;
   padding: 28px;
   box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .04);
   border: 1px solid #f1f1f1;
   text-align: center;
   transition: .15s;
}

.user-card:hover {
   border-color: #e31b23;
   transform: translateY(-2px);
}

.user-card .avatar {
   width: 72px;
   height: 72px;
   font-size: 1.6rem;
   border-radius: 24px;
   margin: 0 auto 16px;
}

.user-card .user-card-name {
   font-weight: 700;
   font-size: 1.15rem;
   color: #1d1d1d;
}

.user-card .user-card-email {
   color: #888;
   font-size: .9rem;
   margin: 4px 0 12px;
}

.user-card-actions {
   display: flex;
   gap: 8px;
   justify-content: center;
   margin-top: 16px;
}

/* ============================================================
   TAGS / PILLS
   ============================================================ */
.tag-pill {
   display: inline-flex;
   align-items: center;
   gap: 4px;
   padding: 4px 12px;
   border-radius: 20px;
   font-size: .75rem;
   font-weight: 600;
   line-height: 1.4;
   white-space: nowrap;
}

.tag-pill .remove-tag {
   cursor: pointer;
   opacity: .6;
   font-size: .85rem;
}

.tag-pill .remove-tag:hover {
   opacity: 1;
}

.tags-list {
   display: flex;
   flex-wrap: wrap;
   gap: 6px;
   margin-top: 6px;
}

.tag-selector {
   display: flex;
   flex-wrap: wrap;
   gap: 6px;
   padding: 12px 0;
}

.tag-option {
   cursor: pointer;
   border: 2px solid transparent;
   transition: .15s;
}

.tag-option:hover {
   border-color: rgba(0, 0, 0, .15);
   transform: scale(1.05);
}

.tag-option.selected {
   border-color: #333;
   box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

/* ============================================================
   LEAD TIMELINE
   ============================================================ */
.timeline {
   padding: 0;
   margin: 0;
   list-style: none;
}

.timeline-item {
   display: flex;
   gap: 16px;
   padding: 16px 0;
   border-bottom: 1px solid #f0f0f0;
   position: relative;
}

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

.timeline-icon {
   width: 36px;
   height: 36px;
   border-radius: 12px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1rem;
   flex-shrink: 0;
}

.timeline-icon.created {
   background: #e3f2fd;
   color: #1565c0;
}

.timeline-icon.updated {
   background: #fff3e0;
   color: #e65100;
}

.timeline-icon.status {
   background: #e8f5e9;
   color: #2e7d32;
}

.timeline-icon.tag {
   background: #f3e5f5;
   color: #7b1fa2;
}

.timeline-icon.note {
   background: #fff8e1;
   color: #f57f17;
}

.timeline-body {
   flex: 1;
}

.timeline-text {
   font-size: .9rem;
   color: #333;
}

.timeline-text strong {
   color: #1d1d1d;
}

.timeline-change {
   display: inline-flex;
   align-items: center;
   gap: 6px;
   font-size: .85rem;
   margin-top: 4px;
}

.timeline-change .old {
   text-decoration: line-through;
   color: #999;
}

.timeline-change .arrow {
   color: #ccc;
}

.timeline-change .new {
   color: #e31b23;
   font-weight: 600;
}

.timeline-time {
   font-size: .8rem;
   color: #aaa;
   margin-top: 4px;
}

/* ============================================================
   CALL / WHATSAPP BUTTONS
   ============================================================ */
.action-btn {
   display: inline-flex;
   align-items: center;
   justify-content: center;
   width: 36px;
   height: 36px;
   border-radius: 12px;
   border: none;
   cursor: pointer;
   transition: .15s;
   text-decoration: none;
   font-size: 1.1rem;
}

.action-btn:hover {
   transform: scale(1.1);
}

.btn-call {
   background: #e3f2fd;
   color: #1565c0;
}

.btn-call:hover {
   background: #bbdefb;
}

.btn-whatsapp {
   background: #e8f5e9;
   color: #25d366;
}

.btn-whatsapp:hover {
   background: #c8e6c9;
}

.action-group {
   display: flex;
   gap: 6px;
   align-items: center;
}

/* ============================================================
   PLAN BADGE (sidebar)
   ============================================================ */
.plan-badge {
   background: #fef1f0;
   color: #b11a1a;
   padding: 4px 14px;
   border-radius: 20px;
   font-size: .75rem;
   font-weight: 700;
   text-transform: uppercase;
   letter-spacing: .5px;
   display: inline-block;
   margin-top: 8px;
   text-align: center;
}

/* ============================================================
   SETTINGS TABS
   ============================================================ */
.settings-tabs {
   display: flex;
   gap: 0;
   background: #f5f5f5;
   border-radius: 20px;
   padding: 4px;
   margin-bottom: 28px;
   overflow-x: auto;
}

.settings-tab {
   padding: 10px 22px;
   border-radius: 16px;
   cursor: pointer;
   font-weight: 500;
   font-size: .9rem;
   color: #666;
   background: transparent;
   border: none;
   white-space: nowrap;
   transition: .15s;
}

.settings-tab.active {
   background: #e31b23;
   color: #fff;
   box-shadow: 0 4px 12px -3px rgba(227, 27, 35, .3);
}

.settings-tab:hover:not(.active) {
   color: #e31b23;
}

/* ============================================================
   CUSTOM FIELDS EDITOR
   ============================================================ */
.custom-field-row {
   display: flex;
   gap: 12px;
   align-items: center;
   padding: 12px 16px;
   background: #fafafa;
   border-radius: 16px;
   margin-bottom: 8px;
}

.custom-field-row .field-name {
   font-weight: 600;
   flex: 1;
}

.custom-field-row .field-type {
   color: #888;
   font-size: .85rem;
}

/* ============================================================
   SUPER ADMIN (dark theme)
   ============================================================ */
.sa-body {
   background: #0f111a;
}

.sa-sidebar {
   background: #161929;
   border-right: 1px solid #252837;
}

.sa-sidebar .nav-item {
   color: #8892b0;
}

.sa-sidebar .nav-item.active {
   background: linear-gradient(135deg, #e31b23, #ff4757);
   color: #fff;
}

.sa-sidebar .nav-item:hover:not(.active) {
   background: #1d2036;
   color: #e31b23;
}

.sa-sidebar .logo-text {
   color: #fff;
}

.sa-sidebar .user-name {
   color: #fff;
}

.sa-sidebar .user-role {
   color: #8892b0;
}

.sa-sidebar .sidebar-footer {
   border-top: 1px solid #252837;
}

.sa-main {
   background: #0f111a;
}

.sa-main .top-header {
   background: #161929;
   border-bottom: 2px solid #e31b23;
}

.sa-main .page-title {
   color: #fff;
}

.sa-main .header-btn {
   color: #8892b0;
}

.sa-main .header-btn:hover {
   color: #e31b23;
}

.sa-main .dashboard-content {
   background: #0f111a;
}

.sa-card {
   background: #161929;
   border: 1px solid #252837;
   border-radius: 28px;
   padding: 28px;
}

.sa-card h2,
.sa-card h3,
.sa-card h4 {
   color: #fff;
}

.sa-card p,
.sa-card span {
   color: #8892b0;
}

.sa-stat-card {
   background: linear-gradient(135deg, #1d2036, #252837);
   border: 1px solid #252837;
}

.sa-stat-card .value {
   color: #fff;
}

.sa-stat-card h4 {
   color: #8892b0;
}

.sa-table th {
   background: #1d2036;
   color: #8892b0;
   border-bottom: 1px solid #252837;
}

.sa-table td {
   color: #ccd6f6;
   border-bottom: 1px solid #1d2036;
}

.sa-table tbody tr:hover {
   background: #1d2036;
}

.sa-badge-active {
   background: rgba(46, 125, 50, .15);
   color: #4caf50;
}

.sa-badge-suspended {
   background: rgba(198, 40, 40, .15);
   color: #ef5350;
}

.org-card {
   background: #161929;
   border: 1px solid #252837;
   border-radius: 24px;
   padding: 24px;
   transition: .15s;
}

.org-card:hover {
   border-color: #e31b23;
   transform: translateY(-2px);
}

/* ============================================================
   LEAD DETAIL PANEL
   ============================================================ */
.lead-detail-panel {
   background: #fff;
   border-radius: 28px;
   border: 1px solid #f0f0f0;
   overflow: hidden;
}

.lead-detail-header {
   padding: 28px;
   border-bottom: 1px solid #f0f0f0;
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
}

.lead-detail-body {
   padding: 0;
}

.detail-tab-content {
   padding: 24px;
   display: none;
}

.detail-tab-content.active {
   display: block;
}

/* ============================================================
   PHOSPHOR ICON SIZING
   ============================================================ */
.ph {
   font-size: 1.7rem;
}

.nav-item .ph {
   font-size: 1.9rem;
}

.stat-icon .ph {
   font-size: 2.5rem;
}

.header-icon .ph {
   font-size: 1.9rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width:1100px) {
   .form-row {
      grid-template-columns: 1fr;
   }
}

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

   .sidebar.full {
      width: 250px;
   }

   .pipeline-container {
      flex-direction: column;
   }

   .pipeline-column {
      min-width: 100%;
   }
}

@media (max-width:700px) {
   .app-container {
      border-radius: 28px;
   }

   .header {
      padding: 16px;
   }

   .stats-row {
      grid-template-columns: 1fr 1fr;
   }

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

   .search-input {
      width: 100%;
   }
}

@media (max-width:520px) {
   .sidebar.min {
      width: 78px;
   }

   .stats-row {
      grid-template-columns: 1fr;
   }

   .header-right .search-box {
      display: none;
   }

   .page-title {
      font-size: 1.5rem;
   }

   .login-card {
      padding: 36px 24px;
   }

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