/* ============================================================
   JUNTUS CRM — Design V2  (CRM Imobiliário.dc.html spec)
   Jun 2026 — layered on top of styles.css, no breaking changes
   ============================================================ */

/* ---- New design tokens ---------------------------------------- */
:root {
  /* Surfaces */
  --bg:          #E9ECF1;
  --surface:     #FFFFFF;
  --surface-2:   #F3F6FA;
  --elevated:    #FFFFFF;

  /* Borders */
  --border:          #E4E8EE;
  --border-strong:   #D4DAE3;

  /* Text */
  --text:    #101A2B;
  --text-2:  #33425A;
  --muted:   #647084;
  --muted-2: #98A2B3;

  /* Brand / Accent */
  --brand:      #003DA5;
  --brand-ink:  #0A4DBA;
  --brand-soft: #E9F1FC;
  --accent:     #E4002B;
  --accent-soft:#FCE8EC;

  /* Semantic */
  --green:      #0B8F62;
  --green-soft: #E2F5EE;
  --amber:      #B26A00;
  --amber-soft: #FAEEDB;
  --gold:       #9C7400;
  --gold-soft:  #F6EFD8;

  /* Shadows */
  --shadow:    0 1px 2px rgba(16,26,43,.05), 0 12px 28px -16px rgba(16,26,43,.20);
  --shadow-sm: 0 1px 2px rgba(16,26,43,.06);

  /* Stage tokens */
  --stage-slate:      #5B6B82;
  --stage-slate-soft: #EEF1F5;
  --stage-amber:      #C2790C;
  --stage-amber-soft: #FAEFDC;
  --stage-blue:       #0A4DBA;
  --stage-blue-soft:  #E8F0FB;
  --stage-gold:       #A07C00;
  --stage-gold-soft:  #F6EFD6;
  --stage-green:      #0B8F62;
  --stage-green-soft: #E2F5EE;

  /* Layout */
  --sidebar-width: 248px;
  --header-height: 66px;
  --pad: 18px;
  --gap: 14px;

  /* Radii (design spec) */
  --radius:    16px;
  --radius-sm: 11px;
  --radius-xs: 8px;

  /* Font families */
  --font-ui:   'Manrope', 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html[data-theme="dark"] {
  --bg:          #070B12;
  --surface:     #121A27;
  --surface-2:   #0E1622;
  --elevated:    #16202F;
  --border:      #23303F;
  --border-strong:#33425A;
  --text:        #EAF1FB;
  --text-2:      #C2CDDC;
  --muted:       #94A2B6;
  --muted-2:     #6A7789;
  --brand:       #5B93F0;
  --brand-ink:   #7DAAF5;
  --brand-soft:  #152843;
  --accent:      #F0706A;
  --accent-soft: #2A1215;
  --shadow:      0 1px 2px rgba(0,0,0,.3), 0 12px 28px -16px rgba(0,0,0,.5);
  --shadow-sm:   0 1px 2px rgba(0,0,0,.5);
  --stage-slate: #8896AC; --stage-slate-soft: #19232F;
  --stage-amber: #E8A33D; --stage-amber-soft: #241B0C;
  --stage-blue:  #5B93F0; --stage-blue-soft:  #14233B;
  --stage-gold:  #D8B24A; --stage-gold-soft:  #241D0B;
  --stage-green: #2FD39A; --stage-green-soft: #0E2A20;
}

/* ---- Typography ------------------------------------------------ */
body,
.sidebar,
.top-header,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

/* ---- Scrollbar ------------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120,132,156,.3);
  border-radius: 20px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(120,132,156,.5);
  background-clip: padding-box;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

/* ---- Brand header --------------------------------------------- */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 16px;
  border-bottom: none;
  flex-shrink: 0;
}

/* Logo mark */
.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px -4px rgba(0,61,165,.45);
}
.sidebar-brand-circle {
  width: 13px;
  height: 13px;
  border-radius: 50% 50% 50% 2px;
  background: #fff;
}
.sidebar-brand-dot {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E4002B;
}

/* Brand text */
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.sidebar-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text-primary);
  text-transform: none;
  color: var(--text);
}
.sidebar-subtitle {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .15em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 1px;
}

/* ---- Nav ------------------------------------------------------ */
.sidebar-nav {
  padding: 6px 12px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

/* Groups */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0;
}

/* Hide the old toggle buttons entirely */
.nav-group-toggle {
  display: none !important;
}

/* All groups always expanded in new flat design */
.nav-group-items {
  display: flex !important;
  flex-direction: column;
  gap: 2px;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Section label */
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: default;
  user-select: none;
}
.nav-group-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  opacity: .8;
  flex-shrink: 0;
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  transition: background .15s, color .15s;
}
.nav-item:hover {
  background: rgba(125,145,175,.1);
  color: var(--text);
}
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  box-shadow: none;
}
.nav-item.active svg { color: var(--brand); }

/* Nav badge (avisos) */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 800;
  margin-left: auto;
}

/* ---- Team list & add-member button ---- */
.btn-add-member {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background .15s;
}
.btn-add-member:hover {
  background: rgba(125,145,175,.1);
  color: var(--text);
}

/* ---- Sidebar footer ------------------------------------------- */
.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.theme-toggle:hover {
  background: rgba(125,145,175,.1);
  color: var(--text);
}

/* ================================================================
   TOPBAR
   ================================================================ */
.top-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Search bar */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 440px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0 12px;
  gap: 8px;
  transition: border-color .15s;
}
.search-container:focus-within {
  border-color: var(--brand);
}
.search-icon {
  position: static;
  transform: none;
  top: auto;
  left: auto;
  flex-shrink: 0;
  color: var(--muted-2);
}
.search-input {
  flex: 1;
  padding: 0;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted-2);
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
}
.search-input::placeholder { color: var(--muted-2); }
.search-input:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.search-kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted-2);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
