/* ==========================================
   VARIABLES DE THÈME (CLAIR & SOMBRE)
   ========================================== */
:root,
[data-theme="light"] {
  --bg: #f6f6f4;
  --sidebar-bg: #efeee9;
  --surface: #ffffff;
  --subtle: #f1f0ec;
  --border: #e2e0d8;
  --text: #1c1c1a;
  --muted: #6e6d68;
  --accent: #2f6f55;
  --accent-soft: #e3efe9;
  --accent-text: #ffffff;
  --pro-color: #3b5998;
  --pro-soft: #e9eef8;
  --univ-color: #6d28d9;
  --univ-soft: #ede9fe;
  --deal-color: #b45309;
  --deal-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
}

[data-theme="dark"] {
  --bg: #121212;
  --sidebar-bg: #181818;
  --surface: #1e1e1e;
  --subtle: #262626;
  --border: #2e2e2e;
  --text: #ededeb;
  --muted: #9a9994;
  --accent: #84b59f;
  --accent-soft: #22332c;
  --accent-text: #101915;
  --pro-color: #8ab4f8;
  --pro-soft: #1f2a3d;
  --univ-color: #c4b5fd;
  --univ-soft: #2a2142;
  --deal-color: #fbbf24;
  --deal-soft: #332711;
  --danger: #f87171;
  --danger-soft: #3b1818;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* ==========================================
   LAYOUT PRINCIPAL & BARRE LATÉRALE
   ========================================== */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.35rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
}

.workspace-title {
  font-size: 1rem;
  font-weight: 700;
  padding: 0 0.65rem 1rem;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-link {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 0.52rem 0.75rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-link:hover {
  background: var(--subtle);
  color: var(--text);
}

.nav-link.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.nav-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.08rem 0.45rem;
  border-radius: 99px;
  background: var(--deal-soft);
  color: var(--deal-color);
}

.nav-badge.neutral {
  background: var(--subtle);
  color: var(--muted);
  border: 1px solid var(--border);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* BLOCS CONNEXIONS COMPTES */
.accounts-box {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.accounts-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.06rem 0.4rem;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.status-pill.live {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.client-id-input {
  width: 100%;
  padding: 0.34rem 0.48rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.74rem;
}

.account-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.connect-btn {
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 0.38rem 0.45rem;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.connect-btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.connect-btn:hover {
  opacity: 0.92;
}

.connect-btn.connected {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}

.work-control {
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.work-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.work-sub {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.text-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.42rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

.text-btn:hover {
  color: var(--text);
  background: var(--subtle);
}

/* ==========================================
   ZONE DE CONTENU & EN-TÊTES
   ========================================== */
.content {
  flex: 1;
  padding: 2rem 2.4rem;
  max-width: 1340px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.day-header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: capitalize;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.arrow-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.arrow-btn:hover {
  background: var(--subtle);
}

.header-actions-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* MÉTÉO & HORLOGE */
.clock-weather-row {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.weather-widget {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.weather-icon-box {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.weather-temp-main {
  font-weight: 700;
  font-size: 1.05rem;
}

.weather-city-desc {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: capitalize;
}

.weather-tip {
  font-size: 0.75rem;
  color: var(--deal-color);
  font-weight: 600;
}

.header-divider {
  width: 1px;
  height: 34px;
  background: var(--border);
}

.clock-large {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.notice {
  background: var(--subtle);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.65rem 1rem;
  border-radius: 6px;
  font-size: 0.86rem;
  margin-bottom: 1.25rem;
}

/* ==========================================
   BLOCS, GRILLES & BOUTONS COMMUNS
   ========================================== */
.columns {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.col-left,
.col-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.15rem 1.25rem;
}

.compact-block {
  padding: 0.9rem 1.15rem;
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.block-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.block-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.section-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
}

.muted {
  color: var(--muted);
  font-size: 0.84rem;
}

.inline-link {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.primary-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:hover {
  opacity: 0.92;
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.delete-small-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.delete-small-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.segmented-control {
  display: inline-flex;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 0.48rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.clean-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .columns,
  .tasks-layout,
  .contacts-layout,
  .mails-layout {
    grid-template-columns: 1fr;
  }
}