/* ============================================================
   JUST CRM - app.css
   Thème clair/sombre via data-theme sur <html>
   ============================================================ */

/* -- VARIABLES GLOBALES -- */
:root {
  --accent:    #c8f135;
  --accent2:   #a8d420;
  --danger:    #ff5c5c;
  --warn:      #f5a623;
  --info:      #4da6ff;
  --lien:      #E4986A;
  --radius:    12px;
  --radius-sm: 8px;
}

/* -- THEME CLAIR -- */
[data-theme="light"] {
  --accent:  #E4986A;
  --accent2: #bd7649;
  --bgsidebar: #14161a;
  --bg:      #f4f5f7;
  --bg2:     #ffffff;
  --bg3:     #f0f1f3;
  --bg4:     #ffffff;
  --text:    #1a1c20;
  --text2:   #4a5060;
  --text3:   #9da5b4;
  --bgcli:   #ffffff;  
  --border:  rgba(0,0,0,.07);
  --border2: rgba(0,0,0,.13);
}
[data-theme="light"] .tinfo a {
  color: #bd7649;
}

/* -- THEME SOMBRE -- */
[data-theme="dark"] {
  --bg:      #0e0f11;
  --bg2:     #14161a;
  --bg3:     #1c1f26;
  --bg4:     #23272f;
  --text:    #f0f2f5;
  --text2:   #9da5b4;
  --text3:   #9da5b4;
  --bgcli:   #14161a; 
  --border:  rgba(255,255,255,.07);
  --border2: rgba(255,255,255,.13);
  --bgsidebar: #14161a;
}
[data-theme="dark"] .tinfo a {
  color: #bd7649
}



/* -- RESET -- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* -- SHELL -- */
.shell {
  display: flex;
  height: auto;
  overflow: hidden;
  height: 100vh;
}

/* -- SIDEBAR -- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bgsidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  height: 100vh;
}

.slogo {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.slabel {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 16px 18px 6px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  max-height: 40px;
  transition:
  opacity .15s ease,
  max-height .3s ease,
  padding .3s ease;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  color: var(--text3);
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all .15s;
  text-decoration: none;
  user-select: none;
}

.nav:hover {
  color: var(--text3);
  background: rgba(128,128,128,.06);
}

.nav.on {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(200,241,53,.06);
}

.nav svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.sspace {
  flex: 1;
}

.suser {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ava {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #0e0f11;
  flex-shrink: 0;
}

.suser-info {
  overflow: hidden;
  opacity: 1;
  max-width: 200px;
  transition:
    opacity .15s ease,
    max-width .3s cubic-bezier(.4,0,.2,1);
}

.suser-name {
  color: var(--text3);
  font-size: 12px;
  font-weight: 500;
}

.suser-role {
  font-size: 10px;
  color: var(--text3);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
  transition: color .15s;
}

.btn-logout:hover {
  color: var(--text);
}

/* -- BOUTON THEME -- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 18px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s;
}

.theme-toggle:hover {
  color: var(--text3);
}

/* -- MAIN -- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* -- STATS -- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.scard {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.scard-label {
  font-size: 10px;
  color: var(--text3);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.scard-val {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

.scard-sub {
  font-size: 11px;
  color: var(--text2);
  margin-top: 6px;
}

.c-acc  { color: var(--accent); }
.c-warn { color: var(--warn); }
.c-dng  { color: var(--danger); }

/* -- CLIENTS GRID -- */
.containerMain {
  padding-top: 30px;
  padding-bottom: 30px;
  padding-left: 20px;
  padding-right: 20px;
}
.cgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.ccard {
  background: var(--bgcli);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color .15s;
  text-decoration: none;
  display: block;
  color: inherit;
}

.ccard:hover {
  border-color: var(--border2);
}

.ccard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cname {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.cdomain {
  font-size: 11px;
  color: var(--text2);
  font-family: monospace;
}

.cmeta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* -- BADGES -- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
}

.badge-g { background: rgba(200,241,53,.12); color: var(--accent); }
.badge-o { background: rgba(245,166,35,.12);  color: var(--warn); }
.badge-b { background: rgba(77,166,255,.12);   color: var(--info); }
.badge-x { background: rgba(128,128,128,.1);   color: var(--text3); }

.badge-r { background: rgba(255,92,92,.12); color: var(--danger); }

/* -- BARRES -- */

.bar-track {
  height: 4px;
  background: var(--bg4);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
}

.bar-g { background: var(--accent); }
.bar-o { background: var(--warn); }
.bar-r { background: var(--danger); }

.hlabel {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text2);
}

/* -- FICHE CLIENT -- */
.section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.igrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.iitem label {
  display: block;
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  margin-bottom: 3px;
}

.iitem span {
  font-size: 13px;
}

.iitem a {
  font-size: 13px;
  color: var(--info);
  text-decoration: none;
}

/* -- TACHES -- */
.task-form {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}

.task-row {
  display: grid;
  grid-template-columns: 1fr 70px auto;
  gap: 8px;
  align-items: end;
}

.tinput {
  width: 100%;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}

.tinput:focus {
  border-color: var(--accent);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.titem {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tinfo {
  flex: 1;
}
.tinfo a {
  text-decoration: none;
}

.ttitle {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 3px;
}

.tdate {
  font-size: 10px;
  color: var(--text3);
}

.thbadge {
  font-size: 10px;
  background: rgba(200,241,53,.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

/* -- BOUTONS -- */
.btn-acc {
  background: var(--accent);
  color: #0e0f11;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-acc:hover {
  background: var(--accent2);
}

.btn-sec {
  background: var(--accent);
  color: #0e0f11;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sec:hover {
  background: var(--accent2);
}

.btn-dng {
  background: rgba(255,92,92,.1);
  color: var(--danger);
  border: 1px solid rgba(255,92,92,.2);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}

.btn-dng:hover {
  background: rgba(255,92,92,.2);
}

/* -- LOGIN -- */
.just-field {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 16px;
  transition: border-color .2s;
  margin-bottom: 14px;
}

.just-field:focus-within {
  border-color: var(--accent);
}

.just-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 90px;
}

.just-input {
  flex: 1;
  background: #1c1F26;
  padding: 8px 10px;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

.just-input::placeholder {
  color: var(--text3);
}

.btn {
  width: 100%;
  background: var(--accent);
  color: #0e0f11;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
  margin-top: 8px;
}

.btn:hover {
  background: var(--accent2);
}

.hint {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  margin-top: 20px;
}

.error-msg {
  background: rgba(255,92,92,.1);
  border: 1px solid rgba(255,92,92,.2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* -- AUTOFILL -- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1c1f26 inset !important;
  -webkit-text-fill-color: #F0F2F5 !important;
  caret-color: #F0F2F5;
  transition: background-color 9999s ease-in-out 0s;
}

/* -- SCROLLBAR -- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg4);
  border-radius: 2px;
}



/* -- SIDEBAR RESPONSIVE -- */
.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 18px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s;
}

.sidebar-collapse:hover {
  color: var(--text3);
}

.sidebar-collapse svg {
  transition: transform .3s;
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}

.sidebar-overlay.visible {
  display: block;
}

.hamburger {
  display: none;
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 0;
  flex-shrink: 0;
}

.hamburger:hover {
  color: var(--text);
}

/* -- SIDEBAR REDUITE (desktop) -- */
.sidebar.collapsed .slogo {
  padding: 20px 10px;
}
.sidebar.collapsed {
  width: 56px;
}

.sidebar.collapsed .slogo .logo-full {
  display: none;
}

.sidebar.collapsed .slogo .logo-icon {
  display: block !important;
}

.sidebar.collapsed .slabel {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.nav-label {
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
  transition:
  opacity .15s ease,
  max-width .3s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  max-width: 0;
}

.sidebar.collapsed .suser-info {
  opacity: 0;
  max-width: 0;
}

.sidebar.collapsed .btn-logout {
  margin-left: 0;
}

.sidebar.collapsed .suser {
  justify-content: center;
  padding: 14px 0;
}

.sidebar.collapsed .nav {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .theme-toggle {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .sidebar-collapse {
  justify-content: center;
  padding: 10px 0;
}

/* -- TOOLTIPS (sidebar réduite) -- */
.sidebar.collapsed [data-tooltip] {
  position: relative;
}

.sidebar.collapsed [data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg4);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid var(--border2);
  pointer-events: none;
  z-index: 100;
}

/* -- LOGIN -- */
.boutonLogin {
  display: flex;
  flex-direction: column;
}



/* ── FORMULAIRES INLINE ── */
.sub-form {
  display: none;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 10px;
}

.alert-success {
  background: rgba(200,241,53,.1);
  border: 1px solid rgba(200,241,53,.2);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.notes-block {
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  white-space: pre-wrap;
}

.btn-sm {
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.btn-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* -- TABLETTE -- */
@media (max-width: 1024px) {
  .sidebar {
    width: 56px;
  }

  .slabel {
    display: none;
  }

  .nav-label {
    display: none;
  }

  .suser-info {
    display: none;
  }

  .suser {
    justify-content: center;
    padding: 14px 0;
  }

  .nav {
    justify-content: center;
    padding: 10px 0;
  }

  .theme-toggle {
    justify-content: center;
    padding: 10px 0;
  }

  .sidebar-collapse {
    justify-content: center;
    padding: 10px 0;
  }

  .sidebar [data-tooltip] {
    position: relative;
  }

  .sidebar [data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg4);
    color: var(--text);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid var(--border2);
    pointer-events: none;
    z-index: 100;
  }
}

/* -- MOBILE -- */
@media (max-width: 767px) {
  .hamburger {
    display: block;
  }

  .sidebar-collapse {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -220px;
    width: 220px;
    height: 100vh;
    z-index: 50;
    transition: left .3s cubic-bezier(.2,.8,.3,1);
  }

  .sidebar .slabel {
    display: block;
  }

  .sidebar .nav-label {
    display: inline;
  }

  .sidebar .suser-info {
    display: block;
  }

  .sidebar .suser {
    justify-content: flex-start;
    padding: 14px 18px;
  }

  .sidebar .nav {
    justify-content: flex-start;
    padding: 9px 18px;
  }

  .sidebar .theme-toggle {
    justify-content: flex-start;
    padding: 9px 18px;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .cgrid {
    grid-template-columns: 1fr;
  }

  .igrid {
    grid-template-columns: 1fr;
  }
}