:root {
  /* Palette CREAMED (Design System : vert deep #164F38 / vert mid #3A7F52) */
  --ink: #17301f;
  --muted: #55595c;
  --muted-2: #7a8479;
  --line: #e3e8e2;
  --line-strong: #c7d3c9;
  --page: #f5f7f2;
  --surface: #ffffff;
  --soft: #eceef2;
  --panel-soft: #f0f6f1;
  --teal: #3a7f52;
  --teal-hover: #164f38;
  --teal-soft: #e3eee5;
  --gold: #a87b2e;
  --gold-soft: #f4eddd;
  --gold-foreground: #164f38;
  --amount: #8a6a2e;
  --red: #a6432f;
  --red-soft: #f5e6e1;
  --green: #3a7f52;
  --blue: #3e6e8c;
  --navy: #164f38;
  --navy-card: #1d5a40;
  --navy-border: #123f2d;
  --navy-border-strong: #2b6b4c;
  --amber: #a87b2e;
  --shadow: 0 18px 45px rgba(22, 79, 56, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

h1,
h2,
h3,
.brand strong {
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  font-weight: 600;
}

.kpi strong,
.user-stat strong,
.amount,
.priority-date {
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: 100vh;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 18px 14px;
  color: #c6cfdc;
  background: var(--navy);
  border-right: 1px solid var(--navy-border);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--navy-border-strong);
  border-radius: 8px;
  background: var(--navy-card);
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.eyebrow,
.section-heading p {
  color: var(--muted);
}

.sidebar .brand span {
  color: #7a8aa0;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #9aa7bb;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.nav-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  opacity: .75;
}

.nav-item:hover,
.nav-item.is-active {
  color: #f2f5f9;
  background: #16263c;
  border-color: var(--navy-border-strong);
}

.nav-item:hover .nav-icon,
.nav-item.is-active .nav-icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--navy-border);
}

.sidebar-user #logoutBtn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  color: #9aa7bb;
  font-size: 16px;
}

.sidebar-user #logoutBtn:hover {
  color: #f2f5f9;
}

.sidebar-user-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
  font-size: 13px;
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-user strong {
  color: #f2f5f9;
  font-size: 13.5px;
}

.sidebar-user span {
  color: #7a8aa0;
  font-size: 12px;
}

.main {
  min-width: 0;
  min-height: 0;
  padding: 0 24px 28px;
  overflow-y: auto;
}

.topbar,
.section-heading,
.panel-header,
.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 62px;
  margin: 0 -24px 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.search {
  display: grid;
  gap: 6px;
}

.search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(38vw, 520px);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: var(--page);
  color: var(--muted-2);
}

.search-box input {
  border: none;
  background: transparent;
  padding: 9px 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

.button,
.ghost-button,
.icon-button {
  border-radius: 7px;
  cursor: pointer;
}

.button {
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12.5px;
  transition: background .15s ease;
}

.button.primary {
  color: #fff;
  background: var(--teal);
}

.button.primary:hover {
  background: var(--teal-hover);
}

.button.secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line-strong);
}

.button.secondary:hover {
  background: var(--panel-soft);
}

.button.secondary.danger {
  color: var(--red);
  border-color: var(--red-soft);
}

.button.secondary.danger:hover {
  background: var(--red-soft);
}

.ghost-button,
.icon-button {
  border: 0;
  color: var(--teal);
  background: transparent;
  font-weight: 800;
}

.icon-button {
  width: 36px;
  height: 36px;
  color: var(--ink);
  font-size: 25px;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

#dashboardView.is-visible {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
  gap: 18px;
}

#dashboardView .section-heading,
#dashboardView .kpi-grid {
  grid-column: 1 / -1;
}

#dashboardView .split-layout {
  grid-column: 1;
  grid-template-columns: 1fr;
}

#dashboardView .ai-brief-panel {
  grid-column: 2;
  grid-row: 3;
  margin-top: 0;
}

.section-heading {
  margin-bottom: 18px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-heading p {
  margin-bottom: 0;
}

.section-heading select {
  max-width: 230px;
}

.pill-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 6px 14px;
  color: var(--muted);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.pill:hover {
  border-color: var(--muted-2);
}

.pill.is-active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi,
.user-stat,
.panel,
.table-wrap,
.task-item,
.dialog-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(20,33,61,.06);
}

.kpi {
  padding: 16px;
  min-height: 98px;
}

.user-stat {
  padding: 15px;
}

.kpi span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.user-stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  letter-spacing: -.01em;
}

.kpi em {
  display: block;
  margin-top: 6px;
  color: var(--teal);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.kpi-money strong {
  color: var(--amount);
}

.kpi-danger strong,
.kpi-danger em {
  color: var(--red);
}

.kpi-success em {
  color: var(--green);
}

.user-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr);
  gap: 16px;
}

.prospecting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  gap: 16px;
}

.prospecting-bottom {
  margin-top: 16px;
}

.ai-brief-panel,
.ai-playbook {
  margin-top: 16px;
}

#dashboardView .ai-brief-panel {
  color: #dce3ec;
  background: var(--navy);
  border-color: var(--navy-border);
  box-shadow: 0 18px 46px rgba(14,27,44,.20);
}

#dashboardView .ai-brief-panel .ghost-button {
  color: var(--gold);
}

.assia-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assia-orb {
  width: 28px;
  height: 28px;
  border: 1px solid var(--navy-border-strong);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 3px, transparent 4px),
    var(--navy-card);
}

.ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 16px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.panel {
  padding: 18px;
}

.priority-list,
.source-list,
.task-list {
  display: grid;
  gap: 0;
  margin-top: 14px;
}

.prospect-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  margin-top: 14px;
  padding-bottom: 4px;
}

.prospect-lane {
  min-height: 360px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--soft);
}

.prospect-card {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.prospect-card.is-hot {
  border-left-color: var(--gold);
}

.chantier-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pilier-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.pilier-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pilier-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.chantier-card .badge-row {
  align-items: center;
}

.chantier-owner {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--blue);
  font-size: 10.5px;
  font-weight: 700;
  margin-left: auto;
}

.calendar-list,
.sequence-list,
.integration-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.calendar-item,
.sequence-list article,
.integration-list article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-item.is-overdue {
  border-color: var(--red-soft);
}

.integration-list span,
.sequence-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-brief,
.ai-recommendations,
.ai-analysis {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ai-brief.large {
  gap: 12px;
}

.ai-item,
.agent-card,
.ai-analysis article {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#dashboardView .ai-item {
  border-color: var(--navy-border-strong);
  color: #dce3ec;
  background: var(--navy-card);
}

#dashboardView .ai-item span {
  color: #b9c4d4;
}

#dashboardView .ai-item.is-urgent {
  border-color: #7a3530;
  background: #1c2f4d;
}

.ai-item.is-urgent {
  border-color: var(--red-soft);
  background: #fbf1ee;
}

.agent-card {
  box-shadow: var(--shadow);
}

.agent-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.agent-card p,
.ai-item span,
.ai-analysis span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.ai-button {
  border: 1px solid var(--teal-soft);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--teal);
  background: #f2f6f4;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.ai-button:hover {
  border-color: var(--teal);
}

.priority,
.source-row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.priority:first-child,
.source-row:first-child {
  border-top: 0;
}

.priority {
  grid-template-columns: 10px minmax(0, 1fr) 34px minmax(90px, auto) minmax(92px, auto);
  align-items: center;
  width: 100%;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.priority-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.priority.is-late .priority-dot {
  background: var(--red);
}

.priority-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.priority-main span {
  color: #59677d;
  font-size: 12px;
}

.owner-chip {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.priority-date {
  color: var(--amount);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.priority-date.late {
  color: var(--red);
}

.priority:hover strong,
tbody tr:hover strong,
.record-card:hover strong {
  color: var(--teal);
}

.source-row {
  grid-template-columns: 120px minmax(0, 1fr) 34px;
  align-items: center;
  padding: 8px 0;
  border-top: 0;
  color: #26344f;
  font-size: 13px;
}

.source-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.source-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--navy);
}

.meta,
.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
}

.badge.hot {
  color: var(--red);
  background: var(--red-soft);
}

.badge.good {
  color: var(--green);
  background: var(--teal-soft);
}

.badge.info {
  color: var(--blue);
  background: var(--soft);
}

.badge.pending {
  color: var(--amount);
  background: var(--gold-soft);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.lane {
  min-height: 520px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--soft);
}

.lane-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 850;
}

.record-card {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.card-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.record-card.is-risk {
  border-left-color: var(--red);
}

.record-card strong {
  font-size: 15px;
}

.amount {
  color: var(--amount);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}

thead tr {
  background: var(--panel-soft);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--panel-soft);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.small-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.small-button.danger {
  color: var(--red);
}

.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
}

.task-item.is-overdue {
  border-color: var(--red-soft);
}

.record-dialog {
  width: min(920px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.record-dialog::backdrop {
  background: rgba(14, 27, 44, .45);
}

.dialog-card {
  padding: 20px;
}

.record-dialog.side-panel {
  position: fixed;
  inset: 0 0 0 auto;
  left: auto;
  width: min(560px, 100vw);
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  animation: sidePanelIn .18s ease-out;
}

.side-panel .dialog-card {
  height: 100%;
  overflow-y: auto;
  border-radius: 0;
  box-shadow: -8px 0 30px rgba(14, 27, 44, .18);
}

.side-panel .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@keyframes sidePanelIn {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.assia-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: grid;
  justify-items: end;
  gap: 12px;
  pointer-events: none;
}

.assia-launcher,
.assia-panel {
  pointer-events: auto;
}

.assia-launcher {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.assia-avatar {
  position: relative;
  display: grid;
  width: 124px;
  height: 124px;
  place-items: center;
  border: 2px solid rgba(255,255,255,.78);
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 35% 24%, rgba(255,255,255,.42), transparent 28%),
    linear-gradient(145deg, var(--teal), var(--navy) 82%);
  box-shadow: 0 15px 35px rgba(20, 33, 61, .32);
  font-size: 22px;
  font-weight: 900;
  cursor: grab;
  touch-action: none;
  transition: transform .18s ease, box-shadow .18s ease;
}

.assia-avatar:hover {
  transform: translateY(-3px) rotate(-2deg);
  box-shadow: 0 18px 42px rgba(20, 33, 61, .38);
}

.assia-widget.is-dragging .assia-avatar {
  cursor: grabbing;
  transition: none;
}

.assia-widget.is-dragging .assia-avatar:hover {
  transform: none;
  box-shadow: 0 15px 35px rgba(20, 33, 61, .32);
}

.assia-status {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 30px;
  height: 30px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--green);
}

.assia-status.is-warning {
  background: var(--gold);
}

.assia-status.is-alert {
  background: var(--red);
}

.assia-hint {
  position: absolute;
  right: 132px;
  top: 24px;
  width: max-content;
  max-width: 180px;
  padding: 8px 10px;
  border: 1px solid rgba(20,33,61,.10);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 12px 32px rgba(20, 33, 61, .16);
  font-size: 12px;
  font-weight: 850;
  opacity: .96;
}

.assia-hint::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-top: 1px solid rgba(20,33,61,.10);
  border-right: 1px solid rgba(20,33,61,.10);
  background: #fff;
  transform: rotate(45deg);
}

.assia-name {
  color: var(--gold);
  font-family: "Fredoka", "Geist", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.assia-face {
  position: relative;
  display: block;
  width: 72px;
  height: 68px;
  border: 4px solid rgba(255,255,255,.42);
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}

.assia-eye {
  position: absolute;
  top: 24px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,.7);
}

.assia-eye.left {
  left: 16px;
}

.assia-eye.right {
  right: 16px;
}

.assia-avatar:hover .assia-eye {
  animation: assiaBlink 1.6s ease-in-out infinite;
}

.assia-panel {
  display: none;
  position: fixed;
  z-index: 21;
  width: min(390px, calc(100vw - 16px));
  max-height: min(640px, calc(100vh - 16px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 33, 61, .22);
  transform-origin: bottom right;
  animation: assiaPanelIn .18s ease-out;
}

.assia-widget.is-open .assia-panel {
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto;
}

.assia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(46,81,65,.96), rgba(17,35,61,.98));
}

.assia-header strong,
.assia-header span {
  display: block;
}

.assia-header span {
  color: rgba(255,255,255,.68);
  font-size: 12px;
}

.assia-header .icon-button {
  color: #fff;
}

.assia-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.assia-quick-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.assia-quick-actions button:hover {
  border-color: var(--teal-soft);
  background: #f2f6f4;
  transform: translateY(-1px);
}

.assia-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafb;
}

.assia-message {
  max-width: 92%;
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.assia-message.assia {
  justify-self: start;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 22px rgba(20, 33, 61, .07);
}

.assia-message.user {
  justify-self: end;
  color: #fff;
  background: var(--teal);
}

.assia-message strong {
  display: block;
  margin-bottom: 4px;
}

.assia-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

@keyframes assiaPanelIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes assiaBlink {
  0%, 88%, 100% {
    transform: scaleY(1);
  }
  92% {
    transform: scaleY(.15);
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.activity-section {
  margin: 0 0 18px;
}

.activity-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.activity-header .meta {
  font-size: 12px;
}

.activity-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  margin-bottom: 10px;
  overflow-y: auto;
}

.activity-list:empty::after {
  content: "Aucune activité enregistrée pour le moment.";
  color: var(--muted);
  font-size: 13px;
}

.activity-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.activity-item p {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.activity-item time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.activity-add {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 8px;
}

.sequence-progress {
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.sequence-progress:empty {
  display: none;
}

.sequence-progress .progress-track {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.sequence-progress .progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.sequence-progress .progress-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.sequence-badge {
  color: var(--blue);
  background: #eef4ff;
}

@media (max-width: 1080px) {
  #dashboardView.is-visible {
    grid-template-columns: 1fr;
  }

  #dashboardView .ai-brief-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-direction: row;
    align-items: center;
    height: auto;
    overflow-x: auto;
    overflow-y: visible;
  }

  .sidebar-user {
    display: none;
  }

  .nav-list {
    display: flex;
  }

  .nav-item {
    white-space: nowrap;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .search input {
    width: 100%;
  }

  .kpi-grid,
  .user-summary,
  .agent-grid,
  .ai-grid,
  .prospecting-grid,
  .split-layout {
    grid-template-columns: 1fr 1fr;
  }

  #dashboardView .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .brand {
    min-width: 220px;
  }

  .kpi-grid,
  .user-summary,
  .agent-grid,
  .ai-grid,
  .prospecting-grid,
  .split-layout,
  .form-grid,
  .side-panel .form-grid {
    grid-template-columns: 1fr;
  }

  .record-dialog.side-panel {
    width: 100vw;
  }

  .task-item {
    grid-template-columns: 1fr;
  }

  .activity-add {
    grid-template-columns: 1fr;
  }

  .activity-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .priority {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .priority .owner-chip,
  .priority .amount,
  .priority .priority-date {
    margin-left: 18px;
  }

  .assia-widget {
    right: 14px;
    bottom: 14px;
  }

  .assia-hint {
    display: none;
  }

  .assia-name {
    display: none;
  }

  .assia-avatar {
    width: 62px;
    height: 62px;
    border: 2px solid rgba(255,255,255,.78);
    border-radius: 22px;
  }

  .assia-status {
    top: -2px;
    right: -2px;
    width: 15px;
    height: 15px;
    border-width: 2px;
  }

  .assia-face {
    width: 36px;
    height: 34px;
    border-width: 2px;
  }

  .assia-eye {
    top: 11px;
    width: 8px;
    height: 8px;
    font-size: 8px;
    text-shadow: 0 0 6px rgba(255,255,255,.7);
  }

  .assia-eye.left {
    left: 8px;
  }

  .assia-eye.right {
    right: 8px;
  }
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--navy);
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(360px, 100%);
  padding: 28px;
  border: 1px solid var(--navy-border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 30px 70px rgba(17, 35, 61, .35);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand span {
  color: var(--muted);
  font-size: 12px;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 13px;
  font-weight: 700;
}
