/* Next Level CRM — Stylesheet */
:root {
  --bg:          #FDFBF8;
  --bg-alt:      #F7F3EE;
  --rose:        #C9907A;
  --rose-dark:   #A8705C;
  --rose-light:  #E8C4B4;
  --champagne:   #D4B896;
  --champ-light: #EDE0CC;
  --silver:      #B8BCC4;
  --silver-light:#E8EAEC;
  --charcoal:    #2C2C2C;
  --mid:         #5A5A5A;
  --subtle:      #8A8A8A;
  --white:       #FFFFFF;
  --sidebar-w:   240px;
  --green:       #5A8A5A;
  --red:         #8A3A3A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--charcoal);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--charcoal);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand .brand-eye {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rose);
  font-weight: 500;
}
.sidebar-brand h2 {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.35rem;
  color: var(--white);
  line-height: 1.2;
  margin-top: 0.2rem;
  font-weight: 600;
}

.sidebar-nav { flex: 1; padding: 0.75rem 0; }

.nav-section {
  padding: 0.75rem 1.25rem 0.2rem;
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 400;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.nav-link.active {
  background: rgba(201,144,122,0.15);
  color: var(--white);
  border-left-color: var(--rose);
}
.nav-icon { width: 18px; text-align: center; font-size: 0.95rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.82rem;
}
.sidebar-footer .user-name { color: var(--white); font-weight: 500; }
.sidebar-footer a { color: rgba(255,255,255,0.45); text-decoration: none; font-size: 0.75rem; }
.sidebar-footer a:hover { color: var(--rose-light); }

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

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--silver-light);
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--charcoal);
}
.topbar-actions { display: flex; gap: 0.65rem; align-items: center; }

.content { padding: 1.75rem 2rem; flex: 1; }

/* ======================== CARDS ======================== */
.card {
  background: var(--white);
  border: 1px solid var(--silver-light);
  border-radius: 6px;
  padding: 1.4rem 1.5rem;
}
.card-title {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--charcoal);
}
.card + .card { margin-top: 1rem; }

/* ======================== STAT CARDS ======================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--silver-light);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
}
.stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
  font-weight: 500;
}
.stat-value {
  font-family: 'Cormorant Garant', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.1;
  margin-top: 0.2rem;
}
.stat-sub { font-size: 0.75rem; color: var(--subtle); margin-top: 0.2rem; }

/* ======================== BUTTONS ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  font-size: 0.84rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  line-height: 1;
}
.btn-primary   { background: var(--rose);  color: var(--white); }
.btn-primary:hover { background: var(--rose-dark); }
.btn-outline   { background: transparent; border: 1px solid var(--silver); color: var(--charcoal); }
.btn-outline:hover { border-color: var(--rose); color: var(--rose); }
.btn-danger    { background: #A83A3A; color: white; }
.btn-danger:hover  { background: #8A2A2A; }
.btn-success   { background: #5A8A5A; color: white; }
.btn-success:hover { background: #3A6A3A; }
.btn-ghost     { background: transparent; color: var(--subtle); }
.btn-ghost:hover   { color: var(--charcoal); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.72rem; }

/* ======================== TABLE ======================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
  font-weight: 500;
  border-bottom: 1px solid var(--silver-light);
  white-space: nowrap;
}
td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--bg-alt); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

/* ======================== FORMS ======================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--mid);
  text-transform: uppercase;
}

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--silver-light);
  border-radius: 4px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  background: var(--white);
  color: var(--charcoal);
  transition: border 0.15s;
  appearance: auto;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 2px rgba(201,144,122,0.12);
}
textarea { resize: vertical; min-height: 80px; }

/* ======================== BADGES ======================== */
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-active       { background: #E8F5E8; color: #2A6A2A; }
.badge-inactive     { background: var(--silver-light); color: var(--subtle); }
.badge-won          { background: #E8F5E8; color: #2A6A2A; }
.badge-lost         { background: #F5E8E8; color: #6A2A2A; }
.badge-new          { background: var(--silver-light); color: var(--mid); }
.badge-contacted    { background: #FFF3E8; color: #8A5A20; }
.badge-consultation { background: #FFE8DC; color: var(--rose-dark); }
.badge-proposal     { background: var(--champ-light); color: #7A4030; }
.badge-high         { background: #F5E8E8; color: #6A2A2A; }
.badge-normal       { background: var(--bg-alt); color: var(--mid); }
.badge-low          { background: var(--silver-light); color: var(--subtle); }
.badge-completed    { background: #E8F5E8; color: #2A6A2A; }
.badge-pending      { background: #FFF3E8; color: #8A5A20; }

/* ======================== ALERTS ======================== */
.alert { padding: 0.8rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.87rem; }
.alert-error   { background: #F5E8E8; color: #6A2A2A; border: 1px solid #E8C4C4; }
.alert-success { background: #E8F5E8; color: #2A6A2A; border: 1px solid #C4E8C4; }

/* ======================== SEARCH BAR ======================== */
.search-bar {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}
.search-input { flex: 1; max-width: 300px; }

/* ======================== PIPELINE ======================== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  min-width: 900px;
}
.pipeline-col {
  background: var(--bg-alt);
  border-radius: 6px;
  padding: 0.85rem;
  min-height: 200px;
}
.pipeline-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.pipeline-col-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mid);
}
.pipeline-count {
  background: var(--silver-light);
  color: var(--mid);
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.lead-card {
  background: var(--white);
  border: 1px solid var(--silver-light);
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.84rem;
}
.lead-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.lead-name { font-weight: 500; }
.lead-service { font-size: 0.74rem; color: var(--subtle); margin-top: 0.2rem; }
.lead-date  { font-size: 0.7rem; color: var(--subtle); margin-top: 0.4rem; }

/* ======================== NOTES ======================== */
.notes-timeline { display: flex; flex-direction: column; gap: 1rem; }
.note-item { display: flex; gap: 0.75rem; }
.note-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rose); margin-top: 0.55rem; flex-shrink: 0;
}
.note-body { flex: 1; }
.note-date { font-size: 0.73rem; color: var(--subtle); }
.note-text { font-size: 0.88rem; margin-top: 0.1rem; line-height: 1.5; }
.note-delete { font-size: 0.7rem; color: var(--subtle); cursor: pointer; margin-left: 0.5rem; }
.note-delete:hover { color: var(--red); }

/* ======================== ENGAGEMENTS ======================== */
.engagement-card {
  border: 1px solid var(--silver-light);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
}
.engagement-service { font-weight: 500; font-size: 0.9rem; }
.engagement-details {
  display: flex; gap: 1.5rem;
  margin-top: 0.4rem;
  font-size: 0.8rem; color: var(--subtle);
  flex-wrap: wrap;
}

/* ======================== TASKS ======================== */
.task-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--bg-alt);
}
.task-item:last-child { border-bottom: none; }
.task-check input[type=checkbox] {
  width: 16px; height: 16px; margin-top: 3px;
  accent-color: var(--rose); cursor: pointer; flex-shrink: 0;
}
.task-content { flex: 1; }
.task-title { font-weight: 500; font-size: 0.88rem; }
.task-title.done { text-decoration: line-through; color: var(--subtle); }
.task-meta { font-size: 0.76rem; color: var(--subtle); margin-top: 0.15rem; }
.overdue { color: #A83A3A !important; font-weight: 500; }

/* ======================== LAYOUT HELPERS ======================== */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; gap: 0.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-subtle { color: var(--subtle); font-size: 0.83rem; }
.text-rose   { color: var(--rose); }
.fw-500      { font-weight: 500; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--subtle); }
.empty-state .empty-icon { font-size: 2rem; margin-bottom: 0.6rem; }
.empty-state p { font-size: 0.88rem; }

/* ======================== LOGIN ======================== */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--white);
  border: 1px solid var(--silver-light);
  border-radius: 8px;
  padding: 2.5rem 2.25rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand .eye {
  font-size: 0.68rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--rose); font-weight: 500;
}
.login-brand h1 {
  font-family: 'Cormorant Garant', serif;
  font-size: 2rem; font-weight: 600;
  color: var(--charcoal); margin-top: 0.2rem; line-height: 1.15;
}
.login-form .form-group { margin-bottom: 1rem; }
.login-form .btn { width: 100%; justify-content: center; padding: 0.7rem; margin-top: 0.5rem; }

/* ======================== CLIENT PROFILE ======================== */
.profile-header {
  display: flex; align-items: flex-start; gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.profile-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--champ-light); color: var(--rose-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garant', serif;
  font-size: 1.4rem; font-weight: 600; flex-shrink: 0;
}
.profile-info h2 {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.75rem; font-weight: 600; line-height: 1.1;
}
.profile-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.4rem; }
.profile-meta-item { font-size: 0.82rem; color: var(--mid); }
.profile-meta-item a { color: var(--rose); text-decoration: none; }

/* ======================== TABS ======================== */
.tab-nav { display: flex; border-bottom: 2px solid var(--silver-light); margin-bottom: 1.25rem; gap: 0; }
.tab-btn {
  padding: 0.6rem 1.1rem; font-size: 0.84rem; font-weight: 500;
  color: var(--subtle); background: none; border: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--charcoal); }
.tab-btn.active { color: var(--rose); border-bottom-color: var(--rose); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .two-col   { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .content { padding: 1.25rem; }
}
