/* =========================================================
   SkelaCRM — stil global (paletă inspirată MiniCRM + brand Skela)
   Namespace-ul intern rămâne `crx-` (nu branding, doar prefix CSS).
   ========================================================= */

:root{
  /* Paletă oficială Skela — preluată direct din skela.ro
     #00a79d teal primary · #008497 teal darker · #32373c charcoal
     #00d084 verde lime accent · #7bdcb5 verde mint */
  --crx-bg:       #f4f6fa;
  --crx-surface:  #ffffff;
  --crx-border:   #e5e9f0;
  --crx-text:     #32373c;   /* charcoal Skela */
  --crx-muted:    #6b7280;
  --crx-primary:  #00a79d;   /* teal Skela oficial */
  --crx-primary-2:#008497;   /* teal Skela darker */
  --crx-accent:   #00d084;   /* verde lime accent */
  --crx-danger:   #dc2626;
  --crx-success:  #00a79d;   /* folosim teal-ul în loc de verde generic */
  --crx-warning:  #f59e0b;

  --crx-sidebar-w: 240px;
  --crx-topbar-h:  58px;

  /* Gradient pentru T-mark / avatar — inspirat din monogramul Skela */
  --crx-brand-start: #00d084;
  --crx-brand-end:   #008497;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--crx-bg);
  color: var(--crx-text);
  font-family: "Inter","Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}

/* ---------- App shell ---------- */
.app-shell{
  display: grid;
  grid-template-columns: var(--crx-sidebar-w) 1fr;
  grid-template-rows: var(--crx-topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar content";
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar{
  grid-area: topbar;
  background: var(--crx-surface);
  border-bottom: 1px solid var(--crx-border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px 0 12px;
  position: sticky; top: 0; z-index: 30;
}
.brand{
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--crx-text);
  width: calc(var(--crx-sidebar-w) - 12px);
  padding-left: 4px;
  flex-shrink: 0;
}
.brand:hover{ color: var(--crx-text); }
.brand-logo{
  height: 30px; width: auto; display: block;
}
.brand-text{
  font-weight: 700; font-size: 17px; letter-spacing: -.015em;
  color: var(--crx-text);
  white-space: nowrap;
}
.topbar-search{
  flex: 1 1 auto; max-width: 560px;
  position: relative;
  background: #f1f4f8;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px 12px 7px 36px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.topbar-search:hover{ background: #eceff5; }
.topbar-search i.bi-search{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color: var(--crx-muted); font-size: 15px; }
.topbar-search input{
  width:100%; border:0; background:transparent; outline:none; color:var(--crx-text); font-size: 13px;
  padding-right: 80px;
}
.topbar-search input::placeholder{ color: #94a3b8; }
.topbar-search.is-open{ background: #fff; box-shadow: 0 6px 18px rgba(15,23,42,.08); border-color: var(--crx-border); }
.topbar-search-kbd{
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: inline-flex; gap: 3px;
  pointer-events: none;
}
.topbar-search-kbd kbd{
  background: #fff;
  border: 1px solid #dfe3ec;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px; font-weight: 600; color: #64748b;
  font-family: "Inter", system-ui, sans-serif;
  box-shadow: 0 1px 0 rgba(15,23,42,.04);
  line-height: 1.3;
}

/* Dropdown rezultate căutare */
.topbar-search-dropdown{
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--crx-border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,.15);
  max-height: 540px; overflow-y: auto;
  z-index: 50;
}
.topbar-search-status{ padding: 10px 14px; font-size: 12px; color: var(--crx-muted); }
.topbar-search-results{ padding: 4px 0 8px; }
.sr-group + .sr-group{ border-top: 1px solid #f1f5f9; margin-top: 4px; padding-top: 4px; }
.sr-group-head{
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--crx-muted); font-weight: 600;
  padding: 8px 14px 4px;
}
.sr-group-head i{ margin-right: 6px; color: var(--crx-primary-2); }
.sr-group-list{ list-style: none; padding: 0; margin: 0; }
.sr-item{
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  color: var(--crx-text); text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
}
.sr-item:hover, .sr-item.is-active{
  background: #f8fafc; color: var(--crx-text);
  border-left-color: var(--crx-primary);
}
.sr-code{
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px; font-weight: 600;
  background: var(--crx-panel); padding: 2px 6px; border-radius: 4px;
  color: var(--crx-muted);
}
.sr-title{
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-sub{
  font-size: 11px; color: var(--crx-muted);
  white-space: nowrap;
}
.sr-chip{
  font-size: 10px; padding: 1px 6px; border-radius: 8px;
  background: #f1f5f9; color: #64748b;
  white-space: nowrap;
}
.sr-chip.chip-done{ background: #d1fae5; color: #065f46; }

/* Notificări */
.notif-wrap{ position: relative; }
.notif-btn{ position: relative; }
.notif-badge{
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--crx-danger); color: #fff;
  font-size: 10px; font-weight: 600;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}
.notif-dropdown{
  width: 360px; max-height: 460px; overflow-y: auto;
  padding: 0; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,.16);
}
.notif-dropdown-head{
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--crx-border);
  background: #fafbfc;
}
.btn-link-sm{
  background: none; border: 0; color: var(--crx-primary-2);
  font-size: 11px; padding: 0; cursor: pointer;
}
.btn-link-sm:hover{ text-decoration: underline; }
.notif-list{ list-style: none; margin: 0; padding: 0; }
.notif-empty{ padding: 24px 14px; text-align: center; color: var(--crx-muted); font-size: 13px; }
.notif-item{ border-bottom: 1px solid #f1f5f9; }
.notif-item:last-child{ border-bottom: none; }
.notif-link{
  display: flex; gap: 10px; padding: 10px 14px;
  color: inherit; text-decoration: none;
  align-items: flex-start;
}
.notif-link:hover{ background: #f8fafc; color: inherit; }
.notif-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: transparent; margin-top: 6px; flex-shrink: 0;
}
.notif-item.is-unread{ background: #eff6ff; }
.notif-item.is-unread .notif-dot{ background: var(--crx-primary); }
.notif-item.is-unread .notif-title{ font-weight: 600; }
.notif-body{ flex: 1; min-width: 0; }
.notif-title{ font-size: 13px; color: var(--crx-text); line-height: 1.35; }
.notif-msg{ font-size: 12px; color: var(--crx-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time{ font-size: 11px; color: var(--crx-muted); margin-top: 2px; }
.topbar-actions{ display:flex; align-items:center; gap:4px; margin-left:auto; }
.btn-ghost{
  background:transparent; border:0; width:38px; height:38px; border-radius:8px;
  display:inline-flex; align-items:center; justify-content:center;
  color: var(--crx-muted); font-size: 18px; cursor: pointer;
  position: relative;
}
.btn-ghost:hover{ background:#eef1f6; color: var(--crx-text); }
.badge-dot{
  position:absolute; top:10px; right:10px; width:8px; height:8px; border-radius:50%;
  background: var(--crx-danger);
}
.avatar{
  width:32px; height:32px; border-radius:50%;
  background: linear-gradient(135deg, var(--crx-brand-start), var(--crx-brand-end));
  color:#fff; font-weight:600;
  display:inline-flex; align-items:center; justify-content:center;
  font-size: 13px;
}
.sidebar-toggle{ margin-right: 4px; }

/* ---------- Sidebar ---------- */
.sidebar{
  grid-area: sidebar;
  background: var(--crx-surface);
  border-right: 1px solid var(--crx-border);
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  position: sticky; top: var(--crx-topbar-h);
  height: calc(100vh - var(--crx-topbar-h));
}
.sidebar-nav{ flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sidebar .nav-link{
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--crx-text);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  transition: background .12s, color .12s;
}
.sidebar .nav-link > i{ font-size: 16px; color: var(--crx-muted); width: 18px; flex-shrink: 0; }
.sidebar .nav-link > span{ flex: 1; min-width: 0; }
.sidebar .nav-link:hover{ background: #f1f3f7; color: var(--crx-text); }
.sidebar .nav-link.active{
  background: color-mix(in srgb, var(--crx-primary) 10%, #fff);
  color: var(--crx-primary-2);
  font-weight: 600;
}
.sidebar .nav-link.active > i{ color: var(--crx-primary); }
.sidebar .nav-link.active::before{
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--crx-primary); border-radius: 0 2px 2px 0;
}
.sidebar .nav-sub{ margin: 2px 0 6px 0; }
.sidebar .nav-sub .nav-link{ padding-top: 5px; padding-bottom: 5px; font-size: 13px; color: var(--crx-muted); }

/* Grupuri în sidebar — separă vizual secțiunile (ex. contacte vs contracte) */
.sidebar-nav-group{
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.sidebar-nav-group + .sidebar-nav-group{
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--crx-border);
}
/* evită dublu separator înainte de blocul admin (are chenar propriu) */
.sidebar-nav-group + .sidebar-nav-group--admin{
  border-top: 0;
  margin-top: 12px;
  padding-top: 0;
}
.sidebar-nav-label{
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 2px 12px 8px;
  margin: 0;
  line-height: 1.2;
  user-select: none;
}
/* Primul label după începutul nav — fără dublură de spațiu */
.sidebar-nav .sidebar-nav-group:first-of-type .sidebar-nav-label{
  padding-top: 0;
}
.sidebar-nav-group--admin .sidebar-nav-label{
  color: #b45309;
}
.sidebar-nav-group--admin{
  background: color-mix(in srgb, #f59e0b 6%, transparent);
  border-radius: 10px;
  padding-top: 8px;
  margin-top: 10px;
  border-top: 0;
  border: 1px solid color-mix(in srgb, #f59e0b 22%, var(--crx-border));
}
.sidebar .sidebar-nav-group--admin .nav-link{ margin-left: 2px; margin-right: 2px; }
.sidebar .sidebar-nav-group--admin .nav-link:last-of-type{ margin-bottom: 4px; }

.sidebar-badge{
  background: #e5e7eb; color: #334155;
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
  min-width: 20px; text-align: center;
  flex-shrink: 0;
}
.sidebar-badge-danger{ background: #fee2e2; color: #b91c1c; }

/* User card + Delogare */
.sidebar-user{
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--crx-border);
}
.sidebar-user-card{
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: #fafbfc;
  border: 1px solid var(--crx-border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.sidebar-user-avatar{
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--crx-brand-start), var(--crx-brand-end));
  color: #fff; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 132, 151, .28);
}
.sidebar-user-info{ flex: 1; min-width: 0; }
.sidebar-user-name{
  font-size: 13px; font-weight: 600; color: var(--crx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar-user-meta{ margin-top: 2px; }
.sidebar-user-role{
  display: inline-block;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 7px; border-radius: 4px;
  background: #e5e7eb; color: #475569;
}
.sidebar-user-role.role-admin{   background: #fef3c7; color: #92400e; }
.sidebar-user-role.role-manager{ background: #dbeafe; color: #1d4ed8; }
.sidebar-user-role.role-agent{   background: #d1fae5; color: #065f46; }

.sidebar-logout-form{ margin: 0; }
.sidebar-logout-btn{
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--crx-border);
  border-radius: 8px;
  color: var(--crx-text);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.sidebar-logout-btn i{ font-size: 16px; color: var(--crx-muted); transition: color .12s; }
.sidebar-logout-btn:hover{
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.sidebar-logout-btn:hover i{ color: #dc2626; }

/* ---------- Content ---------- */
.content{
  grid-area: content;
  padding: 20px 24px;
  min-width: 0;
  /* Fluid — ocupă tot spațiul disponibil, fără plafon artificial. */
}
@media (min-width: 1600px){
  .content{ padding: 24px 32px; }
}

.page-header h2{ font-weight: 600; }

/* ---------- Stat cards ---------- */
.stat-card{
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-label{ color: var(--crx-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
.stat-value{ font-size: 28px; font-weight: 700; margin-top: 4px; }

/* ---------- Auth ---------- */
.auth-body{
  background: linear-gradient(180deg, #f4f6fa 0%, #e4ecf1 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-shell{ width: 100%; max-width: 440px; }
.auth-card{
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0,132,151,.10), 0 4px 12px rgba(0,0,0,.04);
}
.auth-logo{
  max-width: 200px; height: auto; display: inline-block;
  margin-bottom: 12px;
}
.auth-app-name{
  font-size: 14px; font-weight: 600; color: var(--crx-primary-2);
  letter-spacing: .02em; text-transform: uppercase;
  margin-bottom: 2px;
}

/* ---------- Utilities ---------- */
.form-label{ font-weight: 500; font-size: 13px; color: var(--crx-text); }
.btn-primary{
  background: var(--crx-primary); border-color: var(--crx-primary);
  box-shadow: 0 1px 2px rgba(0,132,151,.18);
}
.btn-primary:hover,
.btn-primary:focus{
  background: var(--crx-primary-2); border-color: var(--crx-primary-2);
  box-shadow: 0 2px 6px rgba(0,132,151,.28);
}
.btn-primary:active{ background: var(--crx-primary-2); border-color: var(--crx-primary-2); }
.btn-outline-primary{
  color: var(--crx-primary); border-color: var(--crx-primary);
}
.btn-outline-primary:hover{
  background: var(--crx-primary); border-color: var(--crx-primary); color: #fff;
}
a{ color: var(--crx-primary-2); }
a:hover{ color: var(--crx-primary); }
hr.dropdown-divider{ margin: 4px 0; }

.card{ border-color: var(--crx-border); box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.card-header{ background: #fafbfc; border-bottom: 1px solid var(--crx-border); padding: 12px 16px; }
.table thead th{ font-weight: 600; border-top: 0; background: #fafbfc; }
.table > :not(caption) > * > *{ padding: 10px 14px; }

.info-label{ color: var(--crx-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 3px; }
.btn-ghost-outline{
  background: transparent; border: 1px solid var(--crx-border); color: var(--crx-muted);
  padding: 2px 8px; border-radius: 6px;
}
.btn-ghost-outline:hover{ background: #f1f3f7; color: var(--crx-text); }

.color-dot{ display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.small-avatar{ width: 26px; height: 26px; font-size: 11px; }

/* Settings tiles */
.settings-tile{
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 12px;
  padding: 18px 18px;
  text-decoration: none;
  color: var(--crx-text);
  transition: border-color .15s, box-shadow .15s;
}
.settings-tile:hover{ border-color: var(--crx-primary); box-shadow: 0 2px 8px rgba(0,167,157,.12); color: var(--crx-text); }
.settings-icon{
  width: 44px; height: 44px; border-radius: 10px;
  background: #eff5ff; color: var(--crx-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}

.lookup-tabs .list-group-item{ border: 0; border-radius: 8px; margin-bottom: 2px; color: var(--crx-text); }
.lookup-tabs .list-group-item.active{ background: #eff5ff; color: var(--crx-primary-2); border: 0; }

/* ---------- Pipeline settings (kanban-like) ---------- */
.pipeline-board{ margin-top: 12px; }
.pipeline-column{
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 10px;
  padding: 12px;
  height: 100%;
  display: flex; flex-direction: column;
}
.pipeline-column-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap: 8px; margin-bottom: 4px;
}
.pipeline-group-label{
  font-weight: 600; font-size: 13px;
  padding: 3px 10px; border-radius: 999px;
  display: inline-block;
}
.pipeline-group-sursa       { background: #fff3cd; color: #8a6d00; }  /* galben */
.pipeline-group-deschis     { background: #dbeafe; color: #1d4ed8; }  /* albastru */
.pipeline-group-succes      { background: #d1fae5; color: #047857; }  /* verde */
.pipeline-group-fara_succes { background: #fee2e2; color: #b91c1c; }  /* roșu */

.pipeline-group-desc{
  color: var(--crx-muted); font-size: 12px;
  margin-bottom: 10px; min-height: 30px;
}
.pipeline-list{
  display: flex; flex-direction: column; gap: 6px;
  min-height: 40px;
  flex-grow: 1;
}
.pipeline-item{
  background: #fafbfc;
  border: 1px solid var(--crx-border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  cursor: grab;
  user-select: none;
  transition: border-color .12s, box-shadow .12s;
}
.pipeline-item:hover{ border-color: var(--crx-primary); box-shadow: 0 2px 6px rgba(0,167,157,.1); }
.pipeline-item.is-inactive{ opacity: .55; }
.pipeline-item.is-inactive .pipeline-name{ text-decoration: line-through; }
.pipeline-item .color-dot{ width: 12px; height: 12px; flex-shrink: 0; }
.pipeline-item .pipeline-name{ flex: 1; font-size: 13px; }
.pipeline-edit-btn{
  background: transparent; border: 0; color: var(--crx-muted);
  padding: 2px 4px; border-radius: 4px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.pipeline-item:hover .pipeline-edit-btn{ opacity: 1; }
.pipeline-edit-btn:hover{ background: #eef1f6; color: var(--crx-text); }

.pipeline-empty{
  color: var(--crx-muted); font-size: 12px;
  text-align: center; padding: 16px 0;
  border: 1px dashed var(--crx-border); border-radius: 6px;
}

/* Sortable states */
.pipeline-item-ghost { opacity: .4; background: #eef5ff; border-color: var(--crx-primary); }
.pipeline-item-drag  { opacity: .9; box-shadow: 0 10px 24px rgba(0,0,0,.15); cursor: grabbing; }
.pipeline-item-chosen{ cursor: grabbing; }

.pipeline-save-indicator{
  position: fixed; bottom: 20px; right: 20px;
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  opacity: 0; transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 1050;
}
.pipeline-save-indicator.show{ opacity: 1; transform: translateY(0); }
.pipeline-save-indicator.is-success{ border-color: #16a34a; color: #166534; }
.pipeline-save-indicator.is-error  { border-color: #dc2626; color: #991b1b; }

.bg-secondary-subtle{ background-color: #e5e7eb !important; }

/* =========================================================
   DEALS — listă + sidebar pipeline + modal oportunitate
   ========================================================= */
.deals-layout{
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: flex-start;
}
.deals-main{ min-width: 0; }
.deals-sidebar{
  position: sticky; top: calc(var(--crx-topbar-h) + 12px);
  max-height: calc(100vh - var(--crx-topbar-h) - 24px);
  overflow-y: auto;
}

.view-toggle .btn{ border-radius: 6px !important; padding: 4px 10px; }

.deals-filters{ display:flex; gap:8px; align-items:center; flex-wrap: wrap; }

/* Grupa */
.deal-group{
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}
.deal-group-head{
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  background: #fafbfc;
  border-bottom: 1px solid var(--crx-border);
  color: var(--crx-text);
  user-select: none;
}
.deal-group-urgent .deal-group-head{
  background: #fef2f2; color: #991b1b; border-bottom-color: #fecaca;
}
.deal-group-urgent .deal-group-head i:first-child{ color: #dc2626; }
.deal-group-today .deal-group-head{ background: #fffbeb; color: #92400e; }
.deal-group-today .deal-group-head i:first-child{ color: #d97706; }
.deal-group-title{ font-weight: 600; }
.deal-group-chevron{ transition: transform .2s; }
.deal-group-head[aria-expanded="false"] .deal-group-chevron{ transform: rotate(-90deg); }

/* Sortare listă oportunități (/vanzari) */
.deal-sort-bar{
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  font-size: 12px; line-height: 1.3;
  padding: 8px 12px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--crx-border);
  border-radius: 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.deal-sort-label{
  color: var(--crx-muted); font-weight: 600; text-transform: uppercase;
  font-size: 10px; letter-spacing: .04em; margin-right: 2px;
}
.deal-sort-pill{
  text-decoration: none; color: var(--crx-text);
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  border: 1px solid transparent;
}
.deal-sort-pill:hover{ background: #f1f5f9; color: var(--crx-text); }
.deal-sort-pill.is-active{
  background: #eff5ff; color: var(--crx-primary, #0d9488);
  font-weight: 600; border-color: color-mix(in srgb, var(--crx-primary) 20%, #fff);
}
.deal-sort-pill i{ opacity: .4; font-size: 10px; margin-left: 1px; vertical-align: middle; }
.deal-sort-pill.is-active i{ opacity: 1; }

.deal-table{ display: flex; flex-direction: column; }
.deal-table-head{
  display: grid;
  grid-template-columns: 32px 1fr 200px 100px 40px 100px;
  gap: 12px;
  align-items: center;
  padding: 6px 16px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--crx-muted);
  border-bottom: 1px solid var(--crx-border);
  background: #fafbfc;
}
.deal-th-main{ min-width: 0; }
.deal-th-created, .deal-th-task{ text-align: right; }
.deal-th-user{ text-align: center; }
.deal-row{
  display: grid;
  grid-template-columns: 32px 1fr 200px 100px 40px 100px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--crx-border);
  text-decoration: none;
  color: var(--crx-text);
  transition: background .1s;
}
.deal-row:first-child{ border-top: 0; }
.deal-row:hover{ background: #f5f8ff; color: var(--crx-text); }
.deal-row-bell{ text-align: center; font-size: 16px; }
.deal-row-main{ min-width: 0; }
.deal-row-code-title{ display:flex; gap: 8px; align-items: baseline; }
.deal-code{
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; font-weight: 600;
  color: var(--crx-primary);
  background: #eff5ff; padding: 2px 7px; border-radius: 4px;
  white-space: nowrap;
}
.deal-title{
  font-weight: 500; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deal-row-sub{ color: var(--crx-muted); font-size: 12px; margin-top: 2px; }
.deal-status-pill{
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  border: 1px solid;
}
.deal-row-created{
  text-align: right;
  font-size: 12px;
  color: var(--crx-muted);
  white-space: nowrap;
}
.deal-row-created abbr{ text-decoration: none; border-bottom: 0; cursor: help; }
.deal-row-date{ text-align: right; }

.empty-state{
  text-align: center; padding: 60px 20px;
  background: var(--crx-surface);
  border: 1px dashed var(--crx-border);
  border-radius: 12px; color: var(--crx-muted);
}
.empty-state i{ font-size: 48px; opacity: .35; }

/* Sidebar dreapta pipeline */
.sp-wrap{
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 10px;
  padding: 16px;
}
.sp-head{ margin-bottom: 16px; }
.sp-title{ font-weight: 700; font-size: 15px; }
.sp-section{ margin-bottom: 16px; }
.sp-section-label{
  display: inline-block;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px;
  margin-bottom: 8px;
}
.sp-list{ list-style: none; margin: 0; padding: 0; }
.sp-item{
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  text-decoration: none; color: var(--crx-text);
  font-size: 13px; border-radius: 6px;
}
.sp-item:hover{ background: #f1f3f7; color: var(--crx-text); }
.sp-item.is-active{ background: #eff5ff; color: var(--crx-primary-2); }
.sp-item .color-dot{ width: 10px; height: 10px; flex-shrink: 0; }
.sp-item .sp-name{ flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item .sp-count{ font-size: 12px; white-space: nowrap; }
.sp-item .sp-count strong{ color: var(--crx-primary-2); }

/* Modal oportunitate nouă */
.deal-modal .modal-body{ padding: 24px; }
.deal-modal-section-head{
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.deal-modal-section-head .reset-link{ text-decoration: none; font-size: 12px; padding: 0; }
.deal-modal-section-head .reset-link:hover{ color: var(--crx-text) !important; }

/* Autocomplete dropdown */
.autocomplete-dropdown{
  position: absolute; left: 0; right: 0; top: 100%;
  margin-top: 4px; z-index: 1060;
  background: var(--crx-surface);
  border: 1px solid var(--crx-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  max-height: 320px; overflow-y: auto;
  min-width: 260px;
}
/* În modale, autocomplete e pe input-group: păstrăm inset-ul discret */
.modal .autocomplete-dropdown{ left: 12px; right: 12px; min-width: 0; }
.autocomplete-item{
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--crx-border);
  cursor: pointer; color: var(--crx-text);
}
.autocomplete-item:last-child{ border-bottom: 0; }
.autocomplete-item:hover,
.autocomplete-item.is-active{ background: #eff5ff; }
.autocomplete-item .ac-primary{ font-weight: 500; font-size: 14px; }
.autocomplete-item .ac-primary i{ color: var(--crx-muted); margin-right: 4px; }
.autocomplete-item .ac-sub{ font-size: 12px; color: var(--crx-muted); margin-top: 2px; }
.autocomplete-empty{ padding: 12px 14px; font-size: 13px; color: var(--crx-muted); }

/* Responsive: colapsează sidebar-ul sub 1200px */
@media (max-width: 1199px){
  .deals-layout{ grid-template-columns: 1fr; }
  .deals-sidebar{ position: static; max-height: none; }
}
@media (max-width: 767px){
  .deal-row{ grid-template-columns: 24px 1fr 90px; }
  .deal-row-status, .deal-row-created, .deal-row-user, .deal-row-date{ display: none; }
}

/* =========================================================
   DEAL DETAIL (Faza 5a)
   ========================================================= */
.deal-detail{ display: flex; flex-direction: column; gap: 16px; }

/* ---- Header ---- */
.deal-header{
  background: #fff; border: 1px solid var(--crx-border); border-radius: 12px;
  padding: 14px 18px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.deal-header-left{ flex: 1; min-width: 0; }
.deal-breadcrumb{ font-size: 12px; margin-bottom: 6px; }
.deal-title-row{ display: flex; align-items: center; gap: 10px; }
.deal-code-badge{
  background: var(--crx-panel); border: 1px solid var(--crx-border);
  padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 14px;
  color: var(--crx-muted); font-family: ui-monospace, Menlo, monospace;
  flex-shrink: 0;
}
.deal-title-input{
  flex: 1; border: none; background: transparent; font-size: 22px; font-weight: 700;
  color: var(--crx-text); padding: 4px 6px; border-radius: 6px; min-width: 0;
}
.deal-title-input:focus{ outline: 2px solid rgba(59,130,246,.25); background: #fff; }
.deal-header-meta{ margin-top: 6px; font-size: 12px; color: var(--crx-muted); }
.deal-updated-indicator{ display: inline-flex; align-items: center; gap: 6px; }
.deal-updated-text{ transition: color .2s; }
.deal-updated-text.is-saving{ color: #f59e0b; }
.deal-updated-text.is-saved{ color: #10b981; font-weight: 500; }
.deal-updated-text.is-error{ color: #ef4444; font-weight: 500; }

.deal-header-right{ display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.deal-status-badge{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid; background: #fff; cursor: pointer;
  transition: filter .15s;
}
.deal-status-badge:hover{ filter: brightness(0.96); }
.deal-status-badge .status-dot{ width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.deal-status-dropdown{ max-height: 360px; overflow-y: auto; min-width: 240px; }
.deal-status-dropdown .dropdown-item{ display: flex; align-items: center; gap: 8px; }
.deal-status-dropdown .status-dot{ width: 8px; height: 8px; border-radius: 50%; }

/* ---- Layout 3 coloane ---- */
.deal-body{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px) minmax(280px, 320px);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1399px){
  .deal-body{ grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
  .deal-col-aside{ grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (max-width: 991px){
  .deal-body{ grid-template-columns: 1fr; }
  .deal-col-aside{ grid-template-columns: 1fr; }
}

/* ---- Panel generic (coloana centrală sarcini/istoric) ---- */
.deal-panel{
  background: #fff; border: 1px solid var(--crx-border); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.deal-panel-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--crx-border);
}
.deal-empty-state{
  padding: 40px 20px; text-align: center; color: var(--crx-muted);
}
.deal-empty-state i{ font-size: 42px; color: #cbd5e1; display: block; margin-bottom: 10px; }

/* ---- Secțiuni panou oportunitate ---- */
.deal-section{
  background: #fff; border: 1px solid var(--crx-border); border-radius: 12px;
  margin-bottom: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.deal-section-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; user-select: none;
  background: #fafbfc; border-bottom: 1px solid var(--crx-border);
  transition: background .15s;
}
.deal-section-head:hover{ background: #f3f5f7; }
.deal-section-head[aria-expanded="false"]{ border-bottom: 0; }
.deal-chevron{ transition: transform .2s; color: var(--crx-muted); font-size: 14px; }
.deal-section-head[aria-expanded="false"] .deal-chevron{ transform: rotate(-90deg); }
.deal-section-body{ padding: 16px; }

/* ---- Pastile colorate (Business Lines / BANT / Piața) ---- */
.deal-pills{ display: flex; flex-wrap: wrap; gap: 8px; }
.deal-pill{
  --pill-c: #e5e7eb;
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 16px; font-size: 12px;
  border: 1px solid var(--crx-border);
  background: #fff;
  cursor: pointer; user-select: none;
  transition: all .15s;
}
.deal-pill input{
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.deal-pill .pill-dot{
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  opacity: .5;
}
.deal-pill.is-checked,
.deal-pill:has(input:checked){
  background: color-mix(in srgb, var(--pill-c) 15%, #fff);
  border-color: var(--pill-c);
  color: color-mix(in srgb, var(--pill-c) 70%, #000);
  font-weight: 600;
}
.deal-pill.is-checked .pill-dot,
.deal-pill:has(input:checked) .pill-dot{ opacity: 1; }
.deal-pill-upper{ letter-spacing: .03em; }

/* ---- Slider "Șanse reușită" ---- */
.deal-section-body .form-range{ padding-top: 8px; }

/* ---- Stele feedback ---- */
.deal-stars{ display: inline-flex; gap: 4px; font-size: 22px; cursor: pointer; color: #fbbf24; }
.deal-stars .bi-star{ color: #cbd5e1; }

/* ---- File slot ---- */
.file-slot{ position: relative; }
.file-dropzone{
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 20px 14px;
  border: 2px dashed var(--crx-border); border-radius: 8px;
  background: #fafbfc; color: var(--crx-muted); font-size: 13px;
  cursor: pointer; transition: all .15s; text-align: center;
}
.file-dropzone:hover,
.file-dropzone.is-dragover{
  border-color: var(--crx-primary); background: color-mix(in srgb, var(--crx-primary) 5%, #fff);
  color: var(--crx-primary);
}
.file-dropzone i{ font-size: 28px; color: #94a3b8; }
.file-dropzone:hover i, .file-dropzone.is-dragover i{ color: var(--crx-primary); }
.file-dropzone small{ font-size: 11px; }

.file-chip{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--crx-border); border-radius: 8px;
  background: #f8fafc;
}
.file-chip > i{ font-size: 28px; color: var(--crx-primary); flex-shrink: 0; }
.file-chip-info{ flex: 1; min-width: 0; }
.file-chip-name{
  font-weight: 600; color: var(--crx-text); text-decoration: none; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.file-chip-name:hover{ color: var(--crx-primary); text-decoration: underline; }
.file-chip-meta{ font-size: 11px; color: var(--crx-muted); margin-top: 2px; }
.file-chip-actions{ display: flex; gap: 4px; flex-shrink: 0; }

.file-slot-progress{ margin-top: 8px; }
.file-slot-status{ display: block; }

/* ---- Lista sarcini ---- */
.task-add-wrap{ padding: 14px 18px; border-bottom: 1px solid var(--crx-border); background: #fafbfc; }

.task-list{ list-style: none; margin: 0; padding: 0; }
.task-item{
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--crx-border);
  transition: background .15s, opacity .2s;
}
.task-item:last-child{ border-bottom: 0; }
.task-item:hover{ background: #fafbfc; }
.task-item:hover .task-delete{ visibility: visible; opacity: 1; }

.task-check{
  border: none; background: none; color: #cbd5e1; padding: 0;
  font-size: 22px; cursor: pointer; line-height: 1; flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.task-check:hover{ color: var(--crx-primary); transform: scale(1.15); }
.task-item.is-done .task-check{ color: #10b981; }
.task-item.is-overdue .task-check{ color: #ef4444; }

.task-body{ flex: 1; min-width: 0; }
.task-title{ font-size: 14px; color: var(--crx-text); font-weight: 500; word-break: break-word; }
.task-item.is-done .task-title{ text-decoration: line-through; color: var(--crx-muted); }

.task-meta{ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: 11px; color: var(--crx-muted); }
.task-meta .badge{ font-size: 10px; padding: 2px 6px; }
.task-due, .task-owner{ display: inline-flex; align-items: center; }

.task-delete{
  border: none; background: none; color: #cbd5e1; padding: 4px 6px;
  cursor: pointer; font-size: 14px; visibility: hidden; opacity: 0;
  transition: color .15s, opacity .15s;
}
.task-delete:hover{ color: #ef4444; }

/* ---- Timeline ---- */
.timeline{ padding: 0 18px 14px; }
.timeline-day{ margin-top: 18px; }
.timeline-day:first-child{ margin-top: 14px; }
.timeline-day-header{
  font-size: 12px; font-weight: 600; color: var(--crx-muted);
  letter-spacing: .02em; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--crx-border);
}
.timeline-events{ list-style: none; margin: 0; padding: 0; position: relative; }
.timeline-events::before{
  content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px;
  width: 2px; background: #e5e7eb;
}
.timeline-event{
  position: relative; display: flex; gap: 12px;
  padding: 6px 0 10px 0;
}
.timeline-icon{
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #64748b;
  font-size: 14px; flex-shrink: 0; z-index: 1;
  border: 2px solid #fff;
}
.timeline-event.tone-primary .timeline-icon{ background: #dbeafe; color: #2563eb; }
.timeline-event.tone-success .timeline-icon{ background: #d1fae5; color: #059669; }
.timeline-event.tone-danger  .timeline-icon{ background: #fee2e2; color: #dc2626; }
.timeline-event.tone-warning .timeline-icon{ background: #fef3c7; color: #d97706; }

.timeline-body{ flex: 1; min-width: 0; }
.timeline-title{ font-size: 13px; color: var(--crx-text); line-height: 1.4; }
.timeline-desc{ color: var(--crx-muted); }
.timeline-meta{ font-size: 11px; color: var(--crx-muted); margin-top: 2px; }
.timeline-time{ font-family: ui-monospace, Menlo, monospace; }

/* Diff în timeline (Faza 8) */
.diff-old{
  text-decoration: line-through;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 1px 6px; border-radius: 4px;
  font-size: 12px;
}
.diff-new{
  color: #1e40af;
  background: #dbeafe;
  padding: 1px 6px; border-radius: 4px;
  font-weight: 500;
  font-size: 12px;
}
.timeline-event.kind-pivot .diff-new{ background: #d1fae5; color: #065f46; }
.timeline-event.kind-pivot .diff-old{ background: #fee2e2; color: #991b1b; text-decoration: none; }

/* Comentariu manual (istoric_manual) */
.timeline-event.kind-comment{
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.timeline-event.kind-comment .timeline-icon{
  background: #fef3c7; color: #d97706;
  border-color: #fffbeb;
}
.timeline-comment{
  margin-top: 6px;
  font-size: 13px;
  color: var(--crx-text);
  line-height: 1.45;
  white-space: normal;
}
.timeline-comment-file{
  margin-top: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.timeline-comment-file a{
  color: var(--crx-primary-2); text-decoration: none;
}
.timeline-comment-file a:hover{ text-decoration: underline; }

/* Filtre bar */
.timeline-filters .btn{ font-size: 12px; padding: 3px 10px; }

/* ---- Aside dreapta ---- */
.deal-aside-card{
  background: #fff; border: 1px solid var(--crx-border); border-radius: 12px;
  margin-bottom: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.deal-aside-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #fafbfc; border-bottom: 1px solid var(--crx-border);
}
.deal-aside-body{ padding: 14px; }

.deal-company-link{ font-weight: 600; color: var(--crx-text); text-decoration: none; font-size: 14px; }
.deal-company-link:hover{ color: var(--crx-primary); }

.deal-contacts-list{ list-style: none; padding: 0; margin: 0; }
.deal-contacts-list li{
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--crx-border);
}
.deal-contacts-list li:first-child{ padding-top: 0; }
.deal-contacts-list li:last-child{ border-bottom: 0; padding-bottom: 0; }
.avatar-initials{
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-info{ flex: 1; min-width: 0; }
.contact-name{ font-weight: 600; font-size: 13px; color: var(--crx-text); }
.contact-pos{ font-size: 12px; color: var(--crx-muted); margin-bottom: 2px; }

/* Alte oportunități */
.deal-other-group{ margin-bottom: 10px; }
.deal-other-group-head{
  font-size: 11px; text-transform: uppercase; color: var(--crx-muted);
  font-weight: 600; letter-spacing: .04em; margin-bottom: 4px;
}
.deal-other-item{
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 12px; text-decoration: none; color: var(--crx-text);
  transition: background .15s;
}
.deal-other-item:hover{ background: var(--crx-panel); color: var(--crx-primary); }
.deal-other-status-dot{ width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.deal-other-code{ font-family: ui-monospace, Menlo, monospace; font-weight: 600; font-size: 11px; color: var(--crx-muted); }
.deal-other-title{
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =========================================================
   KANBAN (Faza 6)
   ========================================================= */
.kanban-toolbar{
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff; padding: 10px 14px; border: 1px solid var(--crx-border);
  border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kanban-group-toggles{ display: flex; gap: 6px; flex-wrap: wrap; }
.kanban-group-toggle{
  --gc: #94a3b8;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 14px;
  border: 1px solid var(--crx-border); background: #fff;
  font-size: 12px; color: var(--crx-muted); cursor: pointer; user-select: none;
  transition: all .15s;
}
.kanban-group-toggle input{ position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.kanban-group-toggle .kanban-toggle-dot{
  width: 8px; height: 8px; border-radius: 50%; background: var(--gc); opacity: .35;
}
.kanban-group-toggle.is-active{
  background: color-mix(in srgb, var(--gc) 12%, #fff);
  border-color: var(--gc);
  color: color-mix(in srgb, var(--gc) 70%, #000);
  font-weight: 600;
}
.kanban-group-toggle.is-active .kanban-toggle-dot{ opacity: 1; }

/* Board */
.kanban-board{
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: 8px;
  min-height: 60vh;
  /* Scroll orizontal */
  scrollbar-color: #cbd5e1 transparent;
}
.kanban-board::-webkit-scrollbar{ height: 10px; }
.kanban-board::-webkit-scrollbar-thumb{ background: #cbd5e1; border-radius: 5px; }
.kanban-board::-webkit-scrollbar-thumb:hover{ background: #94a3b8; }

.kanban-col{
  --col-c: #94a3b8;
  flex: 0 0 252px; /* coloane mai înguste → mai multe vizibile orizontal */
  background: #f8fafc;
  border: 1px solid var(--crx-border); border-radius: 10px;
  border-top: 3px solid var(--col-c);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 220px);
}
.kanban-col-head{
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--crx-border);
  background: #fff; border-radius: 7px 7px 0 0;
  position: sticky; top: 0; z-index: 1;
}
.kanban-col-head-left{ display: flex; align-items: center; gap: 8px; min-width: 0; }
.kanban-col-dot{
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--col-c); flex-shrink: 0;
}
.kanban-col-title{
  font-size: 13px; font-weight: 600; color: var(--crx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}
.kanban-col-count{
  background: color-mix(in srgb, var(--col-c) 15%, #fff);
  color: color-mix(in srgb, var(--col-c) 70%, #000);
  border: 1px solid color-mix(in srgb, var(--col-c) 30%, #fff);
  padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  min-width: 26px; text-align: center;
}

.kanban-col-cards{
  list-style: none; margin: 0; padding: 6px;
  flex: 1 1 auto; overflow-y: auto; min-height: 40px;
}
/* Coloană stufosă: arată doar o „fereastră” până la expand */
.kanban-col--clamped .kanban-col-cards{
  max-height: 260px;
  overflow: hidden;
  flex: 0 0 auto;
  mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
}
.kanban-col-footer{
  flex-shrink: 0;
  border-top: 1px solid var(--crx-border);
  background: #fff;
  border-radius: 0 0 8px 8px;
}
.kanban-col-expand{
  display: block; width: 100%;
  border: 0; background: #fff;
  color: var(--crx-primary, #0d9488);
  font-size: 11px; font-weight: 600;
  padding: 6px 8px;
  cursor: pointer;
  line-height: 1.2;
  border-radius: 0 0 7px 7px;
}
.kanban-col-expand:hover{ background: #f0fdfa; }
.kanban-col-footer[hidden]{ display: none !important; }
.kanban-col-empty{
  padding: 16px 12px; text-align: center;
  color: #94a3b8; font-size: 12px; font-style: italic;
}

/* Cards (compact: mai puțin „stufos" vizual) */
.kanban-card{
  background: #fff; border: 1px solid var(--crx-border); border-radius: 6px;
  margin-bottom: 5px; overflow: hidden;
  box-shadow: 0 1px 1px rgba(15,23,42,.04);
  transition: box-shadow .12s, border-color .12s;
  position: relative;
}
.kanban-card:hover{
  box-shadow: 0 2px 6px rgba(15,23,42,.08);
  border-color: #cbd5e1;
  transform: none; /* fără lift: mai puțin zgomot */
}
.kanban-card-link{
  display: block; text-decoration: none; color: inherit; padding: 6px 8px;
}
.kanban-card-head{
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  margin-bottom: 2px;
}
.kanban-card-code{
  font-family: ui-monospace, Menlo, monospace; font-weight: 600;
  font-size: 10px; color: var(--crx-muted);
  background: var(--crx-panel); padding: 1px 4px; border-radius: 3px;
  max-width: 58%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kanban-card-task-badge{
  font-size: 9px; font-weight: 600;
  padding: 1px 4px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 2px;
  flex-shrink: 0;
}
.kanban-card-task-badge i{ font-size: 9px; }
.kanban-card-task-badge.is-overdue{ background: #fee2e2; color: #b91c1c; }
.kanban-card-task-badge.is-today  { background: #fef3c7; color: #92400e; }
.kanban-card-task-badge.is-future { background: #e0e7ff; color: #4338ca; }

.kanban-card-title{
  font-size: 12px; font-weight: 500; color: var(--crx-text);
  line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 2px;
}
.kanban-card-company{
  font-size: 10px; color: var(--crx-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.kanban-card-company i{ font-size: 9px; opacity: .7; }
.kanban-card-foot{
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  margin-top: 3px; padding-top: 3px;
  border-top: 1px solid #f1f5f9;
}
.kanban-card-value{
  font-size: 11px; font-weight: 600; color: #059669;
}
.kanban-avatar{
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 9px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Drag states */
.kanban-card.is-saving{ opacity: .6; }
.kanban-card.is-success{
  box-shadow: 0 0 0 2px #10b981, 0 3px 10px rgba(16,185,129,.25);
  animation: kanbanPulse .6s ease;
}
.kanban-card.is-error{
  box-shadow: 0 0 0 2px #ef4444, 0 3px 10px rgba(239,68,68,.25);
  animation: kanbanShake .4s ease;
}
@keyframes kanbanPulse{
  0%,100%{ transform: scale(1); }
  50%    { transform: scale(1.02); }
}
@keyframes kanbanShake{
  0%,100%{ transform: translateX(0); }
  25%    { transform: translateX(-3px); }
  75%    { transform: translateX(3px); }
}

/* Sortable states */
.kanban-card-ghost{ opacity: .35; background: #e0e7ff; }
.kanban-card-chosen{ cursor: grabbing; }
.kanban-card-drag{ box-shadow: 0 12px 32px rgba(15,23,42,.2); transform: rotate(2deg); }

.kanban-col-cards.sortable-drag-over{ background: color-mix(in srgb, var(--col-c) 10%, #fff); }

/* Empty state */
.kanban-empty{
  background: #fff; border: 1px dashed var(--crx-border); border-radius: 10px;
  padding: 40px 20px; text-align: center; color: var(--crx-muted);
}
.kanban-empty i{ font-size: 42px; color: #cbd5e1; display: block; margin-bottom: 12px; }

/* Toast */
.kanban-toast{
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff;
  padding: 10px 18px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.25);
  display: flex; align-items: center; gap: 12px;
  z-index: 1080; font-size: 13px;
  animation: kanbanToastIn .2s ease;
}
.kanban-toast.is-error{ background: #b91c1c; }
.kanban-toast-undo{ color: #fbbf24 !important; font-weight: 600; text-decoration: none; }
.kanban-toast-undo:hover{ color: #fde68a !important; }
@keyframes kanbanToastIn{
  from{ transform: translate(-50%, 20px); opacity: 0; }
  to  { transform: translate(-50%, 0);    opacity: 1; }
}

/* =========================================================
   TASKS PAGE (Faza 7)
   ========================================================= */
.tasks-toolbar{
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; padding: 10px 14px; border: 1px solid var(--crx-border);
  border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.tasks-empty{
  background: #fff; border: 1px dashed var(--crx-border); border-radius: 10px;
  padding: 40px 20px; text-align: center; color: var(--crx-muted);
}
.tasks-empty i{ font-size: 42px; color: #10b981; display: block; margin-bottom: 12px; }

.tasks-board{
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.tasks-col{
  --bk-c: #94a3b8;
  background: #fff; border: 1px solid var(--crx-border); border-radius: 10px;
  border-top: 3px solid var(--bk-c);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.tasks-col-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: color-mix(in srgb, var(--bk-c) 5%, #fff);
  border-bottom: 1px solid var(--crx-border);
}
.tasks-col-head-left{ display: flex; align-items: center; gap: 8px; color: var(--bk-c); }
.tasks-col-head-left h6{ color: var(--crx-text); font-size: 13px; font-weight: 600; }
.tasks-col-head-left i{ font-size: 16px; }
.tasks-col-count{
  background: color-mix(in srgb, var(--bk-c) 15%, #fff);
  color: color-mix(in srgb, var(--bk-c) 70%, #000);
  border: 1px solid color-mix(in srgb, var(--bk-c) 30%, #fff);
  padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  min-width: 26px; text-align: center;
}
.tasks-col-items{
  list-style: none; padding: 6px; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.tsk-item{
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--crx-border); border-radius: 8px;
  transition: all .15s;
  position: relative;
}
.tsk-item:hover{
  box-shadow: 0 3px 10px rgba(15,23,42,.08);
  border-color: #cbd5e1;
}
.tsk-item.prio-inalta{  border-left: 3px solid #f59e0b; }
.tsk-item.prio-urgenta{ border-left: 3px solid #dc2626; }
.tsk-item.prio-joasa{   border-left: 3px solid #94a3b8; }
.tsk-item.is-done .tsk-title{ text-decoration: line-through; color: var(--crx-muted); }

.tsk-check{
  background: none; border: none; padding: 0;
  color: #cbd5e1; font-size: 18px; cursor: pointer;
  transition: color .15s;
}
.tsk-check:hover{ color: #10b981; }
.is-done .tsk-check{ color: #10b981; }

.tsk-body{ cursor: pointer; min-width: 0; }
.tsk-title{
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tsk-meta{
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 3px; font-size: 11px; color: var(--crx-muted);
}
.tsk-due{ display: inline-flex; align-items: center; gap: 3px; }
.tsk-due.is-overdue{ color: #dc2626; font-weight: 600; }
.tsk-due.is-today  { color: #f59e0b; font-weight: 600; }
.tsk-prio{ display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 8px; font-weight: 600; }
.tsk-prio-inalta{   background: #fff7ed; color: #ea580c; }
.tsk-prio-urgenta{  background: #fee2e2; color: #b91c1c; }
.tsk-prio-joasa{    background: #f1f5f9; color: #64748b; }
.tsk-deal{
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--crx-primary-2); text-decoration: none;
}
.tsk-deal:hover{ text-decoration: underline; }
.tsk-avatar{
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tsk-delete{
  background: none; border: none; padding: 2px 6px;
  color: #cbd5e1; font-size: 13px; cursor: pointer;
  opacity: 0; transition: all .15s;
  border-radius: 4px;
}
.tsk-item:hover .tsk-delete{ opacity: 1; }
.tsk-delete:hover{ color: #dc2626; background: #fee2e2; }

/* =========================================================
   DASHBOARD (Faza 9)
   ========================================================= */
.dashboard-wrap{ /* fluid, nu limităm lățimea */ }

/* KPI row */
.kpi-row{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 1600px){
  .kpi-row{ gap: 16px; }
}
.kpi-card{
  --tc: #94a3b8;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: #fff; border: 1px solid var(--crx-border);
  border-radius: 10px; border-left: 3px solid var(--tc);
  text-decoration: none; color: inherit;
  transition: all .15s;
}
.kpi-card:hover{
  box-shadow: 0 3px 10px rgba(15,23,42,.08);
  transform: translateY(-1px);
  color: inherit;
}
.kpi-card.tone-danger  { --tc: #dc2626; }
.kpi-card.tone-warning { --tc: #f59e0b; }
.kpi-card.tone-info    { --tc: #3b82f6; }
.kpi-card.tone-primary { --tc: #6366f1; }
.kpi-card.tone-neutral { --tc: #64748b; }
.kpi-icon{
  width: 42px; height: 42px; border-radius: 10px;
  background: color-mix(in srgb, var(--tc) 12%, #fff);
  color: var(--tc);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.kpi-main{ min-width: 0; }
.kpi-label{ font-size: 12px; color: var(--crx-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.kpi-value{ font-size: 30px; font-weight: 800; color: var(--crx-text); line-height: 1.1; letter-spacing: -.02em; }

/* Buton „+ Oportunitate nouă" mai proeminent */
.btn-new-deal{
  padding: 6px 14px !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,132,151,.28);
}
.btn-new-deal:hover{ box-shadow: 0 4px 14px rgba(0,132,151,.38); transform: translateY(-1px); }
.btn-new-deal i{ font-weight: 700; }

/* Grid widgeturi mari — fluid, fără celule goale */
.dashboard-grid{
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
.dash-card-tasks    { grid-column: span 2; }
.dash-card-today    { grid-column: span 2; }
.dash-card-pipeline { grid-column: span 2; grid-row: span 2; }
.dash-card-deals    { grid-column: span 2; }
.dash-card-activity { grid-column: span 2; }

@media (min-width: 1600px){
  .dashboard-grid{ gap: 18px; }
}

.dash-card{
  background: #fff; border: 1px solid var(--crx-border);
  border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.dash-card-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--crx-border);
  background: #fafbfc;
}
.dash-card-head h5{ font-size: 14px; font-weight: 600; color: var(--crx-text); }
.dash-card-more{
  font-size: 12px; color: var(--crx-primary-2); text-decoration: none;
}
.dash-card-more:hover{ text-decoration: underline; }

.dash-empty{
  padding: 28px 16px; text-align: center; color: var(--crx-muted);
}
.dash-empty i{ font-size: 32px; display: block; margin-bottom: 8px; opacity: .5; }

/* Task list în card */
.dash-task-list, .dash-deals-list, .dash-activity-list, .dash-status-list{
  list-style: none; margin: 0; padding: 0;
}
.dash-task-row{
  display: grid; grid-template-columns: 8px 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--crx-border);
}
.dash-task-row:last-child{ border-bottom: none; }
.dash-task-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: #cbd5e1;
}
.dash-task-dot.tone-danger  { background: #dc2626; }
.dash-task-dot.tone-warning { background: #f59e0b; }
.dash-task-body{ min-width: 0; }
.dash-task-title{
  font-size: 13px; font-weight: 500; color: var(--crx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-task-meta{
  font-size: 11px; color: var(--crx-muted); margin-top: 2px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.dash-task-deal{
  color: var(--crx-primary-2); text-decoration: none; font-weight: 500;
}
.dash-task-deal:hover{ text-decoration: underline; }
.dash-task-prio{
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 8px;
}
.dash-task-prio.prio-inalta { background: #fff7ed; color: #ea580c; }
.dash-task-prio.prio-urgenta{ background: #fee2e2; color: #b91c1c; }
.dash-task-prio.prio-joasa  { background: #f1f5f9; color: #64748b; }

/* Azi / Mâine */
.dash-today-cols{
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 16px;
}
.dash-sub-title{
  font-size: 11px; color: var(--crx-muted);
  text-transform: uppercase; letter-spacing: .04em;
  font-weight: 600; margin-bottom: 6px;
}
.dash-mini-list{ list-style: none; margin: 0; padding: 0; }
.dash-mini-list li{
  display: flex; gap: 8px; padding: 4px 0;
  font-size: 12px; align-items: baseline;
  border-bottom: 1px dashed #f1f5f9;
}
.dash-mini-list li:last-child{ border-bottom: none; }
.dash-mini-time{
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px; color: var(--crx-primary-2);
  font-weight: 600; flex-shrink: 0;
}
.dash-mini-title{
  color: var(--crx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Pipeline donut */
.dash-pipeline-body{
  padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.donut-wrap{ width: 160px; height: 160px; }
.donut-svg{ width: 100%; height: 100%; display: block; }
.donut-total{ font-size: 22px; font-weight: 700; fill: var(--crx-text); }
.donut-sub{ font-size: 10px; fill: var(--crx-muted); text-transform: uppercase; letter-spacing: .05em; }

.dash-pipeline-legend{
  list-style: none; padding: 0; margin: 0; width: 100%;
}
.dash-pipeline-legend li{
  display: grid; grid-template-columns: 12px 1fr auto;
  gap: 8px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
}
.dash-pipeline-legend li:last-child{ border-bottom: none; }
.dash-pipeline-dot{
  width: 10px; height: 10px; border-radius: 50%;
}
.dash-pipeline-name{ color: var(--crx-text); }
.dash-pipeline-count{ font-weight: 700; color: var(--crx-text); }
.dash-pipeline-value{
  grid-column: 1 / span 3;
  font-size: 11px; color: var(--crx-muted);
  text-align: right;
  margin-top: -2px;
}

.dash-pipeline-detail{
  padding: 12px 16px; border-top: 1px solid var(--crx-border);
  background: #fafbfc;
}
.dash-status-list li{
  display: grid; grid-template-columns: 10px 1fr auto; gap: 8px;
  padding: 4px 0; font-size: 12px; align-items: center;
}
.dash-status-dot{ width: 8px; height: 8px; border-radius: 50%; }
.dash-status-name{ color: var(--crx-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-status-count{ font-weight: 600; color: var(--crx-muted); }

/* Deals recente */
.dash-deals-list{
  padding: 8px 6px; display: flex; flex-direction: column; gap: 4px;
}
.dash-deal-link{
  display: block; padding: 10px 12px;
  text-decoration: none; color: inherit;
  border-radius: 6px;
  transition: all .15s;
}
.dash-deal-link:hover{ background: #f8fafc; color: inherit; }
.dash-deal-head{
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 3px;
}
.dash-deal-code{
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px; font-weight: 600; color: var(--crx-muted);
  background: var(--crx-panel); padding: 2px 6px; border-radius: 4px;
}
.dash-deal-status{ width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dash-deal-title{
  font-size: 13px; font-weight: 500; color: var(--crx-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-deal-meta{
  font-size: 11px; color: var(--crx-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Activitate recentă */
.dash-activity-list{
  padding: 6px;
}
.dash-activity-list li{
  display: grid; grid-template-columns: 28px 1fr; gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
}
.dash-activity-list li:last-child{ border-bottom: none; }
.dash-act-icon{
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #64748b;
  font-size: 12px;
}
.dash-activity-list li.tone-primary .dash-act-icon{ background: #dbeafe; color: #2563eb; }
.dash-activity-list li.tone-success .dash-act-icon{ background: #d1fae5; color: #059669; }
.dash-activity-list li.tone-danger  .dash-act-icon{ background: #fee2e2; color: #dc2626; }
.dash-activity-list li.tone-warning .dash-act-icon{ background: #fef3c7; color: #d97706; }
.dash-act-body{ min-width: 0; }
.dash-act-title{ font-size: 12px; line-height: 1.35; color: var(--crx-text); }
.dash-act-meta{ font-size: 10px; color: var(--crx-muted); margin-top: 2px; }
.dash-act-deal{ color: var(--crx-primary-2); text-decoration: none; font-weight: 600; }
.dash-act-deal:hover{ text-decoration: underline; }

/* Responsive dashboard */
@media (max-width: 1200px){
  .kpi-row{ grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid{
    grid-template-columns: repeat(4, 1fr);
  }
  .dash-card-tasks, .dash-card-today, .dash-card-pipeline,
  .dash-card-deals, .dash-card-activity{ grid-column: span 2; grid-row: auto; }
}
@media (max-width: 768px){
  .kpi-row{ grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid{ grid-template-columns: 1fr; }
  .dash-card-tasks, .dash-card-today, .dash-card-pipeline,
  .dash-card-deals, .dash-card-activity{ grid-column: 1 / -1; }
  .dash-today-cols{ grid-template-columns: 1fr; }
}

/* =========================================================
   RAPOARTE (Faza 10)
   ========================================================= */
.reports-wrap{ /* fluid */ }

.reports-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.report-card{
  --tc: #6366f1;
  display: grid;
  grid-template-columns: 60px 1fr 24px;
  gap: 16px; align-items: center;
  padding: 20px; border-radius: 12px;
  background: #fff; border: 1px solid var(--crx-border);
  border-left: 3px solid var(--tc);
  color: inherit; text-decoration: none;
  transition: all .15s;
}
.report-card:hover{
  box-shadow: 0 6px 16px rgba(15,23,42,.08);
  transform: translateY(-2px);
  color: inherit;
}
.report-card.tone-primary { --tc: #3b82f6; }
.report-card.tone-success { --tc: #10b981; }
.report-card.tone-warning { --tc: #f59e0b; }
.report-card.tone-danger  { --tc: #ef4444; }
.report-card-icon{
  width: 56px; height: 56px; border-radius: 12px;
  background: color-mix(in srgb, var(--tc) 12%, #fff);
  color: var(--tc);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.report-card-body h5{ font-size: 16px; margin-bottom: 4px; color: var(--crx-text); }
.report-card-body p { font-size: 13px; margin-bottom: 0; color: var(--crx-muted); }
.report-card-arrow{ color: var(--tc); font-size: 20px; }

/* Filtre */
.report-header h3{ font-weight: 600; }
.report-filters{ border: 1px solid var(--crx-border); box-shadow: none; }

/* KPI row în rapoarte */
.report-kpi-row{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.report-kpi{
  background: #fff; border: 1px solid var(--crx-border);
  border-radius: 10px; padding: 16px;
}
.report-kpi .label{ font-size: 12px; color: var(--crx-muted); text-transform: uppercase; letter-spacing: .03em; }
.report-kpi .value{ font-size: 26px; font-weight: 700; color: var(--crx-text); line-height: 1.1; margin-top: 4px; }
.report-kpi .unit { font-size: 14px; font-weight: 500; color: var(--crx-muted); }

/* Grupele sumarizate pipeline */
.report-grupe-row{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.report-grupe{
  --gc: #94a3b8;
  background: #fff; border: 1px solid var(--crx-border);
  border-radius: 10px; padding: 14px;
  display: flex; align-items: center; gap: 10px;
}
.report-grupe-dot{
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gc); flex-shrink: 0;
}
.report-grupe-label{ font-size: 12px; color: var(--crx-muted); text-transform: uppercase; letter-spacing: .03em; }
.report-grupe-stats{ font-size: 13px; color: var(--crx-text); margin-top: 2px; }

/* Tabel generic */
.report-table th{
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em;
  color: var(--crx-muted); background: #fafbfc;
  border-bottom: 1px solid var(--crx-border);
}
.report-table td{ font-size: 13px; vertical-align: middle; }
.report-table .status-dot{ width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

.report-grupa-badge{
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  font-weight: 600;
}

/* Bare orizontale tabel */
.report-bar{
  height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden;
}
.report-bar-fill{
  height: 100%; background: #3b82f6; border-radius: 4px;
  transition: width .3s ease;
}

/* Conversion — funnel + donut */
.report-conv-grid{
  display: grid; grid-template-columns: 2fr 1fr; gap: 16px;
}
.funnel-list{ list-style: none; padding: 0; margin: 0; }
.funnel-list li{ margin-bottom: 16px; }
.funnel-list li:last-child{ margin-bottom: 0; }
.funnel-head{
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; margin-bottom: 4px;
}
.funnel-label{ font-weight: 500; color: var(--crx-text); }
.funnel-stat{ font-size: 12px; color: var(--crx-muted); }
.funnel-bar{
  height: 26px; background: #f1f5f9; border-radius: 4px;
  position: relative; overflow: hidden;
}
.funnel-fill{
  height: 100%; border-radius: 4px;
  transition: width .3s ease;
}
.funnel-pct{
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px; font-weight: 600; color: var(--crx-text);
}

.win-donut{ width: 180px; height: 180px; margin: 0 auto; }
.win-donut svg{ width: 100%; height: 100%; }
.win-legend{ font-size: 13px; }
.win-legend li{ margin-bottom: 4px; display: flex; align-items: center; gap: 8px; justify-content: center; }
.win-legend .dot{ width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Performanță */
.perf-avatar{
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.perf-rate{
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.perf-rate.good{ background: #d1fae5; color: #065f46; }
.perf-rate.mid { background: #fef3c7; color: #92400e; }
.perf-rate.bad { background: #fee2e2; color: #991b1b; }

/* Motive */
.motiv-rank{
  display: inline-block; width: 24px; height: 24px; border-radius: 50%;
  background: #f1f5f9; color: #475569;
  text-align: center; line-height: 24px;
  font-size: 12px; font-weight: 600;
}

/* Responsive rapoarte */
@media (max-width: 991px){
  .reports-grid{ grid-template-columns: 1fr; }
  .report-kpi-row{ grid-template-columns: 1fr; }
  .report-grupe-row{ grid-template-columns: repeat(2, 1fr); }
  .report-conv-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 576px){
  .report-grupe-row{ grid-template-columns: 1fr; }
}

/* ---------- Responsive ---------- */
@media (max-width: 991px){
  .app-shell{
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "content";
  }
  .sidebar{
    position: fixed; top: var(--crx-topbar-h); left: 0;
    width: var(--crx-sidebar-w);
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 40;
    box-shadow: 4px 0 18px rgba(15, 23, 42, 0);
  }
  body.sidebar-open .sidebar{
    transform: translateX(0);
    box-shadow: 4px 0 18px rgba(15, 23, 42, .12);
  }
  body.sidebar-open .sidebar-backdrop{
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  .brand{ width: auto; }
  .brand-text{ display: none; }
  .kanban-col{ flex-basis: 240px; }
  .topbar-search{ max-width: none; }
  .topbar-search-kbd{ display: none !important; }
  .topbar-search input{ font-size: 12px; padding-right: 14px; }
  .content{ padding: 12px; }
}
@media (max-width: 576px){
  .topbar{ padding: 0 8px; gap: 6px; }
  .brand-logo{ height: 26px; }
  .notif-dropdown{ width: calc(100vw - 24px); max-width: 340px; }
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop{
  display: none;
  position: fixed; inset: 0; top: var(--crx-topbar-h);
  background: rgba(15, 23, 42, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 35;
}
@media (max-width: 991px){
  .sidebar-backdrop{ display: block; opacity: 0; }
}

/* =========================================================
   FAZA 12 — Polish UI + accesibilitate
   ========================================================= */

/* Focus vizibil pentru tastatură — consistent peste tot */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible{
  outline: 2px solid var(--crx-primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn-ghost:focus-visible{ background: #eef1f6; color: var(--crx-text); }
.nav-link:focus-visible{ background: #eef1f6; }
.topbar-search input:focus-visible{ outline: none; }
.topbar-search.is-open{ outline: 2px solid var(--crx-primary); outline-offset: 0; }

/* Skip link pentru accesibilitate */
.crx-skip-link{
  position: absolute; left: -9999px; top: 0;
  background: var(--crx-primary); color: #fff;
  padding: 8px 14px; border-radius: 4px;
  z-index: 9999; font-weight: 600;
  text-decoration: none;
}
.crx-skip-link:focus{ left: 12px; top: 12px; }

/* Flash messages cu icon */
.crx-flash{
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 44px 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  animation: crxFlashIn .24s ease;
}
.crx-flash-icon{ font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.crx-flash-text{ flex: 1; line-height: 1.4; }
.crx-flash.alert-success{ background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.crx-flash.alert-success .crx-flash-icon{ color: #059669; }
.crx-flash.alert-info{ background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.crx-flash.alert-info .crx-flash-icon{ color: #2563eb; }
.crx-flash.alert-warning{ background: #fffbeb; border-color: #fde68a; color: #92400e; }
.crx-flash.alert-warning .crx-flash-icon{ color: #d97706; }
.crx-flash.alert-danger{ background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.crx-flash.alert-danger .crx-flash-icon{ color: #dc2626; }
@keyframes crxFlashIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Buton loading state */
.btn-is-loading{
  cursor: progress !important;
  opacity: .85;
}
.btn-is-loading .spinner-border{ vertical-align: -2px; }

/* Modal confirm globală — icon mare colorat */
.crx-confirm-icon{
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 18px; flex-shrink: 0;
}
.crx-confirm-danger{  background: #fef2f2; color: #dc2626; }
.crx-confirm-warning{ background: #fffbeb; color: #d97706; }
.crx-confirm-primary{ background: #eff6ff; color: #2563eb; }
.crx-confirm-success{ background: #ecfdf5; color: #059669; }

/* Tooltips Bootstrap — override pentru lizibilitate */
.tooltip-inner{
  background: #1e293b; color: #fff;
  font-size: 12px; padding: 5px 9px; border-radius: 5px;
  max-width: 240px;
}
.tooltip .tooltip-arrow::before{ border-color: #1e293b !important; }

/* ---------- Pagini de eroare ---------- */
.error-page{
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; background: #f8fafc;
}
.error-card{
  max-width: 540px; width: 100%;
  background: #fff; border: 1px solid var(--crx-border); border-radius: 14px;
  padding: 48px 40px; text-align: center;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .06);
}
.error-code{
  font-size: 72px; font-weight: 800; letter-spacing: -.04em;
  line-height: 1; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--crx-primary), var(--crx-primary-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.error-code.tone-warning{ background: linear-gradient(135deg, #f59e0b, #d97706); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.error-code.tone-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.error-title{ font-size: 24px; font-weight: 700; margin: 8px 0 12px; color: var(--crx-text); }
.error-msg{ color: var(--crx-muted); font-size: 15px; line-height: 1.55; margin-bottom: 24px; }
.error-actions{ display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Reduce motion — respectă preferința sistemului */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}


/* ================= Import Wizard ================= */

.import-stepper{
  display:flex; align-items:center; background:#fff; border:1px solid var(--crx-border);
  border-radius:12px; padding:20px 24px; gap:0;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.import-stepper .step{
  display:flex; align-items:center; gap:12px; flex:1; min-width:0;
}
.import-stepper .step-bullet{
  width:36px; height:36px; border-radius:50%; flex:0 0 36px;
  display:inline-flex; align-items:center; justify-content:center;
  font-weight:700; font-size:14px;
  background:#e5e9f0; color:#6b7280;
  border:2px solid transparent; transition: all .2s ease;
}
.import-stepper .step-body{ min-width:0; flex:1; }
.import-stepper .step-num{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--crx-muted); }
.import-stepper .step-label{ font-weight:600; font-size:14px; color:var(--crx-text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.import-stepper .step-sep{
  height:2px; background:#e5e9f0; flex:1; margin:0 16px;
}
.import-stepper .step-active .step-bullet{
  background: var(--crx-primary); color:#fff;
  box-shadow: 0 0 0 4px rgba(0,167,157,.15);
}
.import-stepper .step-active .step-label{ color: var(--crx-primary-2); }
.import-stepper .step-done .step-bullet{ background: var(--crx-accent); color:#fff; }
.import-stepper .step-done + .step-sep, .import-stepper .step-done .step-sep{ background: var(--crx-accent); }

.mapping-table td, .mapping-table th{ vertical-align: middle; }
.preview-table tbody tr td{ padding: 12px; }

.kpi-mini{
  background:#fff; border:1px solid var(--crx-border); border-radius:12px;
  padding: 16px 18px; height:100%;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kpi-mini-label{ font-size:12px; text-transform:uppercase; letter-spacing:.04em; color: var(--crx-muted); margin-bottom:6px; }
.kpi-mini-value{ font-size:28px; font-weight:700; color: var(--crx-text); line-height:1.1; }
.kpi-mini-sub{ font-size:12px; color: var(--crx-muted); margin-top:4px; }
.kpi-mini.success{ border-left: 4px solid var(--crx-accent); }
.kpi-mini.info{ border-left: 4px solid var(--crx-primary); }
.kpi-mini.warn{ border-left: 4px solid var(--crx-warning); }
.kpi-mini.muted{ border-left: 4px solid #cbd5e1; }

.import-hints ol > li{ margin-bottom:4px; }

@media (max-width: 768px){
  .import-stepper{ flex-direction: column; align-items: stretch; gap:8px; }
  .import-stepper .step{ flex-direction: row; }
  .import-stepper .step-sep{ display:none; }
}


/* =========================================================
   Tabele sortabile � linkuri �n <thead> cu s�ge?i
   ========================================================= */
.table-sortable thead th .sort-link{
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; text-decoration: none;
  white-space: nowrap;
  transition: color .15s;
}
.table-sortable thead th .sort-link i{ opacity: .45; transition: opacity .15s; }
.table-sortable thead th .sort-link:hover{ color: var(--crx-primary, #00a79d); }
.table-sortable thead th .sort-link:hover i{ opacity: .85; }
.table-sortable thead th .sort-link.is-active{ color: var(--crx-primary, #00a79d); font-weight: 600; }
.table-sortable thead th .sort-link.is-active i{ opacity: 1; }

/* ================= Pagină Instrucțiuni / ajutor ================= */
.help-page{ max-width: 1100px; margin: 0 auto; }
.help-hero{
  background: linear-gradient(125deg, rgba(0,167,157,.12) 0%, rgba(0,132,151,.10) 45%, #f8fafc 100%);
  border: 1px solid var(--crx-border, #e2e8f0);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
}
.help-hero-inner{ display: flex; align-items: center; gap: 1.25rem; }
.help-hero-icon{
  width: 56px; height: 56px; border-radius: 14px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--crx-primary, #00a79d), var(--crx-primary-2, #008497));
  color: #fff; font-size: 1.5rem; box-shadow: 0 4px 14px rgba(0,132,151,.2);
}
.help-hero-lead{ max-width: 48rem; }
.help-pdf-card{ border-radius: 12px; }
.help-sticky{ position: sticky; top: 1rem; }
.help-toc{ border-radius: 12px; }
.help-toc-list a{
  color: var(--crx-text, #0f172a);
  text-decoration: none; padding: 0.2rem 0; display: block; border-radius: 6px;
}
.help-toc-list a:hover{ color: var(--crx-primary, #00a79d); background: rgba(0,167,157,.08); padding-left: 6px; }
.help-section{ border-radius: 12px !important; }
.help-section-head{
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 0.75rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--crx-border, #e2e8f0);
}
.help-section-icon{
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: var(--crx-primary, #00a79d);
  font-size: 1.1rem; flex: 0 0 auto;
}
.help-list{ margin: 0; padding-left: 1.15rem; }
.help-list li{ margin-bottom: 0.5rem; }
.help-list li:last-child{ margin-bottom: 0; }
.help-kbd{
  display: inline-block; padding: 0.1rem 0.35rem; font-size: 0.8em;
  border: 1px solid var(--crx-border, #e2e8f0); border-bottom-width: 2px;
  border-radius: 4px; background: #fff; color: #475569;
  font-family: ui-monospace, monospace;
}
.nav-link-help{
  border-top: 1px dashed var(--crx-border, #e2e8f0);
  margin-top: 0.35rem; padding-top: 0.65rem !important;
}
@media print{
  .topbar, .sidebar, .sidebar-backdrop, .notif-wrap, .help-toc, .help-pdf-card .btn, .page-header .btn-group, .import-stepper{ display: none !important; }
  .content{ padding: 0 !important; }
  .app-shell{ display: block; }
  .help-hero{ break-inside: avoid; }
  .help-section{ break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* Flatpickr — deasupra cardurilor / meniurilor Bootstrap */
.flatpickr-calendar {
  z-index: 1085;
}
